From 4a8ba85e33a804d173920346c0cc3712a35c9eef Mon Sep 17 00:00:00 2001 From: Electric Date: Thu, 28 May 2020 15:37:48 +0300 Subject: [PATCH] Charge icon fix, hardcoded dimens & other misc fixes. --- .../java/com/dosse/airpods/AboutActivity.java | 22 ++++--- .../com/dosse/airpods/SettingsFragment.java | 54 +++++++++++++--- .../main/res/layout-land/activity_about.xml | 10 +-- .../main/res/layout-land/activity_main.xml | 2 +- .../src/main/res/layout/activity_about.xml | 10 +-- .../src/main/res/layout/activity_intro.xml | 2 +- .../app/src/main/res/layout/activity_main.xml | 2 +- .../src/main/res/layout/activity_no_bt.xml | 9 +-- .../main/res/layout/location_disabled_big.xml | 4 +- .../res/layout/location_disabled_small.xml | 4 +- .../app/src/main/res/layout/status_big.xml | 38 ++++++------ .../app/src/main/res/layout/status_small.xml | 50 +++++++-------- .../app/src/main/res/values-de/strings.xml | 1 + .../app/src/main/res/values-es/strings.xml | 1 + .../app/src/main/res/values-fr/strings.xml | 17 ++++-- .../app/src/main/res/values-it/strings.xml | 1 + .../src/main/res/values-iw-rIL/strings.xml | 3 +- .../app/src/main/res/values-nl/strings.xml | 1 + .../app/src/main/res/values-ru/strings.xml | 1 + .../app/src/main/res/values-uk/strings.xml | 1 + .../src/main/res/values-zh-rCN/strings.xml | 1 + OpenPods/app/src/main/res/values/dimens.xml | 22 +++++++ OpenPods/app/src/main/res/values/strings.xml | 2 + .../src/main/res/xml/preference_screen.xml | 61 +++++++++++++++---- 24 files changed, 216 insertions(+), 103 deletions(-) create mode 100644 OpenPods/app/src/main/res/values/dimens.xml diff --git a/OpenPods/app/src/main/java/com/dosse/airpods/AboutActivity.java b/OpenPods/app/src/main/java/com/dosse/airpods/AboutActivity.java index 74fd9aa..d330493 100644 --- a/OpenPods/app/src/main/java/com/dosse/airpods/AboutActivity.java +++ b/OpenPods/app/src/main/java/com/dosse/airpods/AboutActivity.java @@ -10,25 +10,27 @@ import androidx.appcompat.app.AppCompatActivity; public class AboutActivity extends AppCompatActivity { - final String githubURL = "https://github.com/adolfintel/OpenPods"; - final String websiteURL = "https://fdossena.com/?p=openPods/index.frag"; - final String donateURL = "https://paypal.me/sineisochronic"; - @SuppressWarnings("DanglingJavadoc") + public static final String websiteURL = "https://fdossena.com/?p=openPods/index.frag"; + public static final String githubURL = "https://github.com/adolfintel/OpenPods"; + public static final String donateURL = "https://paypal.me/sineisochronic"; + public static final String fdroidURL = "https://f-droid.org/packages/com.dosse.airpods/"; + @Override protected void onCreate (Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_about); - /** - * LEGAL DANGER ZONE! - * + // --------------- LEGAL DANGER ZONE! --------------- // + + /* * The following actions are a violation of the GNU GPLv3 License: * - Removing, hiding or altering the license or the code that displays it * - Removing or changing the link to the original source code or the code that displays it * - Removing or changing the donation link of the original project or the code that displays it * - * If you're forking the application, it MUST be made clear that your version is a fork, who the original author is, and all references to the original project and license must not be removed. + * If you're forking the application, it MUST be made clear that your version is a fork, + * who the original author is, and all references to the original project and license must not be removed. * You are free to add links to your project, donations, whatever to this activity. * * I am constantly monitoring all major Android app stores for violations. You have been warned. @@ -36,14 +38,14 @@ public class AboutActivity extends AppCompatActivity { ((WebView)(findViewById(R.id.license))).loadUrl("file:///android_asset/license.html"); - findViewById(R.id.github).setOnClickListener(v -> startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(githubURL)))); findViewById(R.id.website).setOnClickListener(v -> startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(websiteURL)))); + findViewById(R.id.github).setOnClickListener(v -> startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(githubURL)))); findViewById(R.id.donate).setOnClickListener(v -> { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(donateURL))); Toast.makeText(AboutActivity.this, "❤️", Toast.LENGTH_SHORT).show(); }); - //END OF LEGAL DANGER ZONE + // ------------ END OF LEGAL DANGER ZONE ------------ // } } diff --git a/OpenPods/app/src/main/java/com/dosse/airpods/SettingsFragment.java b/OpenPods/app/src/main/java/com/dosse/airpods/SettingsFragment.java index ba1cc04..9e60f1f 100644 --- a/OpenPods/app/src/main/java/com/dosse/airpods/SettingsFragment.java +++ b/OpenPods/app/src/main/java/com/dosse/airpods/SettingsFragment.java @@ -4,34 +4,33 @@ import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; +import android.net.Uri; import android.os.Bundle; import android.widget.Toast; import androidx.preference.Preference; import androidx.preference.PreferenceFragmentCompat; -import java.util.Objects; +import static com.dosse.airpods.AboutActivity.donateURL; +import static com.dosse.airpods.AboutActivity.fdroidURL; +import static com.dosse.airpods.AboutActivity.githubURL; +import static com.dosse.airpods.AboutActivity.websiteURL; public class SettingsFragment extends PreferenceFragmentCompat { private Context context; @SuppressWarnings("FieldCanBeLocal") - private Preference mAboutPreference, mHideAppPreference; + private Preference mAboutPreference, mHideAppPreference, mFDroidPreference, mWebsitePreference, mGithubPreference, mDonationPreference; @Override public void onCreatePreferences (Bundle savedInstanceState, String rootKey) { setPreferencesFromResource(R.xml.preference_screen, rootKey); context = getContext(); - mAboutPreference = getPreferenceManager().findPreference("about"); - Objects.requireNonNull(mAboutPreference).setOnPreferenceClickListener(preference -> { - startActivity(new Intent(context, AboutActivity.class)); - return true; - }); - mHideAppPreference = getPreferenceManager().findPreference("hideApp"); - Objects.requireNonNull(mHideAppPreference).setOnPreferenceClickListener(preference -> { + assert mHideAppPreference != null; + mHideAppPreference.setOnPreferenceClickListener(preference -> { PackageManager p = requireContext().getPackageManager(); p.setComponentEnabledSetting(new ComponentName(context, MainActivity.class), PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP); Toast.makeText(context, getString(R.string.hideClicked), Toast.LENGTH_LONG).show(); @@ -46,6 +45,43 @@ public class SettingsFragment extends PreferenceFragmentCompat { return true; }); + mAboutPreference = getPreferenceManager().findPreference("about"); + assert mAboutPreference != null; + mAboutPreference.setSummary(String.format("%s v%s", getString(R.string.app_name), BuildConfig.VERSION_NAME)); + mAboutPreference.setOnPreferenceClickListener(preference -> { + startActivity(new Intent(context, AboutActivity.class)); + return true; + }); + + mFDroidPreference = getPreferenceManager().findPreference("fdroid"); + assert mFDroidPreference != null; + mFDroidPreference.setOnPreferenceClickListener(preference -> { + startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(fdroidURL))); + return true; + }); + + mGithubPreference = getPreferenceManager().findPreference("github"); + assert mGithubPreference != null; + mGithubPreference.setOnPreferenceClickListener(preference -> { + startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(githubURL))); + return true; + }); + + mWebsitePreference = getPreferenceManager().findPreference("website"); + assert mWebsitePreference != null; + mWebsitePreference.setOnPreferenceClickListener(preference -> { + startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(websiteURL))); + return true; + }); + + mDonationPreference = getPreferenceManager().findPreference("donate"); + assert mDonationPreference != null; + mDonationPreference.setOnPreferenceClickListener(preference -> { + startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(donateURL))); + Toast.makeText(getContext(), "❤️", Toast.LENGTH_SHORT).show(); + return true; + }); + enableDisableOptions(); } diff --git a/OpenPods/app/src/main/res/layout-land/activity_about.xml b/OpenPods/app/src/main/res/layout-land/activity_about.xml index 09808d7..569371f 100644 --- a/OpenPods/app/src/main/res/layout-land/activity_about.xml +++ b/OpenPods/app/src/main/res/layout-land/activity_about.xml @@ -4,9 +4,9 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:background="#FFFFFF" - android:paddingLeft="12dp" - android:paddingTop="12dp" - android:paddingRight="12dp" + android:paddingLeft="@dimen/padding_default" + android:paddingTop="@dimen/padding_default" + android:paddingRight="@dimen/padding_default" tools:context=".AboutActivity" tools:ignore="ContentDescription,ButtonStyle"> @@ -24,11 +24,11 @@ - Removing or changing the link to the original source code or the code that displays it - Removing or changing the donation link of the original project or the code that displays it - If you're forking the application, it MUST be made clear that your version is a fork, who the original author is, and all references to the original project and license must not be removed. + If you're forking the application, it MUST be made clear that your version is a fork, + who the original author is, and all references to the original project and license must not be removed. You are free to add links to your project, donations, whatever to this activity. I am constantly monitoring all major Android app stores for violations. You have been warned. - --> @@ -23,11 +23,11 @@ - Removing or changing the link to the original source code or the code that displays it - Removing or changing the donation link of the original project or the code that displays it - If you're forking the application, it MUST be made clear that your version is a fork, who the original author is, and all references to the original project and license must not be removed. + If you're forking the application, it MUST be made clear that your version is a fork, + who the original author is, and all references to the original project and license must not be removed. You are free to add links to your project, donations, whatever to this activity. I am constantly monitoring all major Android app stores for violations. You have been warned. - --> + android:padding="@dimen/padding_default"> + android:padding="@dimen/padding_default"> + android:textColor="@color/textColorPrimary" + android:textSize="15sp" /> diff --git a/OpenPods/app/src/main/res/layout/location_disabled_big.xml b/OpenPods/app/src/main/res/layout/location_disabled_big.xml index 74b9549..fe576f3 100644 --- a/OpenPods/app/src/main/res/layout/location_disabled_big.xml +++ b/OpenPods/app/src/main/res/layout/location_disabled_big.xml @@ -1,10 +1,10 @@ + android:padding="@dimen/padding_default"> + android:padding="@dimen/padding_default"> @@ -34,8 +34,8 @@ @@ -44,7 +44,7 @@ android:id="@+id/leftPodUpdating" style="?android:attr/progressBarStyle" android:layout_width="match_parent" - android:layout_height="18dp" + android:layout_height="@dimen/noti_status_big_progressbar" android:layout_below="@id/leftPodImg" android:gravity="center" android:indeterminate="true" /> @@ -53,15 +53,15 @@ @@ -77,8 +77,8 @@ @@ -87,7 +87,7 @@ android:id="@+id/rightPodUpdating" style="?android:attr/progressBarStyle" android:layout_width="match_parent" - android:layout_height="18dp" + android:layout_height="@dimen/noti_status_big_progressbar" android:layout_below="@id/rightPodImg" android:gravity="center" android:indeterminate="true" /> @@ -96,15 +96,15 @@ @@ -120,8 +120,8 @@ @@ -130,7 +130,7 @@ android:id="@+id/podCaseUpdating" style="?android:attr/progressBarStyle" android:layout_width="match_parent" - android:layout_height="18dp" + android:layout_height="@dimen/noti_status_big_progressbar" android:layout_below="@id/podCaseImg" android:gravity="center" android:indeterminate="true" /> diff --git a/OpenPods/app/src/main/res/layout/status_small.xml b/OpenPods/app/src/main/res/layout/status_small.xml index ba754cc..ca02b14 100644 --- a/OpenPods/app/src/main/res/layout/status_small.xml +++ b/OpenPods/app/src/main/res/layout/status_small.xml @@ -5,20 +5,20 @@ android:layout_height="wrap_content" android:background="@color/bgColorPrimary" android:gravity="center" - android:padding="12dp" + android:padding="@dimen/padding_default" tools:ignore="RtlHardcoded,ContentDescription"> @@ -40,8 +40,8 @@ @@ -49,15 +49,15 @@ @@ -79,8 +79,8 @@ @@ -88,15 +88,15 @@ @@ -118,8 +118,8 @@ diff --git a/OpenPods/app/src/main/res/values-de/strings.xml b/OpenPods/app/src/main/res/values-de/strings.xml index e204964..d014143 100644 --- a/OpenPods/app/src/main/res/values-de/strings.xml +++ b/OpenPods/app/src/main/res/values-de/strings.xml @@ -15,6 +15,7 @@ Stromsparmodus (nicht empfohlen) Aktiviere diesen Modus, wenn Bluetooth zu viel Batterieleistung erfordert App verstecken + Verstecke diese App vor dem Launcher Das Icon wird bald verschwinden Über diff --git a/OpenPods/app/src/main/res/values-es/strings.xml b/OpenPods/app/src/main/res/values-es/strings.xml index 230b8ff..9e2e7ce 100644 --- a/OpenPods/app/src/main/res/values-es/strings.xml +++ b/OpenPods/app/src/main/res/values-es/strings.xml @@ -15,6 +15,7 @@ Ahorro de energía (no recomendado) Activa ésta opción si el Bluetooth consume mucha batería. Ocultar app + Ocultar esta aplicación de la launcher El icono desaparecerá pronto Acerca de diff --git a/OpenPods/app/src/main/res/values-fr/strings.xml b/OpenPods/app/src/main/res/values-fr/strings.xml index a23680f..a4e2aea 100644 --- a/OpenPods/app/src/main/res/values-fr/strings.xml +++ b/OpenPods/app/src/main/res/values-fr/strings.xml @@ -3,18 +3,23 @@ Cette application vous permet de voir l\'état de vos AirPods sur n\'importe quel appareil Android. Pour opérer, nous avons besoin de votre permission pour utiliser Bluetooth LE (Localisation) et permission pour exécuter l\'application en arrière-plan. Permettre - Cette application affichera une notification lorsque vos AirPods seront connectés. - Vous pouvez masquer cette application si vous voulez. + Cette application affichera une notification lorsque vos AirPods seront connectés. + Vous pouvez masquer cette application si vous voulez. Réglages + Il semble que cet appareil ne dispose pas de Bluetooth LE. Vous devez activer la localisation pour permettre aux OpenPod de lire l\'état de vous AirPods. - Appareils pris en charge:\n• Apple AirPods 1re génération\n• Apple AirPods 2e génération\n• Apple AirPods Pro - Masquer l\'application - L\'icône disparaîtra bientôt. + Appareils pris en charge: + • Apple AirPods 1re génération\n• Apple AirPods 2e génération\n• Apple AirPods Pro + Économiseur de batterie (non recommandé) Activez cette option si Bluetooth utilise beaucoup de batterie + Masquer l\'application + Masquer cette application + L\'icône disparaîtra bientôt. À propos - Developpé par Federico Dossena + + Developpé par Federico Dossena Site web Github Faire un don diff --git a/OpenPods/app/src/main/res/values-it/strings.xml b/OpenPods/app/src/main/res/values-it/strings.xml index 646ffc5..5ffa2fa 100644 --- a/OpenPods/app/src/main/res/values-it/strings.xml +++ b/OpenPods/app/src/main/res/values-it/strings.xml @@ -15,6 +15,7 @@ Risparmio batteria (sconsigliato) Attiva se il Bluetooth usa molta batteria Nascondi app + Nascondi questa app dal programma di avvio L\'icona sarà rimossa presto Informazioni su diff --git a/OpenPods/app/src/main/res/values-iw-rIL/strings.xml b/OpenPods/app/src/main/res/values-iw-rIL/strings.xml index 4397fe7..902c680 100644 --- a/OpenPods/app/src/main/res/values-iw-rIL/strings.xml +++ b/OpenPods/app/src/main/res/values-iw-rIL/strings.xml @@ -15,11 +15,12 @@ חיסכון בסוללה (לא מומלץ) הפעל אם Bluetooth משתמש בהרבה סוללה הסתר אפליקציה + הסתר את האפליקציה ממסך הבית האפליקציה תוסתר בקרוב אודות פותח על ידי פדריקו דוסנה אתר המפתח - Github + קוד מקור תרומה diff --git a/OpenPods/app/src/main/res/values-nl/strings.xml b/OpenPods/app/src/main/res/values-nl/strings.xml index 56a5a09..f386956 100644 --- a/OpenPods/app/src/main/res/values-nl/strings.xml +++ b/OpenPods/app/src/main/res/values-nl/strings.xml @@ -15,6 +15,7 @@ Accu-optimalisatie (niet aanbevolen) Schakel dit in als je merkt dat het accuverbruik hoger is door Bluetooth App verbergen + Verberg deze app vanaf de launcher Het pictogram verdwijnt spoedig Over diff --git a/OpenPods/app/src/main/res/values-ru/strings.xml b/OpenPods/app/src/main/res/values-ru/strings.xml index d9abd5c..fa616d9 100644 --- a/OpenPods/app/src/main/res/values-ru/strings.xml +++ b/OpenPods/app/src/main/res/values-ru/strings.xml @@ -15,6 +15,7 @@ Режим энергосбережения (Не рекомендуется) Включите, если Bluetooth использует слишком много ресурсов Скрыть приложение + Скрыть это приложение с домашней страницы Иконка скоро исчезнет О приложении diff --git a/OpenPods/app/src/main/res/values-uk/strings.xml b/OpenPods/app/src/main/res/values-uk/strings.xml index 5175352..1e1a0c7 100644 --- a/OpenPods/app/src/main/res/values-uk/strings.xml +++ b/OpenPods/app/src/main/res/values-uk/strings.xml @@ -15,6 +15,7 @@ Режим збереження енергії (Не рекомендовано) Увімкніть, якщо Bluetooth використовує багато ресурсів Сховати додаток + Приховати це додаток з домашньої сторінки Іконка скоро зникне Про програму diff --git a/OpenPods/app/src/main/res/values-zh-rCN/strings.xml b/OpenPods/app/src/main/res/values-zh-rCN/strings.xml index 2a6b82f..9785559 100644 --- a/OpenPods/app/src/main/res/values-zh-rCN/strings.xml +++ b/OpenPods/app/src/main/res/values-zh-rCN/strings.xml @@ -15,6 +15,7 @@ 省电模式 (不推荐) 可在蓝牙消耗过多电量时开启 隐藏 + 从您的首页隐藏此应用 桌面图标很快就会被隐藏掉 关于 diff --git a/OpenPods/app/src/main/res/values/dimens.xml b/OpenPods/app/src/main/res/values/dimens.xml new file mode 100644 index 0000000..35d622f --- /dev/null +++ b/OpenPods/app/src/main/res/values/dimens.xml @@ -0,0 +1,22 @@ + + + 12dp + 16dp + + 120dp + 70dp + + 18dp + + 80dp + 30dp + 18dp + 25dp + + 70dp + 120dp + 90dp + 40dp + 80dp + 18dp + \ No newline at end of file diff --git a/OpenPods/app/src/main/res/values/strings.xml b/OpenPods/app/src/main/res/values/strings.xml index 3222712..303a9f6 100644 --- a/OpenPods/app/src/main/res/values/strings.xml +++ b/OpenPods/app/src/main/res/values/strings.xml @@ -17,6 +17,7 @@ Battery saver (Not recommended) Enable this if Bluetooth uses a lot of battery Hide app + Hide this app from the launcher The icon will disappear soon About @@ -24,4 +25,5 @@ Website Github Donate + F-Droid diff --git a/OpenPods/app/src/main/res/xml/preference_screen.xml b/OpenPods/app/src/main/res/xml/preference_screen.xml index 4b09ed9..75b91e6 100644 --- a/OpenPods/app/src/main/res/xml/preference_screen.xml +++ b/OpenPods/app/src/main/res/xml/preference_screen.xml @@ -1,18 +1,55 @@ - + - + - + - + + + + + + + + + + + + + + + +