🇫🇷 translates

This commit is contained in:
Mylloon 2021-08-29 23:41:23 +02:00
parent 2674c3a705
commit ba5a2b8552
3 changed files with 28 additions and 12 deletions

View file

@ -140,9 +140,9 @@ class MainActivity : AppCompatActivity() {
button = itemView?.findViewById(R.id.text_list_item) button = itemView?.findViewById(R.id.text_list_item)
button?.setOnLongClickListener { button?.setOnLongClickListener {
val builder: android.app.AlertDialog.Builder = android.app.AlertDialog.Builder(instance) val builder: android.app.AlertDialog.Builder = android.app.AlertDialog.Builder(instance)
builder.setTitle("Remove ${button?.text}?") builder.setTitle("${R.string.remove} ${button?.text} ?")
builder.setPositiveButton("Remove") { _, _ -> instance?.mainPage(button?.text.toString()) } builder.setPositiveButton(R.string.remove) { _, _ -> instance?.mainPage(button?.text.toString()) }
builder.setNeutralButton("Cancel") { dialog, _ -> dialog.cancel() } builder.setNeutralButton(R.string.cancel) { dialog, _ -> dialog.cancel() }
builder.show() builder.show()
true true
} }
@ -181,19 +181,19 @@ class MainActivity : AppCompatActivity() {
val addButton = findViewById<FloatingActionButton>(R.id.addButton) val addButton = findViewById<FloatingActionButton>(R.id.addButton)
addButton.setOnClickListener { addButton.setOnClickListener {
val builder: android.app.AlertDialog.Builder = android.app.AlertDialog.Builder(this) val builder: android.app.AlertDialog.Builder = android.app.AlertDialog.Builder(this)
builder.setTitle("App Name") builder.setTitle(R.string.newAppDialogTitle)
val input = EditText(this) val input = EditText(this)
input.inputType = InputType.TYPE_CLASS_TEXT input.inputType = InputType.TYPE_CLASS_TEXT
builder.setView(input) builder.setView(input)
builder.setPositiveButton("Validate") { _, _ -> addApp(input.text.toString()) } builder.setPositiveButton(R.string.validate) { _, _ -> addApp(input.text.toString()) }
builder.setNeutralButton("Cancel") { dialog, _ -> dialog.cancel() } builder.setNeutralButton(R.string.cancel) { dialog, _ -> dialog.cancel() }
builder.show() builder.show()
} }
// easter egg // easter egg
addButton.setOnLongClickListener { addButton.setOnLongClickListener {
Toast.makeText(this@MainActivity, "lâche frère", Toast.LENGTH_SHORT) Toast.makeText(this@MainActivity, R.string.dropBro, Toast.LENGTH_SHORT)
.show() .show()
true true
} }
@ -216,7 +216,7 @@ class MainActivity : AppCompatActivity() {
val credentialsButton = findViewById<Button>(R.id.changeCredentialsButton) val credentialsButton = findViewById<Button>(R.id.changeCredentialsButton)
credentialsButton.setOnClickListener { // show main page when clicking the login button credentialsButton.setOnClickListener { // show main page when clicking the login button
Credentials().delete() Credentials().delete()
Toast.makeText(this@MainActivity, "Deleted credentials", Toast.LENGTH_LONG) Toast.makeText(this@MainActivity, R.string.deletedCredentials, Toast.LENGTH_LONG)
.show() .show()
loginPage() loginPage()
} }
@ -233,7 +233,7 @@ class MainActivity : AppCompatActivity() {
if (ContextCompat.checkSelfPermission(this@MainActivity, Manifest.permission.INTERNET) if (ContextCompat.checkSelfPermission(this@MainActivity, Manifest.permission.INTERNET)
!= PackageManager.PERMISSION_GRANTED != PackageManager.PERMISSION_GRANTED
) { ) {
Toast.makeText(this@MainActivity, "No permission to use the internet", Toast.LENGTH_SHORT).show() Toast.makeText(this@MainActivity, R.string.internetPermission, Toast.LENGTH_SHORT).show()
this.finishAffinity() this.finishAffinity()
} else { } else {
Scraper(user, password, app = app, debug = true).search() Scraper(user, password, app = app, debug = true).search()
@ -243,9 +243,7 @@ class MainActivity : AppCompatActivity() {
override fun onResume() { override fun onResume() {
super.onResume() super.onResume()
if (prefs!!.getBoolean("firstrun", true)) { if (prefs!!.getBoolean("firstrun", true)) {
println("Generate RSA keys...") Credentials().generateKey() // Generate RSA keys
Credentials().generateKey()
println("Done!")
prefs!!.edit().putBoolean("firstrun", false) prefs!!.edit().putBoolean("firstrun", false)
.apply() // first run done, now the next ones won't be "first". .apply() // first run done, now the next ones won't be "first".
} }

View file

@ -9,4 +9,11 @@
<string name="changeCredentials">Change les identifiants</string> <string name="changeCredentials">Change les identifiants</string>
<string name="sourceCode">Code source</string> <string name="sourceCode">Code source</string>
<string name="credits">Crédits</string> <string name="credits">Crédits</string>
<string name="remove">Retirer</string>
<string name="cancel">Annuler</string>
<string name="newAppDialogTitle">Nom de l\'application</string>
<string name="validate">Valider</string>
<string name="deletedCredentials">Identifiants supprimés</string>
<string name="dropBro">lâche frère</string>
<string name="internetPermission">Pas la permission d\'utiliser internet</string>
</resources> </resources>

View file

@ -6,10 +6,21 @@
<string name="userLogin">Username</string> <string name="userLogin">Username</string>
<string name="passwordLogin">Password</string> <string name="passwordLogin">Password</string>
<string name="buttonLogin">Login</string> <string name="buttonLogin">Login</string>
<!-- Main page -->
<string name="newAppDialogTitle">App Name</string>
<string name="validate">Validate</string>
<string name="remove">Remove</string>
<string name="cancel">Cancel</string>
<string name="dropBro">drop bro</string>
<!-- Settings page --> <!-- Settings page -->
<string name="titleSettings">Settings</string> <string name="titleSettings">Settings</string>
<string name="changeCredentials">Change credentials</string> <string name="changeCredentials">Change credentials</string>
<string name="deletedCredentials">Deleted credentials</string>
<string name="sourceCode">Source code</string> <string name="sourceCode">Source code</string>
<string name="credits">Credits</string> <string name="credits">Credits</string>
<!-- Scraper -->
<string name="internetPermission">No permission to use internet</string>
</resources> </resources>