forked from Sav22999/common-voice-android
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Fixed a bug in Dashboard - Changing language UI manually -> Re-implemented. If the selected language exists in the language of the device (when you installed the app), it will display everything in that language, otherwise it will display in English. - Updated Loading page in WebBrowser
- Loading branch information
Showing
11 changed files
with
314 additions
and
181 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
Common Voice Android/app/src/main/java/org/commonvoice/saverio/RestartActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,51 @@ | ||
package org.commonvoice.saverio | ||
|
||
import android.content.Intent | ||
import android.content.SharedPreferences | ||
import android.os.Bundle | ||
import androidx.appcompat.app.AppCompatActivity | ||
import java.util.* | ||
import kotlin.concurrent.schedule | ||
|
||
class RestartActivity : AppCompatActivity() { | ||
|
||
private var PRIVATE_MODE = 0 | ||
private val UI_LANGUAGE_CHANGED = "UI_LANGUAGE_CHANGED" | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContentView(R.layout.activity_restart) | ||
|
||
val sharedPref: SharedPreferences = getSharedPreferences(UI_LANGUAGE_CHANGED, PRIVATE_MODE) | ||
var restart: Boolean = sharedPref.getBoolean(UI_LANGUAGE_CHANGED, true) | ||
if (restart) { | ||
Timer("StartOrRestart", false).schedule(2000) { | ||
restart() | ||
} | ||
} else { | ||
Timer("StartOrRestart", false).schedule(1000) { | ||
start() | ||
} | ||
} | ||
} | ||
|
||
override fun onBackPressed() { | ||
// | ||
} | ||
|
||
fun restart() { | ||
val sharedPref: SharedPreferences = getSharedPreferences(UI_LANGUAGE_CHANGED, PRIVATE_MODE) | ||
val editor = sharedPref.edit() | ||
editor.putBoolean(UI_LANGUAGE_CHANGED, false) | ||
editor.apply() | ||
|
||
val intent = Intent(this, MainActivity::class.java).also { | ||
startActivity(it) | ||
finish() | ||
} | ||
} | ||
|
||
fun start() { | ||
finish() | ||
} | ||
} |
Oops, something went wrong.