tablet fixes

This commit is contained in:
gdlbo
2022-09-11 02:29:47 +03:00
parent 08909baf2f
commit cedf5d263a
9 changed files with 47 additions and 17 deletions
@@ -15,6 +15,7 @@ import static ru.vtosters.lite.proxy.ProxyUtils.getApi;
import static ru.vtosters.lite.utils.AccountManagerUtils.getUserToken;
import static ru.vtosters.lite.utils.AndroidUtils.getIdentifier;
import static ru.vtosters.lite.utils.AndroidUtils.getString;
import static ru.vtosters.lite.utils.AndroidUtils.isTablet;
import static ru.vtosters.lite.utils.AndroidUtils.sendToast;
import android.annotation.SuppressLint;
@@ -116,8 +117,10 @@ public class DNRInjector {
list.add(new DialogActionsListView.b.a(DialogAction.DNT_ON, 2, im_ic_edit_msg, getIdentifier("DNT_ON", "string"))); // DialogAction, Int, Icon, String
list.add(new DialogActionsListView.b.a(DialogAction.DNT_OFF, 2, im_ic_edit_msg, getIdentifier("DNT_OFF", "string"))); // DialogAction, Int, Icon, String
list.add(new DialogActionsListView.b.a(DialogAction.ENCRYPT, 3, im_ic_keyboard, getIdentifier("encryption", "string"))); // DialogAction, Int, Icon, String
list.add(new DialogActionsListView.b.a(DialogAction.ENCRYPT_SETT, 3, im_ic_more_vertical, getIdentifier("encryption_sett", "string"))); // DialogAction, Int, Icon, String
if (!isTablet()) {
list.add(new DialogActionsListView.b.a(DialogAction.ENCRYPT, 3, im_ic_keyboard, getIdentifier("encryption", "string"))); // DialogAction, Int, Icon, String
list.add(new DialogActionsListView.b.a(DialogAction.ENCRYPT_SETT, 3, im_ic_more_vertical, getIdentifier("encryption_sett", "string"))); // DialogAction, Int, Icon, String
}
list.add(new DialogActionsListView.b.a(DialogAction.MARK_AS_READ, 4, im_ic_done, getIdentifier("vkim_dialogs_list_option_mark_as_read", "string"))); // DialogAction, Int, Icon, String
@@ -2,9 +2,11 @@ package ru.vtosters.lite.ui.fragments;
import static ru.vtosters.lite.utils.AndroidUtils.getIdentifier;
import static ru.vtosters.lite.utils.AndroidUtils.getPreferences;
import static ru.vtosters.lite.utils.AndroidUtils.isTablet;
import static ru.vtosters.lite.utils.LifecycleUtils.restartApplicationWithTimer;
import android.os.Bundle;
import android.view.View;
import androidx.preference.Preference;
@@ -26,6 +28,11 @@ public class InterfaceFragment extends MaterialPreferenceToolbarFragment {
findPreference("swipe").setOnPreferenceClickListener(new restart());
findPreference("is_likes_on_right").setOnPreferenceClickListener(new restart());
if (isTablet()){
findPreference("menusett").setVisible(false);
findPreference("swipe").setVisible(false);
}
findPreference("customrounding").setOnPreferenceClickListener(preference -> {
RoundingSeekbarDialog.dialog(getContext());
return true;
@@ -3,6 +3,7 @@ package ru.vtosters.lite.ui.fragments;
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
import static ru.vtosters.lite.utils.AndroidUtils.getIdentifier;
import static ru.vtosters.lite.utils.AndroidUtils.getPreferences;
import static ru.vtosters.lite.utils.AndroidUtils.isTablet;
import static ru.vtosters.lite.utils.LifecycleUtils.restartApplicationWithTimer;
import static ru.vtosters.lite.utils.Preferences.autoalltranslate;
import static ru.vtosters.lite.utils.Preferences.vkme;
@@ -69,6 +70,11 @@ public class MessagesFragment extends MaterialPreferenceToolbarFragment {
findPreference("vkme_notifs").setEnabled(vkme());
findPreference("wallpapers").setIcon(recolorDrawable(getGlobalContext().getDrawable(getIdentifier("ic_media_outline_28", "drawable"))));
findPreference("vkme").setIcon(getIdentifier("ic_vkme_28", "drawable"));
if (isTablet()){
findPreference("alteremoji").setVisible(false);
findPreference("vkmesett").setVisible(false);
}
}
@Override
@@ -3,6 +3,7 @@ package ru.vtosters.lite.ui.fragments;
import static ru.vtosters.lite.utils.AndroidUtils.edit;
import static ru.vtosters.lite.utils.AndroidUtils.getIdentifier;
import static ru.vtosters.lite.utils.AndroidUtils.getPreferences;
import static ru.vtosters.lite.utils.AndroidUtils.isTablet;
import static ru.vtosters.lite.utils.LifecycleUtils.restartApplicationWithTimer;
import android.content.Context;
@@ -35,6 +36,10 @@ public class ThemesFragment extends MaterialPreferenceToolbarFragment {
findPreference("dockbar_tab_titles").setOnPreferenceClickListener(new restart());
findPreference("dockbar_accent").setOnPreferenceClickListener(new restart());
findPreference("dockcounter").setOnPreferenceClickListener(new restart());
if (isTablet()){
findPreference("dockbarsett").setVisible(false);
}
}
public class openicons implements Preference.OnPreferenceClickListener {
@@ -12,6 +12,7 @@ import static ru.vtosters.lite.utils.AccountManagerUtils.isVKTester;
import static ru.vtosters.lite.utils.AndroidUtils.edit;
import static ru.vtosters.lite.utils.AndroidUtils.getIdentifier;
import static ru.vtosters.lite.utils.AndroidUtils.getPrefsValue;
import static ru.vtosters.lite.utils.AndroidUtils.isTablet;
import static ru.vtosters.lite.utils.CacheUtils.humanReadableByteCountBin;
import static ru.vtosters.lite.utils.GmsUtils.isGmsInstalled;
import static ru.vtosters.lite.utils.ImageUtils.getDrawableFromUrl;
@@ -338,22 +339,24 @@ public class VTSettings extends MaterialPreferenceToolbarFragment {
return false;
});
addPreference(this, "", AndroidUtils.getString("dockbar_editor"), docksumm, "ic_list_outline_28", preference -> {
Context context = requireContext();
Intent intent = new Navigator(DockBarEditorFragment.class).b(context);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
return false;
});
if (milkshake() && superapp()) {
addPreference(this, "", AndroidUtils.getString("superapp_editor"), superapp, "ic_services_outline_28", (preference) -> {
if (!isTablet()) {
addPreference(this, "", AndroidUtils.getString("dockbar_editor"), docksumm, "ic_list_outline_28", preference -> {
Context context = requireContext();
Intent intent = new Navigator(SuperAppEditorFragment.class).b(context);
Intent intent = new Navigator(DockBarEditorFragment.class).b(context);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
return true;
return false;
});
if (milkshake() && superapp()) {
addPreference(this, "", AndroidUtils.getString("superapp_editor"), superapp, "ic_services_outline_28", (preference) -> {
Context context = requireContext();
Intent intent = new Navigator(SuperAppEditorFragment.class).b(context);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
return true;
});
}
}
} else {
addPreference(this, "", AndroidUtils.getString("warning"), AndroidUtils.getString("vkme_mode_info"), "ic_about_outline_28", preference -> false);
@@ -14,6 +14,8 @@ import android.widget.Toast;
import androidx.annotation.StringRes;
import com.vk.core.util.Screen;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Locale;
@@ -30,6 +32,10 @@ public class AndroidUtils {
return PreferenceManager.getDefaultSharedPreferences(getGlobalContext());
}
public static boolean isTablet() {
return Screen.l(getGlobalContext());
}
public static String getPrefsValue(String pref) {
return getPreferences().getString(pref, "");
} // Get pref value as string
+1 -1
View File
@@ -46,7 +46,7 @@
android:summary="@string/postsredesign_summ"
android:title="@string/postsredesign_title" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/menu">
<PreferenceCategory android:title="@string/menu" android:key="menusett">
<com.vtosters.lite.ui.MaterialSwitchPreference
android:defaultValue="true"
android:key="miniapps"
+1 -1
View File
@@ -15,7 +15,7 @@
android:summary="@string/convBarRecomm_summ"
android:title="@string/convBarRecomm_title" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/vk_messenger">
<PreferenceCategory android:title="@string/vk_messenger" android:key="vkmesett">
<com.vtosters.lite.ui.MaterialSwitchPreference
android:defaultValue="false"
android:key="vkme"
+1 -1
View File
@@ -25,7 +25,7 @@
android:key="lighttheme"
android:title="@string/appearance_theme_light_theme" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/vtl_settings_dockbar_title">
<PreferenceCategory android:title="@string/vtl_settings_dockbar_title" android:key="dockbarsett">
<com.vtosters.lite.ui.MaterialSwitchPreference
android:defaultValue="true"
android:key="dockbar_tab_titles"