Feat: Added Swipe Actions / Options.
This commit is contained in:
@@ -12,6 +12,9 @@ object Constants {
|
|||||||
const val SHOW_STATUS_BAR = "SHOW_STATUS_BAR"
|
const val SHOW_STATUS_BAR = "SHOW_STATUS_BAR"
|
||||||
const val DOUBLE_TAP_LOCK = "DOUBLE_TAP_LOCK"
|
const val DOUBLE_TAP_LOCK = "DOUBLE_TAP_LOCK"
|
||||||
|
|
||||||
|
const val SWIPE_NOTIFICATION = "SWIPE_NOTIFICATION"
|
||||||
|
const val SWIPE_SEARCH = "SWIPE_SEARCH"
|
||||||
|
|
||||||
const val DATE_COLOR = "DATE_COLOR"
|
const val DATE_COLOR = "DATE_COLOR"
|
||||||
const val TIME_COLOR = "TIME_COLOR"
|
const val TIME_COLOR = "TIME_COLOR"
|
||||||
const val BATTERY_COLOR = "BATTERY_COLOR"
|
const val BATTERY_COLOR = "BATTERY_COLOR"
|
||||||
|
|||||||
@@ -109,4 +109,12 @@ class PreferenceHelper @Inject constructor(@ApplicationContext context: Context)
|
|||||||
var tapLockScreen: Boolean
|
var tapLockScreen: Boolean
|
||||||
get() = prefs.getBoolean(Constants.DOUBLE_TAP_LOCK, false)
|
get() = prefs.getBoolean(Constants.DOUBLE_TAP_LOCK, false)
|
||||||
set(value) = prefs.edit().putBoolean(Constants.DOUBLE_TAP_LOCK, value).apply()
|
set(value) = prefs.edit().putBoolean(Constants.DOUBLE_TAP_LOCK, value).apply()
|
||||||
|
|
||||||
|
var swipeNotification: Boolean
|
||||||
|
get() = prefs.getBoolean(Constants.SWIPE_NOTIFICATION, true)
|
||||||
|
set(value) = prefs.edit().putBoolean(Constants.SWIPE_NOTIFICATION, value).apply()
|
||||||
|
|
||||||
|
var swipeSearch: Boolean
|
||||||
|
get() = prefs.getBoolean(Constants.SWIPE_SEARCH, false)
|
||||||
|
set(value) = prefs.edit().putBoolean(Constants.SWIPE_SEARCH, value).apply()
|
||||||
}
|
}
|
||||||
@@ -288,11 +288,11 @@ class HomeFragment : Fragment(), OnItemClickedListener.OnAppsClickedListener,
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onTopReached() {
|
override fun onTopReached() {
|
||||||
appHelper.expandNotificationDrawer(context)
|
if (preferenceHelper.swipeNotification) appHelper.expandNotificationDrawer(context)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onBottomReached() {
|
override fun onBottomReached() {
|
||||||
appHelper.searchView(context)
|
if (preferenceHelper.swipeSearch) appHelper.searchView(context)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onScroll(isTopReached: Boolean, isBottomReached: Boolean) {
|
override fun onScroll(isTopReached: Boolean, isBottomReached: Boolean) {
|
||||||
|
|||||||
@@ -61,6 +61,9 @@ class SettingsFragment : Fragment(), ScrollEventListener {
|
|||||||
|
|
||||||
initializeInjectedDependencies()
|
initializeInjectedDependencies()
|
||||||
observeClickListener()
|
observeClickListener()
|
||||||
|
|
||||||
|
val packageInfo = requireContext().packageManager.getPackageInfo(requireContext().packageName, 0)
|
||||||
|
binding.versionInfo.text = getString(R.string.settings_version, getString(R.string.app_name), packageInfo.versionName)
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n")
|
@SuppressLint("SetTextI18n")
|
||||||
@@ -73,7 +76,9 @@ class SettingsFragment : Fragment(), ScrollEventListener {
|
|||||||
binding.dateSwitchCompat.isChecked = preferenceHelper.showDate
|
binding.dateSwitchCompat.isChecked = preferenceHelper.showDate
|
||||||
binding.batterySwitchCompat.isChecked = preferenceHelper.showBattery
|
binding.batterySwitchCompat.isChecked = preferenceHelper.showBattery
|
||||||
binding.dailyWordSwitchCompat.isChecked = preferenceHelper.showDailyWord
|
binding.dailyWordSwitchCompat.isChecked = preferenceHelper.showDailyWord
|
||||||
binding.gesturesLockSwitchCompat1.isChecked = preferenceHelper.tapLockScreen
|
binding.gesturesLockSwitchCompat.isChecked = preferenceHelper.tapLockScreen
|
||||||
|
binding.gesturesNotificationSwitchCompat.isChecked = preferenceHelper.swipeNotification
|
||||||
|
binding.gesturesSearchSwitchCompat.isChecked = preferenceHelper.swipeSearch
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun observeClickListener() {
|
private fun observeClickListener() {
|
||||||
@@ -139,10 +144,18 @@ class SettingsFragment : Fragment(), ScrollEventListener {
|
|||||||
preferenceViewModel.setShowDailyWord(isChecked)
|
preferenceViewModel.setShowDailyWord(isChecked)
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.gesturesLockSwitchCompat1.setOnCheckedChangeListener { _, isChecked ->
|
binding.gesturesLockSwitchCompat.setOnCheckedChangeListener { _, isChecked ->
|
||||||
appHelper.enableAppAsAccessibilityService(requireContext(), preferenceHelper.tapLockScreen)
|
appHelper.enableAppAsAccessibilityService(requireContext(), preferenceHelper.tapLockScreen)
|
||||||
preferenceViewModel.setDoubleTapLock(isChecked)
|
preferenceViewModel.setDoubleTapLock(isChecked)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
binding.gesturesNotificationSwitchCompat.setOnCheckedChangeListener { _, isChecked ->
|
||||||
|
preferenceViewModel.setSwipeNotification(isChecked)
|
||||||
|
}
|
||||||
|
|
||||||
|
binding.gesturesSearchSwitchCompat.setOnCheckedChangeListener { _, isChecked ->
|
||||||
|
preferenceViewModel.setSwipeSearch(isChecked)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onTopReached() {
|
override fun onTopReached() {
|
||||||
|
|||||||
@@ -31,6 +31,8 @@ class PreferenceViewModel @Inject constructor(
|
|||||||
val appTextSizeLiveData: MutableLiveData<Float> = MutableLiveData()
|
val appTextSizeLiveData: MutableLiveData<Float> = MutableLiveData()
|
||||||
val batteryTextSizeLiveData: MutableLiveData<Float> = MutableLiveData()
|
val batteryTextSizeLiveData: MutableLiveData<Float> = MutableLiveData()
|
||||||
val tapLockScreenLiveData: MutableLiveData<Boolean> = MutableLiveData()
|
val tapLockScreenLiveData: MutableLiveData<Boolean> = MutableLiveData()
|
||||||
|
val swipeNotificationLiveData: MutableLiveData<Boolean> = MutableLiveData()
|
||||||
|
val swipeSearchLiveData: MutableLiveData<Boolean> = MutableLiveData()
|
||||||
val appPaddingSizeLiveData: MutableLiveData<Float> = MutableLiveData()
|
val appPaddingSizeLiveData: MutableLiveData<Float> = MutableLiveData()
|
||||||
|
|
||||||
fun setFirstLaunch(firstLaunch: Boolean) {
|
fun setFirstLaunch(firstLaunch: Boolean) {
|
||||||
@@ -137,4 +139,14 @@ class PreferenceViewModel @Inject constructor(
|
|||||||
preferenceHelper.tapLockScreen = tapLockScreen
|
preferenceHelper.tapLockScreen = tapLockScreen
|
||||||
tapLockScreenLiveData.postValue((preferenceHelper.tapLockScreen))
|
tapLockScreenLiveData.postValue((preferenceHelper.tapLockScreen))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun setSwipeNotification(swipeNotification: Boolean){
|
||||||
|
preferenceHelper.swipeNotification = swipeNotification
|
||||||
|
swipeNotificationLiveData.postValue((preferenceHelper.swipeNotification))
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setSwipeSearch(swipeSearch: Boolean){
|
||||||
|
preferenceHelper.swipeSearch = swipeSearch
|
||||||
|
swipeSearchLiveData.postValue((preferenceHelper.swipeSearch))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -34,6 +34,16 @@
|
|||||||
android:textSize="@dimen/text_super_large"
|
android:textSize="@dimen/text_super_large"
|
||||||
style="@style/TextDefaultStyle"/>
|
style="@style/TextDefaultStyle"/>
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
|
android:id="@+id/version_info"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginHorizontal="20dp"
|
||||||
|
android:layout_marginTop="18dp"
|
||||||
|
android:text="@string/settings_version"
|
||||||
|
android:textSize="@dimen/text_large"
|
||||||
|
style="@style/TextDefaultStyle"/>
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
android:id="@+id/set_launcher_selector"
|
android:id="@+id/set_launcher_selector"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@@ -439,7 +449,69 @@
|
|||||||
style="@style/TextDefaultStyle"/>
|
style="@style/TextDefaultStyle"/>
|
||||||
|
|
||||||
<androidx.appcompat.widget.SwitchCompat
|
<androidx.appcompat.widget.SwitchCompat
|
||||||
android:id="@+id/gestures_lock_switchCompat1"
|
android:id="@+id/gestures_lock_switchCompat"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:thumb="@drawable/shape_switch_thumb"
|
||||||
|
app:track="@drawable/selector_switch"
|
||||||
|
android:scaleY="0.8"
|
||||||
|
android:scaleX="0.7"/>
|
||||||
|
|
||||||
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginHorizontal="20dp"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
tools:ignore="MissingConstraints">
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
|
android:id="@+id/gestures_notification_text"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="left|center"
|
||||||
|
android:text="@string/settings_swipe_down_notification"
|
||||||
|
android:textSize="@dimen/text_large"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
tools:ignore="RtlHardcoded"
|
||||||
|
style="@style/TextDefaultStyle"/>
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.SwitchCompat
|
||||||
|
android:id="@+id/gestures_notification_switchCompat"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:thumb="@drawable/shape_switch_thumb"
|
||||||
|
app:track="@drawable/selector_switch"
|
||||||
|
android:scaleY="0.8"
|
||||||
|
android:scaleX="0.7"/>
|
||||||
|
|
||||||
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginHorizontal="20dp"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
tools:ignore="MissingConstraints">
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
|
android:id="@+id/gestures_search_text"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="left|center"
|
||||||
|
android:text="@string/settings_swipe_up_search"
|
||||||
|
android:textSize="@dimen/text_large"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
tools:ignore="RtlHardcoded"
|
||||||
|
style="@style/TextDefaultStyle"/>
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.SwitchCompat
|
||||||
|
android:id="@+id/gestures_search_switchCompat"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:thumb="@drawable/shape_switch_thumb"
|
android:thumb="@drawable/shape_switch_thumb"
|
||||||
@@ -473,66 +545,38 @@
|
|||||||
android:layout_marginHorizontal="20dp"
|
android:layout_marginHorizontal="20dp"
|
||||||
android:layout_marginBottom="20dp"
|
android:layout_marginBottom="20dp"
|
||||||
android:layout_weight="4"
|
android:layout_weight="4"
|
||||||
|
android:gravity="center"
|
||||||
tools:ignore="MissingConstraints">
|
tools:ignore="MissingConstraints">
|
||||||
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:id="@+id/rate_view"
|
|
||||||
android:text="@string/settings_title_others"
|
|
||||||
android:textSize="@dimen/text_large"
|
|
||||||
style="@style/TextDefaultStyle"
|
|
||||||
android:layout_weight="1"/>
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/share_view"
|
android:id="@+id/share_view"
|
||||||
android:text="@string/settings_title_others"
|
android:text="@string/settings_others_share"
|
||||||
android:textSize="@dimen/text_large"
|
android:textSize="@dimen/text_large"
|
||||||
style="@style/TextDefaultStyle"
|
android:layout_marginHorizontal="10dp"
|
||||||
android:layout_weight="1"/>
|
style="@style/TextDefaultStyle"/>
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/github_view"
|
android:id="@+id/github_view"
|
||||||
android:text="@string/settings_title_others"
|
android:text="@string/settings_others_github"
|
||||||
android:textSize="@dimen/text_large"
|
android:textSize="@dimen/text_large"
|
||||||
style="@style/TextDefaultStyle"
|
android:layout_marginHorizontal="10dp"
|
||||||
android:layout_weight="1"/>
|
style="@style/TextDefaultStyle"/>
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/feedback_view"
|
android:id="@+id/feedback_view"
|
||||||
android:text="@string/settings_title_others"
|
android:text="@string/settings_others_feedback"
|
||||||
android:textSize="@dimen/text_large"
|
android:textSize="@dimen/text_large"
|
||||||
style="@style/TextDefaultStyle"
|
android:layout_marginHorizontal="10dp"
|
||||||
android:layout_weight="1"/>
|
style="@style/TextDefaultStyle"/>
|
||||||
|
|
||||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
|
|
||||||
<androidx.appcompat.widget.LinearLayoutCompat
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:layout_marginHorizontal="20dp"
|
|
||||||
android:layout_marginBottom="20dp"
|
|
||||||
android:layout_weight="4"
|
|
||||||
tools:ignore="MissingConstraints">
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:id="@+id/version_info"
|
|
||||||
android:text="@string/settings_version"
|
|
||||||
android:textSize="@dimen/text_large"
|
|
||||||
style="@style/TextDefaultStyle"
|
|
||||||
android:layout_weight="1"/>
|
|
||||||
|
|
||||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
|
||||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
|
|
||||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
<string name="bottom_dialog_app_uninstall">Uninstall App</string>
|
<string name="bottom_dialog_app_uninstall">Uninstall App</string>
|
||||||
|
|
||||||
<string name="settings_name">Launcher Settings</string>
|
<string name="settings_name">Launcher Settings</string>
|
||||||
<string name="settings_version">Version</string>
|
<string name="settings_version">%s Version: %s</string>
|
||||||
<string name="settings_home">Home</string>
|
<string name="settings_home">Home</string>
|
||||||
|
|
||||||
<string name="settings_title_home_display_preferences">Display</string>
|
<string name="settings_title_home_display_preferences">Display</string>
|
||||||
@@ -71,8 +71,14 @@
|
|||||||
<string name="settings_manager_favorite">Favorite Apps</string>
|
<string name="settings_manager_favorite">Favorite Apps</string>
|
||||||
<string name="settings_manager_hidden">Hidden Apps</string>
|
<string name="settings_manager_hidden">Hidden Apps</string>
|
||||||
|
|
||||||
<string name="settings_double_tap_lock">Double tap to lock</string>
|
|
||||||
<string name="settings_select_wallpaper">Select Wallpaper</string>
|
<string name="settings_select_wallpaper">Select Wallpaper</string>
|
||||||
|
<string name="settings_double_tap_lock">Double tap to lock</string>
|
||||||
|
<string name="settings_swipe_down_notification">Swipe down expand notification</string>
|
||||||
|
<string name="settings_swipe_up_search">Swipe up open search view</string>
|
||||||
|
|
||||||
|
<string name="settings_others_share">Share</string>
|
||||||
|
<string name="settings_others_feedback">Feedback</string>
|
||||||
|
<string name="settings_others_github">Github</string>
|
||||||
|
|
||||||
<string name="authentication_title">Authentication</string>
|
<string name="authentication_title">Authentication</string>
|
||||||
<string name="authentication_subtitle">Please login to get access</string>
|
<string name="authentication_subtitle">Please login to get access</string>
|
||||||
|
|||||||
Reference in New Issue
Block a user