Translated some strings, commented some methods in MainActivity

This commit is contained in:
VanitasVitae 2015-10-30 17:43:07 +01:00
parent 1f3c3d33a7
commit 5624130e2c
4 changed files with 43 additions and 15 deletions

View File

@ -202,6 +202,9 @@ public class MainActivity extends Activity
layoutContainer.doCrypto();
}
/**
* Start an intent to share the configuration as QR-Code via Barcode Scanner
*/
private void shareConfigurationAsQR()
{
IntentIntegrator QRIntegrator = new IntentIntegrator(this);
@ -211,6 +214,9 @@ public class MainActivity extends Activity
QRIntegrator.shareText(encoded_state);
}
/**
* Start an intent to share the configuration as text
*/
private void shareConfigurationAsText()
{
Intent sendIntent = new Intent();
@ -221,17 +227,26 @@ public class MainActivity extends Activity
startActivity(Intent.createChooser(sendIntent, getResources().getText(R.string.send_to)));
}
/**
* Start the barcode app to scan a barcode for configuration
*/
private void receiveConfigurationQR()
{
IntentIntegrator integrator = new IntentIntegrator(this);
integrator.initiateScan();
}
/**
* Show a dialog to restore a configuration
*/
private void receiveConfigurationText()
{
new PassphraseDialogBuilder().showDialog();
}
/**
* Check, whether the app has been updated
*/
private void handleVersionUpdate()
{
int currentVersionNumber = 0;
@ -250,6 +265,11 @@ public class MainActivity extends Activity
}
/**
* Show a dialog that informs the user about the latest important changes in the app
* The dialog appears whenever the app starts after an update or after data has been
* deleted
*/
private void showWhatsNewDialog()
{
PackageInfo pInfo = null;
@ -314,6 +334,10 @@ public class MainActivity extends Activity
}).show();
}
/**
* Show a dialog where the user can choose between sharing the configuration via QR-code or
* via string (intent or copy-to-clipboard)
*/
private void showShareConfigurationDialog()
{
final String configuration = APP_ID+"/"+layoutContainer.getEnigma().getEncodedState().toString(16);
@ -345,7 +369,7 @@ public class MainActivity extends Activity
builder.setTitle(R.string.dialog_title_share_configuration)
.setView(shareView).setCancelable(true);
final Dialog d = builder.create();
Button one = (Button) shareView.findViewById(R.id.dialog_two_options_2);
Button one = (Button) shareView.findViewById(R.id.dialog_two_options_1);
one.setText(R.string.dialog_share_qr);
one.setOnClickListener(new View.OnClickListener()
{
@ -356,7 +380,7 @@ public class MainActivity extends Activity
d.dismiss();
}
});
Button two = (Button) shareView.findViewById(R.id.dialog_two_options_1);
Button two = (Button) shareView.findViewById(R.id.dialog_two_options_2);
two.setText(R.string.dialog_share_code);
two.setOnClickListener(new View.OnClickListener()
{
@ -370,6 +394,10 @@ public class MainActivity extends Activity
d.show();
}
/**
* Show a dialog, where the user can choose between scanning QR-code and entering a string to
* restore the encoded configuration
*/
private void showReceiveConfigurationDialog()
{
final View shareView = View.inflate(this, R.layout.dialog_two_options, null);
@ -377,7 +405,7 @@ public class MainActivity extends Activity
builder.setTitle(R.string.dialog_title_restore_configuration)
.setView(shareView).setCancelable(true);
final Dialog d = builder.create();
Button one = (Button) shareView.findViewById(R.id.dialog_two_options_2);
Button one = (Button) shareView.findViewById(R.id.dialog_two_options_1);
one.setText(R.string.dialog_restore_qr);
one.setOnClickListener(new View.OnClickListener()
{
@ -388,7 +416,7 @@ public class MainActivity extends Activity
d.dismiss();
}
});
Button two = (Button) shareView.findViewById(R.id.dialog_two_options_1);
Button two = (Button) shareView.findViewById(R.id.dialog_two_options_2);
two.setText(R.string.dialog_restore_code);
two.setOnClickListener(new View.OnClickListener()
{

View File

@ -49,7 +49,8 @@
<string name="dialog_abort">Keine Änderungen.</string>
<string name="message_reset">Enigma zurückgesetzt.</string>
<string name="message_random">Enigma auf zufällige Konfiguration gesetzt.</string>
<string name="dialog_whats_new_title">Was ist neu?</string>
<string name="message_clipboard">In Zwischenablage kopiert</string>
<string name="dialog_whats_new_title">Was ist neu?</string>
</resources>

View File

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="dialog_whats_new_title">What\'s new?</string>
<string name="dialog_whats_new_header" translatable="false">%1$s:</string> <!--Version-->
<string name="dialog_whats_new_content" translatable="false">
- This is some information about the release\n
- Please send me a mail, if you read this, because I probably forgot to change this :)\n
- lol\n
</string>
</resources>

View File

@ -48,6 +48,15 @@
<string name="message_random">Enigma set to random configuration.</string>
<string name="message_clipboard">Copied to clipboard</string>
<string name="dialog_whats_new_title">What\'s new?</string>
<string name="dialog_whats_new_header" translatable="false">%1$s:</string> <!--Version-->
<string name="dialog_whats_new_content" translatable="false">
- This splash screen!
\n- Protocol-versioning to ensure compatibility to upcoming releases/new functions\n
Unfortunately we had to break backwards compatibility to older versions :/
\n- Enigma KD\n
</string>
<string translatable="false" name="button_plug_title">%1$s:%2$s</string>
<string-array translatable="false" name="rotors_1_3">