Compare commits

...

2 Commits

Author SHA1 Message Date
Balazs Toldi
fd6bc82214
Make icon toggleable
This commit adds an option to choose between the original and the new icon
2023-10-22 09:51:30 +02:00
Balazs Toldi
0ae8826732
Add the new icon 2023-10-22 09:03:44 +02:00
17 changed files with 206 additions and 8 deletions

View File

@ -441,11 +441,36 @@
android:theme="@style/AppTheme.Launcher"
android:windowSoftInputMode="adjustPan">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity-alias
android:name=".DefaultIcon"
android:targetActivity=".activities.MainActivity"
android:label="@string/application_name"
android:enabled="true"
android:icon="@mipmap/ic_launcher"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity-alias>
<activity-alias
android:name=".OriginalIcon"
android:targetActivity=".activities.MainActivity"
android:label="@string/application_name"
android:enabled="false"
android:icon="@mipmap/original_ic_launcher"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity-alias>
<activity
android:name=".activities.LoginActivity"
android:configChanges="orientation|screenLayout|screenSize|layoutDirection"

View File

@ -1,6 +1,8 @@
package eu.toldi.infinityforlemmy.settings;
import android.content.ComponentName;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.widget.Toast;
@ -42,6 +44,7 @@ public class MiscellaneousPreferenceFragment extends CustomFontPreferenceFragmen
ListPreference languageListPreference = findPreference(SharedPreferencesUtils.LANGUAGE);
EditTextPreference anonymousAccountInstance = findPreference(SharedPreferencesUtils.ANONYMOUS_ACCOUNT_INSTANCE);
EditTextPreference postFeedMaxResolution = findPreference(SharedPreferencesUtils.POST_FEED_MAX_RESOLUTION);
ListPreference iconPreference = findPreference(SharedPreferencesUtils.ICON_PREFERENCE);
if (mainPageBackButtonActionListPreference != null) {
mainPageBackButtonActionListPreference.setOnPreferenceChangeListener((preference, newValue) -> {
@ -102,5 +105,41 @@ public class MiscellaneousPreferenceFragment extends CustomFontPreferenceFragmen
return true;
});
}
if (iconPreference != null) {
iconPreference.setOnPreferenceChangeListener((preference, newValue) -> {
updateIcon((String) newValue);
return true;
});
}
}
private void updateIcon(String iconValue) {
PackageManager pm = getActivity().getPackageManager();
// Disable all the alternative icons
pm.setComponentEnabledSetting(
new ComponentName(getActivity(), "eu.toldi.infinityforlemmy.OriginalIcon"),
PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
PackageManager.DONT_KILL_APP);
pm.setComponentEnabledSetting(
new ComponentName(getActivity(), "eu.toldi.infinityforlemmy.DefaultIcon"),
PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
PackageManager.DONT_KILL_APP);
// Enable the chosen icon
if ("original_icon".equals(iconValue)) {
pm.setComponentEnabledSetting(
new ComponentName(getActivity(), "eu.toldi.infinityforlemmy.OriginalIcon"),
PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
PackageManager.DONT_KILL_APP);
} else {
pm.setComponentEnabledSetting(
new ComponentName(getActivity(), "eu.toldi.infinityforlemmy.DefaultIcon"),
PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
PackageManager.DONT_KILL_APP);
}
}
}

View File

@ -420,4 +420,6 @@ public class SharedPreferencesUtils {
public static final String SHOW_POST_AND_COMMENT_SCORE = "show_score";
public static final String SHARE_LINK_ON_LOCAL_INSTANCE = "share_link_on_local_instance";
public static final String ICON_PREFERENCE = "icon_preference";
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -0,0 +1,30 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="512dp"
android:height="512dp"
android:viewportWidth="512"
android:viewportHeight="512">
<path
android:pathData="M0,0h512v512h-512z"
android:fillColor="#F3DBB9" />
<group>
<clip-path android:pathData="M0,0h512v512h-512z" />
<path
android:pathData="M233.34,72.72m-169.34,0a169.34,169.34 0,1 1,338.68 0a169.34,169.34 0,1 1,-338.68 0"
android:fillColor="#F94E3C" />
<path
android:pathData="M124.6,0l-124.6,0l0,145.83l275.01,366.17l236.99,0l-0,-214l-387.4,-298Z"
android:fillColor="#FFB026" />
<path
android:pathData="M448,474.98m-121.24,0a121.24,121.24 0,1 1,242.48 0a121.24,121.24 0,1 1,-242.48 0"
android:fillColor="#82F5D4" />
<path
android:pathData="M0,512c-21.42,-243.29 239.91,-279.77 239.91,-279.77c0,-0 -68.17,142.79 80.18,279.77c40.15,37.07 -315.52,51.92 -320.1,0Z"
android:fillColor="#F1EA4F" />
<group>
<clip-path android:pathData="M18.97,-135.06c-85.05,-0 -156.55,81.43 -156.55,184.25c0,102.82 71.5,184.25 156.55,184.25c85.05,-0 156.55,-81.43 156.55,-184.25c0,-102.82 -71.5,-184.25 -156.55,-184.25ZM18.97,-111.06c73.16,-0 132.55,71.81 132.55,160.25c0,88.44 -59.4,160.25 -132.55,160.25c-73.16,-0 -132.55,-71.81 -132.55,-160.25c0,-88.45 59.4,-160.25 132.55,-160.25Z" />
</group>
<group>
<clip-path android:pathData="M520.97,-177.56c-85.05,0 -156.55,81.43 -156.55,184.25c0,102.82 71.5,184.25 156.55,184.25c85.05,0 156.55,-81.43 156.55,-184.25c0,-102.82 -71.5,-184.25 -156.55,-184.25ZM520.97,-153.56c73.16,0 132.55,71.81 132.55,160.25c0,88.45 -59.4,160.25 -132.55,160.25c-73.16,0 -132.55,-71.81 -132.55,-160.25c0,-88.44 59.4,-160.25 132.55,-160.25Z" />
</group>
</group>
</vector>

View File

@ -0,0 +1,72 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="512dp"
android:height="512dp"
android:viewportWidth="740"
android:viewportHeight="740">
<group
android:translateX="120"
android:translateY="120">
<clip-path android:pathData="M0,0h512v512h-512z" />
<path
android:pathData="M179.76,220.04a91.29,93.65 0,1 0,182.58 0a91.29,93.65 0,1 0,-182.58 0z"
android:fillColor="#000F44" />
<path
android:pathData="M161.99,207.29c-0.42,14.79 121.94,114.37 139.21,105.89c5.22,-2.56 -11.67,-11.26 -5.25,-12.06c15.88,-1.97 12.87,-24.19 18.18,-30.99c20.97,-26.82 27.47,-71.3 -15.65,-97.84c-32.7,-20.13 -69.99,-7 -85.19,13.06c-7.59,10.02 -19.13,7.43 -22.99,12.82c-5.83,8.14 -4.47,3.14 -5.36,-2.2c-2.46,-14.77 -22.43,-7.04 -22.95,11.31Z"
android:fillColor="#426367" />
<path
android:pathData="M256,174.58m-19.34,0a19.34,19.34 0,1 1,38.68 0a19.34,19.34 0,1 1,-38.68 0"
android:fillColor="#426367" />
<path
android:pathData="M314.97,212.69m-19.34,0a19.34,19.34 0,1 1,38.68 0a19.34,19.34 0,1 1,-38.68 0"
android:fillColor="#426367" />
<path
android:pathData="M205.75,274.58c13.55,17.51 71.46,47.84 93.99,25.51c11.36,-11.26 -1.88,-11.27 -0,-18.44c10.98,-41.87 -9.94,-35.84 -36.98,-56.33c-27.25,-20.65 -33.02,-38.56 -57.01,-17.37c-7.75,6.84 -14.71,-0.6 -18.91,4.54c-12.25,14.96 3.34,41.97 18.91,62.08Z"
android:fillColor="#918279" />
<path
android:pathData="M264.29,224.92m-6.06,0a6.06,6.06 0,1 1,12.13 0a6.06,6.06 0,1 1,-12.13 0"
android:fillColor="#000F44" />
<path
android:pathData="M260.1,187.88c5.34,3.55 6.78,10.77 3.23,16.1c-3.55,5.34 -8.39,4.41 -13.72,0.85c-5.34,-3.55 -9.16,-8.39 -5.61,-13.73c3.55,-5.34 10.77,-6.78 16.1,-3.23Z"
android:fillColor="#000F44" />
<path
android:pathData="M302.1,213.76c5.34,3.55 6.78,10.77 3.23,16.1c-3.55,5.34 -8.39,4.41 -13.73,0.86c-5.34,-3.55 -9.16,-8.39 -5.61,-13.73c3.55,-5.34 10.77,-6.78 16.1,-3.23Z"
android:fillColor="#000F44" />
<path
android:pathData="M251.24,185.73c2.14,-0.45 4.24,0.87 4.68,2.95c0.44,2.08 -0.95,4.13 -3.09,4.59c-2.14,0.45 -4.24,-0.87 -4.68,-2.95c-0.44,-2.08 0.95,-4.13 3.09,-4.59Z"
android:fillColor="#82F5D4" />
<path
android:pathData="M294.81,211.51c2.22,-0.47 4.39,0.9 4.85,3.06c0.45,2.15 -0.98,4.28 -3.2,4.75c-2.22,0.47 -4.39,-0.9 -4.85,-3.06c-0.46,-2.15 0.98,-4.28 3.2,-4.75Z"
android:fillColor="#82F5D4" />
<path
android:pathData="M229.32,420.89c-0.38,-9.41 -0.4,-12.12 -3.04,-21.61c-18.38,-66.06 15.68,-73.88 33.95,-69.82c12.06,2.67 30.13,2.04 33.66,-15.43c1.16,-5.77 -10.31,-7.13 -14.76,-7.68c-14.47,-1.78 -45.16,-4.09 -55.9,-13.06c-17.83,-14.89 -23.98,-46.08 -32.37,-73.04c-6.4,-20.58 -12.88,-35.01 -19.32,-42.08c-12.81,-14.06 -28.61,-6.82 -24.75,14.53c1.19,6.6 9.81,25.35 13.99,35.64c5.04,12.41 1.54,23.97 -0.39,35.46c-3.34,19.91 -3.27,52.95 -3.27,52.95c-0,0 -16.23,7.15 -18.11,22.41c-2.57,20.83 13.45,29.74 13.45,29.74c0,0 -1.15,12.65 -3.39,20.82c-2,7.26 6.16,9.73 9.54,5.03c7.25,-10.08 15.02,-25.48 15.02,-25.48c0,0 7.59,6.8 10.98,11.47c4.36,6.01 14.72,11.72 20.76,15.66c8.65,5.64 11.18,14.34 15.36,26.16c1.49,4.22 8.78,2.83 8.6,-1.64Z"
android:fillColor="#000F44" />
<path
android:pathData="M218.27,304.12c1.45,-1.18 2.27,-2.97 2.22,-4.84c-0.05,-1.87 -0.96,-3.61 -2.47,-4.72c-5.72,-4.19 -14.14,-10.35 -20.1,-14.71c-1.61,-1.18 -3.7,-1.49 -5.58,-0.82c-1.88,0.66 -3.32,2.21 -3.83,4.14c-1.85,6.92 -4.39,16.38 -5.85,21.84c-0.69,2.59 0.4,5.32 2.68,6.72c2.93,1.8 6.94,4.27 9.83,6.04c2.19,1.35 5,1.16 6.99,-0.47c4.08,-3.33 11.07,-9.05 16.12,-13.16Z"
android:fillColor="#426367" />
<path
android:pathData="M158.59,183.75m-8.2,0a8.2,8.2 0,1 1,16.41 0a8.2,8.2 0,1 1,-16.41 0"
android:fillColor="#426367" />
<path
android:pathData="M226.47,318.64c0,-0 7.6,52.73 48.87,80.16c41.26,27.43 70.49,-12.13 118.23,-6.93c105.73,11.52 125.82,133.74 125.82,133.74"
android:strokeWidth="8"
android:fillColor="#00000000"
android:strokeColor="#000F44" />
<path
android:pathData="M182.47,209.44a95.4,98.97 0,1 0,190.81 0a95.4,98.97 0,1 0,-190.81 0z"
android:strokeWidth="12"
android:fillColor="#00000000"
android:strokeColor="#000F44" />
<path
android:pathData="M337.26,159.6c3.89,-0.82 7.81,2.17 8.76,6.68c0.95,4.51 -1.43,8.83 -5.32,9.65c-3.89,0.82 -7.81,-2.17 -8.77,-6.68c-0.95,-4.51 1.43,-8.83 5.32,-9.65Z"
android:fillColor="#ffffff" />
<path
android:pathData="M323.37,175.31c1.51,-0.32 3.03,0.84 3.39,2.59c0.37,1.75 -0.56,3.42 -2.06,3.74c-1.5,0.32 -3.03,-0.84 -3.39,-2.59c-0.37,-1.75 0.56,-3.42 2.06,-3.74Z"
android:fillColor="#ffffff" />
<path
android:pathData="M202.41,225.13c1.93,-0.62 3.14,9.33 6.65,20.17c3.51,10.83 8,18.47 6.07,19.09c-1.93,0.62 -8.98,-5.51 -12.49,-16.34c-3.51,-10.83 -2.16,-22.29 -0.23,-22.91Z"
android:fillColor="#ffffff" />
<path
android:pathData="M278.08,313.74c4.52,0.32 8.05,2.53 7.88,4.95c-0.17,2.41 -3.97,4.12 -8.49,3.8c-4.52,-0.32 -8.05,-2.53 -7.88,-4.95c0.17,-2.41 3.97,-4.12 8.49,-3.8Z"
android:fillColor="#426367" />
</group>
</vector>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
<monochrome android:drawable="@drawable/ic_launcher_foreground_monochrome" />
<background android:drawable="@drawable/icon_new_colour_background" />
<foreground android:drawable="@drawable/icon_new_colour_foreground" />
<monochrome android:drawable="@drawable/icon_new" />
</adaptive-icon>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
<monochrome android:drawable="@drawable/ic_launcher_foreground_monochrome" />
<background android:drawable="@drawable/icon_new_colour_background" />
<foreground android:drawable="@drawable/icon_new_colour_foreground" />
<monochrome android:drawable="@drawable/icon_new" />
</adaptive-icon>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
<monochrome android:drawable="@drawable/ic_launcher_foreground_monochrome" />
</adaptive-icon>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
<monochrome android:drawable="@drawable/ic_launcher_foreground_monochrome" />
</adaptive-icon>

View File

@ -691,4 +691,13 @@
<item>1</item>
</string-array>
<string-array name="icon_labels">
<item>Cosmic Lemmy</item>
<item>Galactic Cruiser Lemmy</item>
</string-array>
<string-array name="icon_values">
<item>default_icon</item>
<item>original_icon</item>
</string-array>
</resources>

View File

@ -1386,4 +1386,6 @@
<string name="settings_hide_user_instance">Hide user instance</string>
<string name="share_links_on_your_local_instance_rather_than_the_original_creation_instance">Share links on your local instance rather than the original creation instance.</string>
<string name="share_links_on_your_local_instance">Share links on your local instance</string>
<string name="icon_original_label">Original Icon</string>
</resources>

View File

@ -52,6 +52,13 @@
app:title="@string/share_links_on_your_local_instance"
app:summary="@string/share_links_on_your_local_instance_rather_than_the_original_creation_instance" />
<ListPreference
app:key="icon_preference"
app:title="Change App Icon"
app:entries="@array/icon_labels"
app:entryValues="@array/icon_values"
app:defaultValue="default_icon" />
<eu.toldi.infinityforlemmy.customviews.CustomFontPreferenceCategory app:title="@string/settings_miscellaneous_dangerous_group_title" />
<eu.toldi.infinityforlemmy.customviews.CustomFontPreference