mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 03:18:06 +00:00
Change icon color to match selected theme
This commit is contained in:
parent
942e78eede
commit
50c9297c77
6 changed files with 103 additions and 3 deletions
|
|
@ -241,6 +241,70 @@
|
||||||
android:resource="@xml/provider_paths" />
|
android:resource="@xml/provider_paths" />
|
||||||
</provider>
|
</provider>
|
||||||
|
|
||||||
|
<!-- Aliases for custom icon launcher -->
|
||||||
|
|
||||||
|
<activity-alias
|
||||||
|
android:name=".ui.main.MainActivityBlue"
|
||||||
|
android:icon="@mipmap/ic_launcher_blue"
|
||||||
|
android:roundIcon="@mipmap/ic_launcher_round_blue"
|
||||||
|
android:theme="@style/AppSplashScreenTheme"
|
||||||
|
android:windowSoftInputMode="adjustResize"
|
||||||
|
android:exported="true"
|
||||||
|
android:enabled="false"
|
||||||
|
android:launchMode="singleTask"
|
||||||
|
android:targetActivity=".ui.main.MainActivity">
|
||||||
|
|
||||||
|
<meta-data
|
||||||
|
android:name="android.app.shortcuts"
|
||||||
|
android:resource="@xml/shortcuts" />
|
||||||
|
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.VIEW_LOCUS" />
|
||||||
|
</intent-filter>
|
||||||
|
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.SEND" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<data android:mimeType="text/*" />
|
||||||
|
<data android:mimeType="image/*" />
|
||||||
|
<data android:mimeType="audio/*" />
|
||||||
|
<data android:mimeType="video/*" />
|
||||||
|
<data android:mimeType="application/*" />
|
||||||
|
</intent-filter>
|
||||||
|
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.SEND_MULTIPLE" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<data android:mimeType="image/*" />
|
||||||
|
<data android:mimeType="audio/*" />
|
||||||
|
<data android:mimeType="video/*" />
|
||||||
|
<data android:mimeType="application/*" />
|
||||||
|
</intent-filter>
|
||||||
|
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.DIAL" />
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
<action android:name="android.intent.action.CALL" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
|
<data android:scheme="tel" />
|
||||||
|
<data android:scheme="sip" />
|
||||||
|
<data android:scheme="callto" />
|
||||||
|
<data android:scheme="sips" />
|
||||||
|
<data android:scheme="sip-linphone" />
|
||||||
|
<data android:scheme="sips-linphone" />
|
||||||
|
<data android:scheme="linphone-sip" />
|
||||||
|
<data android:scheme="linphone-sips" />
|
||||||
|
<data android:scheme="linphone-config" />
|
||||||
|
</intent-filter>
|
||||||
|
|
||||||
|
</activity-alias>
|
||||||
|
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
|
|
@ -20,6 +20,8 @@
|
||||||
package org.linphone.ui
|
package org.linphone.ui
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
|
import android.content.ComponentName
|
||||||
|
import android.content.pm.PackageManager
|
||||||
import android.content.res.Configuration
|
import android.content.res.Configuration
|
||||||
import android.content.res.Resources
|
import android.content.res.Resources
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
|
@ -88,6 +90,8 @@ open class GenericActivity : AppCompatActivity() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enableDisableLaunchersToKeepOnlyOneMatchingTheme()
|
||||||
|
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -247,4 +251,27 @@ open class GenericActivity : AppCompatActivity() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun enableDisableLaunchersToKeepOnlyOneMatchingTheme() {
|
||||||
|
val currentTheme = corePreferences.themeMainColor
|
||||||
|
|
||||||
|
val supportedThemes = arrayListOf<Pair<String, String>>(
|
||||||
|
Pair("org.linphone.ui.main.MainActivity", "orange"),
|
||||||
|
Pair("org.linphone.ui.main.MainActivityBlue", "blue"),
|
||||||
|
)
|
||||||
|
for (theme in supportedThemes) {
|
||||||
|
val componentName = theme.first
|
||||||
|
val color = theme.second
|
||||||
|
|
||||||
|
packageManager.setComponentEnabledSetting(
|
||||||
|
ComponentName(this, componentName),
|
||||||
|
if (currentTheme == color) {
|
||||||
|
PackageManager.COMPONENT_ENABLED_STATE_ENABLED
|
||||||
|
} else {
|
||||||
|
PackageManager.COMPONENT_ENABLED_STATE_DISABLED
|
||||||
|
},
|
||||||
|
PackageManager.DONT_KILL_APP
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
6
app/src/main/res/mipmap-anydpi/ic_launcher_blue.xml
Normal file
6
app/src/main/res/mipmap-anydpi/ic_launcher_blue.xml
Normal 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="@color/blue_main_500" />
|
||||||
|
<foreground android:drawable="@mipmap/linphone_launcher_icon_foreground" />
|
||||||
|
<monochrome android:drawable="@mipmap/linphone_launcher_icon_foreground"/>
|
||||||
|
</adaptive-icon>
|
||||||
|
|
@ -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="@color/blue_main_500" />
|
||||||
|
<foreground android:drawable="@mipmap/linphone_launcher_icon_foreground" />
|
||||||
|
<monochrome android:drawable="@mipmap/linphone_launcher_icon_foreground"/>
|
||||||
|
</adaptive-icon>
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
<resources>
|
||||||
<style name="AppSplashScreenTheme" parent="Theme.SplashScreen">
|
<style name="AppSplashScreenTheme" parent="Theme.SplashScreen">
|
||||||
<item name="windowSplashScreenBackground">@color/background_color_alt_dark_mode</item>
|
<item name="windowSplashScreenBackground">@color/background_color_alt_dark_mode</item>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
<resources>
|
||||||
|
|
||||||
<style name="AppSplashScreenTheme" parent="Theme.SplashScreen">
|
<style name="AppSplashScreenTheme" parent="Theme.SplashScreen">
|
||||||
<item name="windowSplashScreenBackground">@color/bc_white</item>
|
<item name="windowSplashScreenBackground">@color/bc_white</item>
|
||||||
<item name="windowSplashScreenAnimatedIcon">@drawable/linphone_splashscreen</item>
|
<item name="windowSplashScreenAnimatedIcon">@drawable/linphone_splashscreen</item>
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue