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,6 +1,6 @@
buildscript {
ext.versions = [
kotlin: '1.5.10'
kotlin: '1.5.31'
]
repositories {
@ -10,7 +10,7 @@ buildscript {
dependencies {
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:' + versions.kotlin
classpath 'com.android.tools.build:gradle:4.2.1'
classpath 'com.android.tools.build:gradle:7.0.2'
}
}
@ -18,15 +18,17 @@ apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
android {
compileSdkVersion 29
compileSdk 31
defaultConfig {
archivesBaseName = 'droidify'
applicationId 'com.looker.droidify'
minSdkVersion 28
targetSdkVersion 29
versionCode 2
versionName '0.2'
minSdk 28
targetSdk 31
versionCode 3
versionName '0.3'
vectorDrawables.useSupportLibrary true
def languages = ['en']
buildConfigField 'String[]', 'LANGUAGES', '{ "' + languages.join('", "') + '" }'
@ -38,15 +40,6 @@ android {
it.java.srcDirs += new File(javaDir.parentFile, 'kotlin')
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = compileOptions.sourceCompatibility.toString()
}
buildTypes {
debug {
minifyEnabled false
@ -54,7 +47,7 @@ android {
}
release {
minifyEnabled true
shrinkResources false
shrinkResources true
}
all {
crunchPngs false
@ -114,13 +107,11 @@ repositories {
}
dependencies {
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:' + versions.kotlin
implementation 'androidx.fragment:fragment-ktx:1.3.4'
implementation 'androidx.fragment:fragment-ktx:1.3.6'
implementation 'androidx.viewpager2:viewpager2:1.0.0'
implementation 'androidx.vectordrawable:vectordrawable:1.1.0'
implementation 'com.squareup.okhttp3:okhttp:5.0.0-alpha.2'
implementation 'io.reactivex.rxjava3:rxjava:3.0.4'
implementation 'io.reactivex.rxjava3:rxjava:3.1.1'
implementation 'io.reactivex.rxjava3:rxandroid:3.0.0'
implementation 'com.fasterxml.jackson.core:jackson-core:2.12.1'
implementation 'com.fasterxml.jackson.core:jackson-core:2.13.0'
implementation 'com.squareup.picasso:picasso:2.71828'
}

View File

@ -1,6 +1,6 @@
#Fri Jun 04 15:33:52 IST 2021
#Wed Oct 06 17:43:04 IST 2021
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-rc-1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME

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