Skip to content

Commit

Permalink
chore: ui tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
butzist committed Feb 17, 2024
1 parent f7772c0 commit 6cc68d2
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 123 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ class ActivityDetailsFragment : Fragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)

binding.etName.setText(activityInfo.name)
binding.etPackage.setText(activityInfo.componentName.packageName)
binding.etClass.setText(activityInfo.componentName.className)
binding.etIcon.setText(activityInfo.iconResourceName ?: "")
binding.tiName.setText(activityInfo.name)
binding.tiPackage.setText(activityInfo.componentName.packageName)
binding.tiClass.setText(activityInfo.componentName.shortClassName)
binding.tiIcon.setText(activityInfo.iconResourceName ?: "")
binding.ibIconPicker.setImageDrawable(activityInfo.icon)

// TODO binding.ibIconPicker
Expand Down Expand Up @@ -88,12 +88,12 @@ class ActivityDetailsFragment : Fragment() {
private val editedActivityInfo: MyActivityInfo
get() {
val componentName =
ComponentName(binding.etPackage.text.toString(), binding.etClass.text.toString())
val iconResourceName = binding.etIcon.text.toString()
ComponentName(binding.tiPackage.text.toString(), binding.tiClass.text.toString())
val iconResourceName = binding.tiIcon.text.toString()

return MyActivityInfo(
componentName,
binding.etName.text.toString(),
binding.tiName.text.toString(),
binding.ibIconPicker.drawable,
iconResourceName.ifBlank { null },
false,
Expand Down
209 changes: 93 additions & 116 deletions app/src/main/res/layout/fragment_activity_details.xml
Original file line number Diff line number Diff line change
@@ -1,141 +1,118 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<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"
android:layout_marginLeft="15dp"
android:layout_marginTop="10dp"
android:layout_marginRight="15dp"
android:layout_height="match_parent"
android:orientation="vertical">

<TableLayout
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/tilName"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<TableRow
android:layout_width="wrap_content"
android:layout_height="wrap_content">

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:labelFor="@+id/etName"
android:text="@string/label_name"
android:textAppearance="?android:attr/textAppearanceMedium" />

<EditText
android:id="@+id/etName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:importantForAutofill="no"
android:inputType="text" />
</TableRow>

<TableRow
android:layout_width="wrap_content"
android:layout_height="wrap_content">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:labelFor="@+id/etPackage"
android:text="@string/label_package"
android:textAppearance="?android:attr/textAppearanceMedium" />

<EditText
android:id="@+id/etPackage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:importantForAutofill="no"
android:inputType="text">

<requestFocus />
</EditText>
</TableRow>

<TableRow
android:layout_width="wrap_content"
android:layout_height="wrap_content">

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:labelFor="@+id/etClass"
android:text="@string/label_class"
android:textAppearance="?android:attr/textAppearanceMedium" />

<EditText
android:id="@+id/etClass"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:importantForAutofill="no"
android:inputType="text" />
</TableRow>

<TableRow
android:layout_width="wrap_content"
android:layout_height="wrap_content">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:labelFor="@+id/etIcon"
android:text="@string/label_icon"
android:textAppearance="?android:attr/textAppearanceMedium" />

<EditText
android:id="@+id/etIcon"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:importantForAutofill="no"
android:inputType="text" />

<ImageButton
android:id="@+id/ibIconPicker"
android:layout_width="68dp"
android:layout_height="68dp"
android:adjustViewBounds="false"
android:contentDescription="@string/title_dialog_icon_picker"
android:scaleType="centerInside"
android:src="@mipmap/ic_launcher" />

</TableRow>

<TableRow
android:id="@+id/tableRow_as_root"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</TableLayout>
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:hint="@string/label_name"
app:layout_constraintTop_toTopOf="parent">

<com.google.android.material.textfield.TextInputEditText
android:id="@+id/tiName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:importantForAutofill="no" />
</com.google.android.material.textfield.TextInputLayout>

<com.google.android.material.textfield.TextInputLayout
android:id="@+id/tilPackage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:hint="@string/label_package"
app:layout_constraintTop_toBottomOf="@+id/tilName">

<com.google.android.material.textfield.TextInputEditText
android:id="@+id/tiPackage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:importantForAutofill="no" />
</com.google.android.material.textfield.TextInputLayout>

<com.google.android.material.textfield.TextInputLayout
android:id="@+id/tilClass"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:hint="@string/label_class"
app:layout_constraintTop_toBottomOf="@+id/tilPackage">

<com.google.android.material.textfield.TextInputEditText
android:id="@+id/tiClass"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:importantForAutofill="no" />
</com.google.android.material.textfield.TextInputLayout>

<com.google.android.material.textfield.TextInputLayout
android:id="@+id/tilIcon"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:hint="@string/label_icon"
app:layout_constraintEnd_toStartOf="@+id/ibIconPicker"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tilClass">

<com.google.android.material.textfield.TextInputEditText
android:id="@+id/tiIcon"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:importantForAutofill="no" />
</com.google.android.material.textfield.TextInputLayout>

<ImageButton
android:id="@+id/ibIconPicker"
android:layout_width="68dp"
android:layout_height="68dp"
android:layout_margin="8dp"
android:adjustViewBounds="false"
android:contentDescription="@string/title_dialog_icon_picker"
android:scaleType="centerInside"
android:src="@mipmap/ic_launcher"
app:layout_constraintBottom_toBottomOf="@+id/tilIcon"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/tilIcon" />

<Button
android:id="@+id/btLaunch"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/context_action_launch" />
android:layout_marginHorizontal="8dp"
android:layout_marginTop="32dp"
android:layout_marginBottom="8dp"
android:text="@string/context_action_launch"
app:layout_constraintTop_toBottomOf="@+id/tilIcon" />

<Button
android:id="@+id/btLaunchAsRoot"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/context_action_launch_as_root" />
android:layout_margin="8dp"
android:text="@string/context_action_launch_as_root"
app:layout_constraintTop_toBottomOf="@+id/btLaunch" />

<Button
android:id="@+id/btCreateShortcut"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/context_action_shortcut" />
android:layout_margin="8dp"
android:text="@string/context_action_shortcut"
app:layout_constraintTop_toBottomOf="@+id/btLaunchAsRoot" />

<Button
android:id="@+id/btCreateShortcutAsRoot"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/context_action_shortcut_as_root" />
</LinearLayout>
android:layout_margin="8dp"
android:text="@string/context_action_shortcut_as_root"
app:layout_constraintTop_toBottomOf="@+id/btCreateShortcut"
tools:layout_editor_absoluteY="20dp" />
</androidx.constraintlayout.widget.ConstraintLayout>

0 comments on commit 6cc68d2

Please sign in to comment.