Extract base activity.

This commit is contained in:
2022-09-14 22:00:28 +08:00
parent 29a398a66a
commit 09eeab35c4
13 changed files with 288 additions and 180 deletions

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/constraint_layout_root"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/app_show_background_theme"
tools:context=".util.tool.BaseActivityHorizontal">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/constraint_layout_content"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,33 @@
<?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:id="@+id/constraint_layout_root"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/app_background_theme"
tools:context=".util.tool.BaseActivityNormal">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/app_bar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/Theme.OxygenToolbox.AppBarOverlay"
app:layout_constraintTop_toTopOf="parent">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/Theme.OxygenToolbox.PopupOverlay" />
</com.google.android.material.appbar.AppBarLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/constraint_layout_content"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@+id/app_bar_layout" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -2,10 +2,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:id="@+id/constraint_layout_root"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/app_show_background_theme"
android:keepScreenOn="true"
tools:context=".tools.timescreen.MainActivity">

View File

@@ -2,143 +2,118 @@
<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:id="@+id/constraint_layout_root"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/app_background_theme"
tools:context=".tools.translation.MainActivity">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/app_bar_layout"
<LinearLayout
android:id="@+id/linear_layout_language"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/Theme.OxygenToolbox.AppBarOverlay"
android:layout_margin="@dimen/tool_translation_layout_margin"
android:background="@drawable/background_top_bottom_radius"
android:gravity="center"
android:orientation="horizontal"
app:layout_constraintTop_toTopOf="parent">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/Theme.OxygenToolbox.PopupOverlay" />
</com.google.android.material.appbar.AppBarLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@+id/app_bar_layout">
<LinearLayout
android:id="@+id/linear_layout_language"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/tool_translation_layout_margin"
android:background="@drawable/background_top_bottom_radius"
android:gravity="center"
android:orientation="horizontal"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/text_view_language_from"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="@string/tool_translation_language_chinese"
android:textColor="?attr/app_theme"
android:textSize="@dimen/tool_translation_text_size" />
<ImageView
android:id="@+id/image_view_swap"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="Swap"
android:padding="@dimen/tool_translation_clickable_padding"
android:src="@drawable/animation_swap_horizon" />
<TextView
android:id="@+id/text_view_language_to"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="@string/tool_translation_language_english"
android:textColor="?attr/app_theme"
android:textSize="@dimen/tool_translation_text_size" />
</LinearLayout>
<EditText
android:id="@+id/edit_text_from"
android:layout_width="match_parent"
android:layout_height="@dimen/tool_translation_edit_text_view_height"
android:layout_margin="@dimen/tool_translation_layout_margin"
android:autofillHints="text"
android:background="@drawable/background_top_bottom_radius"
android:gravity="start|top"
android:hint="@string/tool_translation_please_enter_text"
android:inputType="textMultiLine"
android:maxLength="850"
android:paddingHorizontal="@dimen/tool_translation_edit_text_view_padding"
android:paddingTop="@dimen/tool_translation_edit_text_view_padding"
android:paddingBottom="@dimen/tool_translation_edit_text_view_padding_plus"
android:textColor="?attr/app_text_theme"
android:textSize="@dimen/tool_translation_text_size"
app:layout_constraintTop_toBottomOf="@id/linear_layout_language" />
<TextView
android:id="@+id/edit_text_to"
android:layout_width="match_parent"
android:layout_height="@dimen/tool_translation_edit_text_view_height"
android:layout_margin="@dimen/tool_translation_layout_margin"
android:autofillHints="text"
android:background="@drawable/background_top_bottom_radius"
android:gravity="start|top"
android:paddingHorizontal="@dimen/tool_translation_edit_text_view_padding"
android:paddingTop="@dimen/tool_translation_edit_text_view_padding_plus"
android:paddingBottom="@dimen/tool_translation_edit_text_view_padding"
android:textColor="?attr/app_text_theme"
android:textIsSelectable="true"
android:textSize="@dimen/tool_translation_text_size"
app:layout_constraintTop_toBottomOf="@id/edit_text_from" />
android:id="@+id/text_view_language_from"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="@string/tool_translation_language_chinese"
android:textColor="?attr/app_theme"
android:textSize="@dimen/tool_translation_text_size" />
<androidx.constraintlayout.widget.ConstraintLayout
<ImageView
android:id="@+id/image_view_swap"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/background_round"
android:contentDescription="Swap"
android:padding="@dimen/tool_translation_clickable_padding"
app:layout_constraintBottom_toTopOf="@id/edit_text_to"
android:src="@drawable/animation_swap_horizon" />
<TextView
android:id="@+id/text_view_language_to"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="@string/tool_translation_language_english"
android:textColor="?attr/app_theme"
android:textSize="@dimen/tool_translation_text_size" />
</LinearLayout>
<EditText
android:id="@+id/edit_text_from"
android:layout_width="match_parent"
android:layout_height="@dimen/tool_translation_edit_text_view_height"
android:layout_margin="@dimen/tool_translation_layout_margin"
android:autofillHints="text"
android:background="@drawable/background_top_bottom_radius"
android:gravity="start|top"
android:hint="@string/tool_translation_please_enter_text"
android:inputType="textMultiLine"
android:maxLength="850"
android:paddingHorizontal="@dimen/tool_translation_edit_text_view_padding"
android:paddingTop="@dimen/tool_translation_edit_text_view_padding"
android:paddingBottom="@dimen/tool_translation_edit_text_view_padding_plus"
android:textColor="?attr/app_text_theme"
android:textSize="@dimen/tool_translation_text_size"
app:layout_constraintTop_toBottomOf="@id/linear_layout_language" />
<TextView
android:id="@+id/edit_text_to"
android:layout_width="match_parent"
android:layout_height="@dimen/tool_translation_edit_text_view_height"
android:layout_margin="@dimen/tool_translation_layout_margin"
android:autofillHints="text"
android:background="@drawable/background_top_bottom_radius"
android:gravity="start|top"
android:paddingHorizontal="@dimen/tool_translation_edit_text_view_padding"
android:paddingTop="@dimen/tool_translation_edit_text_view_padding_plus"
android:paddingBottom="@dimen/tool_translation_edit_text_view_padding"
android:textColor="?attr/app_text_theme"
android:textIsSelectable="true"
android:textSize="@dimen/tool_translation_text_size"
app:layout_constraintTop_toBottomOf="@id/edit_text_from" />
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/background_round"
android:padding="@dimen/tool_translation_clickable_padding"
app:layout_constraintBottom_toTopOf="@id/edit_text_to"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/edit_text_from">
<ImageView
android:id="@+id/image_view_translate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true"
android:contentDescription="Translate"
android:focusable="true"
android:foreground="@drawable/foreground_ripple"
android:src="@drawable/ic_tool_translation_translate"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/edit_text_from">
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/image_view_translate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true"
android:contentDescription="Translate"
android:focusable="true"
android:foreground="@drawable/foreground_ripple"
android:src="@drawable/ic_tool_translation_translate"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ProgressBar
android:id="@+id/progress_bar_in_translation"
android:layout_width="0dp"
android:layout_height="0dp"
android:indeterminateTint="?attr/app_on_theme"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<ProgressBar
android:id="@+id/progress_bar_in_translation"
android:layout_width="0dp"
android:layout_height="0dp"
android:indeterminateTint="?attr/app_on_theme"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>