Improvements of multiacc + added migrating from old type of accounts to new type
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package ru.vtosters.lite.utils;
|
||||
|
||||
import static android.content.Context.MODE_PRIVATE;
|
||||
import static ru.vtosters.lite.utils.Helper.GetContext;
|
||||
|
||||
import android.content.SharedPreferences;
|
||||
|
||||
@@ -13,6 +14,15 @@ public class AccountManager {
|
||||
return Helper.GetContext().getSharedPreferences("pref_account_manager" + Value, MODE_PRIVATE);
|
||||
}
|
||||
|
||||
public static void MigrateToNewType() {
|
||||
SharedPreferences OldPrefs = Helper.GetContext().getSharedPreferences("pref_account_manager", MODE_PRIVATE);
|
||||
String OldPrefsValue = OldPrefs.getString("key_vk_account", "");
|
||||
SharedPreferences NewPrefs = GetContext().getSharedPreferences("pref_account_manager0", MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = NewPrefs.edit();
|
||||
editor.putString("key_vk_account", OldPrefsValue);
|
||||
editor.commit();
|
||||
}
|
||||
|
||||
public static String getCurrentAccountName() {
|
||||
String Value = ru.vtosters.lite.utils.Helper.GetPreferences().getString("account", "");
|
||||
return getName(Value);
|
||||
@@ -31,26 +41,25 @@ public class AccountManager {
|
||||
}
|
||||
return "err";
|
||||
}
|
||||
public static String getAvalibleAcc(){
|
||||
|
||||
public static String getAvalibleAcc() {
|
||||
int intg = 0;
|
||||
while (true) {
|
||||
if (getName(Integer.toString(intg)) != "err") {
|
||||
intg++;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
};
|
||||
return Integer.toString(intg);
|
||||
}
|
||||
|
||||
public static int getAvalibleAccInt(){
|
||||
public static int getAvalibleAccInt() {
|
||||
int intg = 0;
|
||||
while (true) {
|
||||
if (getName(Integer.toString(intg)) != "err") {
|
||||
intg++;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -707,7 +707,7 @@ public class Prefs {
|
||||
setupFilters();
|
||||
fixGapps();
|
||||
setProxy();
|
||||
|
||||
AccountManager.MigrateToNewType();
|
||||
registerActivities(application);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user