@@ -33,7 +33,6 @@ import com.osfans.trime.ui.setup.SetupActivity
3333import com.osfans.trime.util.ProgressBarDialogIndeterminate
3434import com.osfans.trime.util.applyTranslucentSystemBars
3535import com.osfans.trime.util.briefResultLogDialog
36- import com.osfans.trime.util.withLoadingDialog
3736import kotlinx.coroutines.Dispatchers
3837import kotlinx.coroutines.launch
3938import kotlinx.coroutines.withContext
@@ -143,26 +142,7 @@ class PrefMainActivity : AppCompatActivity() {
143142 override fun onOptionsItemSelected (item : MenuItem ): Boolean {
144143 return when (item.itemId) {
145144 R .id.preference__menu_deploy -> {
146- lifecycleScope.withLoadingDialog(
147- context = this ,
148- titleId = R .string.deploy_progress,
149- ) {
150- withContext(Dispatchers .IO ) {
151- Runtime .getRuntime().exec(arrayOf(" logcat" , " -c" ))
152- }
153- val deployResult =
154- withContext(Dispatchers .Default ) {
155- // All functions that implement the DirectoryChangeListener.Listener
156- // interface are called here.
157- // To refresh directory settings.
158- return @withContext RimeWrapper .deploy()
159- }
160- if (deployResult) {
161- briefResultLogDialog(" rime.trime" , " W" , 1 )
162- } else {
163- ToastUtils .showLong(" Rime is already deploying/starting" )
164- }
165- }
145+ deploy()
166146 true
167147 }
168148 R .id.preference__menu_about -> {
@@ -173,6 +153,26 @@ class PrefMainActivity : AppCompatActivity() {
173153 }
174154 }
175155
156+ private fun deploy () {
157+ lifecycleScope.launch {
158+ withContext(Dispatchers .IO ) {
159+ Runtime .getRuntime().exec(arrayOf(" logcat" , " -c" ))
160+ }
161+ val deployResult =
162+ withContext(Dispatchers .Default ) {
163+ // All functions that implement the DirectoryChangeListener.Listener
164+ // interface are called here.
165+ // To refresh directory settings.
166+ return @withContext RimeWrapper .deploy()
167+ }
168+ if (deployResult) {
169+ briefResultLogDialog(" rime.trime" , " W" , 1 )
170+ } else {
171+ ToastUtils .showLong(" Rime is already deploying/starting" )
172+ }
173+ }
174+ }
175+
176176 override fun onResume () {
177177 super .onResume()
178178 requestExternalStoragePermission()
0 commit comments