Oh, fixes?
-Added styles list for dark and light themes -Updated libs -Auto refactored resources for easy editing -Improved amoled theme
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package ru.f0x1d.net;
|
||||
|
||||
import android.util.Base64;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@@ -13,8 +15,6 @@ import java.nio.charset.StandardCharsets;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import android.util.Base64;
|
||||
|
||||
public final class NetCall {
|
||||
private NetRequest req;
|
||||
private NetClient cl;
|
||||
|
||||
@@ -22,7 +22,7 @@ public class DockBarAdapter extends RecyclerView.a
|
||||
public static final int DISABLED_TAB_TYPE = 2;
|
||||
public static final int GROUP_TITLE_TYPE = 3;
|
||||
|
||||
|
||||
|
||||
private final DockBarManager mDockBarManager = DockBarManager.getInstance();
|
||||
|
||||
@Override
|
||||
|
||||
@@ -36,7 +36,7 @@ public class DockBarFragment extends ToolbarFragment {
|
||||
Helper.convertDpToPixel(10)
|
||||
);
|
||||
container.addView(buttonsContainer, new LinearLayout.LayoutParams(-1, -2));
|
||||
|
||||
|
||||
Button save = new Button(n());
|
||||
save.setText("Сохранить");
|
||||
save.setOnClickListener(v -> {
|
||||
|
||||
@@ -224,7 +224,8 @@ public class DockBarManager {
|
||||
int target = adapter.getIndexByViewType(toPosition, adapter.getItemType(toPosition));
|
||||
if (fromPosition < toPosition) {
|
||||
|
||||
if (mSelectedTabs.size() <= MIN_SELECTED_TABS_LIMIT || mSelectedTabs.get(curr).tag.equals("tab_menu")) return;
|
||||
if (mSelectedTabs.size() <= MIN_SELECTED_TABS_LIMIT || mSelectedTabs.get(curr).tag.equals("tab_menu"))
|
||||
return;
|
||||
|
||||
DockBarTab tab = mSelectedTabs.get(curr);
|
||||
mSelectedTabs.remove(tab);
|
||||
@@ -237,7 +238,7 @@ public class DockBarManager {
|
||||
for (int i = 0; i < target; i++) {
|
||||
Collections.swap(mDisabledTabs, i, i + 1);
|
||||
}
|
||||
} else {
|
||||
} else {
|
||||
|
||||
if (mSelectedTabs.size() >= MAX_SELECTED_TABS_LIMIT) return;
|
||||
|
||||
|
||||
+2
-2
@@ -83,10 +83,10 @@ public class MultiAccountAdapter extends RecyclerView.a<MultiAccountAdapter.Mult
|
||||
|
||||
return new MultiAccountViewHolder(layout);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void a(MultiAccountViewHolder holder, int pos) {
|
||||
holder.bind(pos == 0 ? null : mAccounts.get(pos-1), pos);
|
||||
holder.bind(pos == 0 ? null : mAccounts.get(pos - 1), pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ public class MultiAccountManager {
|
||||
}
|
||||
|
||||
private static int getAccountPrefsCount() {
|
||||
File[] prefs = new File(Helper.GetContext().getFilesDir().getParent(), "shared_prefs")
|
||||
File[] prefs = new File(Helper.GetContext().getFilesDir().getParent(), "shared_prefs")
|
||||
.listFiles((dir, name) -> {
|
||||
return name.matches("pref_account_manager\\d+\\.xml");
|
||||
});
|
||||
|
||||
@@ -166,10 +166,10 @@ public class StickersFragment extends ToolbarFragment {
|
||||
TGPref.setTGBotKey(editText.getText().toString());
|
||||
if (r != null) r.run();
|
||||
}).setNegativeButton(android.R.string.cancel, null).setNeutralButton(Helper.getString("stickersapi7"), (dialog, which) -> new AlertDialog.Builder(super.n())
|
||||
.setTitle(Helper.getString("stickersapi8"))
|
||||
.setMessage(Helper.getString("stickersapi9") +
|
||||
Helper.getString("stickersapi10")).setPositiveButton(android.R.string.ok, null)
|
||||
.create().show()).create().show();
|
||||
.setTitle(Helper.getString("stickersapi8"))
|
||||
.setMessage(Helper.getString("stickersapi9") +
|
||||
Helper.getString("stickersapi10")).setPositiveButton(android.R.string.ok, null)
|
||||
.create().show()).create().show();
|
||||
}
|
||||
|
||||
private void checkApiKey(final Runnable r) {
|
||||
|
||||
@@ -65,7 +65,7 @@ public class Helper {
|
||||
return extendedUserProfile.a;
|
||||
}
|
||||
|
||||
public static void restarting(){
|
||||
public static void restarting() {
|
||||
Context ctx = GetContext();
|
||||
PackageManager pm = ctx.getPackageManager();
|
||||
Intent intent = pm.getLaunchIntentForPackage(ctx.getPackageName());
|
||||
@@ -141,6 +141,6 @@ public class Helper {
|
||||
public static boolean isNetworkConnected() {
|
||||
ConnectivityManager cm = (ConnectivityManager) GetContext().getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
NetworkInfo activeNetwork = cm.getActiveNetworkInfo();
|
||||
return activeNetwork != null ? activeNetwork.isConnectedOrConnecting() :false;
|
||||
return activeNetwork != null ? activeNetwork.isConnectedOrConnecting() : false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package ru.vtosters.lite.utils;
|
||||
|
||||
import static ru.vtosters.lite.utils.Proxy.setProxy;
|
||||
import static ru.vtosters.lite.utils.Themes.amoled;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Application;
|
||||
@@ -274,7 +273,8 @@ public class Prefs {
|
||||
}
|
||||
|
||||
public static String getAmoledVKUI() {
|
||||
return amoled() ? "1" : "0";
|
||||
String string = Helper.GetPreferences().getString("darktheme", "");
|
||||
return string.equals("amoled") ? "1" : "0";
|
||||
}
|
||||
|
||||
public static String getMeToken() {
|
||||
|
||||
@@ -10,6 +10,7 @@ import android.widget.ImageButton;
|
||||
import com.vk.core.d.RecoloredDrawable;
|
||||
import com.vk.core.ui.themes.VKTheme;
|
||||
import com.vk.core.ui.themes.VKThemeHelper;
|
||||
import com.vk.im.ui.themes.ImTheme;
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
public class Themes {
|
||||
@@ -37,8 +38,42 @@ public class Themes {
|
||||
return Helper.GetContext().getResources().getIdentifier("VkIm.Theme.VkApp.Amoled", "style", Helper.GetContext().getPackageName());
|
||||
}
|
||||
|
||||
public static VKTheme getCurrentDarkTheme() {
|
||||
return amoled() ? VKTheme.AMOLED : VKTheme.DARK;
|
||||
public static VKTheme getDarkTheme() {
|
||||
String string = Helper.GetPreferences().getString("darktheme", "");
|
||||
if (string.isEmpty()) {
|
||||
return VKTheme.DARK;
|
||||
}
|
||||
if (string.equals("amoled")) {
|
||||
return VKTheme.AMOLED;
|
||||
}
|
||||
return VKTheme.DARK;
|
||||
}
|
||||
|
||||
public static ImTheme getImDarkTheme() {
|
||||
String string = Helper.GetPreferences().getString("darktheme", "");
|
||||
if (string.isEmpty()) {
|
||||
return ImTheme.VKAPP_DARK;
|
||||
}
|
||||
if (string.equals("amoled")) {
|
||||
return ImTheme.VKAPP_AMOLED;
|
||||
}
|
||||
return ImTheme.VKAPP_DARK;
|
||||
}
|
||||
|
||||
public static VKTheme getLightTheme() {
|
||||
String string = Helper.GetPreferences().getString("lighttheme", "");
|
||||
if (string.isEmpty()) {
|
||||
return VKTheme.DEFAULT_LIGHT;
|
||||
}
|
||||
return VKTheme.DEFAULT_LIGHT;
|
||||
}
|
||||
|
||||
public static ImTheme getImLightTheme() {
|
||||
String string = Helper.GetPreferences().getString("lighttheme", "");
|
||||
if (string.isEmpty()) {
|
||||
return ImTheme.VKAPP_LIGHT;
|
||||
}
|
||||
return ImTheme.VKAPP_LIGHT;
|
||||
}
|
||||
|
||||
public static int getColorFromAttr(int attr) {
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
package ru.vtosters.lite.utils;
|
||||
|
||||
import static ru.vtosters.lite.utils.Themes.amoled;
|
||||
|
||||
import android.util.Base64;
|
||||
import android.util.Log;
|
||||
import android.webkit.WebView;
|
||||
|
||||
import com.vtosters.lite.R;
|
||||
@@ -61,6 +58,7 @@ public class VKUIInjector {
|
||||
}
|
||||
|
||||
public static void inject(WebView webView) {
|
||||
String string = Helper.GetPreferences().getString("darktheme", "");
|
||||
if (Prefs.BooleanTrue("VKUI_INJ")) {
|
||||
if (!isLoaded) {
|
||||
load();
|
||||
@@ -70,7 +68,7 @@ public class VKUIInjector {
|
||||
sb.append("\n\n");
|
||||
sb.append(loadedCSS);
|
||||
}
|
||||
if (amoled() == true) {
|
||||
if (string.equals("amoled")) {
|
||||
sb.append("\n\n");
|
||||
sb.append(loadedCSSAmoled);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user