OSDN Git Service

Pull in branded start button image from BoringdroidSystemUI on Android-Generic builds
authorBraden Farmer <farmerbb@gmail.com>
Fri, 20 Nov 2020 06:36:33 +0000 (23:36 -0700)
committerBraden Farmer <farmerbb@gmail.com>
Fri, 20 Nov 2020 06:36:33 +0000 (23:36 -0700)
13 files changed:
app/src/main/java/com/farmerbb/taskbar/fragment/AppearanceFragment.java
app/src/main/java/com/farmerbb/taskbar/ui/TaskbarController.java
app/src/main/java/com/farmerbb/taskbar/util/U.java
app/src/main/res/values-de/strings.xml
app/src/main/res/values-es/strings.xml
app/src/main/res/values-ja/strings.xml
app/src/main/res/values-nl/strings.xml
app/src/main/res/values-pl/strings.xml
app/src/main/res/values-ru/strings.xml
app/src/main/res/values-tr/strings.xml
app/src/main/res/values-zh-rCN/strings.xml
app/src/main/res/values/donottranslate.xml
app/src/main/res/values/strings.xml

index f2711f4..94f2efc 100644 (file)
@@ -58,8 +58,17 @@ public class AppearanceFragment extends SettingsFragment {
         findPreference(PREF_BACKGROUND_TINT_PREF).setOnPreferenceClickListener(this);
         findPreference(PREF_ACCENT_COLOR_PREF).setOnPreferenceClickListener(this);
 
-        if(U.isBlissOs(getActivity()))
-            ((ListPreference) findPreference(PREF_START_BUTTON_IMAGE)).setEntries(R.array.tb_pref_start_button_image_list_alt);
+        if(U.isAndroidGeneric(getActivity())) {
+            String[] array = getResources().getStringArray(R.array.tb_pref_start_button_image_list);
+            String flavor = U.getSystemProperty("ro.ag.flavor");
+
+            if(flavor != null && flavor.length() > 0)
+                array[1] = flavor;
+            else
+                array[1] = getString(R.string.tb_pref_title_app_drawer_icon_bliss);
+
+            ((ListPreference) findPreference(PREF_START_BUTTON_IMAGE)).setEntries(array);
+        }
 
         bindPreferenceSummaryToValue(findPreference(PREF_THEME));
         bindPreferenceSummaryToValue(findPreference(PREF_INVISIBLE_BUTTON));
index 35297b5..9fc63b2 100644 (file)
@@ -57,6 +57,7 @@ import android.speech.RecognizerIntent;
 
 import androidx.annotation.VisibleForTesting;
 import androidx.core.content.ContextCompat;
+import androidx.core.content.res.ResourcesCompat;
 import androidx.core.graphics.ColorUtils;
 import android.telephony.PhoneStateListener;
 import android.telephony.SignalStrength;
@@ -453,9 +454,16 @@ public class TaskbarController extends UIController {
             case PREF_START_BUTTON_IMAGE_APP_LOGO:
                 Drawable drawable;
 
-                if(U.isBlissOs(context)) {
-                    drawable = ContextCompat.getDrawable(context, R.drawable.tb_bliss);
-                    drawable.setTint(accentColor);
+                if(U.isAndroidGeneric(context)) {
+                    try {
+                        String bdPackageName = "com.boringdroid.systemui";
+                        Resources res = context.getPackageManager().getResourcesForApplication(bdPackageName);
+                        int id = res.getIdentifier("bt_all_apps", "drawable", bdPackageName);
+                        drawable = ResourcesCompat.getDrawable(res, id, null);
+                    } catch (Exception e) {
+                        drawable = ContextCompat.getDrawable(context, R.drawable.tb_bliss);
+                        drawable.setTint(accentColor);
+                    }
                 } else {
                     LauncherApps launcherApps = (LauncherApps) context.getSystemService(Context.LAUNCHER_APPS_SERVICE);
                     LauncherActivityInfo info = launcherApps.getActivityList(context.getPackageName(), Process.myUserHandle()).get(0);
index 6e4e7ee..4464f2c 100644 (file)
@@ -1338,10 +1338,7 @@ public class U {
                 editor.putBoolean(PREF_FREEFORM_HACK, true);
             }
 
-            if(isBlissOs(context)) {
-                editor.putString(PREF_START_BUTTON_IMAGE, PREF_START_BUTTON_IMAGE_APP_LOGO);
-            }
-
+            editor.putString(PREF_START_BUTTON_IMAGE, PREF_START_BUTTON_IMAGE_APP_LOGO);
             editor.putString(PREF_RECENTS_AMOUNT, PREF_RECENTS_AMOUNT_RUNNING_APPS_ONLY);
             editor.putString(PREF_REFRESH_FREQUENCY, "0");
             editor.putString(PREF_MAX_NUM_OF_RECENTS, "2147483647");
@@ -1695,7 +1692,7 @@ public class U {
     }
 
     @SuppressLint("PrivateApi")
-    private static String getSystemProperty(String key) {
+    public static String getSystemProperty(String key) {
         allowReflection();
         try {
             Class<?> cls = Class.forName("android.os.SystemProperties");
index fdd02aa..e5f8274 100644 (file)
 
     <string name="tb_pref_title_app_drawer_icon">Das Logo von Taskbar als Menüknopf verwenden</string>
     <string name="tb_pref_title_app_drawer_icon_bliss">Das Logo von Taskbar als Menüknopf verwenden</string>
+    <string name="tb_pref_title_app_drawer_icon_ag">%s logo</string>
 
     <string name="tb_already_blacklisted">%1$s kann nicht ausgewählt werden, da es auf der Liste der verborgenen Apps ist.</string>
     <string name="tb_already_top_app">%1$s kann nicht ausgewählt werden, da es auf der Liste der top Apps ist.</string>
index f05f41c..58169cc 100644 (file)
 
     <string name="tb_pref_title_app_drawer_icon">Logo de Taskbar</string>
     <string name="tb_pref_title_app_drawer_icon_bliss">Logo de Bliss</string>
+    <string name="tb_pref_title_app_drawer_icon_ag">%s logo</string>
 
     <string name="tb_already_blacklisted">No es posible seleccionar %1$s porque está en la lista de aplicaciones ocultas</string>
     <string name="tb_already_top_app">No es posible seleccionar %1$s porque está en la lista de aplicaciones más populares</string>
index 20aba3c..4969f69 100644 (file)
 
     <string name="tb_pref_title_app_drawer_icon">スタートメニューアイコンとして Taskbar ロゴを使用する</string>
     <string name="tb_pref_title_app_drawer_icon_bliss">スタートメニューアイコンとして Taskbar ロゴを使用する</string>
+    <string name="tb_pref_title_app_drawer_icon_ag">%s logo</string>
 
     <string name="tb_already_blacklisted">非表示アプリリストにあるため %1$s は選択できません</string>
     <string name="tb_already_top_app">トップアプリリストにあるため %1$s は選択できません</string>
index 7af04e7..12e1b14 100644 (file)
 
     <string name="tb_pref_title_app_drawer_icon">Taakbalk-logo gebruiken als startmenu-pictogram</string>
     <string name="tb_pref_title_app_drawer_icon_bliss">Bliss-logo gebruiken als startmenu-pictogram</string>
+    <string name="tb_pref_title_app_drawer_icon_ag">%s logo</string>
 
     <string name="tb_already_blacklisted">%1$s kan niet worden gekozen omdat hij op de verborgen apps-lijst staat</string>
     <string name="tb_already_top_app">%1$s kan niet worden gekozen omdat hij op de top-apps-lijst staat</string>
index 674dbdf..4095b26 100644 (file)
@@ -273,6 +273,7 @@ Pokaż menu Start
 <string name="tb_pref_title_anchor">Zakotwiczenie Taskbar podczas obracania ekranu</string>
 <string name="tb_pref_title_app_drawer_icon">Logo Taskbar</string>
 <string name="tb_pref_title_app_drawer_icon_bliss">Logo Bliss</string>
+<string name="tb_pref_title_app_drawer_icon_ag">%s logo</string>
 <string name="tb_pref_title_background_tint">Barwa tła</string>
 <string name="tb_pref_title_blacklist">Konfiguracja aplikacji w menu startowym</string>
 <string name="tb_pref_title_chrome_os_context_menu_fix">Poprawka zgodności stacji dokującej Chrome OS</string>
index d06c15c..1c080cf 100644 (file)
 
     <string name="tb_pref_title_app_drawer_icon">Использовать иконку Taskbar в качестве иконки меню</string>
     <string name="tb_pref_title_app_drawer_icon_bliss">Использовать иконку Taskbar в качестве иконки меню</string>
+    <string name="tb_pref_title_app_drawer_icon_ag">%s logo</string>
 
     <string name="tb_already_blacklisted">%1$s нельзя выбрать, он уже в списке</string>
     <string name="tb_already_top_app">%1$s нельзя выбрать, он уже в списке</string>
index 408c8a7..7dac41d 100644 (file)
@@ -260,6 +260,7 @@ Başlat menüsü gösterme
 <string name="tb_pref_title_anchor">Ekran döndürmede Taskbar tut</string>
 <string name="tb_pref_title_app_drawer_icon">Başlat menüsü simgesi olarak Taskbar logosunu kullan</string>
 <string name="tb_pref_title_app_drawer_icon_bliss">Başlat menüsü simgesi olarak Taskbar logosunu kullan</string>
+<string name="tb_pref_title_app_drawer_icon_ag">%s logo</string>
 <string name="tb_pref_title_background_tint">Arkaplan tonu</string>
 <string name="tb_pref_title_blacklist">Uygulamaları başlangıç menüsünde yapılandır</string>
 <string name="tb_pref_title_chrome_os_context_menu_fix">Chrome OS uyumluluğu düzeltmesi</string>
index dcee6a8..0430162 100644 (file)
 
     <string name="tb_pref_title_app_drawer_icon">使用 任务栏 徽标作为开始菜单图标</string>
     <string name="tb_pref_title_app_drawer_icon_bliss">使用 任务栏 徽标作为开始菜单图标</string>
+    <string name="tb_pref_title_app_drawer_icon_ag">%s logo</string>
 
     <string name="tb_already_blacklisted">%1$s 无法选中,因为在隐藏应用列表中</string>
     <string name="tb_already_top_app">%1$s 无法选中,因为在置顶应用列表中</string>
index ea21ad1..329c72f 100644 (file)
         <item>@string/tb_start_button_image_custom</item>
     </string-array>
 
-    <string-array name="tb_pref_start_button_image_list_alt">
-        <item>@string/tb_start_button_image_default</item>
-        <item>@string/tb_pref_title_app_drawer_icon_bliss</item>
-        <item>@string/tb_start_button_image_custom</item>
-    </string-array>
-
     <string-array name="tb_pref_start_button_image_list_values">
         <item>default</item>
         <item>app_logo</item>
index baaa41e..0328f79 100644 (file)
 
     <string name="tb_pref_title_app_drawer_icon">Taskbar logo</string>
     <string name="tb_pref_title_app_drawer_icon_bliss">Bliss logo</string>
+    <string name="tb_pref_title_app_drawer_icon_ag">%s logo</string>
 
     <string name="tb_already_blacklisted">%1$s can\'t be selected because it is on the hidden apps list</string>
     <string name="tb_already_top_app">%1$s can\'t be selected because it is on the top apps list</string>