# HG changeset patch # User Da Risk # Date 1705441348 14400 # Node ID 0bcd943bb51cad6f3c075aaa65f6f8a2fe04eb2e # Parent 262e1b65de7d3e54c4d7f4b6f9a71147d8213dcf geekdroid: remove AppCompat, migrate AppCompatActivity to ComponentActivity diff -r 262e1b65de7d -r 0bcd943bb51c geekdroid/build.gradle.kts --- a/geekdroid/build.gradle.kts Tue Jan 16 17:05:53 2024 -0400 +++ b/geekdroid/build.gradle.kts Tue Jan 16 17:42:28 2024 -0400 @@ -79,7 +79,6 @@ dependencies { api(libs.recyclerview) - api(libs.appcompat) api(libs.material) api(libs.constraintlayout) api(libs.coordinatorlayout) diff -r 262e1b65de7d -r 0bcd943bb51c geekdroid/src/main/java/com/geekorum/geekdroid/accounts/AccountAuthenticatorAppCompatActivity.kt --- a/geekdroid/src/main/java/com/geekorum/geekdroid/accounts/AccountAuthenticatorAppCompatActivity.kt Tue Jan 16 17:05:53 2024 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -/* - * Geekdroid is a utility library for development on the Android - * Platform. - * - * Copyright (C) 2017-2024 by Frederic-Charles Barthelery. - * - * This file is part of Geekdroid. - * - * Geekdroid is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Geekdroid is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Geekdroid. If not, see . - */ -package com.geekorum.geekdroid.accounts - -import android.accounts.AccountAuthenticatorActivity -import android.accounts.AccountAuthenticatorResponse -import android.accounts.AccountManager -import android.os.Bundle -import androidx.appcompat.app.AppCompatActivity -import androidx.core.content.IntentCompat - -/** - * An [AccountAuthenticatorActivity] that supports and AppCompat theme - */ -open class AccountAuthenticatorAppCompatActivity : AppCompatActivity() { - - private var accountAuthenticatorResponse: AccountAuthenticatorResponse? = null - var accountAuthenticatorResult: Bundle? = null - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - accountAuthenticatorResponse = IntentCompat.getParcelableExtra(intent, AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, AccountAuthenticatorResponse::class.java) - accountAuthenticatorResponse?.onRequestContinued() - } - - override fun finish() { - accountAuthenticatorResponse?.apply { - if (accountAuthenticatorResult != null) { - onResult(accountAuthenticatorResult) - } else { - onError(AccountManager.ERROR_CODE_CANCELED, "cancelled") - } - } - super.finish() - } -} diff -r 262e1b65de7d -r 0bcd943bb51c geekdroid/src/main/java/com/geekorum/geekdroid/accounts/AccountAuthenticatorComponentActivity.kt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/geekdroid/src/main/java/com/geekorum/geekdroid/accounts/AccountAuthenticatorComponentActivity.kt Tue Jan 16 17:42:28 2024 -0400 @@ -0,0 +1,55 @@ +/* + * Geekdroid is a utility library for development on the Android + * Platform. + * + * Copyright (C) 2017-2024 by Frederic-Charles Barthelery. + * + * This file is part of Geekdroid. + * + * Geekdroid is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Geekdroid is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Geekdroid. If not, see . + */ +package com.geekorum.geekdroid.accounts + +import android.accounts.AccountAuthenticatorActivity +import android.accounts.AccountAuthenticatorResponse +import android.accounts.AccountManager +import android.os.Bundle +import androidx.activity.ComponentActivity +import androidx.core.content.IntentCompat + +/** + * An [AccountAuthenticatorActivity] that enables composition of higher level components. + */ +open class AccountAuthenticatorComponentActivity : ComponentActivity() { + + private var accountAuthenticatorResponse: AccountAuthenticatorResponse? = null + var accountAuthenticatorResult: Bundle? = null + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + accountAuthenticatorResponse = IntentCompat.getParcelableExtra(intent, AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, AccountAuthenticatorResponse::class.java) + accountAuthenticatorResponse?.onRequestContinued() + } + + override fun finish() { + accountAuthenticatorResponse?.apply { + if (accountAuthenticatorResult != null) { + onResult(accountAuthenticatorResult) + } else { + onError(AccountManager.ERROR_CODE_CANCELED, "cancelled") + } + } + super.finish() + } +} diff -r 262e1b65de7d -r 0bcd943bb51c geekdroid/src/main/java/com/geekorum/geekdroid/app/BottomSheetDialogActivity.kt --- a/geekdroid/src/main/java/com/geekorum/geekdroid/app/BottomSheetDialogActivity.kt Tue Jan 16 17:05:53 2024 -0400 +++ b/geekdroid/src/main/java/com/geekorum/geekdroid/app/BottomSheetDialogActivity.kt Tue Jan 16 17:42:28 2024 -0400 @@ -22,25 +22,26 @@ package com.geekorum.geekdroid.app import android.annotation.SuppressLint -import android.os.Build +import android.app.Activity import android.os.Bundle -import androidx.core.view.AccessibilityDelegateCompat -import androidx.core.view.ViewCompat -import androidx.core.view.accessibility.AccessibilityNodeInfoCompat import android.view.View import android.view.ViewGroup import android.view.WindowManager import android.widget.FrameLayout -import androidx.appcompat.app.AppCompatActivity +import androidx.activity.ComponentActivity import androidx.core.content.res.use +import androidx.core.view.AccessibilityDelegateCompat +import androidx.core.view.ViewCompat +import androidx.core.view.accessibility.AccessibilityNodeInfoCompat import com.geekorum.geekdroid.databinding.ActivityBottomSheetDialogBinding import com.google.android.material.bottomsheet.BottomSheetBehavior +import com.google.android.material.bottomsheet.BottomSheetDialogFragment /** - * React like a [android.support.design.widget.BottomSheetDialogFragment] but is a separate [Activity]. + * React like a [BottomSheetDialogFragment] but is a separate [Activity]. * This allows you to launch the bottom sheet easily from another external activity. */ -abstract class BottomSheetDialogActivity : AppCompatActivity() { +abstract class BottomSheetDialogActivity : ComponentActivity() { private lateinit var binding: ActivityBottomSheetDialogBinding private lateinit var behavior: BottomSheetBehavior