Skip to content

Commit

Permalink
refactor: apply spotless check
Browse files Browse the repository at this point in the history
  • Loading branch information
WhiredPlanck committed Aug 6, 2022
1 parent c6db387 commit f36ff94
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ object ThemeManager {
}
return sharedThemes + userThemes
}
}
}
3 changes: 2 additions & 1 deletion app/src/main/java/com/osfans/trime/ime/keyboard/Sound.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ public Sound(String soundPackageName) {

Map<String, ?> m = ConfigGetter.loadMap(soundPackageName + ".sound", "");
if (m != null) {
String path = appPrefs.getUserData().getUserDataDir() + File.separator + "sound" + File.separator;
String path =
appPrefs.getUserData().getUserDataDir() + File.separator + "sound" + File.separator;
if (m.containsKey("folder")) path = path + m.get("folder") + File.separator;

if (m.containsKey("sound")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ class MainViewModel : ViewModel() {
fun disableTopOptionsMenu() {
topOptionsMenu.value = false
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ class PrefMainActivity :
override fun onOptionsItemSelected(item: MenuItem): Boolean {
return when (item.itemId) {
R.id.preference__menu_deploy -> {
lifecycleScope.withLoadingDialog(this, 200L, R.string.deploy_progress
lifecycleScope.withLoadingDialog(
this, 200L, R.string.deploy_progress
) {
withContext(Dispatchers.IO) {
Rime.destroy()
Expand Down
44 changes: 24 additions & 20 deletions app/src/main/java/com/osfans/trime/util/DialogUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,30 @@ import kotlinx.coroutines.launch
fun Context.ProgressBarDialogIndeterminate(@StringRes titleId: Int): AlertDialog.Builder {
return AlertDialog.Builder(this, R.style.Theme_AppCompat_DayNight_Dialog_Alert)
.setTitle(titleId)
.setView(LinearLayout(this).apply {
orientation = LinearLayout.VERTICAL
addView(
ProgressBar(this@ProgressBarDialogIndeterminate,
null, android.R.attr.progressBarStyleHorizontal).apply {
isIndeterminate = true
},
ViewGroup.MarginLayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT
).apply {
val verticalMargin = SizeUtils.dp2px(26F)
val horizontalMargin = SizeUtils.dp2px(20F)
topMargin = horizontalMargin
bottomMargin = horizontalMargin
leftMargin = verticalMargin
rightMargin = verticalMargin
}
)
})
.setView(
LinearLayout(this).apply {
orientation = LinearLayout.VERTICAL
addView(
ProgressBar(
this@ProgressBarDialogIndeterminate,
null, android.R.attr.progressBarStyleHorizontal
).apply {
isIndeterminate = true
},
ViewGroup.MarginLayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT
).apply {
val verticalMargin = SizeUtils.dp2px(26F)
val horizontalMargin = SizeUtils.dp2px(20F)
topMargin = horizontalMargin
bottomMargin = horizontalMargin
leftMargin = verticalMargin
rightMargin = verticalMargin
}
)
}
)
.setCancelable(false)
}

Expand Down

0 comments on commit f36ff94

Please sign in to comment.