small fixes
This commit is contained in:
@@ -21,10 +21,10 @@ public class FeedFragment extends MaterialPreferenceToolbarFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void prefs() {
|
private void prefs() {
|
||||||
a("officialnewssett").a(new FeedFragment.openofficialsett());
|
a("officialnewssett").a(new openofficialsett());
|
||||||
}
|
}
|
||||||
|
|
||||||
public class openofficialsett implements Preference.c {
|
public static class openofficialsett implements Preference.c {
|
||||||
openofficialsett() {
|
openofficialsett() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package ru.vtosters.lite.ui.fragments;
|
|||||||
|
|
||||||
import static android.widget.Toast.LENGTH_SHORT;
|
import static android.widget.Toast.LENGTH_SHORT;
|
||||||
import static android.widget.Toast.makeText;
|
import static android.widget.Toast.makeText;
|
||||||
|
import static ru.vtosters.lite.utils.Globals.deleteCache;
|
||||||
import static ru.vtosters.lite.utils.Globals.getContext;
|
import static ru.vtosters.lite.utils.Globals.getContext;
|
||||||
import static ru.vtosters.lite.utils.Globals.getString;
|
import static ru.vtosters.lite.utils.Globals.getString;
|
||||||
import static ru.vtosters.lite.utils.Globals.getUserToken;
|
import static ru.vtosters.lite.utils.Globals.getUserToken;
|
||||||
@@ -68,24 +69,27 @@ public class OtherFragment extends MaterialPreferenceToolbarFragment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class e implements Preference.c {
|
public static class e implements Preference.c {
|
||||||
e() {
|
e() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override // android.support.v7.preference.Preference.c
|
@Override // android.support.v7.preference.Preference.c
|
||||||
public boolean a(Preference preference) {
|
public boolean a(Preference preference) {
|
||||||
SharedPreferences prefs = getContext().getSharedPreferences("stickers", Context.MODE_PRIVATE);
|
SharedPreferences prefs = getContext().getSharedPreferences("stickers", Context.MODE_PRIVATE);
|
||||||
|
SharedPreferences prefs2 = getContext().getSharedPreferences("stickers_storage", Context.MODE_PRIVATE);
|
||||||
prefs.edit().clear().commit();
|
prefs.edit().clear().commit();
|
||||||
|
prefs2.edit().clear().commit();
|
||||||
VKImageLoader.b();
|
VKImageLoader.b();
|
||||||
ImEngineProvider.a().h();
|
ImEngineProvider.a().h();
|
||||||
AudioMessageUtils.j();
|
AudioMessageUtils.j();
|
||||||
FileUtils.l();
|
FileUtils.l();
|
||||||
|
deleteCache();
|
||||||
ToastUtils.a(getString("cachecleaned"));
|
ToastUtils.a(getString("cachecleaned"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class b implements Preference.c {
|
public static class b implements Preference.c {
|
||||||
b() {
|
b() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,7 +100,7 @@ public class OtherFragment extends MaterialPreferenceToolbarFragment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class d implements Preference.c {
|
public static class d implements Preference.c {
|
||||||
d() {
|
d() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,20 +130,23 @@ public class OtherFragment extends MaterialPreferenceToolbarFragment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class f implements Preference.c {
|
public static class f implements Preference.c {
|
||||||
f() {
|
f() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override // android.support.v7.preference.Preference.c
|
@Override // android.support.v7.preference.Preference.c
|
||||||
public boolean a(Preference preference) {
|
public boolean a(Preference preference) {
|
||||||
SharedPreferences prefs = getContext().getSharedPreferences("stickers", Context.MODE_PRIVATE);
|
SharedPreferences prefs = getContext().getSharedPreferences("stickers", Context.MODE_PRIVATE);
|
||||||
|
SharedPreferences prefs2 = getContext().getSharedPreferences("stickers_storage", Context.MODE_PRIVATE);
|
||||||
prefs.edit().clear().commit();
|
prefs.edit().clear().commit();
|
||||||
restartApplication();
|
prefs2.edit().clear().commit();
|
||||||
|
deleteCache();
|
||||||
|
ToastUtils.a(getString("cachecleaned"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class deleteprefs implements Preference.c {
|
public static class deleteprefs implements Preference.c {
|
||||||
deleteprefs() {
|
deleteprefs() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -151,7 +158,7 @@ public class OtherFragment extends MaterialPreferenceToolbarFragment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class saveprefs implements Preference.c {
|
public static class saveprefs implements Preference.c {
|
||||||
saveprefs() {
|
saveprefs() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -162,7 +169,7 @@ public class OtherFragment extends MaterialPreferenceToolbarFragment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class restoreprefs implements Preference.c {
|
public static class restoreprefs implements Preference.c {
|
||||||
restoreprefs() {
|
restoreprefs() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ import com.vtosters.lite.api.ExtendedUserProfile;
|
|||||||
import com.vtosters.lite.auth.VKAccountManager;
|
import com.vtosters.lite.auth.VKAccountManager;
|
||||||
import com.vtosters.lite.im.ImEngineProvider;
|
import com.vtosters.lite.im.ImEngineProvider;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
@@ -50,11 +51,12 @@ import java.security.NoSuchAlgorithmException;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import ru.vtosters.lite.ui.dialogs.DisableBattery;
|
import ru.vtosters.lite.ui.dialogs.DisableBattery;
|
||||||
import ru.vtosters.lite.ui.dialogs.InstallGMS;
|
import ru.vtosters.lite.ui.dialogs.InstallGMS;
|
||||||
import ru.vtosters.lite.ui.dialogs.Start;
|
|
||||||
import ru.vtosters.lite.ui.dialogs.OTADialog;
|
import ru.vtosters.lite.ui.dialogs.OTADialog;
|
||||||
|
import ru.vtosters.lite.ui.dialogs.Start;
|
||||||
|
|
||||||
public class Globals {
|
public class Globals {
|
||||||
private static final List<Activity> activities = new ArrayList<>();
|
private static final List<Activity> activities = new ArrayList<>();
|
||||||
@@ -200,7 +202,31 @@ public class Globals {
|
|||||||
return null;
|
return null;
|
||||||
} // Getting the global context through reflection to use context on application initialization
|
} // Getting the global context through reflection to use context on application initialization
|
||||||
|
|
||||||
|
public static void deleteCache() {
|
||||||
|
try {
|
||||||
|
File dir = getContext().getCacheDir();
|
||||||
|
deleteDir(dir);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean deleteDir(File dir) {
|
||||||
|
if (dir != null && dir.isDirectory()) {
|
||||||
|
String[] children = dir.list();
|
||||||
|
for (int i=0; i < Objects.requireNonNull(children).length; i++) {
|
||||||
|
boolean success = deleteDir(new File(dir, children[i]));
|
||||||
|
if (!success) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return dir.delete();
|
||||||
|
} else if(dir!= null && dir.isFile()) {
|
||||||
|
return dir.delete();
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
public static boolean isGmsInstalled() {
|
public static boolean isGmsInstalled() {
|
||||||
try {
|
try {
|
||||||
getContext().getPackageManager().getPackageInfo("com.google.android.gms", 0);
|
getContext().getPackageManager().getPackageInfo("com.google.android.gms", 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user