Skip to content

Commit

Permalink
feat(options): add titles to configuration views (#181)
Browse files Browse the repository at this point in the history
Co-authored-by: Joshua Kuestersteffen <[email protected]>
  • Loading branch information
khwolf and jkuester authored Dec 27, 2023
1 parent 9c9fc4d commit da163e7
Show file tree
Hide file tree
Showing 17 changed files with 385 additions and 254 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ import com.sduduzog.slimlauncher.utils.BaseFragment
import com.sduduzog.slimlauncher.utils.OnItemActionListener
import com.sduduzog.slimlauncher.utils.OnShitDoneToAppsListener
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.android.synthetic.main.customise_apps_fragment.*
import kotlinx.android.synthetic.main.customise_apps_fragment.customise_apps_fragment
import kotlinx.android.synthetic.main.customise_apps_fragment.customise_apps_fragment_add
import kotlinx.android.synthetic.main.customise_apps_fragment.customise_apps_fragment_back
import kotlinx.android.synthetic.main.customise_apps_fragment.customise_apps_fragment_list
import kotlinx.android.synthetic.main.customise_apps_fragment.customise_apps_fragment_remove_all


@AndroidEntryPoint
Expand All @@ -34,6 +38,12 @@ class CustomiseAppsFragment : BaseFragment(), OnShitDoneToAppsListener {
return inflater.inflate(R.layout.customise_apps_fragment, container, false)
}

override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState)
customise_apps_fragment_back.setOnClickListener {
requireActivity().onBackPressedDispatcher.onBackPressed()
}
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
val adapter = CustomAppsAdapter(this)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ import com.sduduzog.slimlauncher.adapters.CustomizeAppDrawerAppsAdapter
import com.sduduzog.slimlauncher.datasource.UnlauncherDataSource
import com.sduduzog.slimlauncher.utils.BaseFragment
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.android.synthetic.main.customize_app_drawer_app_list_fragment.*
import kotlinx.android.synthetic.main.customize_app_drawer_app_list_fragment.customize_app_drawer_fragment
import kotlinx.android.synthetic.main.customize_app_drawer_app_list_fragment.customize_app_drawer_fragment_app_list
import kotlinx.android.synthetic.main.customize_app_drawer_app_list_fragment.customize_app_drawer_fragment_app_progress_bar
import kotlinx.android.synthetic.main.customize_app_drawer_app_list_fragment.customize_app_drawer_fragment_back
import javax.inject.Inject

@AndroidEntryPoint
Expand Down Expand Up @@ -39,5 +42,8 @@ class CustomizeAppDrawerAppListFragment : BaseFragment() {
customize_app_drawer_fragment_app_progress_bar.visibility = View.VISIBLE
}
}
customize_app_drawer_fragment_back.setOnClickListener {
requireActivity().onBackPressedDispatcher.onBackPressed()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import com.sduduzog.slimlauncher.utils.BaseFragment
import com.sduduzog.slimlauncher.utils.createTitleAndSubtitleText
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.android.synthetic.main.customize_app_drawer_fragment.customize_app_drawer_fragment
import kotlinx.android.synthetic.main.customize_app_drawer_fragment.customize_app_drawer_fragment_back
import kotlinx.android.synthetic.main.customize_app_drawer_fragment.customize_app_drawer_fragment_search_options
import kotlinx.android.synthetic.main.customize_app_drawer_fragment.customize_app_drawer_fragment_show_headings_switch
import kotlinx.android.synthetic.main.customize_app_drawer_fragment.customize_app_drawer_fragment_visible_apps
Expand All @@ -37,6 +38,10 @@ class CustomizeAppDrawerFragment : BaseFragment() {
customize_app_drawer_fragment_visible_apps
.setOnClickListener(Navigation.createNavigateOnClickListener(R.id.action_customiseAppDrawerFragment_to_customiseAppDrawerAppListFragment))

customize_app_drawer_fragment_back.setOnClickListener{
requireActivity().onBackPressedDispatcher.onBackPressed()
}

setupSearchFieldOptionsButton()
setupHeadingSwitch()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import com.sduduzog.slimlauncher.ui.dialogs.ChooseQuickButtonDialog
import com.sduduzog.slimlauncher.utils.BaseFragment
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.android.synthetic.main.customize_quick_buttons_fragment.customize_quick_buttons_fragment
import kotlinx.android.synthetic.main.customize_quick_buttons_fragment.customize_quick_buttons_fragment_back
import kotlinx.android.synthetic.main.customize_quick_buttons_fragment.customize_quick_buttons_fragment_center
import kotlinx.android.synthetic.main.customize_quick_buttons_fragment.customize_quick_buttons_fragment_left
import kotlinx.android.synthetic.main.customize_quick_buttons_fragment.customize_quick_buttons_fragment_right
Expand Down Expand Up @@ -42,6 +43,9 @@ class CustomizeQuickButtonsFragment : BaseFragment() {
.setImageResource(QuickButtonPreferencesRepository.RES_BY_ICON.getValue(prefs.rightButton.iconId))
}

customize_quick_buttons_fragment_back.setOnClickListener {
requireActivity().onBackPressedDispatcher.onBackPressed()
}
customize_quick_buttons_fragment_left.setOnClickListener {
ChooseQuickButtonDialog(
prefsRepo,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import com.sduduzog.slimlauncher.ui.dialogs.ChooseSearchBarPositionDialog
import com.sduduzog.slimlauncher.utils.BaseFragment
import com.sduduzog.slimlauncher.utils.createTitleAndSubtitleText
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.android.synthetic.main.customize_app_drawer_fragment_search_field_options.customise_apps_fragment_back
import kotlinx.android.synthetic.main.customize_app_drawer_fragment_search_field_options.customize_app_drawer_fragment_search_field_options

import kotlinx.android.synthetic.main.customize_app_drawer_fragment_search_field_options.customize_app_drawer_fragment_search_field_position
Expand Down Expand Up @@ -40,6 +41,10 @@ class CustomizeSearchFieldFragment : BaseFragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)

customise_apps_fragment_back.setOnClickListener{
requireActivity().onBackPressedDispatcher.onBackPressed()
}

setupShowSearchBarSwitch()
setupSearchBarPositionOption()
setupKeyboardSwitch()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ class OptionsFragment : BaseFragment() {
val intent = Intent(Settings.ACTION_SETTINGS)
launchActivity(it, intent)
}
options_fragment_back.setOnClickListener{
requireActivity().onBackPressedDispatcher.onBackPressed()
}
options_fragment_device_settings.setOnLongClickListener {
val intent = Intent(Settings.ACTION_HOME_SETTINGS)
launchActivity(it, intent)
Expand Down
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/ic_back.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:autoMirrored="true"
android:height="24dp" android:width="24dp"
android:viewportHeight="24" android:viewportWidth="24">
<path
android:fillColor="?attr/colorAccent"
android:pathData="M20,11H7.83l5.59,-5.59L12,4l-8,8 8,8 1.41,-1.41L7.83,13H20v-2z"/>
</vector>
16 changes: 3 additions & 13 deletions app/src/main/res/layout/add_app_fragment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,15 @@
android:id="@+id/add_app_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/_8sdp"
android:layout_marginStart="@dimen/_16sdp"
android:layout_marginEnd="@dimen/_16sdp"
tools:context=".ui.options.AddAppFragment">

<EditText
android:id="@+id/add_app_fragment_edit_text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="32dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:ems="10"
android:imeOptions="actionDone"
android:inputType="none|textNoSuggestions|textCapWords"
Expand All @@ -30,10 +28,6 @@
android:id="@+id/add_app_fragment_list"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
Expand All @@ -46,11 +40,7 @@
style="?android:attr/progressBarStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
Expand Down
33 changes: 20 additions & 13 deletions app/src/main/res/layout/customise_apps_fragment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,33 @@
android:id="@+id/customise_apps_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="@dimen/_8sdp"
android:layout_marginStart="@dimen/_16sdp"
android:layout_marginEnd="@dimen/_16sdp"
tools:context=".ui.options.CustomiseAppsFragment">

<TextView
android:id="@+id/textView6"
<ImageView
android:id="@+id/customise_apps_fragment_back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/_8sdp"
android:padding="@dimen/_8ssp"
android:paddingStart="0dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:srcCompat="@drawable/ic_back"
android:contentDescription="@string/content_description_back"
tools:ignore="RtlSymmetry" />
<TextView
android:id="@+id/customise_apps_fragment_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textColor="?headerTextColor"
android:layout_marginTop="@dimen/_8sdp"
android:text="@string/options_fragment_customise_apps"
android:textAppearance="@style/TextAppearance.AppCompat"
android:textSize="@dimen/font_size_customize_title"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintStart_toEndOf="@+id/customise_apps_fragment_back"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/customise_apps_fragment_list"
android:layout_width="0dp"
Expand All @@ -32,11 +40,10 @@
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView6"
app:layout_constraintTop_toBottomOf="@+id/customise_apps_fragment_title"
app:layout_constraintBottom_toBottomOf="parent"
tools:itemCount="5"
tools:listitem="@layout/customise_apps_fragment_list_item" />

<TextView
android:id="@+id/customise_apps_fragment_add"
android:layout_width="wrap_content"
Expand All @@ -48,7 +55,6 @@
android:textSize="@dimen/font_size_add_apps_action"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" />

<TextView
android:id="@+id/customise_apps_fragment_remove_all"
android:layout_width="wrap_content"
Expand All @@ -59,4 +65,5 @@
android:textSize="@dimen/font_size_add_apps_action"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>
2 changes: 0 additions & 2 deletions app/src/main/res/layout/customise_apps_fragment_list_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
android:id="@+id/ca_list_item_app_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:ellipsize="end"
android:maxLines="1"
android:singleLine="true"
Expand Down
33 changes: 28 additions & 5 deletions app/src/main/res/layout/customize_app_drawer_app_list_fragment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,44 @@
android:id="@+id/customize_app_drawer_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginStart="@dimen/_16sdp"
android:layout_marginEnd="@dimen/_16sdp"
android:layout_marginTop="@dimen/_8sdp"
tools:context=".ui.options.CustomizeAppDrawerFragment">

<ImageView
android:id="@+id/customize_app_drawer_fragment_back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/_8ssp"
android:paddingStart="0dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:srcCompat="@drawable/ic_back"
android:contentDescription="@string/content_description_back"
tools:ignore="RtlSymmetry" />
<TextView
android:id="@+id/customize_app_drawer_fragment_app_list_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textColor="?headerTextColor"
android:text="@string/customize_app_drawer_fragment_visible_apps"
android:textAppearance="@style/TextAppearance.AppCompat"
android:textSize="@dimen/font_size_customize_title"
app:layout_constraintStart_toEndOf="@+id/customize_app_drawer_fragment_back"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/customize_app_drawer_fragment_app_list"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginTop="@dimen/_16sdp"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintTop_toBottomOf="@+id/customize_app_drawer_fragment_app_list_title"
tools:listitem="@layout/customize_app_drawer_fragment_app_list_item" />

<ProgressBar
Expand Down
Loading

0 comments on commit da163e7

Please sign in to comment.