Skip to content

Commit

Permalink
Merge pull request #142 from KieronQuinn/release/1.8
Browse files Browse the repository at this point in the history
1.8
  • Loading branch information
KieronQuinn authored Aug 24, 2024
2 parents fba5615 + 135342d commit 5965017
Show file tree
Hide file tree
Showing 67 changed files with 542 additions and 180 deletions.
34 changes: 28 additions & 6 deletions .idea/navEditor.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions Controls/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ android {

defaultConfig {
minSdk 30
targetSdk 34
targetSdk 35

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
Expand All @@ -31,13 +31,13 @@ android {
}

dependencies {
implementation 'androidx.core:core-ktx:1.12.0'
implementation "androidx.lifecycle:lifecycle-common-java8:2.7.0"
implementation 'androidx.core:core-ktx:1.13.1'
implementation "androidx.lifecycle:lifecycle-common-java8:2.8.4"
implementation 'androidx.recyclerview:recyclerview:1.3.2'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.fragment:fragment-ktx:1.6.2'
implementation 'androidx.fragment:fragment-ktx:1.8.2'
implementation 'androidx.preference:preference-ktx:1.2.1'
implementation 'androidx.viewpager2:viewpager2:1.0.0'
implementation 'androidx.viewpager2:viewpager2:1.1.0'
implementation "io.insert-koin:koin-android:$koin_version"
compileOnly project(path: ':systemstubs')
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,8 @@ class StatefulControlSubscriber(
}

override fun onNext(token: IBinder, control: Control) {
Log.d("SCS", "onNext ${control.title}")
run(token) {
if (!subscriptionOpen) {
Log.w(TAG, "Refresh outside of window for token:$token")
} else {
controller.refreshStatus(provider.componentName, control)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ class ControlActionCoordinatorImpl constructor(
it.show()
}*/
activityStarter.dismissKeyguardThenExecute({
Log.d("CACI", "startActivity")
activityStarter.dismissPowerMenu()
serviceRunner.startActivity(context, intent.createLaunchIntent()){
serviceRunner.overridePendingTransition(R.anim.bottomsheet_in, R.anim.bottomsheet_out)
Expand Down
2 changes: 1 addition & 1 deletion QuickAccessWallet/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ android {

defaultConfig {
minSdk 30
targetSdk 34
targetSdk 35

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
Expand Down
26 changes: 14 additions & 12 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ plugins {
id 'com.google.android.gms.oss-licenses-plugin'
}

def version = '1.7.2'
def version = '1.8'

android {
compileSdk 34

defaultConfig {
applicationId "com.kieronquinn.app.classicpowermenu"
minSdk 30
targetSdk 34
versionCode 172
targetSdk 35
versionCode 180
versionName version

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand Down Expand Up @@ -70,22 +70,24 @@ dependencies {
implementation 'androidx.recyclerview:recyclerview:1.3.2'

//AndroidX
def lifecycle_version = "2.7.0"
implementation 'androidx.core:core-ktx:1.12.0'
implementation 'androidx.appcompat:appcompat:1.6.1'
def lifecycle_version = "2.8.4"
implementation 'androidx.core:core-ktx:1.13.1'
implementation "androidx.activity:activity-ktx:1.9.1"
implementation "androidx.fragment:fragment-ktx:1.8.2"
implementation 'androidx.appcompat:appcompat:1.7.0'
implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-process:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-service:$lifecycle_version"
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.work:work-runtime-ktx:2.9.0'
implementation 'androidx.work:work-runtime-ktx:2.9.1'
implementation "androidx.core:core-splashscreen:1.0.1"
implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
implementation "androidx.navigation:navigation-ui-ktx:$nav_version"

//Material
implementation 'com.google.android.material:material:1.11.0'
implementation 'com.google.android.material:material:1.12.0'

//Monet
implementation 'com.github.KieronQuinn:MonetCompat:0.4.1'
Expand All @@ -97,7 +99,7 @@ dependencies {
implementation "com.google.protobuf:protobuf-javalite:3.25.2"

//Guava for hashing code (to match what Gpay uses)
implementation 'com.google.guava:guava:30.1.1-android'
implementation 'com.google.guava:guava:31.1-android'

//Stubs for hidden APIs. Shouldn't be included in APK.
compileOnly project(':systemstubs')
Expand Down Expand Up @@ -129,7 +131,7 @@ dependencies {
compileOnly 'de.robv.android.xposed:api:82'

//OSS libraries activity
implementation 'com.google.android.gms:play-services-oss-licenses:17.0.1'
implementation 'com.google.android.gms:play-services-oss-licenses:17.1.0'

//Retrofit for update checking
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
Expand All @@ -144,6 +146,6 @@ dependencies {

//Test
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
androidTestImplementation 'androidx.test.ext:junit:1.2.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
}
4 changes: 2 additions & 2 deletions app/release/output-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 171,
"versionName": "1.7.1",
"versionCode": 172,
"versionName": "1.7.2",
"outputFile": "app-release.apk"
}
],
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" />
<uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS"
tools:ignore="ProtectedPermissions" />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES"/>
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.content.Context
import android.os.HandlerThread
import android.os.Looper
import androidx.lifecycle.lifecycleScope
import androidx.navigation.Navigation
import com.android.systemui.broadcast.BroadcastDispatcher
import com.android.systemui.broadcast.logging.BroadcastDispatcherLogger
import com.android.systemui.controls.CustomIconCache
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import android.content.Intent
import android.graphics.drawable.ColorDrawable
import android.os.Build
import android.os.Bundle
import android.util.Log
import android.view.View
import android.view.ViewTreeObserver
import android.view.animation.AnticipateInterpolator
Expand All @@ -19,6 +20,8 @@ import com.kieronquinn.app.classicpowermenu.components.settings.Settings
import com.kieronquinn.app.classicpowermenu.service.accessibility.CPMAccessibilityService
import com.kieronquinn.app.classicpowermenu.utils.TransitionUtils
import com.kieronquinn.app.classicpowermenu.utils.extensions.broadcastReceiverAsFlow
import com.kieronquinn.app.classicpowermenu.utils.extensions.delayPreDrawUntilFlow
import com.kieronquinn.app.classicpowermenu.utils.extensions.whenCreated
import com.kieronquinn.app.classicpowermenu.workers.UpdateCheckWorker
import com.kieronquinn.monetcompat.app.MonetCompatActivity
import kotlinx.coroutines.flow.collect
Expand All @@ -34,21 +37,22 @@ class MainActivity : MonetCompatActivity() {
super.onCreate(savedInstanceState)
installSplashScreen()
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
//TODO move when android.core:splashscreen supports it
setupSplashScreen()
setupSplashDelay()
}
setupTransition()
setupBringToFront()
setupInsets()
WindowCompat.setDecorFitsSystemWindows(window, false)
UpdateCheckWorker.queueCheckWorker(this)
lifecycleScope.launchWhenCreated {
whenCreated {
monet.awaitMonetReady()
window.setBackgroundDrawable(ColorDrawable(monet.getBackgroundColor(this@MainActivity)))
setContentView(R.layout.activity_main)
setupStatusNav()
}
findViewById<View>(android.R.id.content).delayPreDrawUntilFlow(
viewModel.appReady,
lifecycle
)
}

private fun setupInsets(){
Expand All @@ -67,22 +71,6 @@ class MainActivity : MonetCompatActivity() {
}
}

private fun setupSplashDelay(){
val content: View = findViewById(android.R.id.content)
content.viewTreeObserver.addOnPreDrawListener(
object : ViewTreeObserver.OnPreDrawListener {
override fun onPreDraw(): Boolean {
return if (viewModel.appReady.value) {
content.viewTreeObserver.removeOnPreDrawListener(this)
true
} else {
false
}
}
}
)
}

@RequiresApi(Build.VERSION_CODES.S)
private fun setupSplashScreen() {
//Use the default animation when not loading setup where there's a shared element
Expand All @@ -102,17 +90,12 @@ class MainActivity : MonetCompatActivity() {
}
}

private fun setupBringToFront() = lifecycleScope.launchWhenCreated {
private fun setupBringToFront() = whenCreated {
broadcastReceiverAsFlow(CPMAccessibilityService.INTENT_ACTION_BRING_TO_FRONT, oneShot = true).collect {
startActivity(Intent(this@MainActivity, MainActivity::class.java).apply {
flags = Intent.FLAG_ACTIVITY_REORDER_TO_FRONT
})
}
}

private fun setupTransition() = with(window) {
exitTransition = TransitionUtils.getMaterialSharedAxis(this@MainActivity, true)
reenterTransition = TransitionUtils.getMaterialSharedAxis(this@MainActivity, false)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class MainActivityViewModelImpl(context: Context, private val updateChecker: Upd
emit(true)
}

private val _appReady = combine(splashDelay, decisionMade){ requirements, _ ->
private val _appReady = combine(splashDelay, decisionMade){ requirements, decision ->
requirements
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import com.kieronquinn.app.classicpowermenu.components.starter.PowerMenuStarter
import com.kieronquinn.app.classicpowermenu.service.container.CPMServiceContainer
import com.kieronquinn.app.classicpowermenu.utils.extensions.awaitPost
import com.kieronquinn.app.classicpowermenu.utils.extensions.sendDismissIntent
import com.kieronquinn.app.classicpowermenu.utils.extensions.whenCreated
import com.kieronquinn.app.classicpowermenu.utils.extensions.whenResumed
import com.kieronquinn.monetcompat.app.MonetCompatActivity
import kotlinx.coroutines.flow.collect
import org.koin.android.ext.android.inject
Expand All @@ -39,7 +41,7 @@ class PowerMenuActivity : MonetCompatActivity(), PowerMenuStarter.PowerMenuStart
super.onCreate(savedInstanceState)
requestedOrientation = viewModel.getRequestedOrientation()
hideStatusBar()
lifecycleScope.launchWhenCreated {
whenCreated {
setContentView(R.layout.activity_power_menu)
WindowCompat.setDecorFitsSystemWindows(window, false)
window.setupLayout()
Expand All @@ -57,7 +59,7 @@ class PowerMenuActivity : MonetCompatActivity(), PowerMenuStarter.PowerMenuStart
}
}

private fun sendDismiss(runAfter: () -> Unit) = lifecycleScope.launchWhenResumed {
private fun sendDismiss(runAfter: () -> Unit) = whenResumed {
serviceContainer.runWithService {
it.sendDismissIntent(this@PowerMenuActivity)
runAfter()
Expand All @@ -67,7 +69,7 @@ class PowerMenuActivity : MonetCompatActivity(), PowerMenuStarter.PowerMenuStart
override fun onResume() {
super.onResume()
starter.setEventListener(this)
lifecycleScope.launchWhenResumed {
whenResumed {
window.decorView.awaitPost()
if(!viewModel.useSolidBackground){
blurProvider.applyBlurToWindow(window, 1.5f)
Expand All @@ -80,13 +82,13 @@ class PowerMenuActivity : MonetCompatActivity(), PowerMenuStarter.PowerMenuStart
starter.setEventListener(null)
}

private fun setupClose() = lifecycleScope.launchWhenCreated {
private fun setupClose() = whenCreated {
navigation.closePowerMenuBus.collect {
closePowerMenu()
}
}

private fun setupCloseBroadcast() = lifecycleScope.launchWhenCreated {
private fun setupCloseBroadcast() = whenCreated {
viewModel.closeBroadcast.collect {
closePowerMenu()
}
Expand Down
Loading

0 comments on commit 5965017

Please sign in to comment.