Move Extension app info button beside uninstall button

This commit is contained in:
Jays2Kings 2021-09-07 20:02:30 -04:00
parent 0b15a399e5
commit c945dc0bd4
5 changed files with 37 additions and 19 deletions

View file

@ -2,10 +2,7 @@ package eu.kanade.tachiyomi.ui.extension.details
import android.annotation.SuppressLint
import android.content.Context
import android.content.Intent
import android.net.Uri
import android.os.Bundle
import android.provider.Settings
import android.util.TypedValue
import android.view.ContextThemeWrapper
import android.view.LayoutInflater
@ -156,7 +153,6 @@ class ExtensionDetailsController(bundle: Bundle? = null) :
override fun onOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) {
R.id.action_history -> openCommitHistory()
R.id.action_app_info -> openInSettings()
}
return super.onOptionsItemSelected(item)
}
@ -171,13 +167,6 @@ class ExtensionDetailsController(bundle: Bundle? = null) :
openInBrowser(url)
}
private fun openInSettings() {
val intent = Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS).apply {
data = Uri.fromParts("package", presenter.pkgName, null)
}
startActivity(intent)
}
private fun addPreferencesForSource(screen: PreferenceScreen, source: Source, isMultiSource: Boolean, isMultiLangSingleSource: Boolean) {
val context = screen.context

View file

@ -1,5 +1,8 @@
package eu.kanade.tachiyomi.ui.extension.details
import android.content.Intent
import android.net.Uri
import android.provider.Settings
import android.view.View
import android.view.ViewGroup
import androidx.core.view.isVisible
@ -49,6 +52,13 @@ class ExtensionDetailsHeaderAdapter(private val presenter: ExtensionDetailsPrese
presenter.uninstallExtension()
}
binding.extensionAppInfoButton.setOnClickListener {
val intent = Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS).apply {
data = Uri.fromParts("package", presenter.pkgName, null)
}
it.context.startActivity(intent)
}
if (extension.isObsolete) {
binding.extensionWarningBanner.isVisible = true
binding.extensionWarningBanner.setText(R.string.obsolete_extension_message)

View file

@ -90,14 +90,15 @@
android:layout_height="wrap_content"
android:elevation="3dp"
android:ellipsize="middle"
android:singleLine="true"
android:layout_marginTop="6dp"
android:maxLines="1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@id/extension_title"
app:layout_constraintTop_toBottomOf="@id/extension_nsfw"
tools:text="eu.kanade.tachiyomi.extension.en.myext" />
<Button
android:id="@+id/extension_uninstall_button"
android:id="@+id/extension_app_info_button"
style="@style/Theme.Widget.Button.Colored"
android:layout_width="0dp"
android:layout_height="wrap_content"
@ -105,8 +106,24 @@
android:paddingStart="32dp"
android:textAllCaps="false"
android:paddingEnd="32dp"
android:text="@string/uninstall"
android:layout_marginStart="4dp"
android:text="@string/app_info"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/extension_uninstall_button"
app:layout_constraintTop_toBottomOf="@id/extension_pkg" />
<Button
android:id="@+id/extension_uninstall_button"
style="@style/Theme.Widget.Button.OutlinedButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:paddingStart="32dp"
android:layout_marginEnd="4dp"
android:paddingEnd="32dp"
android:text="@string/uninstall"
app:layout_constraintEnd_toStartOf="@id/extension_app_info_button"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/extension_pkg" />
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -7,9 +7,4 @@
android:title="@string/whats_new"
app:showAsAction="ifRoom" />
<item
android:id="@+id/action_app_info"
android:title="@string/app_info"
app:showAsAction="never" />
</menu>

View file

@ -312,6 +312,13 @@
</style>
<style name="Theme.Widget.Button.OutlinedButton" parent="Widget.MaterialComponents.Button.OutlinedButton">
<item name="backgroundTint">@color/ext_bg_selector</item>
<item name="android:textColor">@color/ext_button_text_selector</item>
<item name="rippleColor">?colorControlHighlight</item>
</style>
<style name="Theme.Widget.Button.Borderless.Small">
<item name="android:minHeight">48dip</item>
<item name="android:minWidth">48dip</item>