Skip to content

Commit fb759ba

Browse files
Merge branch 'main' into translate_main
2 parents 279e55a + d343e12 commit fb759ba

20 files changed

+409
-43
lines changed

.github/workflows/changelog.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
fetch-depth: 0
2020

2121
- name: Generate a changelog
22-
uses: orhun/git-cliff-action@v4.3.1
22+
uses: orhun/git-cliff-action@v4.4.0
2323
with:
2424
config: cliff.toml
2525
args: --verbose

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,20 @@
22

33
All notable changes to this project will be documented in this file. See [conventional commits](https://www.conventionalcommits.org/) for commit guidelines.
44

5+
## [Coming Soon](https://github.com/DroidWorksStudio/EasyLauncher/tree/HEAD)
6+
7+
### Implemented Enhancements:
8+
9+
- Added Alarm Clock to HomeScreen. - ([d6050f3](https://github.com/DroidWorksStudio/EasyLauncher/commit/d6050f399f1428c2a71429578c076b40ba194d14))
10+
11+
### Bug Fixes:
12+
13+
- Fixed App Searching. - ([1f0d4c8](https://github.com/DroidWorksStudio/EasyLauncher/commit/1f0d4c8301d9f6ab088e115942f2f177f36882d9))
14+
15+
### Releases:
16+
17+
- Prepare for version 0.2.8 - ([b098564](https://github.com/DroidWorksStudio/EasyLauncher/commit/b098564570efceca1ae223737e01f67200a587bf))
18+
519
## [0.2.7](https://github.com/DroidWorksStudio/EasyLauncher/tree/0.2.7) - (23, November 2024)
620

721
### Implemented Enhancements:

app/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ android {
1919
applicationId = "app.easy.launcher"
2020
minSdk = 24
2121
targetSdk = 35
22-
versionCode = 27
23-
versionName = "0.2.7"
22+
versionCode = 28
23+
versionName = "0.2.8"
2424

2525
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
2626
manifestPlaceholders["internetPermission"] = "android.permission.INTERNET"

app/src/main/java/com/github/droidworksstudio/launcher/helper/AppHelper.kt

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package com.github.droidworksstudio.launcher.helper
22

33
import android.annotation.SuppressLint
44
import android.app.Activity
5+
import android.app.AlarmManager
56
import android.content.ActivityNotFoundException
67
import android.content.ComponentName
78
import android.content.Context
@@ -10,12 +11,17 @@ import android.content.res.Configuration
1011
import android.content.res.Resources
1112
import android.net.Uri
1213
import android.os.Build
14+
import android.text.SpannableStringBuilder
15+
import android.text.style.ImageSpan
1316
import android.util.Log
17+
import android.util.TypedValue
1418
import android.view.Gravity
1519
import android.view.View
1620
import android.view.Window
1721
import android.view.WindowInsets
1822
import android.widget.TextView
23+
import androidx.annotation.RequiresApi
24+
import androidx.appcompat.content.res.AppCompatResources
1925
import androidx.appcompat.widget.LinearLayoutCompat
2026
import androidx.navigation.NavOptions
2127
import com.github.droidworksstudio.common.showLongToast
@@ -172,6 +178,38 @@ class AppHelper @Inject constructor() {
172178
return dailyWordsArray[wordIndex]
173179
}
174180

181+
@RequiresApi(Build.VERSION_CODES.Q)
182+
fun getNextAlarm(context: Context, preferenceHelper: PreferenceHelper): CharSequence {
183+
val alarmManager = context.getSystemService(Context.ALARM_SERVICE) as AlarmManager
184+
val nextAlarmClock = alarmManager.nextAlarmClock
185+
186+
if (nextAlarmClock == null) return "No alarm is set."
187+
188+
val alarmTime = nextAlarmClock.triggerTime
189+
val formattedTime = SimpleDateFormat("EEE, MMM d hh:mm a", Locale.getDefault()).format(alarmTime)
190+
191+
val drawable = AppCompatResources.getDrawable(context, R.drawable.ic_alarm_clock)
192+
val fontSize = TypedValue.applyDimension(
193+
TypedValue.COMPLEX_UNIT_SP,
194+
(preferenceHelper.alarmClockTextSize / 1.5).toFloat(),
195+
context.resources.displayMetrics
196+
).toInt()
197+
198+
drawable?.setBounds(0, 0, fontSize, fontSize)
199+
200+
return SpannableStringBuilder(" ").apply {
201+
drawable?.let {
202+
setSpan(
203+
ImageSpan(it, ImageSpan.ALIGN_CENTER),
204+
0, 1,
205+
SpannableStringBuilder.SPAN_EXCLUSIVE_EXCLUSIVE
206+
)
207+
}
208+
append(" $formattedTime")
209+
}
210+
}
211+
212+
175213
fun shareApplicationButton(context: Context) {
176214
val shareIntent = Intent(Intent.ACTION_SEND)
177215
val description = context.getString(R.string.advanced_settings_share_application_description, context.getString(R.string.app_name))

app/src/main/java/com/github/droidworksstudio/launcher/helper/PreferenceHelper.kt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ class PreferenceHelper @Inject constructor(@ApplicationContext context: Context)
4343
get() = prefs.getBoolean(Constants.SHOW_DAILY_WORD, false)
4444
set(value) = prefs.edit().putBoolean(Constants.SHOW_DAILY_WORD, value).apply()
4545

46+
var showAlarmClock: Boolean
47+
get() = prefs.getBoolean(Constants.SHOW_ALARM_CLOCK, false)
48+
set(value) = prefs.edit().putBoolean(Constants.SHOW_ALARM_CLOCK, value).apply()
49+
4650
var showWeatherWidget: Boolean
4751
get() = prefs.getBoolean(Constants.SHOW_WEATHER_WIDGET, false)
4852
set(value) = prefs.edit().putBoolean(Constants.SHOW_WEATHER_WIDGET, value).apply()
@@ -59,6 +63,10 @@ class PreferenceHelper @Inject constructor(@ApplicationContext context: Context)
5963
get() = prefs.getInt(Constants.DATE_COLOR, setColor.toInt())
6064
set(value) = prefs.edit().putInt(Constants.DATE_COLOR, value).apply()
6165

66+
var alarmClockColor: Int
67+
get() = prefs.getInt(Constants.ALARM_CLOCK_COLOR, setColor.toInt())
68+
set(value) = prefs.edit().putInt(Constants.ALARM_CLOCK_COLOR, value).apply()
69+
6270
var timeColor: Int
6371
get() = prefs.getInt(Constants.TIME_COLOR, setColor.toInt())
6472
set(value) = prefs.edit().putInt(Constants.TIME_COLOR, value).apply()
@@ -127,6 +135,10 @@ class PreferenceHelper @Inject constructor(@ApplicationContext context: Context)
127135
get() = prefs.getInt(Constants.HOME_TIME_ALIGNMENT, Gravity.START)
128136
set(value) = prefs.edit().putInt(Constants.HOME_TIME_ALIGNMENT, value).apply()
129137

138+
var homeAlarmClockAlignment: Int
139+
get() = prefs.getInt(Constants.HOME_ALARM_CLOCK_ALIGNMENT, Gravity.START)
140+
set(value) = prefs.edit().putInt(Constants.HOME_ALARM_CLOCK_ALIGNMENT, value).apply()
141+
130142
var homeDailyWordAlignment: Int
131143
get() = prefs.getInt(Constants.HOME_DAILY_WORD_ALIGNMENT, Gravity.START)
132144
set(value) = prefs.edit().putInt(Constants.HOME_DAILY_WORD_ALIGNMENT, value).apply()
@@ -147,6 +159,10 @@ class PreferenceHelper @Inject constructor(@ApplicationContext context: Context)
147159
get() = prefs.getFloat(Constants.APP_TEXT_SIZE, 24f)
148160
set(value) = prefs.edit().putFloat(Constants.APP_TEXT_SIZE, value).apply()
149161

162+
var alarmClockTextSize: Float
163+
get() = prefs.getFloat(Constants.ALARM_CLOCK_TEXT_SIZE, 22f)
164+
set(value) = prefs.edit().putFloat(Constants.ALARM_CLOCK_TEXT_SIZE, value).apply()
165+
150166
var dailyWordTextSize: Float
151167
get() = prefs.getFloat(Constants.DAILY_WORD_TEXT_SIZE, 18f)
152168
set(value) = prefs.edit().putFloat(Constants.DAILY_WORD_TEXT_SIZE, value).apply()

app/src/main/java/com/github/droidworksstudio/launcher/ui/bottomsheetdialog/AlignmentBottomSheetDialogFragment.kt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ class AlignmentBottomSheetDialogFragment : BottomSheetDialogFragment() {
7777
binding.selectWordTextSize.apply {
7878
text = appHelper.gravityToString(preferenceHelper.homeDailyWordAlignment)
7979
}
80+
81+
binding.selectAlarmClockTextSize.apply {
82+
text = appHelper.gravityToString(preferenceHelper.homeAlarmClockAlignment)
83+
}
8084
}
8185

8286
private fun observeClickListener() {
@@ -99,6 +103,11 @@ class AlignmentBottomSheetDialogFragment : BottomSheetDialogFragment() {
99103
selectedAlignment = REQUEST_KEY_WORD_ALIGNMENT
100104
showListDialog(selectedAlignment)
101105
}
106+
107+
binding.bottomAlignmentAlarmClockView.setOnClickListener {
108+
selectedAlignment = REQUEST_KEY_ALARM_CLOCK_ALIGNMENT
109+
showListDialog(selectedAlignment)
110+
}
102111
}
103112

104113

@@ -144,6 +153,14 @@ class AlignmentBottomSheetDialogFragment : BottomSheetDialogFragment() {
144153
binding.selectWordTextSize
145154
)
146155
}
156+
157+
REQUEST_KEY_ALARM_CLOCK_ALIGNMENT -> {
158+
setAlignment(
159+
selectedAlignment,
160+
gravity,
161+
binding.selectAlarmClockTextSize
162+
)
163+
}
147164
}
148165
}
149166
dialog.show()
@@ -178,6 +195,11 @@ class AlignmentBottomSheetDialogFragment : BottomSheetDialogFragment() {
178195
alignmentGetter = { preferenceHelper.homeDailyWordAlignment }
179196
}
180197

198+
REQUEST_KEY_ALARM_CLOCK_ALIGNMENT -> {
199+
alignmentPreference = { preferenceViewModel.setHomeAlarmClockAppAlignment(it) }
200+
alignmentGetter = { preferenceHelper.homeAlarmClockAlignment }
201+
}
202+
181203
else -> return
182204
}
183205

@@ -190,6 +212,7 @@ class AlignmentBottomSheetDialogFragment : BottomSheetDialogFragment() {
190212
private const val REQUEST_KEY_DATE_ALIGNMENT = "REQUEST_KEY_DATE_ALIGNMENT"
191213
private const val REQUEST_KEY_TIME_ALIGNMENT = "REQUEST_KEY_TIME_ALIGNMENT"
192214
private const val REQUEST_KEY_APP_ALIGNMENT = "REQUEST_KEY_APP_ALIGNMENT"
215+
private const val REQUEST_KEY_ALARM_CLOCK_ALIGNMENT = "REQUEST_KEY_ALARM_CLOCK_ALIGNMENT"
193216
private const val REQUEST_KEY_WORD_ALIGNMENT = "REQUEST_KEY_WORD_ALIGNMENT"
194217
}
195218
}

app/src/main/java/com/github/droidworksstudio/launcher/ui/bottomsheetdialog/ColorBottomSheetDialogFragment.kt

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,11 @@ class ColorBottomSheetDialogFragment : BottomSheetDialogFragment() {
8080
setTextColor(preferenceHelper.batteryColor)
8181
}
8282

83+
binding.selectAlarmClockTextColor.apply {
84+
text = bottomDialogHelper.getColorText(preferenceHelper.alarmClockColor)
85+
setTextColor(preferenceHelper.alarmClockColor)
86+
}
87+
8388
binding.selectWordTextColor.apply {
8489
text = bottomDialogHelper.getColorText(preferenceHelper.dailyWordColor)
8590
setTextColor(preferenceHelper.dailyWordColor)
@@ -138,6 +143,14 @@ class ColorBottomSheetDialogFragment : BottomSheetDialogFragment() {
138143
)
139144
}
140145

146+
binding.bottomColorAlarmClockView.setOnClickListener {
147+
showColorPickerDialog(
148+
binding.selectAlarmClockTextColor,
149+
REQUEST_KEY_DAILY_ALARM_CLOCK_COLOR,
150+
preferenceHelper.alarmClockColor
151+
)
152+
}
153+
141154
binding.bottomColorWidgetBackgroundView.setOnClickListener {
142155
showColorPickerDialog(
143156
binding.selectWidgetBackgroundColor,
@@ -170,11 +183,6 @@ class ColorBottomSheetDialogFragment : BottomSheetDialogFragment() {
170183
setTextColor(pickedColor)
171184
}
172185
when (requestCode) {
173-
REQUEST_KEY_DAILY_WORD_COLOR -> {
174-
preferenceViewModel.setDailyWordColor(pickedColor)
175-
Log.d("Tag", "Settings Daily Color: ${Integer.toHexString(pickedColor)}")
176-
}
177-
178186
REQUEST_KEY_BATTERY_COLOR -> {
179187
preferenceViewModel.setBatteryColor(pickedColor)
180188
Log.d("Tag", "Settings Battery Color: ${Integer.toHexString(pickedColor)}")
@@ -195,6 +203,16 @@ class ColorBottomSheetDialogFragment : BottomSheetDialogFragment() {
195203
Log.d("Tag", "Settings Time Color: ${Integer.toHexString(color)}")
196204
}
197205

206+
REQUEST_KEY_DAILY_ALARM_CLOCK_COLOR -> {
207+
preferenceViewModel.setAlarmClockColor(pickedColor)
208+
Log.d("Tag", "Settings Alarm Clock Color: ${Integer.toHexString(pickedColor)}")
209+
}
210+
211+
REQUEST_KEY_DAILY_WORD_COLOR -> {
212+
preferenceViewModel.setDailyWordColor(pickedColor)
213+
Log.d("Tag", "Settings Daily Word Color: ${Integer.toHexString(pickedColor)}")
214+
}
215+
198216
REQUEST_KEY_WIDGET_BACKGROUND_COLOR -> {
199217
preferenceViewModel.setWidgetBackgroundColor(pickedColor)
200218
Log.d("Tag", "Settings Widget Background Color: ${Integer.toHexString(color)}")
@@ -213,6 +231,7 @@ class ColorBottomSheetDialogFragment : BottomSheetDialogFragment() {
213231
companion object {
214232
private const val REQUEST_KEY_DATE_COLOR = "REQUEST_DATE_COLOR"
215233
private const val REQUEST_KEY_TIME_COLOR = "REQUEST_TIME_COLOR"
234+
private const val REQUEST_KEY_DAILY_ALARM_CLOCK_COLOR = "REQUEST_KEY_DAILY_ALARM_CLOCK_COLOR"
216235
private const val REQUEST_KEY_DAILY_WORD_COLOR = "REQUEST_DAILY_WORD_COLOR"
217236
private const val REQUEST_KEY_APP_COLOR = "REQUEST_APP_COLOR"
218237
private const val REQUEST_KEY_BATTERY_COLOR = "REQUEST_BATTERY_COLOR"

app/src/main/java/com/github/droidworksstudio/launcher/ui/bottomsheetdialog/TextBottomSheetDialogFragment.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,24 +57,32 @@ class TextBottomSheetDialogFragment : BottomSheetDialogFragment() {
5757
binding.selectTimeTextSize.setText("${preferenceHelper.timeTextSize}")
5858
binding.selectAppTextSize.setText("${preferenceHelper.appTextSize}")
5959
binding.selectBatteryTextSize.setText("${preferenceHelper.batteryTextSize}")
60+
binding.selectAlarmClockTextSize.setText("${preferenceHelper.alarmClockTextSize}")
61+
binding.selectDailyWordTextSize.setText("${preferenceHelper.dailyWordTextSize}")
6062
}
6163

6264
private fun observeValueChange() {
6365
val dateValue = binding.selectDateTextSize.text.toString()
6466
val timeValue = binding.selectTimeTextSize.text.toString()
6567
val appValue = binding.selectAppTextSize.text.toString()
6668
val batteryValue = binding.selectBatteryTextSize.text.toString()
69+
val alarmValue = binding.selectAlarmClockTextSize.text.toString()
70+
val wordValue = binding.selectDailyWordTextSize.text.toString()
6771

6872
val dateFloatValue = parseFloatValue(dateValue, preferenceHelper.dateTextSize)
6973
val timeFloatValue = parseFloatValue(timeValue, preferenceHelper.timeTextSize)
7074
val appFloatValue = parseFloatValue(appValue, preferenceHelper.appTextSize)
7175
val batteryFloatValue = parseFloatValue(batteryValue, preferenceHelper.batteryTextSize)
76+
val alarmFloatValue = parseFloatValue(alarmValue, preferenceHelper.alarmClockTextSize)
77+
val wordFloatValue = parseFloatValue(wordValue, preferenceHelper.dailyWordTextSize)
7278
dismiss()
7379

7480
preferenceViewModel.setDateTextSize(dateFloatValue)
7581
preferenceViewModel.setTimeTextSize(timeFloatValue)
7682
preferenceViewModel.setAppTextSize(appFloatValue)
7783
preferenceViewModel.setBatteryTextSize(batteryFloatValue)
84+
preferenceViewModel.setAlarmClockTextSize(alarmFloatValue)
85+
preferenceViewModel.setDailyWordTextSize(wordFloatValue)
7886
}
7987

8088
private fun parseFloatValue(text: String, defaultValue: Float): Float {

app/src/main/java/com/github/droidworksstudio/launcher/ui/drawer/DrawFragment.kt

Lines changed: 25 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ class DrawFragment : Fragment(),
143143
val searchQuery = trimmedQuery.substringAfter("!")
144144
requireContext().searchCustomSearchEngine(preferenceHelper, searchQuery)
145145
} else {
146-
checkAppThenRun(trimmedQuery)
146+
searchApp(trimmedQuery, false)
147147
return true // Exit the function
148148
}
149149
}
@@ -152,7 +152,7 @@ class DrawFragment : Fragment(),
152152
}
153153

154154
override fun onQueryTextChange(newText: String?): Boolean {
155-
searchApp(newText.toString())
155+
searchApp(newText.toString(), true)
156156
return true
157157
}
158158
})
@@ -188,31 +188,7 @@ class DrawFragment : Fragment(),
188188
}
189189
}
190190

191-
private fun checkAppThenRun(query: String) {
192-
val searchQuery = "%$query%"
193-
194-
// Launch a coroutine tied to the lifecycle of the view
195-
viewLifecycleOwner.lifecycleScope.launch {
196-
// Use repeatOnLifecycle to manage the lifecycle state
197-
repeatOnLifecycle(Lifecycle.State.CREATED) {
198-
val trimmedQuery = searchQuery.trim()
199-
viewModel.searchAppInfo().collect { searchResults ->
200-
val numberOfItemsLeft = searchResults.size
201-
val appResults = searchResults.firstOrNull()
202-
if (numberOfItemsLeft == 0 && !requireContext().searchOnPlayStore(trimmedQuery)) {
203-
requireContext().openSearch(trimmedQuery)
204-
} else {
205-
appResults?.let { appInfo ->
206-
observeBioAuthCheck(appInfo)
207-
}
208-
drawAdapter.submitList(searchResults)
209-
}
210-
}
211-
}
212-
}
213-
}
214-
215-
private fun searchApp(query: String) {
191+
private fun searchApp(query: String, isSearching: Boolean) {
216192
// Launch a coroutine tied to the lifecycle of the view
217193
viewLifecycleOwner.lifecycleScope.launch {
218194
// Repeat the block when the lifecycle is at least CREATED
@@ -260,16 +236,30 @@ class DrawFragment : Fragment(),
260236
val numberOfItemsLeft = finalResults.size
261237
val appResults = finalResults.firstOrNull()
262238

263-
when (numberOfItemsLeft) {
264-
1 -> {
265-
appResults?.let { appInfo ->
266-
if (preferenceHelper.automaticOpenApp) observeBioAuthCheck(appInfo)
239+
if (isSearching) {
240+
when (numberOfItemsLeft) {
241+
1 -> {
242+
appResults?.let { appInfo ->
243+
if (preferenceHelper.automaticOpenApp) observeBioAuthCheck(appInfo)
244+
}
245+
drawAdapter.submitList(finalResults)
267246
}
268-
drawAdapter.submitList(finalResults)
269-
}
270247

271-
else -> {
272-
drawAdapter.submitList(finalResults)
248+
else -> {
249+
drawAdapter.submitList(finalResults)
250+
}
251+
}
252+
if (trimmedQuery.isEmpty()) {
253+
drawAdapter.submitList(searchResults)
254+
}
255+
} else {
256+
if (numberOfItemsLeft == 0 && !requireContext().searchOnPlayStore(trimmedQuery)) {
257+
requireContext().openSearch(trimmedQuery)
258+
} else {
259+
appResults?.let { appInfo ->
260+
observeBioAuthCheck(appInfo)
261+
}
262+
drawAdapter.submitList(searchResults)
273263
}
274264
}
275265
}

0 commit comments

Comments
 (0)