Skip to content

Commit cb0d24a

Browse files
committed
Fix format
Signed-off-by: utzcoz <[email protected]>
1 parent 84582b4 commit cb0d24a

File tree

7 files changed

+45
-121
lines changed

7 files changed

+45
-121
lines changed

app/src/main/java/com/boringdroid/systemui/AllAppsLayout.kt

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,8 @@ import androidx.recyclerview.widget.RecyclerView
1414

1515
class AllAppsLayout
1616
@JvmOverloads
17-
constructor(
18-
context: Context,
19-
attrs: AttributeSet? = null,
20-
defStyle: Int = 0,
21-
) : RecyclerView(context, attrs, defStyle) {
17+
constructor(context: Context, attrs: AttributeSet? = null, defStyle: Int = 0) :
18+
RecyclerView(context, attrs, defStyle) {
2219
private val appListAdapter: AppListAdapter
2320

2421
fun setData(apps: List<AppData?>?) {
@@ -35,20 +32,14 @@ constructor(
3532
private val apps: MutableList<AppData?> = ArrayList()
3633
private var handler: Handler? = null
3734

38-
override fun onCreateViewHolder(
39-
parent: ViewGroup,
40-
viewType: Int,
41-
): ViewHolder {
35+
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
4236
val appInfoLayout =
4337
LayoutInflater.from(context).inflate(R.layout.layout_app_info, parent, false)
4438
as ViewGroup
4539
return ViewHolder(appInfoLayout)
4640
}
4741

48-
override fun onBindViewHolder(
49-
holder: ViewHolder,
50-
position: Int,
51-
) {
42+
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
5243
val appData = apps[position]
5344
holder.iconIV.setImageDrawable(appData!!.icon)
5445
holder.nameTV.text = appData.name
@@ -79,9 +70,7 @@ constructor(
7970
}
8071

8172
private class ViewHolder(val appInfoLayout: ViewGroup) :
82-
RecyclerView.ViewHolder(
83-
appInfoLayout,
84-
) {
73+
RecyclerView.ViewHolder(appInfoLayout) {
8574
val iconIV: ImageView = appInfoLayout.findViewById(R.id.app_info_icon)
8675
val nameTV: TextView = appInfoLayout.findViewById(R.id.app_info_name)
8776
}

app/src/main/java/com/boringdroid/systemui/AllAppsWindow.kt

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,7 @@ class AllAppsWindow(private val mContext: Context?) : View.OnClickListener {
4646
val cornerRadius = mContext.resources.getDimension(R.dimen.all_apps_corner_radius)
4747
windowContentView!!.outlineProvider =
4848
object : ViewOutlineProvider() {
49-
override fun getOutline(
50-
view: View,
51-
outline: Outline,
52-
) {
49+
override fun getOutline(view: View, outline: Outline) {
5350
outline.setRoundRect(0, 0, view.width, view.height, cornerRadius)
5451
}
5552
}
@@ -117,15 +114,15 @@ class AllAppsWindow(private val mContext: Context?) : View.OnClickListener {
117114
override fun run(allAppsWindow: AllAppsWindow?) {
118115
allAppsWindow!!.notifyLoadSucceed()
119116
}
120-
},
117+
}
121118
)
122119
HandlerConstant.H_DISMISS_ALL_APPS_WINDOW ->
123120
runMethodSafely(
124121
object : RunAllAppsWindowMethod {
125122
override fun run(allAppsWindow: AllAppsWindow?) {
126123
allAppsWindow!!.dismiss()
127124
}
128-
},
125+
}
129126
)
130127
else -> {
131128
// Do nothing

app/src/main/java/com/boringdroid/systemui/AppLoaderTask.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,7 @@ class AppLoaderTask(context: Context?, target: Handler?) : Runnable {
4545
loaderAllApps.add(appData)
4646
}
4747
loaderAllApps.sortWith { appDataOne: AppData, appDataTwo: AppData ->
48-
appDataOne.name!!.compareTo(
49-
appDataTwo.name!!,
50-
)
48+
appDataOne.name!!.compareTo(appDataTwo.name!!)
5149
}
5250
val target = target
5351
target?.sendEmptyMessage(HandlerConstant.H_LOAD_SUCCEED)

app/src/main/java/com/boringdroid/systemui/AppStateLayout.kt

Lines changed: 15 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,8 @@ import kotlin.math.abs
3232

3333
class AppStateLayout
3434
@JvmOverloads
35-
constructor(
36-
context: Context,
37-
attrs: AttributeSet? = null,
38-
defStyleAttr: Int = 0,
39-
) : RecyclerView(context, attrs, defStyleAttr) {
35+
constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0) :
36+
RecyclerView(context, attrs, defStyleAttr) {
4037
private val activityManager: ActivityManager
4138
private val appStateListener = AppStateListener()
4239
private val launchApps: LauncherApps
@@ -109,10 +106,7 @@ constructor(
109106
return false
110107
}
111108

112-
private fun topTask(
113-
runningTaskInfo: RunningTaskInfo,
114-
skipIgnoreCheck: Boolean = false,
115-
) {
109+
private fun topTask(runningTaskInfo: RunningTaskInfo, skipIgnoreCheck: Boolean = false) {
116110
val packageName = getRunningTaskInfoPackageName(runningTaskInfo)
117111
if (!skipIgnoreCheck && shouldIgnoreTopTask(runningTaskInfo.topActivity)) {
118112
taskAdapter!!.setTopTaskId(-1)
@@ -163,10 +157,7 @@ constructor(
163157
}
164158

165159
@VisibleForTesting
166-
fun isLauncher(
167-
context: Context,
168-
componentName: ComponentName?,
169-
): Boolean {
160+
fun isLauncher(context: Context, componentName: ComponentName?): Boolean {
170161
if (componentName == null) {
171162
return false
172163
}
@@ -193,10 +184,7 @@ constructor(
193184
}
194185

195186
private inner class AppStateListener : TaskStackChangeListener {
196-
override fun onTaskCreated(
197-
taskId: Int,
198-
componentName: ComponentName?,
199-
) {
187+
override fun onTaskCreated(taskId: Int, componentName: ComponentName?) {
200188
super.onTaskCreated(taskId, componentName)
201189
Log.d(TAG, "onTaskCreated $taskId, cm $componentName")
202190
onTaskStackChanged()
@@ -236,20 +224,14 @@ constructor(
236224
private var topTaskId = -1
237225
private val dragCloseThreshold: Int
238226

239-
override fun onCreateViewHolder(
240-
parent: ViewGroup,
241-
viewType: Int,
242-
): ViewHolder {
227+
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
243228
val taskInfoLayout =
244229
LayoutInflater.from(context).inflate(R.layout.layout_task_info, parent, false)
245230
as ViewGroup
246231
return ViewHolder(taskInfoLayout)
247232
}
248233

249-
override fun onBindViewHolder(
250-
holder: ViewHolder,
251-
position: Int,
252-
) {
234+
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
253235
val taskInfo = tasks[position]
254236
val packageName = taskInfo.packageName
255237
holder.iconIV.setImageDrawable(taskInfo.icon)
@@ -264,8 +246,8 @@ constructor(
264246
packageManager.getApplicationLabel(
265247
packageManager.getApplicationInfo(
266248
packageName!!,
267-
PackageManager.GET_META_DATA
268-
),
249+
PackageManager.GET_META_DATA,
250+
)
269251
)
270252
} catch (e: PackageManager.NameNotFoundException) {
271253
Log.e(TAG, "Failed to get label for $packageName")
@@ -274,23 +256,16 @@ constructor(
274256
holder.iconIV.tooltipText = label
275257
holder.iconIV.setOnClickListener {
276258
systemUIActivityManager.moveTaskToFront(taskInfo.id, 0)
277-
context.sendBroadcast(
278-
Intent("com.boringdroid.systemui.CLOSE_RECENTS"),
279-
)
259+
context.sendBroadcast(Intent("com.boringdroid.systemui.CLOSE_RECENTS"))
280260
}
281261
holder.iconIV.setOnLongClickListener { v: View ->
282262
val item = ClipData.Item(TAG_TASK_ICON)
283263
val dragData = ClipData(TAG_TASK_ICON, arrayOf("unknown"), item)
284264
val shadow: DragShadowBuilder = DragDropShadowBuilder(v)
285265
holder.iconIV.setOnDragListener(
286-
DragDropCloseListener(
287-
dragCloseThreshold,
288-
dragCloseThreshold,
289-
) { taskId: Int? ->
290-
AM_WRAPPER.removeTask(
291-
taskId!!,
292-
)
293-
},
266+
DragDropCloseListener(dragCloseThreshold, dragCloseThreshold) { taskId: Int? ->
267+
AM_WRAPPER.removeTask(taskId!!)
268+
}
294269
)
295270
v.startDragAndDrop(dragData, shadow, null, DRAG_FLAG_GLOBAL)
296271
true
@@ -343,10 +318,7 @@ constructor(
343318
private var startX = 0f
344319
private var startY = 0f
345320

346-
override fun onDrag(
347-
v: View,
348-
event: DragEvent,
349-
): Boolean {
321+
override fun onDrag(v: View, event: DragEvent): Boolean {
350322
when (event.action) {
351323
DragEvent.ACTION_DRAG_STARTED -> {
352324
val locations = IntArray(2)
@@ -372,10 +344,7 @@ constructor(
372344
}
373345

374346
private class DragDropShadowBuilder(v: View?) : DragShadowBuilder(v) {
375-
override fun onProvideShadowMetrics(
376-
size: Point,
377-
touch: Point,
378-
) {
347+
override fun onProvideShadowMetrics(size: Point, touch: Point) {
379348
val width = view.width
380349
val height = view.height
381350
shadow.setBounds(0, 0, width, height)

app/src/main/java/com/boringdroid/systemui/ClockAndStatus.kt

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,7 @@ class ClockAndStatus(
4040

4141
private val batteryReceiver =
4242
object : BroadcastReceiver() {
43-
override fun onReceive(
44-
context: Context,
45-
intent: Intent,
46-
) {
43+
override fun onReceive(context: Context, intent: Intent) {
4744
if (intent.action == Intent.ACTION_BATTERY_CHANGED) {
4845
updateBatteryLevel(intent)
4946
}
@@ -52,10 +49,7 @@ class ClockAndStatus(
5249

5350
private val wifiReceiver =
5451
object : BroadcastReceiver() {
55-
override fun onReceive(
56-
context: Context,
57-
intent: Intent,
58-
) {
52+
override fun onReceive(context: Context, intent: Intent) {
5953
if (intent.action == WifiManager.RSSI_CHANGED_ACTION) {
6054
updateWifiStrength()
6155
}
@@ -150,7 +144,7 @@ class ClockAndStatus(
150144
val drawable = ContextCompat.getDrawable(context, wifiLevelResourceId)
151145
drawable?.setColorFilter(
152146
ContextCompat.getColor(context, R.color.wifi_strength_color),
153-
PorterDuff.Mode.SRC_IN
147+
PorterDuff.Mode.SRC_IN,
154148
)
155149
return drawable
156150
}

app/src/main/java/com/boringdroid/systemui/SystemUIOverlay.kt

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,7 @@ class SystemUIOverlay : OverlayPlugin {
4343
private val tunerKeyObserver: ContentObserver = TunerKeyObserver()
4444
private val closeSystemDialogsReceiver: BroadcastReceiver =
4545
object : BroadcastReceiver() {
46-
override fun onReceive(
47-
context: Context,
48-
intent: Intent,
49-
) {
46+
override fun onReceive(context: Context, intent: Intent) {
5047
Log.d(TAG, "receive intent $intent")
5148
if (allAppsWindow == null) {
5249
return
@@ -58,10 +55,7 @@ class SystemUIOverlay : OverlayPlugin {
5855
}
5956
}
6057

61-
override fun setup(
62-
statusBar: View,
63-
navBar: View?,
64-
) {
58+
override fun setup(statusBar: View, navBar: View?) {
6559
Log.d(TAG, "setup status bar $statusBar, nav bar $navBar")
6660
if (navBarButtonGroupId > 0 && navBar != null) {
6761
val buttonGroup = navBar.findViewById<View>(navBarButtonGroupId)
@@ -100,7 +94,7 @@ class SystemUIOverlay : OverlayPlugin {
10094
val layoutParams1 =
10195
FrameLayout.LayoutParams(
10296
FrameLayout.LayoutParams.WRAP_CONTENT,
103-
FrameLayout.LayoutParams.WRAP_CONTENT
97+
FrameLayout.LayoutParams.WRAP_CONTENT,
10498
)
10599
layoutParams1.gravity = Gravity.END
106100
layoutParams1.width = FrameLayout.LayoutParams.WRAP_CONTENT
@@ -129,10 +123,7 @@ class SystemUIOverlay : OverlayPlugin {
129123
// Do nothing
130124
}
131125

132-
override fun onCreate(
133-
sysUIContext: Context,
134-
pluginContext: Context,
135-
) {
126+
override fun onCreate(sysUIContext: Context, pluginContext: Context) {
136127
systemUIContext = sysUIContext
137128
this.pluginContext = pluginContext
138129
navBarButtonGroupId =
@@ -208,19 +199,13 @@ class SystemUIOverlay : OverlayPlugin {
208199
}
209200

210201
@SuppressLint("InflateParams")
211-
private fun initializeAllAppsButton(
212-
context: Context?,
213-
btAllAppsGroup: ViewGroup?,
214-
): ViewGroup {
202+
private fun initializeAllAppsButton(context: Context?, btAllAppsGroup: ViewGroup?): ViewGroup {
215203
return btAllAppsGroup
216204
?: LayoutInflater.from(context).inflate(R.layout.layout_bt_all_apps, null) as ViewGroup
217205
}
218206

219207
@SuppressLint("InflateParams")
220-
private fun initializeClockAndStatus(
221-
context: Context?,
222-
clockAndStatus: ViewGroup?,
223-
): ViewGroup {
208+
private fun initializeClockAndStatus(context: Context?, clockAndStatus: ViewGroup?): ViewGroup {
224209
return clockAndStatus
225210
?: LayoutInflater.from(context).inflate(R.layout.layout_clock_and_status, null)
226211
as ViewGroup
@@ -247,10 +232,7 @@ class SystemUIOverlay : OverlayPlugin {
247232
}
248233

249234
private inner class TunerKeyObserver : ContentObserver(Handler(Looper.getMainLooper())) {
250-
override fun onChange(
251-
selfChange: Boolean,
252-
uri: Uri?,
253-
) {
235+
override fun onChange(selfChange: Boolean, uri: Uri?) {
254236
super.onChange(selfChange, uri)
255237
Log.d(TAG, "TunerKeyChanged $uri, self changed $selfChange")
256238
onTunerChange(uri!!)

0 commit comments

Comments
 (0)