speedup settings
This commit is contained in:
@@ -149,7 +149,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment{
|
||||
int vtosterXml = getIdentifier("empty", "xml");
|
||||
this.addPreferencesFromResource(vtosterXml);
|
||||
|
||||
addPreferenceDrawable(this, "", "Аккаунты", getUsername() + (hasVerification() ? Globals.getString("thanksfordonate") : Globals.getString("getdonate")), getDrawableFromUrl(getUserPhoto(), "ic_user_circle_outline_28", true, true), preference -> {
|
||||
addPreferenceDrawable(this, "", getUsername(), hasVerification() ? Globals.getString("thanksfordonate") : Globals.getString("getdonate"), getDrawableFromUrl(getUserPhoto(), "ic_user_circle_outline_28", true, true), preference -> {
|
||||
logout();
|
||||
restartApplication();
|
||||
return false;
|
||||
|
||||
@@ -52,6 +52,9 @@ import com.vtosters.lite.api.ExtendedUserProfile;
|
||||
import com.vtosters.lite.auth.VKAccountManager;
|
||||
import com.vtosters.lite.im.ImEngineProvider;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
@@ -65,6 +68,11 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import okhttp3.Call;
|
||||
import okhttp3.Callback;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import ru.vtosters.lite.downloaders.notifications.NotificationChannels;
|
||||
import ru.vtosters.lite.ui.dialogs.DisableBattery;
|
||||
import ru.vtosters.lite.ui.dialogs.InstallGMS;
|
||||
@@ -76,6 +84,10 @@ public class Globals{
|
||||
|
||||
private static final List<Activity> activities = new ArrayList<>();
|
||||
|
||||
private static final OkHttpClient mClient = new OkHttpClient();
|
||||
|
||||
public static Bitmap bmp = null;
|
||||
|
||||
public static SharedPreferences getDefprefs(){
|
||||
if (preferences == null)
|
||||
preferences = PreferenceManager.getDefaultSharedPreferences(getContext());
|
||||
@@ -220,13 +232,28 @@ public class Globals{
|
||||
}
|
||||
|
||||
try {
|
||||
URL aryURI = new URL(url);
|
||||
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
|
||||
StrictMode.setThreadPolicy(policy); // fix get pic
|
||||
|
||||
URLConnection conn = aryURI.openConnection();
|
||||
InputStream is = conn.getInputStream();
|
||||
Bitmap bmp = BitmapFactory.decodeStream(is);
|
||||
var request = new Request.a()
|
||||
.b(url)
|
||||
.a();
|
||||
mClient.a(request).a(new Callback() {
|
||||
@Override
|
||||
public void a(Call call, IOException e) {
|
||||
Log.e("Error", e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(Call call, Response response){
|
||||
bmp = BitmapFactory.decodeStream(response.a().a());
|
||||
}
|
||||
});
|
||||
|
||||
if (bmp == null) {
|
||||
if (def == null) return null;
|
||||
return getDrawable(getContext(), getIdentifier(def, "drawable"));
|
||||
}
|
||||
|
||||
bmp = rounded ? getBitmapClippedCircle(bmp) : bmp; // rounding
|
||||
|
||||
|
||||
@@ -5789,8 +5789,8 @@
|
||||
<string name="download_mp3">Скачать как mp3</string>
|
||||
<string name="remove_from_cache">Удалить из кэша</string>
|
||||
|
||||
<string name="thanksfordonate">, спасибо тебе за поддержку проекта!</string>
|
||||
<string name="getdonate">, поддержи проект донатом и получи бонусы</string>
|
||||
<string name="thanksfordonate">Спасибо тебе за поддержку проекта!</string>
|
||||
<string name="getdonate">Поддержи проект донатом и получи бонусы</string>
|
||||
|
||||
<string name="wallpapers">Обои</string>
|
||||
</resources>
|
||||
|
||||
@@ -5947,8 +5947,8 @@ May look like a fake leaving the online"</string>
|
||||
<string name="download_mp3">Download as mp3</string>
|
||||
<string name="remove_from_cache">Delete from cache</string>
|
||||
|
||||
<string name="thanksfordonate">, thank you for supporting the project!</string>
|
||||
<string name="getdonate">, support the project with a donation and get rewards</string>
|
||||
<string name="thanksfordonate">Thank you for supporting the project!</string>
|
||||
<string name="getdonate">Support the project with a donation and get rewards</string>
|
||||
|
||||
<string name="wallpapers">Wallpapers</string>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user