Change to a RecyclerView for displaying actions

Icons are shown instead of a button if apps are selected
This commit is contained in:
Finn M Glas 2020-05-29 17:31:47 +02:00
parent d7ac02352c
commit 0134665ee3
No known key found for this signature in database
GPG key ID: 25037A2E81AB459C
6 changed files with 194 additions and 403 deletions

View file

@ -13,276 +13,48 @@
android:paddingRight="32sp"
tools:context=".settings.SettingsFragmentApps">
<TableLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="32sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
android:layout_height="match_parent">
<TableRow
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/activity_settings_actions_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:minHeight="@dimen/app_action_height">
android:layout_height="0dp"
android:layout_marginBottom="16dp"
app:layout_constraintBottom_toTopOf="@+id/settings_app_btn_layout"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/fragment_settings_apps_text_up"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10sp"
android:paddingRight="10sp"
android:text="@string/settings_choose_up"
android:textSize="20sp" />
</androidx.recyclerview.widget.RecyclerView>
<ImageView
android:id="@+id/fragment_settings_apps_up_icon"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:visibility="gone"
tools:ignore="ContentDescription" />
<LinearLayout
android:id="@+id/settings_app_btn_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="32dp"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
<Button
android:id="@+id/fragment_settings_apps_choose_up_btn"
android:id="@+id/fragment_settings_apps_btn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/settings_choose_btn"
android:textAllCaps="false"
android:visibility="visible" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:minHeight="@dimen/app_action_height">
<TextView
android:id="@+id/fragment_settings_apps_choose_down_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10sp"
android:paddingRight="10sp"
android:text="@string/settings_choose_down"
android:textSize="20sp" />
<ImageView
android:id="@+id/fragment_settings_apps_down_icon"
android:layout_width="wrap_content"
android:layout_height="@dimen/app_icon_side"
android:visibility="gone"
tools:ignore="ContentDescription" />
<Button
android:id="@+id/fragment_settings_apps_choose_down_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/settings_choose_btn"
android:text="@string/settings_apps"
android:textAllCaps="false" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:minHeight="@dimen/app_action_height">
<TextView
android:id="@+id/fragment_settings_apps_choose_left_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10sp"
android:paddingRight="10sp"
android:text="@string/settings_choose_left"
android:textSize="20sp" />
<ImageView
android:id="@+id/fragment_settings_apps_left_icon"
android:layout_width="wrap_content"
android:layout_height="@dimen/app_icon_side"
android:visibility="gone"
tools:ignore="ContentDescription" />
<Button
android:id="@+id/fragment_settings_apps_choose_left_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/settings_choose_btn"
android:textAllCaps="false" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:minHeight="@dimen/app_action_height">
<TextView
android:id="@+id/fragment_settings_apps_choose_right_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10sp"
android:paddingRight="10sp"
android:text="@string/settings_choose_right"
android:textSize="20sp" />
<ImageView
android:id="@+id/fragment_settings_apps_right_icon"
android:layout_width="wrap_content"
android:layout_height="@dimen/app_icon_side"
android:visibility="gone"
tools:ignore="ContentDescription" />
<Button
android:id="@+id/fragment_settings_apps_choose_right_btn"
android:id="@+id/fragment_settings_apps_install_btn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/settings_choose_btn"
android:text="@string/settings_install"
android:textAllCaps="false" />
</TableRow>
</LinearLayout>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:minHeight="@dimen/app_action_height">
<TextView
android:id="@+id/fragment_settings_apps_choose_vol_up_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10sp"
android:paddingRight="10sp"
android:text="@string/settings_choose_vol_up"
android:textSize="20sp" />
<ImageView
android:id="@+id/fragment_settings_apps_vol_up_icon"
android:layout_width="wrap_content"
android:layout_height="@dimen/app_icon_side"
android:visibility="gone"
tools:ignore="ContentDescription" />
<Button
android:id="@+id/fragment_settings_apps_choose_vol_up_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/settings_choose_btn"
android:textAllCaps="false" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:minHeight="@dimen/app_action_height">
<TextView
android:id="@+id/fragment_settings_apps_choose_vol_down_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10sp"
android:paddingRight="10sp"
android:text="@string/settings_choose_vol_down"
android:textSize="20sp" />
<ImageView
android:id="@+id/fragment_settings_apps_vol_down_icon"
android:layout_width="wrap_content"
android:layout_height="@dimen/app_icon_side"
android:visibility="gone"
tools:ignore="ContentDescription" />
<Button
android:id="@+id/fragment_settings_apps_choose_vol_down_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/settings_choose_btn"
android:textAllCaps="false" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:minHeight="@dimen/app_action_height">
<TextView
android:id="@+id/fragment_settings_apps_choose_double_click_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10sp"
android:paddingRight="10sp"
android:text="@string/settings_choose_double_click"
android:textSize="20sp" />
<ImageView
android:id="@+id/fragment_settings_apps_double_click_icon"
android:layout_width="wrap_content"
android:layout_height="@dimen/app_icon_side"
android:visibility="gone"
tools:ignore="ContentDescription" />
<Button
android:id="@+id/fragment_settings_apps_choose_double_click_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/settings_choose_btn"
android:textAllCaps="false" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:minHeight="@dimen/app_action_height">
<TextView
android:id="@+id/fragment_settings_apps_choose_long_click_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10sp"
android:paddingRight="10sp"
android:text="@string/settings_choose_long_click"
android:textSize="20sp" />
<ImageView
android:id="@+id/fragment_settings_apps_long_click_icon"
android:layout_width="wrap_content"
android:layout_height="@dimen/app_icon_side"
android:visibility="gone"
tools:ignore="ContentDescription" />
<Button
android:id="@+id/fragment_settings_apps_choose_long_click_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/settings_choose_btn"
android:textAllCaps="false" />
</TableRow>
</TableLayout>
<Button
android:id="@+id/fragment_settings_apps_btn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/settings_apps"
android:textAllCaps="false" />
<Button
android:id="@+id/fragment_settings_apps_install_btn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/settings_install"
android:textAllCaps="false" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>

View file

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/row_action_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="5dp"
android:layout_marginRight="5dp"
android:gravity="start"
android:text=""
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/row_choose_button"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/row_app_icon"
android:layout_width="@dimen/app_icon_side"
android:layout_height="@dimen/app_icon_side"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@id/row_choose_button"
app:layout_constraintStart_toStartOf="@+id/row_choose_button"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="ContentDescription" />
<Button
android:id="@+id/row_choose_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/settings_choose_btn"
android:textAllCaps="false"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>