Added Amoled theme

Upgrade Gradle 7.1-rc-1 > 7.2
Bumped Kotlin Version 1.5.20 > 1.5.31
Gradle FIles cleanup
All dependencies upgraded
This commit is contained in:
LooKeR
2021-10-07 00:27:07 +05:30
parent f79d666219
commit 5d4fb29f9e
10 changed files with 136 additions and 113 deletions

View File

@ -1,93 +1,99 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.looker.droidify">
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.looker.droidify">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<uses-permission android:name="android.permission.REQUEST_DELETE_PACKAGES" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<uses-permission android:name="android.permission.REQUEST_DELETE_PACKAGES" />
<application
android:name="com.looker.droidify.MainApplication"
android:label="@string/application_name"
android:icon="@mipmap/ic_launcher"
android:supportsRtl="true"
android:allowBackup="false"
android:theme="@style/MainTheme"
tools:ignore="GoogleAppIndexingWarning">
<application
android:name="com.looker.droidify.MainApplication"
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/application_name"
android:supportsRtl="true"
android:theme="@style/MainTheme"
tools:ignore="GoogleAppIndexingWarning">
<receiver
android:name="com.looker.droidify.MainApplication$BootReceiver">
<receiver
android:name="com.looker.droidify.MainApplication$BootReceiver"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
</receiver>
<activity
android:name="com.looker.droidify.MainActivity"
android:launchMode="singleTask"
android:windowSoftInputMode="adjustResize">
<activity
android:name="com.looker.droidify.MainActivity"
android:exported="true"
android:launchMode="singleTask"
android:windowSoftInputMode="adjustResize">
<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.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="fdroid.app" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="market" android:host="details" />
</intent-filter>
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" />
<data android:scheme="https" />
<data android:host="f-droid.org" />
<data android:host="www.f-droid.org" />
<data android:host="staging.f-droid.org" />
<data android:pathPattern="/app/.*" />
<data android:pathPattern="/packages/.*" />
<data android:pathPattern="/.*/packages/.*" />
</intent-filter>
<data android:scheme="fdroid.app" />
</intent-filter>
</activity>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<service
android:name="com.looker.droidify.service.SyncService" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<service
android:name="com.looker.droidify.service.SyncService$Job"
android:exported="true"
android:permission="android.permission.BIND_JOB_SERVICE" />
<data
android:host="details"
android:scheme="market" />
</intent-filter>
<service
android:name="com.looker.droidify.service.DownloadService" />
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<receiver
android:name="com.looker.droidify.service.DownloadService$Receiver" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<provider
android:name="com.looker.droidify.content.Cache$Provider"
android:authorities="${applicationId}.provider.cache"
android:exported="false"
android:grantUriPermissions="true" />
<data android:scheme="http" />
<data android:scheme="https" />
<data android:host="f-droid.org" />
<data android:host="www.f-droid.org" />
<data android:host="staging.f-droid.org" />
<data android:pathPattern="/app/.*" />
<data android:pathPattern="/packages/.*" />
<data android:pathPattern="/.*/packages/.*" />
</intent-filter>
</application>
</activity>
<service android:name="com.looker.droidify.service.SyncService" />
<service
android:name="com.looker.droidify.service.SyncService$Job"
android:exported="true"
android:permission="android.permission.BIND_JOB_SERVICE" />
<service android:name="com.looker.droidify.service.DownloadService" />
<receiver android:name="com.looker.droidify.service.DownloadService$Receiver" />
<provider
android:name="com.looker.droidify.content.Cache$Provider"
android:authorities="${applicationId}.provider.cache"
android:exported="false"
android:grantUriPermissions="true" />
</application>
</manifest>

View File

@ -171,7 +171,8 @@ object Preferences {
sealed class Theme(override val valueString: String) : Enumeration<Theme> {
override val values: List<Theme>
get() = if (Android.sdk(29)) listOf(System, Light, Dark) else listOf(Light, Dark)
get() = if (Android.sdk(29)) listOf(System, Light, Dark, Amoled)
else listOf(Light, Dark, Amoled)
abstract fun getResId(configuration: Configuration): Int
@ -189,6 +190,10 @@ object Preferences {
object Dark : Theme("dark") {
override fun getResId(configuration: Configuration): Int = R.style.Theme_Main_Dark
}
object Amoled : Theme("amoled") {
override fun getResId(configuration: Configuration): Int = R.style.Theme_Main_Amoled
}
}
operator fun <T> get(key: Key<T>): T {

View File

@ -474,9 +474,8 @@ class EditRepositoryFragment() : ScreenFragment() {
.observeOn(AndroidSchedulers.mainThread())
.subscribe { result, throwable ->
checkDisposable = null
throwable?.printStackTrace()
val resultAddress =
result?.let { if (it.isEmpty()) null else it } ?: address
throwable.printStackTrace()
val resultAddress = if (result.isEmpty()) address else result
val allow = resultAddress == address || run {
layout.address.setText(resultAddress)
invalidateAddress(resultAddress)

View File

@ -100,6 +100,7 @@ class SettingsFragment : ScreenFragment() {
is Preferences.Theme.System -> getString(R.string.system)
is Preferences.Theme.Light -> getString(R.string.light)
is Preferences.Theme.Dark -> getString(R.string.dark)
is Preferences.Theme.Amoled -> getString(R.string.amoled)
}
}
addSwitch(

View File

@ -7,6 +7,7 @@ import android.content.res.ColorStateList
import android.content.res.Resources
import android.graphics.Typeface
import android.graphics.drawable.Drawable
import android.graphics.drawable.VectorDrawable
import android.net.Uri
import android.util.TypedValue
import android.util.Xml
@ -16,7 +17,6 @@ import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
import androidx.core.content.ContextCompat
import androidx.vectordrawable.graphics.drawable.VectorDrawableCompat
import com.looker.droidify.utility.extension.android.Android
import com.squareup.picasso.Picasso
import com.squareup.picasso.RequestCreator
@ -37,7 +37,7 @@ fun Context.getDrawableCompat(resId: Int): Drawable {
.find { it == XmlPullParser.START_TAG || it == XmlPullParser.END_DOCUMENT }
if (eventType == XmlPullParser.START_TAG) {
when (it.name) {
"vector" -> VectorDrawableCompat.createFromXmlInner(
"vector" -> VectorDrawable.createFromXmlInner(
resources,
it,
Xml.asAttributeSet(it),

View File

@ -1,14 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="default_green">#3EDA86</color>
<color name="default_green_dark">#36C378</color>
<color name="white">#FFFFFF</color>
<color name="black">#1E1E1E</color>
<color name="grey_light">#333333</color>
<color name="grey_dark">#595959</color>
<color name="accent_default_dark">#ff47a2fc</color>
<color name="error_default_dark">#D36C6B</color>
<color name="accent_default_light">#ff1976d2</color>
<color name="error_default_light">#F48886</color>
<color name="default_green">#3EDA86</color>
<color name="default_green_dark">#36C378</color>
<color name="white">#FFFFFF</color>
<color name="black">#1E1E1E</color>
<color name="pitch_black">#000000</color>
<color name="grey_light">#333333</color>
<color name="grey_dark">#595959</color>
<color name="accent_default_dark">#69ECA6</color>
<color name="accent_default_light">#2C8756</color>
<color name="error_default_dark">#D36C6B</color>
<color name="error_default_light">#F48886</color>
</resources>

View File

@ -8,6 +8,7 @@
<string name="all_applications_up_to_date">All applications up to date</string>
<string name="already_exists">Already exists</string>
<string name="always">Always</string>
<string name="amoled">Amoled</string>
<string name="anti_features">Anti-features</string>
<string name="application">Application</string>
<string name="application_name" translatable="false">Droid-ify</string>

View File

@ -43,6 +43,25 @@
<item name="android:fastScrollTrackDrawable">@drawable/scrollbar_track</item>
</style>
<style name="Theme.Main.Amoled" parent="@android:style/Theme.Material.NoActionBar">
<item name="android:toolbarStyle">@style/Widget.Main.Toolbar</item>
<item name="android:windowBackground">@color/pitch_black</item>
<item name="android:colorPrimary">@color/default_green_dark</item>
<item name="android:colorPrimaryDark">@color/pitch_black</item>
<item name="android:colorBackground">@color/pitch_black</item>
<item name="colorOnBackground">@color/black</item>
<item name="android:colorAccent">@color/accent_dark</item>
<item name="android:colorControlActivated">@color/default_green_dark</item>
<item name="colorError">@color/error_dark</item>
<item name="android:titleTextColor">@color/default_green_dark</item>
<item name="android:textColorPrimary">@color/default_green</item>
<item name="android:textColor">@color/white</item>
<item name="subTextColor">@color/black</item>
<item name="android:popupTheme">@style/Theme.Popup.Dark</item>
<item name="android:fastScrollThumbDrawable">@drawable/scrollbar_thumb</item>
<item name="android:fastScrollTrackDrawable">@drawable/scrollbar_track</item>
</style>
<style name="Widget.Main.Toolbar" parent="@android:style/Widget.Material.Toolbar">
<item name="android:titleTextAppearance">
@android:style/TextAppearance.Material.Widget.Toolbar.Title