Implement new splash screen and dynamic color
This commit is contained in:
parent
aa7aa04df6
commit
48752e8db2
@ -16,21 +16,21 @@ jacoco.toolVersion = "0.8.7"
|
|||||||
android {
|
android {
|
||||||
|
|
||||||
namespace 'org.pixeldroid.app'
|
namespace 'org.pixeldroid.app'
|
||||||
compileSdkVersion 32
|
compileSdkVersion 33
|
||||||
buildToolsVersion '31.0.0'
|
buildToolsVersion '33.0.0'
|
||||||
compileOptions {
|
compileOptions {
|
||||||
coreLibraryDesugaringEnabled true
|
coreLibraryDesugaringEnabled true
|
||||||
sourceCompatibility JavaVersion.VERSION_1_8
|
sourceCompatibility JavaVersion.VERSION_1_8
|
||||||
targetCompatibility JavaVersion.VERSION_1_8
|
targetCompatibility JavaVersion.VERSION_1_8
|
||||||
}
|
}
|
||||||
kotlinOptions {
|
kotlinOptions {
|
||||||
jvmTarget = "1.8"
|
jvmTarget = JavaVersion.VERSION_1_8
|
||||||
freeCompilerArgs += ["-opt-in=kotlin.RequiresOptIn"]
|
freeCompilerArgs += ["-opt-in=kotlin.RequiresOptIn"]
|
||||||
}
|
}
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 23
|
minSdkVersion 23
|
||||||
targetSdkVersion 32
|
targetSdkVersion 33
|
||||||
versionCode 18
|
versionCode 19
|
||||||
versionName "1.0.beta" + versionCode
|
versionName "1.0.beta" + versionCode
|
||||||
|
|
||||||
testInstrumentationRunner "org.pixeldroid.app.testUtility.TestRunner"
|
testInstrumentationRunner "org.pixeldroid.app.testUtility.TestRunner"
|
||||||
@ -123,32 +123,33 @@ android {
|
|||||||
dependencies {
|
dependencies {
|
||||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
|
|
||||||
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
|
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.0'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AndroidX dependencies:
|
* AndroidX dependencies:
|
||||||
*/
|
*/
|
||||||
implementation 'androidx.appcompat:appcompat:1.4.2'
|
implementation 'androidx.appcompat:appcompat:1.5.1'
|
||||||
implementation 'androidx.core:core-ktx:1.8.0'
|
implementation 'androidx.core:core-splashscreen:1.0.0'
|
||||||
|
implementation 'androidx.core:core-ktx:1.9.0'
|
||||||
implementation 'androidx.preference:preference-ktx:1.2.0'
|
implementation 'androidx.preference:preference-ktx:1.2.0'
|
||||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
||||||
implementation 'androidx.navigation:navigation-fragment-ktx:2.5.0'
|
implementation 'androidx.navigation:navigation-fragment-ktx:2.5.2'
|
||||||
implementation 'androidx.navigation:navigation-ui-ktx:2.5.0'
|
implementation 'androidx.navigation:navigation-ui-ktx:2.5.2'
|
||||||
implementation "androidx.browser:browser:1.4.0"
|
implementation "androidx.browser:browser:1.4.0"
|
||||||
implementation 'androidx.recyclerview:recyclerview:1.2.1'
|
implementation 'androidx.recyclerview:recyclerview:1.2.1'
|
||||||
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
|
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
|
||||||
implementation 'androidx.navigation:navigation-fragment-ktx:2.5.0'
|
implementation 'androidx.navigation:navigation-fragment-ktx:2.5.2'
|
||||||
implementation 'androidx.navigation:navigation-ui-ktx:2.5.0'
|
implementation 'androidx.navigation:navigation-ui-ktx:2.5.2'
|
||||||
implementation 'androidx.paging:paging-runtime-ktx:3.1.1'
|
implementation 'androidx.paging:paging-runtime-ktx:3.1.1'
|
||||||
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.5.0'
|
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.5.1'
|
||||||
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.0'
|
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1'
|
||||||
implementation 'androidx.lifecycle:lifecycle-viewmodel-savedstate:2.5.0'
|
implementation 'androidx.lifecycle:lifecycle-viewmodel-savedstate:2.5.1'
|
||||||
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.5.0"
|
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.5.1"
|
||||||
implementation "androidx.lifecycle:lifecycle-common-java8:2.5.0"
|
implementation "androidx.lifecycle:lifecycle-common-java8:2.5.1"
|
||||||
implementation "androidx.annotation:annotation:1.4.0"
|
implementation "androidx.annotation:annotation:1.5.0"
|
||||||
implementation 'androidx.gridlayout:gridlayout:1.0.0'
|
implementation 'androidx.gridlayout:gridlayout:1.0.0'
|
||||||
implementation "androidx.activity:activity-ktx:1.5.0"
|
implementation "androidx.activity:activity-ktx:1.6.0"
|
||||||
implementation 'androidx.fragment:fragment-ktx:1.5.0'
|
implementation 'androidx.fragment:fragment-ktx:1.5.3'
|
||||||
implementation 'androidx.work:work-runtime-ktx:2.7.1'
|
implementation 'androidx.work:work-runtime-ktx:2.7.1'
|
||||||
implementation 'androidx.media2:media2-widget:1.2.1'
|
implementation 'androidx.media2:media2-widget:1.2.1'
|
||||||
implementation 'androidx.media2:media2-player:1.2.1'
|
implementation 'androidx.media2:media2-player:1.2.1'
|
||||||
@ -164,7 +165,7 @@ dependencies {
|
|||||||
// CameraX View class
|
// CameraX View class
|
||||||
implementation "androidx.camera:camera-view:$cameraX_version"
|
implementation "androidx.camera:camera-view:$cameraX_version"
|
||||||
|
|
||||||
def room_version = "2.4.2"
|
def room_version = "2.4.3"
|
||||||
implementation "androidx.room:room-runtime:$room_version"
|
implementation "androidx.room:room-runtime:$room_version"
|
||||||
kapt "androidx.room:room-compiler:$room_version"
|
kapt "androidx.room:room-compiler:$room_version"
|
||||||
implementation "androidx.room:room-ktx:$room_version"
|
implementation "androidx.room:room-ktx:$room_version"
|
||||||
@ -176,16 +177,17 @@ dependencies {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
implementation 'com.davemorrissey.labs:subsampling-scale-image-view-androidx:3.10.0'
|
implementation 'com.davemorrissey.labs:subsampling-scale-image-view-androidx:3.10.0'
|
||||||
implementation 'com.arthenica:ffmpeg-kit-min:4.5.1-1.LTS'
|
implementation 'com.arthenica:ffmpeg-kit-min-gpl:5.1.LTS'
|
||||||
|
|
||||||
implementation 'com.google.android.material:material:1.6.1'
|
|
||||||
|
implementation 'com.google.android.material:material:1.7.0-rc01'
|
||||||
|
|
||||||
//Dagger (dependency injection)
|
//Dagger (dependency injection)
|
||||||
implementation 'com.google.dagger:dagger-android:2.42'
|
implementation 'com.google.dagger:dagger-android:2.44'
|
||||||
implementation 'com.google.dagger:dagger-android-support:2.42'
|
implementation 'com.google.dagger:dagger-android-support:2.44'
|
||||||
// if you use the support libraries
|
// if you use the support libraries
|
||||||
kapt 'com.google.dagger:dagger-android-processor:2.42'
|
kapt 'com.google.dagger:dagger-android-processor:2.44'
|
||||||
kapt 'com.google.dagger:dagger-compiler:2.42'
|
kapt 'com.google.dagger:dagger-compiler:2.44'
|
||||||
|
|
||||||
implementation 'com.squareup.okhttp3:okhttp:4.9.3'
|
implementation 'com.squareup.okhttp3:okhttp:4.9.3'
|
||||||
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
|
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
|
||||||
@ -199,18 +201,18 @@ dependencies {
|
|||||||
implementation 'info.androidhive:imagefilters:1.0.7'
|
implementation 'info.androidhive:imagefilters:1.0.7'
|
||||||
implementation 'com.github.yalantis:ucrop:2.2.8-native'
|
implementation 'com.github.yalantis:ucrop:2.2.8-native'
|
||||||
|
|
||||||
implementation('com.github.bumptech.glide:glide:4.13.2') {
|
implementation('com.github.bumptech.glide:glide:4.14.2') {
|
||||||
exclude group: "com.android.support"
|
exclude group: "com.android.support"
|
||||||
}
|
}
|
||||||
|
|
||||||
implementation 'com.github.bumptech.glide:okhttp3-integration:4.13.2'
|
implementation 'com.github.bumptech.glide:okhttp3-integration:4.14.2'
|
||||||
implementation('com.github.bumptech.glide:recyclerview-integration:4.13.2') {
|
implementation('com.github.bumptech.glide:recyclerview-integration:4.14.2') {
|
||||||
// Excludes the support library because it's already included by Glide.
|
// Excludes the support library because it's already included by Glide.
|
||||||
transitive = false
|
transitive = false
|
||||||
}
|
}
|
||||||
implementation 'com.github.bumptech.glide:annotations:4.13.2'
|
implementation 'com.github.bumptech.glide:annotations:4.14.2'
|
||||||
annotationProcessor 'com.github.bumptech.glide:compiler:4.13.2'
|
annotationProcessor 'com.github.bumptech.glide:compiler:4.14.2'
|
||||||
kapt 'com.github.bumptech.glide:compiler:4.13.2'
|
kapt 'com.github.bumptech.glide:compiler:4.14.2'
|
||||||
|
|
||||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||||
|
|
||||||
@ -219,9 +221,9 @@ dependencies {
|
|||||||
implementation 'com.mikepenz:materialdrawer-nav:9.0.1'
|
implementation 'com.mikepenz:materialdrawer-nav:9.0.1'
|
||||||
|
|
||||||
//iconics
|
//iconics
|
||||||
implementation 'com.mikepenz:iconics-core:5.3.4'
|
implementation 'com.mikepenz:iconics-core:5.4.0'
|
||||||
implementation 'com.mikepenz:materialdrawer-iconics:9.0.1'
|
implementation 'com.mikepenz:materialdrawer-iconics:9.0.1'
|
||||||
implementation 'com.mikepenz:iconics-views:5.3.4'
|
implementation 'com.mikepenz:iconics-views:5.4.0'
|
||||||
implementation 'com.mikepenz:google-material-typeface:4.0.0.2-kotlin@aar'
|
implementation 'com.mikepenz:google-material-typeface:4.0.0.2-kotlin@aar'
|
||||||
|
|
||||||
|
|
||||||
@ -242,7 +244,7 @@ dependencies {
|
|||||||
androidTestUtil 'com.linkedin.testbutler:test-butler-app:2.2.1'
|
androidTestUtil 'com.linkedin.testbutler:test-butler-app:2.2.1'
|
||||||
|
|
||||||
androidTestImplementation 'androidx.work:work-testing:2.7.1'
|
androidTestImplementation 'androidx.work:work-testing:2.7.1'
|
||||||
testImplementation 'com.github.tomakehurst:wiremock-jre8:2.33.2'
|
testImplementation 'com.github.tomakehurst:wiremock-jre8:2.34.0'
|
||||||
testImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0"
|
testImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0"
|
||||||
testImplementation 'junit:junit:4.13.2'
|
testImplementation 'junit:junit:4.13.2'
|
||||||
testImplementation "androidx.room:room-testing:$room_version"
|
testImplementation "androidx.room:room-testing:$room_version"
|
||||||
|
@ -11,6 +11,12 @@
|
|||||||
android:name="android.hardware.camera.any"
|
android:name="android.hardware.camera.any"
|
||||||
android:required="false" />
|
android:required="false" />
|
||||||
<uses-feature android:name="android.hardware.location.gps" />
|
<uses-feature android:name="android.hardware.location.gps" />
|
||||||
|
<uses-feature
|
||||||
|
android:name="android.hardware.camera"
|
||||||
|
android:required="false" />
|
||||||
|
<uses-feature
|
||||||
|
android:name="android.hardware.camera.autofocus"
|
||||||
|
android:required="false" />
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:name=".utils.PixelDroidApplication"
|
android:name=".utils.PixelDroidApplication"
|
||||||
@ -89,8 +95,8 @@
|
|||||||
<activity
|
<activity
|
||||||
android:name=".MainActivity"
|
android:name=".MainActivity"
|
||||||
android:exported="true"
|
android:exported="true"
|
||||||
|
android:theme="@style/Theme.App.Starting"
|
||||||
android:screenOrientation="sensorPortrait"
|
android:screenOrientation="sensorPortrait"
|
||||||
android:theme="@style/AppTheme.Launcher"
|
|
||||||
android:windowSoftInputMode="adjustPan"
|
android:windowSoftInputMode="adjustPan"
|
||||||
tools:ignore="LockedOrientationActivity">
|
tools:ignore="LockedOrientationActivity">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
|
@ -11,6 +11,7 @@ import android.view.View
|
|||||||
import android.widget.ImageView
|
import android.widget.ImageView
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
|
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
|
||||||
import androidx.core.view.GravityCompat
|
import androidx.core.view.GravityCompat
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
@ -21,6 +22,7 @@ import androidx.viewpager2.widget.ViewPager2
|
|||||||
import androidx.viewpager2.widget.ViewPager2.OnPageChangeCallback
|
import androidx.viewpager2.widget.ViewPager2.OnPageChangeCallback
|
||||||
import com.bumptech.glide.Glide
|
import com.bumptech.glide.Glide
|
||||||
import com.google.android.material.bottomnavigation.BottomNavigationView
|
import com.google.android.material.bottomnavigation.BottomNavigationView
|
||||||
|
import com.google.android.material.color.DynamicColors
|
||||||
import com.mikepenz.iconics.typeface.library.googlematerial.GoogleMaterial
|
import com.mikepenz.iconics.typeface.library.googlematerial.GoogleMaterial
|
||||||
import com.mikepenz.materialdrawer.iconics.iconicsIcon
|
import com.mikepenz.materialdrawer.iconics.iconicsIcon
|
||||||
import com.mikepenz.materialdrawer.model.PrimaryDrawerItem
|
import com.mikepenz.materialdrawer.model.PrimaryDrawerItem
|
||||||
@ -68,6 +70,11 @@ class MainActivity : BaseThemedWithoutBarActivity() {
|
|||||||
|
|
||||||
@OptIn(ExperimentalPagingApi::class)
|
@OptIn(ExperimentalPagingApi::class)
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
installSplashScreen()
|
||||||
|
|
||||||
|
// Workaround for dynamic colors not applying due to splash screen?
|
||||||
|
DynamicColors.applyToActivityIfAvailable(this)
|
||||||
|
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
binding = ActivityMainBinding.inflate(layoutInflater)
|
binding = ActivityMainBinding.inflate(layoutInflater)
|
||||||
setContentView(binding.root)
|
setContentView(binding.root)
|
||||||
|
@ -76,12 +76,12 @@ class NestedScrollableHost(context: Context, attrs: AttributeSet? = null) :
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDoubleTap(e: MotionEvent?): Boolean {
|
override fun onDoubleTap(e: MotionEvent): Boolean {
|
||||||
doubleTapCallback?.invoke()
|
doubleTapCallback?.invoke()
|
||||||
return super.onDoubleTap(e)
|
return super.onDoubleTap(e)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onSingleTapConfirmed(e: MotionEvent?): Boolean {
|
override fun onSingleTapConfirmed(e: MotionEvent): Boolean {
|
||||||
// Disable opening AlbumActivity if the only image is a video (let the video open directly)
|
// Disable opening AlbumActivity if the only image is a video (let the video open directly)
|
||||||
if(images.size == 1 && images.first().type == Attachment.AttachmentType.video){
|
if(images.size == 1 && images.first().type == Attachment.AttachmentType.video){
|
||||||
return super.onSingleTapConfirmed(e)
|
return super.onSingleTapConfirmed(e)
|
||||||
|
@ -7,7 +7,6 @@ import org.pixeldroid.app.databinding.OpenSourceLicenseBinding
|
|||||||
import org.pixeldroid.app.settings.licenseObjects.Libraries
|
import org.pixeldroid.app.settings.licenseObjects.Libraries
|
||||||
import org.pixeldroid.app.settings.licenseObjects.OpenSourceItem
|
import org.pixeldroid.app.settings.licenseObjects.OpenSourceItem
|
||||||
import org.pixeldroid.app.utils.BaseThemedWithBarActivity
|
import org.pixeldroid.app.utils.BaseThemedWithBarActivity
|
||||||
import org.pixeldroid.app.utils.themeActionBar
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays licenses for all app dependencies. JSON is
|
* Displays licenses for all app dependencies. JSON is
|
||||||
@ -18,7 +17,6 @@ class LicenseActivity: BaseThemedWithBarActivity() {
|
|||||||
private lateinit var binding: OpenSourceLicenseBinding
|
private lateinit var binding: OpenSourceLicenseBinding
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
setTheme(themeActionBar())
|
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
binding = OpenSourceLicenseBinding.inflate(layoutInflater)
|
binding = OpenSourceLicenseBinding.inflate(layoutInflater)
|
||||||
|
|
||||||
|
@ -57,11 +57,11 @@ class SettingsActivity : BaseThemedWithBarActivity(), SharedPreferences.OnShared
|
|||||||
}
|
}
|
||||||
override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences, key: String) {
|
override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences, key: String) {
|
||||||
when (key) {
|
when (key) {
|
||||||
"theme" -> {
|
"language" -> {
|
||||||
setThemeFromPreferences(sharedPreferences, resources)
|
|
||||||
recreateWithRestartStatus()
|
recreateWithRestartStatus()
|
||||||
}
|
}
|
||||||
"language" -> {
|
"theme" -> {
|
||||||
|
setThemeFromPreferences(sharedPreferences, resources)
|
||||||
recreateWithRestartStatus()
|
recreateWithRestartStatus()
|
||||||
}
|
}
|
||||||
"themeColor" -> {
|
"themeColor" -> {
|
||||||
|
@ -3,6 +3,7 @@ package org.pixeldroid.app.settings
|
|||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.res.ColorStateList
|
import android.content.res.ColorStateList
|
||||||
import android.content.res.TypedArray
|
import android.content.res.TypedArray
|
||||||
|
import android.os.Build
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
import android.util.TypedValue
|
import android.util.TypedValue
|
||||||
@ -110,6 +111,7 @@ class ColorPreference constructor(context: Context, attrs: AttributeSet? = null)
|
|||||||
thumbnail?.visibility = if (thumbColor == null) View.GONE else View.VISIBLE
|
thumbnail?.visibility = if (thumbColor == null) View.GONE else View.VISIBLE
|
||||||
@ColorRes
|
@ColorRes
|
||||||
val colorCode: Int = when(thumbColor){
|
val colorCode: Int = when(thumbColor){
|
||||||
|
-1 -> android.R.color.transparent
|
||||||
1 -> R.color.seed2
|
1 -> R.color.seed2
|
||||||
2 -> R.color.seed3
|
2 -> R.color.seed3
|
||||||
3 -> R.color.seed4
|
3 -> R.color.seed4
|
||||||
@ -162,6 +164,13 @@ class ColorPickerView(context: Context?, attrs: AttributeSet? = null) : FrameLay
|
|||||||
|
|
||||||
init {
|
init {
|
||||||
binding = ColorDialogBinding.inflate(LayoutInflater.from(context),this, true)
|
binding = ColorDialogBinding.inflate(LayoutInflater.from(context),this, true)
|
||||||
|
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.S){
|
||||||
|
binding.dynamicColorSwitch.isVisible = true
|
||||||
|
binding.dynamicColorSwitch.setOnCheckedChangeListener{ _, isChecked ->
|
||||||
|
binding.themeChooser.isVisible = !isChecked
|
||||||
|
color = if(isChecked) -1 else 0
|
||||||
|
}
|
||||||
|
}
|
||||||
binding.theme1.setOnClickListener { color = 0 }
|
binding.theme1.setOnClickListener { color = 0 }
|
||||||
binding.theme2.setOnClickListener { color = 1 }
|
binding.theme2.setOnClickListener { color = 1 }
|
||||||
binding.theme3.setOnClickListener { color = 2 }
|
binding.theme3.setOnClickListener { color = 2 }
|
||||||
@ -188,5 +197,8 @@ class ColorPickerView(context: Context?, attrs: AttributeSet? = null) : FrameLay
|
|||||||
3 -> binding.theme4
|
3 -> binding.theme4
|
||||||
else -> null
|
else -> null
|
||||||
}?.let { changeConstraint(it) }
|
}?.let { changeConstraint(it) }
|
||||||
|
|
||||||
|
// Check switch if set to dynamic
|
||||||
|
binding.dynamicColorSwitch.isChecked = value == -1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,8 @@ import android.os.Bundle
|
|||||||
|
|
||||||
open class BaseThemedWithBarActivity : BaseActivity() {
|
open class BaseThemedWithBarActivity : BaseActivity() {
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
setTheme(themeActionBar())
|
// Set theme when we chose one
|
||||||
|
themeActionBar()?.let { setTheme(it) }
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -4,7 +4,8 @@ import android.os.Bundle
|
|||||||
|
|
||||||
open class BaseThemedWithoutBarActivity : BaseActivity() {
|
open class BaseThemedWithoutBarActivity : BaseActivity() {
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
setTheme(themeNoActionBar())
|
// Set theme when we chose one
|
||||||
|
themeNoActionBar()?.let { setTheme(it) }
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -21,6 +21,6 @@ class PixelDroidGlideModule : AppGlideModule() {
|
|||||||
.addNetworkInterceptor(PixelfedAPI.headerInterceptor)
|
.addNetworkInterceptor(PixelfedAPI.headerInterceptor)
|
||||||
.build()
|
.build()
|
||||||
val factory = OkHttpUrlLoader.Factory(client)
|
val factory = OkHttpUrlLoader.Factory(client)
|
||||||
glide.registry.replace(GlideUrl::class.java, InputStream::class.java, factory)
|
registry.replace(GlideUrl::class.java, InputStream::class.java, factory)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,8 +27,7 @@ class PixelDroidApplication: Application() {
|
|||||||
.build()
|
.build()
|
||||||
mApplicationComponent.inject(this)
|
mApplicationComponent.inject(this)
|
||||||
|
|
||||||
//TODO put condition depending on setting to apply dynamic colours (android 12+)
|
DynamicColors.applyToActivitiesIfAvailable(this)
|
||||||
if(false) DynamicColors.applyToActivitiesIfAvailable(this)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getAppComponent(): ApplicationComponent {
|
fun getAppComponent(): ApplicationComponent {
|
||||||
|
@ -211,22 +211,26 @@ fun setThemeFromPreferences(preferences: SharedPreferences, resources: Resources
|
|||||||
}
|
}
|
||||||
|
|
||||||
@StyleRes
|
@StyleRes
|
||||||
fun Context.themeNoActionBar(): Int {
|
fun Context.themeNoActionBar(): Int? {
|
||||||
return when(PreferenceManager.getDefaultSharedPreferences(this).getInt("themeColor", 0)) {
|
return when(PreferenceManager.getDefaultSharedPreferences(this).getInt("themeColor", 0)) {
|
||||||
|
// No theme was chosen: the user wants to use the system dynamic color (from wallpaper for example)
|
||||||
|
-1 -> null
|
||||||
1 -> R.style.AppTheme2_NoActionBar
|
1 -> R.style.AppTheme2_NoActionBar
|
||||||
2 -> R.style.AppTheme3_NoActionBar
|
2 -> R.style.AppTheme3_NoActionBar
|
||||||
3 -> R.style.AppTheme4_NoActionBar
|
3 -> R.style.AppTheme4_NoActionBar
|
||||||
else -> R.style.AppTheme_NoActionBar
|
else -> R.style.AppTheme5_NoActionBar
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@StyleRes
|
@StyleRes
|
||||||
fun Context.themeActionBar(): Int {
|
fun Context.themeActionBar(): Int? {
|
||||||
return when(PreferenceManager.getDefaultSharedPreferences(this).getInt("themeColor", 0)) {
|
return when(PreferenceManager.getDefaultSharedPreferences(this).getInt("themeColor", 0)) {
|
||||||
|
// No theme was chosen: the user wants to use the system dynamic color (from wallpaper for example)
|
||||||
|
-1 -> null
|
||||||
1 -> R.style.AppTheme2
|
1 -> R.style.AppTheme2
|
||||||
2 -> R.style.AppTheme3
|
2 -> R.style.AppTheme3
|
||||||
3 -> R.style.AppTheme4
|
3 -> R.style.AppTheme4
|
||||||
else -> R.style.AppTheme
|
else -> R.style.AppTheme5
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ interface PixelfedAPI {
|
|||||||
val headerInterceptor = Interceptor { chain ->
|
val headerInterceptor = Interceptor { chain ->
|
||||||
val requestBuilder = chain.request().newBuilder()
|
val requestBuilder = chain.request().newBuilder()
|
||||||
.removeHeader("User-Agent")
|
.removeHeader("User-Agent")
|
||||||
.addHeader("User-Agent", "PixelDroid") //TODO check if okay?
|
.addHeader("User-Agent", "PixelDroid")
|
||||||
chain.proceed(requestBuilder.build())
|
chain.proceed(requestBuilder.build())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,7 +151,6 @@ open class Status(
|
|||||||
val shareIntent: Intent = Intent.createChooser(Intent().apply {
|
val shareIntent: Intent = Intent.createChooser(Intent().apply {
|
||||||
action = Intent.ACTION_SEND
|
action = Intent.ACTION_SEND
|
||||||
putExtra(Intent.EXTRA_STREAM, file)
|
putExtra(Intent.EXTRA_STREAM, file)
|
||||||
data = file
|
|
||||||
flags = Intent.FLAG_GRANT_READ_URI_PERMISSION
|
flags = Intent.FLAG_GRANT_READ_URI_PERMISSION
|
||||||
type = "image/$ext"
|
type = "image/$ext"
|
||||||
}, null)
|
}, null)
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 95 KiB |
Binary file not shown.
Before Width: | Height: | Size: 92 KiB |
@ -1,8 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" android:opacity="opaque">
|
|
||||||
<!-- The background color -->
|
|
||||||
<item android:drawable="@android:color/black"/>
|
|
||||||
<!-- The drawable (mascot) -->
|
|
||||||
<item android:drawable="@drawable/mascot"
|
|
||||||
android:gravity="center"/>
|
|
||||||
</layer-list>
|
|
Binary file not shown.
Before Width: | Height: | Size: 105 KiB |
Binary file not shown.
Before Width: | Height: | Size: 108 KiB |
Binary file not shown.
Before Width: | Height: | Size: 117 KiB |
815
app/src/main/res/drawable/mascot_small.xml
Normal file
815
app/src/main/res/drawable/mascot_small.xml
Normal file
File diff suppressed because one or more lines are too long
@ -1,8 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" android:opacity="opaque">
|
|
||||||
<!-- The background color -->
|
|
||||||
<item android:drawable="@android:color/white"/>
|
|
||||||
<!-- The drawable (mascot) -->
|
|
||||||
<item android:drawable="@drawable/mascot"
|
|
||||||
android:gravity="center"/>
|
|
||||||
</layer-list>
|
|
@ -5,6 +5,25 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<com.google.android.material.materialswitch.MaterialSwitch
|
||||||
|
android:id="@+id/dynamicColorSwitch"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:lineSpacingExtra="8sp"
|
||||||
|
android:text="Use dynamic color from your system"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
tools:visibility="visible" />
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:id="@+id/themeChooser"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/dynamicColorSwitch">
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/theme1"
|
android:id="@+id/theme1"
|
||||||
@ -15,7 +34,6 @@
|
|||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toStartOf="@id/theme2"
|
app:layout_constraintEnd_toStartOf="@id/theme2"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
app:srcCompat="@drawable/circle_black_24dp"
|
app:srcCompat="@drawable/circle_black_24dp"
|
||||||
app:tint="@color/seed" />
|
app:tint="@color/seed" />
|
||||||
|
|
||||||
@ -28,7 +46,7 @@
|
|||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toStartOf="@id/theme3"
|
app:layout_constraintEnd_toStartOf="@id/theme3"
|
||||||
app:layout_constraintStart_toEndOf="@+id/theme1"
|
app:layout_constraintStart_toEndOf="@+id/theme1"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="@+id/theme1"
|
||||||
app:srcCompat="@drawable/circle_black_24dp"
|
app:srcCompat="@drawable/circle_black_24dp"
|
||||||
app:tint="@color/seed2" />
|
app:tint="@color/seed2" />
|
||||||
|
|
||||||
@ -41,7 +59,7 @@
|
|||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toStartOf="@id/theme4"
|
app:layout_constraintEnd_toStartOf="@id/theme4"
|
||||||
app:layout_constraintStart_toEndOf="@+id/theme2"
|
app:layout_constraintStart_toEndOf="@+id/theme2"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="@+id/theme2"
|
||||||
app:srcCompat="@drawable/circle_black_24dp"
|
app:srcCompat="@drawable/circle_black_24dp"
|
||||||
app:tint="@color/seed3" />
|
app:tint="@color/seed3" />
|
||||||
|
|
||||||
@ -54,7 +72,7 @@
|
|||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toEndOf="@+id/theme3"
|
app:layout_constraintStart_toEndOf="@+id/theme3"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="@+id/theme3"
|
||||||
app:srcCompat="@drawable/circle_black_24dp"
|
app:srcCompat="@drawable/circle_black_24dp"
|
||||||
app:tint="@color/seed4" />
|
app:tint="@color/seed4" />
|
||||||
|
|
||||||
@ -66,7 +84,7 @@
|
|||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="@id/theme1"
|
app:layout_constraintEnd_toEndOf="@id/theme1"
|
||||||
app:layout_constraintStart_toStartOf="@id/theme1"
|
app:layout_constraintStart_toStartOf="@id/theme1"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="@+id/theme1"
|
||||||
tools:visibility="visible">
|
tools:visibility="visible">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
@ -89,5 +107,6 @@
|
|||||||
app:srcCompat="@drawable/ic_baseline_check_24" />
|
app:srcCompat="@drawable/ic_baseline_check_24" />
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -1,6 +1,10 @@
|
|||||||
|
|
||||||
<resources>
|
<resources>
|
||||||
<style name="AppTheme" parent="Theme.Material3.Dark">
|
<style name="AppTheme" parent="Theme.Material3.Dark">
|
||||||
|
<item name="colorPrimary">@android:color/transparent</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="AppTheme5" parent="Theme.Material3.Dark">
|
||||||
<item name="colorPrimary">@color/md_theme_dark_primary</item>
|
<item name="colorPrimary">@color/md_theme_dark_primary</item>
|
||||||
<item name="colorOnPrimary">@color/md_theme_dark_onPrimary</item>
|
<item name="colorOnPrimary">@color/md_theme_dark_onPrimary</item>
|
||||||
<item name="colorPrimaryContainer">@color/md_theme_dark_primaryContainer</item>
|
<item name="colorPrimaryContainer">@color/md_theme_dark_primaryContainer</item>
|
||||||
|
@ -1,12 +1,25 @@
|
|||||||
<resources>
|
<resources>
|
||||||
|
|
||||||
<!-- Base application theme. -->
|
<!-- Splash screen theme. -->
|
||||||
<style name="AppTheme.Launcher">
|
<style name="Theme.App.Starting" parent="Theme.SplashScreen">
|
||||||
<item name="android:windowBackground">@drawable/theme</item>
|
<!-- Set the splash screen background, animated icon, and animation duration. -->
|
||||||
<item name="colorPrimaryDark">?android:attr/colorBackground</item>
|
<item name="windowSplashScreenBackground">?android:attr/colorBackground</item>
|
||||||
|
|
||||||
|
<!-- Use windowSplashScreenAnimatedIcon to add either a drawable or an
|
||||||
|
animated drawable. One of these is required. -->
|
||||||
|
<!-- TODO get rid of duplicated mascot/mascot_small somehow -->
|
||||||
|
<item name="windowSplashScreenAnimatedIcon">@drawable/mascot_small</item>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Set the theme of the Activity that directly follows your splash screen. -->
|
||||||
|
<!-- Required -->
|
||||||
|
<item name="postSplashScreenTheme">@style/AppTheme.NoActionBar</item>
|
||||||
|
<item name="windowActionBar">false</item>
|
||||||
|
<item name="windowNoTitle">true</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
||||||
<style name="AppTheme.PopupOverlay" parent="Theme.Material3.Light" />
|
<style name="AppTheme.PopupOverlay" parent="Theme.Material3.Light" />
|
||||||
|
|
||||||
<style name="AppTheme.ActionBar.Transparent" parent="AppTheme">
|
<style name="AppTheme.ActionBar.Transparent" parent="AppTheme">
|
||||||
@ -22,26 +35,35 @@
|
|||||||
<item name="android:windowTranslucentStatus">true</item>
|
<item name="android:windowTranslucentStatus">true</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="AppTheme.NoActionBar">
|
<style name="AppTheme.NoActionBar" parent="AppTheme">
|
||||||
<item name="windowActionBar">false</item>
|
<item name="windowActionBar">false</item>
|
||||||
<item name="windowNoTitle">true</item>
|
<item name="windowNoTitle">true</item>
|
||||||
</style>
|
</style>
|
||||||
<style name="AppTheme2.NoActionBar">
|
<style name="AppTheme2.NoActionBar" parent="AppTheme2">
|
||||||
<item name="windowActionBar">false</item>
|
<item name="windowActionBar">false</item>
|
||||||
<item name="windowNoTitle">true</item>
|
<item name="windowNoTitle">true</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="AppTheme3.NoActionBar">
|
<style name="AppTheme3.NoActionBar" parent="AppTheme3">
|
||||||
<item name="windowActionBar">false</item>
|
<item name="windowActionBar">false</item>
|
||||||
<item name="windowNoTitle">true</item>
|
<item name="windowNoTitle">true</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="AppTheme4.NoActionBar">
|
<style name="AppTheme4.NoActionBar" parent="AppTheme4">
|
||||||
|
<item name="windowActionBar">false</item>
|
||||||
|
<item name="windowNoTitle">true</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="AppTheme5.NoActionBar" parent="AppTheme5">
|
||||||
<item name="windowActionBar">false</item>
|
<item name="windowActionBar">false</item>
|
||||||
<item name="windowNoTitle">true</item>
|
<item name="windowNoTitle">true</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="AppTheme" parent="Theme.Material3.Light">
|
<style name="AppTheme" parent="Theme.Material3.Light">
|
||||||
|
<item name="colorPrimary">@android:color/transparent</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="AppTheme5" parent="Theme.Material3.Light">
|
||||||
<item name="materialDrawerStyle">@style/Widget.MaterialDrawerStyle</item>
|
<item name="materialDrawerStyle">@style/Widget.MaterialDrawerStyle</item>
|
||||||
<item name="materialDrawerHeaderStyle">@style/Widget.MaterialDrawerHeaderStyle</item>
|
<item name="materialDrawerHeaderStyle">@style/Widget.MaterialDrawerHeaderStyle</item>
|
||||||
<item name="colorPrimary">@color/md_theme_light_primary</item>
|
<item name="colorPrimary">@color/md_theme_light_primary</item>
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = '1.7.10'
|
ext.kotlin_version = '1.7.20'
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:7.3.0-rc01'
|
classpath 'com.android.tools.build:gradle:8.0.0-alpha03'
|
||||||
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
|
||||||
|
File diff suppressed because it is too large
Load Diff
8
gradle/wrapper/gradle-wrapper.properties
vendored
8
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,7 +1,7 @@
|
|||||||
#Tue Jul 26 13:21:08 GMT 2022
|
#Fri Oct 14 13:37:44 GMT 2022
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
|
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStorePath=wrapper/dists
|
distributionSha256Sum=cb87f222c5585bd46838ad4db78463a5c5f3d336e5e2b98dc7c0c586527351c2
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
distributionSha256Sum=8cc27038d5dbd815759851ba53e70cf62e481b87494cc97cfd97982ada5ba634
|
zipStorePath=wrapper/dists
|
||||||
|
Loading…
x
Reference in New Issue
Block a user