Skip to content

Commit 47f1da8

Browse files
committed
Changes in battery %
1 parent 9afa930 commit 47f1da8

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

app/src/main/java/app/olauncher/ui/HomeFragment.kt

+17-11
Original file line numberDiff line numberDiff line change
@@ -161,14 +161,14 @@ class HomeFragment : Fragment(), View.OnClickListener, View.OnLongClickListener
161161
binding.dateTimeLayout.isVisible = prefs.dateTimeVisibility != Constants.DateTime.OFF
162162
binding.clock.isVisible = Constants.DateTime.isTimeVisible(prefs.dateTimeVisibility)
163163
binding.date.isVisible = Constants.DateTime.isDateVisible(prefs.dateTimeVisibility)
164-
val day = SimpleDateFormat("EEE, dd MMM", Locale.getDefault()).format(Date())
165-
if (prefs.showStatusBar)
166-
binding.date.text = day
167-
else {
164+
165+
var dateText = SimpleDateFormat("EEE, dd MMM", Locale.getDefault()).format(Date())
166+
if (!prefs.showStatusBar) {
168167
val battery = (requireContext().getSystemService(Context.BATTERY_SERVICE) as BatteryManager)
169168
.getIntProperty(BatteryManager.BATTERY_PROPERTY_CAPACITY)
170-
binding.date.text = getString(R.string.day_battery, day, battery)
169+
dateText = getString(R.string.day_battery, dateText, battery)
171170
}
171+
binding.date.text = dateText.replace(".,", ",")
172172
}
173173

174174
private fun populateHomeScreen(appCountUpdated: Boolean) {
@@ -266,11 +266,13 @@ class HomeFragment : Fragment(), View.OnClickListener, View.OnLongClickListener
266266

267267
private fun launchApp(appName: String, packageName: String, activityClassName: String?, userString: String) {
268268
viewModel.selectedApp(
269-
AppModel(appName,
269+
AppModel(
270+
appName,
270271
null,
271272
packageName,
272273
activityClassName,
273-
getUserHandleFromString(requireContext(), userString)),
274+
getUserHandleFromString(requireContext(), userString)
275+
),
274276
Constants.FLAG_LAUNCH_APP
275277
)
276278
}
@@ -307,20 +309,24 @@ class HomeFragment : Fragment(), View.OnClickListener, View.OnLongClickListener
307309
private fun openSwipeRightApp() {
308310
if (!prefs.swipeRightEnabled) return
309311
if (prefs.appPackageSwipeRight.isNotEmpty())
310-
launchApp(prefs.appNameSwipeRight,
312+
launchApp(
313+
prefs.appNameSwipeRight,
311314
prefs.appPackageSwipeRight,
312315
prefs.appActivityClassNameRight,
313-
android.os.Process.myUserHandle().toString())
316+
android.os.Process.myUserHandle().toString()
317+
)
314318
else openDialerApp(requireContext())
315319
}
316320

317321
private fun openSwipeLeftApp() {
318322
if (!prefs.swipeLeftEnabled) return
319323
if (prefs.appPackageSwipeLeft.isNotEmpty())
320-
launchApp(prefs.appNameSwipeLeft,
324+
launchApp(
325+
prefs.appNameSwipeLeft,
321326
prefs.appPackageSwipeLeft,
322327
prefs.appActivityClassNameSwipeLeft,
323-
android.os.Process.myUserHandle().toString())
328+
android.os.Process.myUserHandle().toString()
329+
)
324330
else openCameraApp(requireContext())
325331
}
326332

0 commit comments

Comments
 (0)