updating commons and target SDK to 31

This commit is contained in:
tibbi 2022-04-01 20:37:19 +02:00
parent 5ce950df4a
commit 0d56d78a3f
8 changed files with 49 additions and 12 deletions

View File

@ -9,12 +9,12 @@ if (keystorePropertiesFile.exists()) {
} }
android { android {
compileSdkVersion 30 compileSdkVersion 31
defaultConfig { defaultConfig {
applicationId "com.simplemobiletools.flashlight" applicationId "com.simplemobiletools.flashlight"
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 30 targetSdkVersion 31
versionCode 51 versionCode 51
versionName "5.5.3" versionName "5.5.3"
setProperty("archivesBaseName", "flashlight") setProperty("archivesBaseName", "flashlight")
@ -61,7 +61,7 @@ android {
} }
dependencies { dependencies {
implementation 'com.github.SimpleMobileTools:Simple-Commons:03e4d214b1' implementation 'com.github.SimpleMobileTools:Simple-Commons:7e87bb9089'
implementation 'org.greenrobot:eventbus:3.2.0' implementation 'org.greenrobot:eventbus:3.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3' implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
} }

View File

@ -29,6 +29,7 @@
<activity <activity
android:name=".activities.SplashActivity" android:name=".activities.SplashActivity"
android:exported="true"
android:theme="@style/SplashTheme"> android:theme="@style/SplashTheme">
<intent-filter> <intent-filter>
<action android:name="android.service.quicksettings.action.QS_TILE_PREFERENCES" /> <action android:name="android.service.quicksettings.action.QS_TILE_PREFERENCES" />
@ -41,6 +42,7 @@
<activity <activity
android:name=".activities.WidgetTorchConfigureActivity" android:name=".activities.WidgetTorchConfigureActivity"
android:exported="true"
android:screenOrientation="portrait" android:screenOrientation="portrait"
android:theme="@style/MyWidgetConfigTheme"> android:theme="@style/MyWidgetConfigTheme">
<intent-filter> <intent-filter>
@ -50,6 +52,7 @@
<activity <activity
android:name=".activities.WidgetBrightDisplayConfigureActivity" android:name=".activities.WidgetBrightDisplayConfigureActivity"
android:exported="true"
android:screenOrientation="portrait" android:screenOrientation="portrait"
android:theme="@style/MyWidgetConfigTheme"> android:theme="@style/MyWidgetConfigTheme">
<intent-filter> <intent-filter>
@ -59,36 +62,49 @@
<activity <activity
android:name=".activities.BrightDisplayActivity" android:name=".activities.BrightDisplayActivity"
android:exported="false"
android:label="@string/bright_display" android:label="@string/bright_display"
android:theme="@style/FullScreenTheme" /> android:theme="@style/FullScreenTheme" />
<activity <activity
android:name=".activities.SettingsActivity" android:name=".activities.SettingsActivity"
android:exported="true"
android:label="@string/settings" android:label="@string/settings"
android:parentActivityName=".activities.MainActivity" /> android:parentActivityName=".activities.MainActivity">
<intent-filter>
<action android:name="android.intent.action.APPLICATION_PREFERENCES" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity <activity
android:name="com.simplemobiletools.commons.activities.AboutActivity" android:name="com.simplemobiletools.commons.activities.AboutActivity"
android:exported="false"
android:label="@string/about" android:label="@string/about"
android:parentActivityName=".activities.MainActivity" /> android:parentActivityName=".activities.MainActivity" />
<activity <activity
android:name="com.simplemobiletools.commons.activities.LicenseActivity" android:name="com.simplemobiletools.commons.activities.LicenseActivity"
android:exported="false"
android:label="@string/third_party_licences" android:label="@string/third_party_licences"
android:parentActivityName="com.simplemobiletools.commons.activities.AboutActivity" /> android:parentActivityName="com.simplemobiletools.commons.activities.AboutActivity" />
<activity <activity
android:name="com.simplemobiletools.commons.activities.CustomizationActivity" android:name="com.simplemobiletools.commons.activities.CustomizationActivity"
android:exported="false"
android:label="@string/customize_colors" android:label="@string/customize_colors"
android:parentActivityName=".activities.SettingsActivity" /> android:parentActivityName=".activities.SettingsActivity" />
<activity <activity
android:name="com.simplemobiletools.commons.activities.FAQActivity" android:name="com.simplemobiletools.commons.activities.FAQActivity"
android:exported="false"
android:label="@string/frequently_asked_questions" android:label="@string/frequently_asked_questions"
android:parentActivityName="com.simplemobiletools.commons.activities.AboutActivity" /> android:parentActivityName="com.simplemobiletools.commons.activities.AboutActivity" />
<receiver <receiver
android:name=".helpers.MyWidgetTorchProvider" android:name=".helpers.MyWidgetTorchProvider"
android:exported="true"
android:icon="@drawable/ic_flashlight"> android:icon="@drawable/ic_flashlight">
<intent-filter> <intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" /> <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
@ -101,6 +117,7 @@
<receiver <receiver
android:name=".helpers.MyWidgetBrightDisplayProvider" android:name=".helpers.MyWidgetBrightDisplayProvider"
android:exported="true"
android:icon="@drawable/ic_bright_display"> android:icon="@drawable/ic_bright_display">
<intent-filter> <intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" /> <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
@ -113,6 +130,7 @@
<service <service
android:name=".helpers.MyTileService" android:name=".helpers.MyTileService"
android:exported="true"
android:icon="@drawable/img_widget_preview" android:icon="@drawable/img_widget_preview"
android:label="@string/app_launcher_name" android:label="@string/app_launcher_name"
android:permission="android.permission.BIND_QUICK_SETTINGS_TILE"> android:permission="android.permission.BIND_QUICK_SETTINGS_TILE">
@ -124,6 +142,7 @@
<activity-alias <activity-alias
android:name=".activities.SplashActivity.Red" android:name=".activities.SplashActivity.Red"
android:enabled="false" android:enabled="false"
android:exported="true"
android:icon="@mipmap/ic_launcher_red" android:icon="@mipmap/ic_launcher_red"
android:roundIcon="@mipmap/ic_launcher_red" android:roundIcon="@mipmap/ic_launcher_red"
android:targetActivity=".activities.SplashActivity"> android:targetActivity=".activities.SplashActivity">
@ -137,6 +156,7 @@
<activity-alias <activity-alias
android:name=".activities.SplashActivity.Pink" android:name=".activities.SplashActivity.Pink"
android:enabled="false" android:enabled="false"
android:exported="true"
android:icon="@mipmap/ic_launcher_pink" android:icon="@mipmap/ic_launcher_pink"
android:roundIcon="@mipmap/ic_launcher_pink" android:roundIcon="@mipmap/ic_launcher_pink"
android:targetActivity=".activities.SplashActivity"> android:targetActivity=".activities.SplashActivity">
@ -150,6 +170,7 @@
<activity-alias <activity-alias
android:name=".activities.SplashActivity.Purple" android:name=".activities.SplashActivity.Purple"
android:enabled="false" android:enabled="false"
android:exported="true"
android:icon="@mipmap/ic_launcher_purple" android:icon="@mipmap/ic_launcher_purple"
android:roundIcon="@mipmap/ic_launcher_purple" android:roundIcon="@mipmap/ic_launcher_purple"
android:targetActivity=".activities.SplashActivity"> android:targetActivity=".activities.SplashActivity">
@ -163,6 +184,7 @@
<activity-alias <activity-alias
android:name=".activities.SplashActivity.Deep_purple" android:name=".activities.SplashActivity.Deep_purple"
android:enabled="false" android:enabled="false"
android:exported="true"
android:icon="@mipmap/ic_launcher_deep_purple" android:icon="@mipmap/ic_launcher_deep_purple"
android:roundIcon="@mipmap/ic_launcher_deep_purple" android:roundIcon="@mipmap/ic_launcher_deep_purple"
android:targetActivity=".activities.SplashActivity"> android:targetActivity=".activities.SplashActivity">
@ -176,6 +198,7 @@
<activity-alias <activity-alias
android:name=".activities.SplashActivity.Indigo" android:name=".activities.SplashActivity.Indigo"
android:enabled="false" android:enabled="false"
android:exported="true"
android:icon="@mipmap/ic_launcher_indigo" android:icon="@mipmap/ic_launcher_indigo"
android:roundIcon="@mipmap/ic_launcher_indigo" android:roundIcon="@mipmap/ic_launcher_indigo"
android:targetActivity=".activities.SplashActivity"> android:targetActivity=".activities.SplashActivity">
@ -189,6 +212,7 @@
<activity-alias <activity-alias
android:name=".activities.SplashActivity.Blue" android:name=".activities.SplashActivity.Blue"
android:enabled="false" android:enabled="false"
android:exported="true"
android:icon="@mipmap/ic_launcher_blue" android:icon="@mipmap/ic_launcher_blue"
android:roundIcon="@mipmap/ic_launcher_blue" android:roundIcon="@mipmap/ic_launcher_blue"
android:targetActivity=".activities.SplashActivity"> android:targetActivity=".activities.SplashActivity">
@ -202,6 +226,7 @@
<activity-alias <activity-alias
android:name=".activities.SplashActivity.Light_blue" android:name=".activities.SplashActivity.Light_blue"
android:enabled="false" android:enabled="false"
android:exported="true"
android:icon="@mipmap/ic_launcher_light_blue" android:icon="@mipmap/ic_launcher_light_blue"
android:roundIcon="@mipmap/ic_launcher_light_blue" android:roundIcon="@mipmap/ic_launcher_light_blue"
android:targetActivity=".activities.SplashActivity"> android:targetActivity=".activities.SplashActivity">
@ -215,6 +240,7 @@
<activity-alias <activity-alias
android:name=".activities.SplashActivity.Cyan" android:name=".activities.SplashActivity.Cyan"
android:enabled="false" android:enabled="false"
android:exported="true"
android:icon="@mipmap/ic_launcher_cyan" android:icon="@mipmap/ic_launcher_cyan"
android:roundIcon="@mipmap/ic_launcher_cyan" android:roundIcon="@mipmap/ic_launcher_cyan"
android:targetActivity=".activities.SplashActivity"> android:targetActivity=".activities.SplashActivity">
@ -228,6 +254,7 @@
<activity-alias <activity-alias
android:name=".activities.SplashActivity.Teal" android:name=".activities.SplashActivity.Teal"
android:enabled="false" android:enabled="false"
android:exported="true"
android:icon="@mipmap/ic_launcher_teal" android:icon="@mipmap/ic_launcher_teal"
android:roundIcon="@mipmap/ic_launcher_teal" android:roundIcon="@mipmap/ic_launcher_teal"
android:targetActivity=".activities.SplashActivity"> android:targetActivity=".activities.SplashActivity">
@ -241,6 +268,7 @@
<activity-alias <activity-alias
android:name=".activities.SplashActivity.Green" android:name=".activities.SplashActivity.Green"
android:enabled="false" android:enabled="false"
android:exported="true"
android:icon="@mipmap/ic_launcher_green" android:icon="@mipmap/ic_launcher_green"
android:roundIcon="@mipmap/ic_launcher_green" android:roundIcon="@mipmap/ic_launcher_green"
android:targetActivity=".activities.SplashActivity"> android:targetActivity=".activities.SplashActivity">
@ -254,6 +282,7 @@
<activity-alias <activity-alias
android:name=".activities.SplashActivity.Light_green" android:name=".activities.SplashActivity.Light_green"
android:enabled="false" android:enabled="false"
android:exported="true"
android:icon="@mipmap/ic_launcher_light_green" android:icon="@mipmap/ic_launcher_light_green"
android:roundIcon="@mipmap/ic_launcher_light_green" android:roundIcon="@mipmap/ic_launcher_light_green"
android:targetActivity=".activities.SplashActivity"> android:targetActivity=".activities.SplashActivity">
@ -267,6 +296,7 @@
<activity-alias <activity-alias
android:name=".activities.SplashActivity.Lime" android:name=".activities.SplashActivity.Lime"
android:enabled="false" android:enabled="false"
android:exported="true"
android:icon="@mipmap/ic_launcher_lime" android:icon="@mipmap/ic_launcher_lime"
android:roundIcon="@mipmap/ic_launcher_lime" android:roundIcon="@mipmap/ic_launcher_lime"
android:targetActivity=".activities.SplashActivity"> android:targetActivity=".activities.SplashActivity">
@ -280,6 +310,7 @@
<activity-alias <activity-alias
android:name=".activities.SplashActivity.Yellow" android:name=".activities.SplashActivity.Yellow"
android:enabled="false" android:enabled="false"
android:exported="true"
android:icon="@mipmap/ic_launcher_yellow" android:icon="@mipmap/ic_launcher_yellow"
android:roundIcon="@mipmap/ic_launcher_yellow" android:roundIcon="@mipmap/ic_launcher_yellow"
android:targetActivity=".activities.SplashActivity"> android:targetActivity=".activities.SplashActivity">
@ -293,6 +324,7 @@
<activity-alias <activity-alias
android:name=".activities.SplashActivity.Amber" android:name=".activities.SplashActivity.Amber"
android:enabled="false" android:enabled="false"
android:exported="true"
android:icon="@mipmap/ic_launcher_amber" android:icon="@mipmap/ic_launcher_amber"
android:roundIcon="@mipmap/ic_launcher_amber" android:roundIcon="@mipmap/ic_launcher_amber"
android:targetActivity=".activities.SplashActivity"> android:targetActivity=".activities.SplashActivity">
@ -306,6 +338,7 @@
<activity-alias <activity-alias
android:name=".activities.SplashActivity.Orange" android:name=".activities.SplashActivity.Orange"
android:enabled="true" android:enabled="true"
android:exported="true"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher"
android:targetActivity=".activities.SplashActivity"> android:targetActivity=".activities.SplashActivity">
@ -318,6 +351,7 @@
<activity-alias <activity-alias
android:name=".activities.SplashActivity.Deep_orange" android:name=".activities.SplashActivity.Deep_orange"
android:enabled="false" android:enabled="false"
android:exported="true"
android:icon="@mipmap/ic_launcher_deep_orange" android:icon="@mipmap/ic_launcher_deep_orange"
android:roundIcon="@mipmap/ic_launcher_deep_orange" android:roundIcon="@mipmap/ic_launcher_deep_orange"
android:targetActivity=".activities.SplashActivity"> android:targetActivity=".activities.SplashActivity">
@ -331,6 +365,7 @@
<activity-alias <activity-alias
android:name=".activities.SplashActivity.Brown" android:name=".activities.SplashActivity.Brown"
android:enabled="false" android:enabled="false"
android:exported="true"
android:icon="@mipmap/ic_launcher_brown" android:icon="@mipmap/ic_launcher_brown"
android:roundIcon="@mipmap/ic_launcher_brown" android:roundIcon="@mipmap/ic_launcher_brown"
android:targetActivity=".activities.SplashActivity"> android:targetActivity=".activities.SplashActivity">
@ -344,6 +379,7 @@
<activity-alias <activity-alias
android:name=".activities.SplashActivity.Blue_grey" android:name=".activities.SplashActivity.Blue_grey"
android:enabled="false" android:enabled="false"
android:exported="true"
android:icon="@mipmap/ic_launcher_blue_grey" android:icon="@mipmap/ic_launcher_blue_grey"
android:roundIcon="@mipmap/ic_launcher_blue_grey" android:roundIcon="@mipmap/ic_launcher_blue_grey"
android:targetActivity=".activities.SplashActivity"> android:targetActivity=".activities.SplashActivity">
@ -357,6 +393,7 @@
<activity-alias <activity-alias
android:name=".activities.SplashActivity.Grey_black" android:name=".activities.SplashActivity.Grey_black"
android:enabled="false" android:enabled="false"
android:exported="true"
android:icon="@mipmap/ic_launcher_grey_black" android:icon="@mipmap/ic_launcher_grey_black"
android:roundIcon="@mipmap/ic_launcher_grey_black" android:roundIcon="@mipmap/ic_launcher_grey_black"
android:targetActivity=".activities.SplashActivity"> android:targetActivity=".activities.SplashActivity">

View File

@ -210,11 +210,11 @@ class MainActivity : SimpleActivity() {
private fun cameraPermissionGranted(isSOS: Boolean) { private fun cameraPermissionGranted(isSOS: Boolean) {
if (isSOS) { if (isSOS) {
val isSOSRunning = mCameraImpl!!.toggleSOS() val isSOSRunning = mCameraImpl!!.toggleSOS()
sos_btn.setTextColor(if (isSOSRunning) getAdjustedPrimaryColor() else getContrastColor()) sos_btn.setTextColor(if (isSOSRunning) getProperPrimaryColor() else getContrastColor())
} else { } else {
if (mCameraImpl!!.toggleStroboscope()) { if (mCameraImpl!!.toggleStroboscope()) {
stroboscope_bar.beInvisibleIf(stroboscope_bar.isVisible()) stroboscope_bar.beInvisibleIf(stroboscope_bar.isVisible())
changeIconColor(if (stroboscope_bar.isVisible()) getAdjustedPrimaryColor() else getContrastColor(), stroboscope_btn) changeIconColor(if (stroboscope_bar.isVisible()) getProperPrimaryColor() else getContrastColor(), stroboscope_btn)
} }
} }
} }
@ -251,7 +251,7 @@ class MainActivity : SimpleActivity() {
} }
private fun enableFlashlight() { private fun enableFlashlight() {
changeIconColor(getAdjustedPrimaryColor(), flashlight_btn) changeIconColor(getProperPrimaryColor(), flashlight_btn)
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
mIsFlashlightOn = true mIsFlashlightOn = true

View File

@ -32,7 +32,7 @@ class SettingsActivity : SimpleActivity() {
invalidateOptionsMenu() invalidateOptionsMenu()
arrayOf(settings_color_customization_label, settings_general_settings_label).forEach { arrayOf(settings_color_customization_label, settings_general_settings_label).forEach {
it.setTextColor(getAdjustedPrimaryColor()) it.setTextColor(getProperPrimaryColor())
} }
arrayOf(settings_color_customization_holder, settings_general_settings_holder).forEach { arrayOf(settings_color_customization_holder, settings_general_settings_holder).forEach {

View File

@ -38,7 +38,7 @@ class MyWidgetBrightDisplayProvider : AppWidgetProvider() {
private fun setupAppOpenIntent(context: Context, views: RemoteViews) { private fun setupAppOpenIntent(context: Context, views: RemoteViews) {
Intent(context, BrightDisplayActivity::class.java).apply { Intent(context, BrightDisplayActivity::class.java).apply {
val pendingIntent = PendingIntent.getActivity(context, OPEN_APP_INTENT_ID, this, PendingIntent.FLAG_UPDATE_CURRENT) val pendingIntent = PendingIntent.getActivity(context, OPEN_APP_INTENT_ID, this, PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE)
views.setOnClickPendingIntent(R.id.bright_display_btn, pendingIntent) views.setOnClickPendingIntent(R.id.bright_display_btn, pendingIntent)
} }
} }

View File

@ -30,7 +30,7 @@ class MyWidgetTorchProvider : AppWidgetProvider() {
appWidgetManager.getAppWidgetIds(getComponentName(context)).forEach { appWidgetManager.getAppWidgetIds(getComponentName(context)).forEach {
val views = RemoteViews(context.packageName, R.layout.widget_torch) val views = RemoteViews(context.packageName, R.layout.widget_torch)
val pendingIntent = PendingIntent.getBroadcast(context, it, intent, PendingIntent.FLAG_UPDATE_CURRENT) val pendingIntent = PendingIntent.getBroadcast(context, it, intent, PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE)
views.setOnClickPendingIntent(R.id.flashlight_btn, pendingIntent) views.setOnClickPendingIntent(R.id.flashlight_btn, pendingIntent)
views.setImageViewBitmap(R.id.flashlight_btn, bmp) views.setImageViewBitmap(R.id.flashlight_btn, bmp)
appWidgetManager.updateAppWidget(it, views) appWidgetManager.updateAppWidget(it, views)

View File

@ -9,7 +9,7 @@ buildscript {
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:7.0.4' classpath 'com.android.tools.build:gradle:7.1.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong

View File

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip