From 54facab486af40e2ae2066e857bd72828867c78f Mon Sep 17 00:00:00 2001 From: Moez Bhatti Date: Mon, 30 Jul 2018 23:25:32 -0400 Subject: [PATCH] Move toolbar from controller to activity --- .../moez/QKSMS/common/base/QkController.kt | 8 - .../feature/settings/about/AboutController.kt | 4 +- .../themepicker/ThemePickerController.kt | 4 +- .../src/main/res/layout/about_activity.xml | 119 ----- .../src/main/res/layout/about_controller.xml | 85 +++ .../main/res/layout/container_activity.xml | 29 +- .../main/res/layout/settings_controller.xml | 320 +++++------- .../res/layout/swipe_actions_controller.xml | 488 ++++++++---------- ...tivity.xml => theme_picker_controller.xml} | 40 +- 9 files changed, 491 insertions(+), 606 deletions(-) delete mode 100644 presentation/src/main/res/layout/about_activity.xml create mode 100644 presentation/src/main/res/layout/about_controller.xml rename presentation/src/main/res/layout/{theme_picker_activity.xml => theme_picker_controller.xml} (61%) diff --git a/presentation/src/main/java/com/moez/QKSMS/common/base/QkController.kt b/presentation/src/main/java/com/moez/QKSMS/common/base/QkController.kt index 50cbb641..60c6047e 100644 --- a/presentation/src/main/java/com/moez/QKSMS/common/base/QkController.kt +++ b/presentation/src/main/java/com/moez/QKSMS/common/base/QkController.kt @@ -3,7 +3,6 @@ package com.moez.QKSMS.common.base import android.view.LayoutInflater import android.view.View import android.view.ViewGroup -import androidx.annotation.CallSuper import androidx.annotation.LayoutRes import androidx.annotation.StringRes import androidx.appcompat.app.AppCompatActivity @@ -32,13 +31,6 @@ abstract class QkController, State, Present return inflater.inflate(layoutRes, container, false) } - @CallSuper - override fun onAttach(view: View) { - super.onAttach(view) - appCompatActivity?.setSupportActionBar(view.toolbar) - setTitle(activity?.title) - } - fun setTitle(@StringRes titleId: Int) { setTitle(activity?.getString(titleId)) } diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/settings/about/AboutController.kt b/presentation/src/main/java/com/moez/QKSMS/feature/settings/about/AboutController.kt index 9e5bf858..a8301b0f 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/settings/about/AboutController.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/settings/about/AboutController.kt @@ -8,7 +8,7 @@ import com.moez.QKSMS.common.base.QkController import com.moez.QKSMS.common.widget.PreferenceView import com.moez.QKSMS.injection.appComponent import io.reactivex.Observable -import kotlinx.android.synthetic.main.about_activity.* +import kotlinx.android.synthetic.main.about_controller.* import javax.inject.Inject class AboutController : QkController(), AboutView { @@ -17,7 +17,7 @@ class AboutController : QkController(), AboutVi init { appComponent.inject(this) - layoutRes = R.layout.about_activity + layoutRes = R.layout.about_controller } override fun onAttach(view: View) { diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/themepicker/ThemePickerController.kt b/presentation/src/main/java/com/moez/QKSMS/feature/themepicker/ThemePickerController.kt index c13bc1e4..fed51e71 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/themepicker/ThemePickerController.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/themepicker/ThemePickerController.kt @@ -32,7 +32,7 @@ import com.moez.QKSMS.injection.appComponent import io.reactivex.Observable import io.reactivex.subjects.PublishSubject import io.reactivex.subjects.Subject -import kotlinx.android.synthetic.main.theme_picker_activity.* +import kotlinx.android.synthetic.main.theme_picker_controller.* import kotlinx.android.synthetic.main.theme_picker_hsv.* import javax.inject.Inject @@ -53,7 +53,7 @@ class ThemePickerController(val threadId: Long = 0L) : QkController - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/presentation/src/main/res/layout/about_controller.xml b/presentation/src/main/res/layout/about_controller.xml new file mode 100644 index 00000000..1231c44b --- /dev/null +++ b/presentation/src/main/res/layout/about_controller.xml @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/presentation/src/main/res/layout/container_activity.xml b/presentation/src/main/res/layout/container_activity.xml index 2d03ac7d..4723fd0d 100644 --- a/presentation/src/main/res/layout/container_activity.xml +++ b/presentation/src/main/res/layout/container_activity.xml @@ -1,11 +1,32 @@ - + android:layout_height="match_parent" + android:orientation="vertical"> + + + + + + + android:layout_height="0dp" + android:layout_weight="1" /> - \ No newline at end of file + + + \ No newline at end of file diff --git a/presentation/src/main/res/layout/settings_controller.xml b/presentation/src/main/res/layout/settings_controller.xml index 0e75d793..49c1e1ea 100644 --- a/presentation/src/main/res/layout/settings_controller.xml +++ b/presentation/src/main/res/layout/settings_controller.xml @@ -17,213 +17,173 @@ ~ You should have received a copy of the GNU General Public License ~ along with QKSMS. If not, see . --> - + android:layout_height="match_parent"> - + + style="@style/PreferenceCategory" + android:text="@string/settings_category_appearance" /> - - - - - + app:icon="@drawable/ic_color_lens_black_24dp" + app:title="@string/settings_theme_title" + app:widget="@layout/settings_theme_widget" /> - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - - - - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/presentation/src/main/res/layout/swipe_actions_controller.xml b/presentation/src/main/res/layout/swipe_actions_controller.xml index 02700c10..bf52e494 100644 --- a/presentation/src/main/res/layout/swipe_actions_controller.xml +++ b/presentation/src/main/res/layout/swipe_actions_controller.xml @@ -17,292 +17,256 @@ ~ You should have received a copy of the GNU General Public License ~ along with QKSMS. If not, see . --> - + android:layout_height="match_parent"> - - - - - - - + android:layout_height="wrap_content" + android:orientation="vertical"> - + android:foreground="?attr/selectableItemBackground"> - + android:layout_marginEnd="16dp" + android:layout_marginStart="24dp" + android:layout_marginTop="24dp" + android:text="@string/settings_swipe_actions_right" + android:textColor="?android:attr/textColorPrimary" + app:layout_constraintEnd_toStartOf="@id/rightChange" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + app:textSize="primary" /> - + - - - - - - - - - - - - - - - + + android:layout_height="84dp" + android:layout_marginBottom="16dp" + android:layout_marginEnd="16dp" + android:layout_marginStart="16dp" + android:layout_marginTop="16dp" + android:alpha="0.1" + android:background="@drawable/rounded_rectangle_outline_4dp" + android:backgroundTint="?android:attr/textColorPrimary" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@id/rightLabel" /> - + + + + + + + + + + + + + + + android:layout_marginEnd="16dp" + android:layout_marginStart="24dp" + android:layout_marginTop="24dp" + android:text="@string/settings_swipe_actions_left" + android:textColor="?android:attr/textColorPrimary" + app:layout_constraintEnd_toStartOf="@id/leftChange" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + app:textSize="primary" /> - + - + - + - + - + - + - + - + - + - - - - - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/presentation/src/main/res/layout/theme_picker_activity.xml b/presentation/src/main/res/layout/theme_picker_controller.xml similarity index 61% rename from presentation/src/main/res/layout/theme_picker_activity.xml rename to presentation/src/main/res/layout/theme_picker_controller.xml index dedd3ec9..4997f7ba 100644 --- a/presentation/src/main/res/layout/theme_picker_activity.xml +++ b/presentation/src/main/res/layout/theme_picker_controller.xml @@ -24,51 +24,33 @@ android:animateLayoutChanges="true" android:orientation="vertical"> - - - - + android:layout_height="match_parent" /> - - - - - - - + android:layout_height="match_parent" /> - - - + \ No newline at end of file