diff --git a/app/src/main/java/com/vanced/manager/adapter/ExpandableAppListAdapter.kt b/app/src/main/java/com/vanced/manager/adapter/ExpandableAppListAdapter.kt index 1b6b724e..5ce4240d 100644 --- a/app/src/main/java/com/vanced/manager/adapter/ExpandableAppListAdapter.kt +++ b/app/src/main/java/com/vanced/manager/adapter/ExpandableAppListAdapter.kt @@ -15,6 +15,7 @@ import androidx.recyclerview.widget.RecyclerView import com.google.android.material.card.MaterialCardView import com.vanced.manager.R import com.vanced.manager.databinding.ViewAppExpandableBinding +import com.vanced.manager.model.ButtonTag import com.vanced.manager.model.DataModel import com.vanced.manager.ui.dialogs.AppInfoDialog import com.vanced.manager.ui.viewmodels.HomeViewModel @@ -42,8 +43,15 @@ class ExpandableAppListAdapter( appTitle.text = dataModel?.appName appDescription.text = dataModel?.appDescription dataModel?.appIcon?.let { appIcon.setImageResource(it) } - appDownload.setOnClickListener { - viewModel.openInstallDialog(dataModel?.buttonTag?.value, apps[position]) + appDownload.apply { + val buttonTag = dataModel?.buttonTag?.value + setOnClickListener { viewModel.openInstallDialog(buttonTag, apps[position]) } + contentDescription = activity.getString( + if (buttonTag == ButtonTag.UPDATE) + R.string.accessibility_update + else + R.string.accessibility_download + ) } appClickableLayout.setOnClickListener { if (isAnimationRunning) return@setOnClickListener @@ -90,7 +98,7 @@ class ExpandableAppListAdapter( } dataModel?.buttonImage?.observe(activity) { if (it != null) { - appDownload.setImageDrawable(it) + appDownload.icon = it } } } diff --git a/app/src/main/java/com/vanced/manager/ui/core/ThemedIconButton.kt b/app/src/main/java/com/vanced/manager/ui/core/ThemedIconButton.kt new file mode 100644 index 00000000..e1ef7d0f --- /dev/null +++ b/app/src/main/java/com/vanced/manager/ui/core/ThemedIconButton.kt @@ -0,0 +1,25 @@ +package com.vanced.manager.ui.core + +import android.content.Context +import android.content.res.ColorStateList +import android.util.AttributeSet +import android.widget.Toast +import androidx.appcompat.widget.AppCompatImageButton +import com.google.android.material.button.MaterialButton +import com.vanced.manager.utils.accentColor + +class ThemedIconButton @JvmOverloads constructor( + context: Context, + attributeSet: AttributeSet? = null, + defStyleAttr: Int = 0 +) : MaterialButton(context, attributeSet, defStyleAttr) { + + init { + iconTint = ColorStateList.valueOf(accentColor.value!!) + setOnLongClickListener { + Toast.makeText(context, contentDescription, Toast.LENGTH_SHORT).show() + true + } + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/vanced/manager/ui/core/ThemedImageButton.kt b/app/src/main/java/com/vanced/manager/ui/core/ThemedImageButton.kt deleted file mode 100644 index f5623ed1..00000000 --- a/app/src/main/java/com/vanced/manager/ui/core/ThemedImageButton.kt +++ /dev/null @@ -1,19 +0,0 @@ -package com.vanced.manager.ui.core - -import android.content.Context -import android.content.res.ColorStateList -import android.util.AttributeSet -import androidx.appcompat.widget.AppCompatImageButton -import com.vanced.manager.utils.accentColor - -class ThemedImageButton @JvmOverloads constructor( - context: Context, - attributeSet: AttributeSet? = null, - defStyleAttr: Int = 0 -) : AppCompatImageButton(context, attributeSet, defStyleAttr) { - - init { - imageTintList = ColorStateList.valueOf(accentColor.value!!) - } - -} \ No newline at end of file diff --git a/app/src/main/res/drawable/icon_button_ripple.xml b/app/src/main/res/drawable/icon_button_ripple.xml new file mode 100644 index 00000000..34e07bdc --- /dev/null +++ b/app/src/main/res/drawable/icon_button_ripple.xml @@ -0,0 +1,9 @@ + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/view_app_expandable.xml b/app/src/main/res/layout/view_app_expandable.xml index e486ec4c..ec05039b 100644 --- a/app/src/main/res/layout/view_app_expandable.xml +++ b/app/src/main/res/layout/view_app_expandable.xml @@ -14,8 +14,8 @@ android:id="@+id/app_expanded_view" android:layout_width="match_parent" android:layout_height="wrap_content" - android:paddingHorizontal="16dp" - android:paddingVertical="12dp" + android:paddingVertical="8dp" + android:paddingHorizontal="12dp" android:alpha="0" android:scaleX="0.8" android:scaleY="0.8" @@ -75,37 +75,41 @@ app:flexWrap="wrap" app:flexDirection="row_reverse"> - + app:icon="@drawable/ic_app_download" + android:contentDescription="@string/accessibility_download"/> - + app:icon="@drawable/ic_baseline_launch_24" + android:contentDescription="@string/accessibility_launch"/> - + app:icon="@drawable/ic_app_uninstall" + android:contentDescription="@string/accessibility_uninstall"/> - + app:icon="@drawable/ic_app_info" + android:contentDescription="@string/accessibility_info"/> @@ -115,7 +119,7 @@ android:id="@+id/app_clickable_layout" android:layout_width="match_parent" android:layout_height="wrap_content" - app:contentPadding="16dp" + app:contentPadding="12dp" app:cardCornerRadius="0dp" app:cardElevation="0dp" app:cardBackgroundColor="?colorLinkBG" diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 47724dfb..22ba7670 100755 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -28,6 +28,11 @@ About %1$s + Download + Info + Launch + Uninstall + Update Apps Changelog Downloading %1$s diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 666dbdd8..fd961ee4 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -22,11 +22,22 @@ wrap_content -