Commit 8816c498 authored by Aaditya Prakash's avatar Aaditya Prakash Committed by Toni Beier

Add English localization

parent 1f06d5e4
...@@ -10,14 +10,12 @@ package de.tu_chemnitz.wlan; ...@@ -10,14 +10,12 @@ package de.tu_chemnitz.wlan;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.res.AssetManager; import android.content.res.AssetManager;
import android.content.res.Resources;
import android.net.ConnectivityManager; import android.net.ConnectivityManager;
import android.net.NetworkInfo; import android.net.NetworkInfo;
import android.net.wifi.WifiConfiguration; import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiEnterpriseConfig; import android.net.wifi.WifiEnterpriseConfig;
import android.net.wifi.WifiManager; import android.net.wifi.WifiManager;
import android.os.Build; import android.os.Build;
import android.util.Base64;
import android.util.Log; import android.util.Log;
import android.widget.Toast; import android.widget.Toast;
...@@ -29,11 +27,9 @@ import com.android.volley.VolleyError; ...@@ -29,11 +27,9 @@ import com.android.volley.VolleyError;
import com.android.volley.VolleyLog; import com.android.volley.VolleyLog;
import com.android.volley.toolbox.StringRequest; import com.android.volley.toolbox.StringRequest;
import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
import java.io.ByteArrayInputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
...@@ -51,8 +47,6 @@ import java.util.HashMap; ...@@ -51,8 +47,6 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import java.util.regex.Pattern;
import java.util.stream.Stream;
class Helper { class Helper {
...@@ -470,12 +464,12 @@ class Helper { ...@@ -470,12 +464,12 @@ class Helper {
static void quickApply(Context context, String json) { static void quickApply(Context context, String json) {
if (Helper.buildWifiConfig(json, context)) { if (Helper.buildWifiConfig(json, context)) {
if (Helper.applyWifiConfig(context)) { if (Helper.applyWifiConfig(context)) {
Toast.makeText(context, Helper.lastWifi.SSID + " erfolgreich angewendet!", Toast.LENGTH_LONG).show(); Toast.makeText(context, context.getResources().getString(R.string.message_last_wifi_ssid_successfully_applied, Helper.lastWifi.SSID), Toast.LENGTH_LONG).show();
} else { } else {
Toast.makeText(context, "Konnte Konfiguration nicht anwenden!\nLöschen Sie ggf. bestehende Konfiguration von " + Helper.lastWifi.SSID + ".", Toast.LENGTH_LONG).show(); Toast.makeText(context, context.getResources().getString(R.string.message_not_successfully_applied_last_wifi_ssid, Helper.lastWifi.SSID), Toast.LENGTH_LONG).show();
} }
} else { } else {
Toast.makeText(context, "Ungültiges Format!", Toast.LENGTH_LONG).show(); Toast.makeText(context, context.getResources().getString(R.string.msg_invalid_format), Toast.LENGTH_LONG).show();
} }
} }
...@@ -595,7 +589,7 @@ class Helper { ...@@ -595,7 +589,7 @@ class Helper {
WifiManager wifi = (WifiManager)context.getApplicationContext().getSystemService(Context.WIFI_SERVICE); WifiManager wifi = (WifiManager)context.getApplicationContext().getSystemService(Context.WIFI_SERVICE);
if (wifi.isWifiEnabled()) if (wifi.isWifiEnabled())
{ {
MainActivity.TickLine tick = new MainActivity.TickLine(true, "WLAN ist aktiviert", "Verfügbarkeit", false); MainActivity.TickLine tick = new MainActivity.TickLine(true, context.getResources().getString(R.string.tickline_message_wifi_enabled), context.getResources().getString(R.string.msg_available ), false);
tick._tag = status_tags[0]; tick._tag = status_tags[0];
list.add(tick); list.add(tick);
...@@ -627,7 +621,7 @@ class Helper { ...@@ -627,7 +621,7 @@ class Helper {
ticked = false; ticked = false;
} }
list.add(new MainActivity.TickLine(ticked, message, context.getString(R.string.tickline_message_user_identity), false)); list.add(new MainActivity.TickLine(ticked, message, context.getString(R.string.tickline_category_user_identity), false));
if (currentConfig.enterpriseConfig.getAnonymousIdentity().length()>0) { if (currentConfig.enterpriseConfig.getAnonymousIdentity().length()>0) {
String anonymousIdentity = currentConfig.enterpriseConfig.getAnonymousIdentity(); String anonymousIdentity = currentConfig.enterpriseConfig.getAnonymousIdentity();
...@@ -639,10 +633,10 @@ class Helper { ...@@ -639,10 +633,10 @@ class Helper {
ticked = true; ticked = true;
} }
} else { } else {
message="Nicht gesetzt"; message= context.getResources().getString(R.string.msg_not_set);
ticked = false; ticked = false;
} }
list.add(new MainActivity.TickLine(ticked, message, "Anonyme Identität", true)); list.add(new MainActivity.TickLine(ticked, message, context.getResources().getString(R.string.tickline_category_anonymous_identity), true));
ticked = true; ticked = true;
...@@ -719,12 +713,12 @@ class Helper { ...@@ -719,12 +713,12 @@ class Helper {
list.add(new MainActivity.TickLine(ticked, message, "Server Subject Match", true)); list.add(new MainActivity.TickLine(ticked, message, "Server Subject Match", true));
message = "Technische Parameter "; message = context.getResources().getString(R.string.tickline_message_techincal_parameters);
if (list.get(3).ticked && list.get(4).ticked && list.get(5).ticked && list.get(6).ticked) { if (list.get(3).ticked && list.get(4).ticked && list.get(5).ticked && list.get(6).ticked) {
message += "sicher"; message += " " + context.getResources().getString(R.string.tickline_message_are_correct);
ticked = true; ticked = true;
} else { } else {
message += "unsicher"; message += " " + context.getResources().getString(R.string.tickline_message_not_correct);
ticked = false; ticked = false;
} }
list.add(3, new MainActivity.TickLine(ticked, message, "", false)); list.add(3, new MainActivity.TickLine(ticked, message, "", false));
...@@ -740,20 +734,20 @@ class Helper { ...@@ -740,20 +734,20 @@ class Helper {
} }
} }
} else { } else {
MainActivity.TickLine tick = new MainActivity.TickLine(false, "WLAN ist deaktiviert", "Verfügbarkeit", false); MainActivity.TickLine tick = new MainActivity.TickLine(false, context.getResources().getString(R.string.tickline_message_wifi_disabled), context.getResources().getString(R.string.msg_available), false);
tick._tag = status_tags[0]; tick._tag = status_tags[0];
list.add(tick); list.add(tick);
} }
MainActivity.TickLine tick = getByTag(list, status_tags[0]); MainActivity.TickLine tick = getByTag(list, status_tags[0]);
if (list.size() <= 1 && tick != null && tick.ticked) { if (list.size() <= 1 && tick != null && tick.ticked) {
list.add(new MainActivity.TickLine(false, "Kein " + ssid + " konfiguriert", "Verfügbarkeit", false)); list.add(new MainActivity.TickLine(false, context.getResources().getString(R.string.message_no_ssid_configuration, ssid), context.getResources().getString(R.string.msg_available), false));
} }
return list; return list;
} }
static void getInstallStatus(Context context) { static void getInstallStatus(final Context context) {
ticks_install = new ArrayList<>(); ticks_install = new ArrayList<>();
...@@ -767,14 +761,14 @@ class Helper { ...@@ -767,14 +761,14 @@ class Helper {
MainActivity.TickLine tick; MainActivity.TickLine tick;
if (!response.startsWith("{")) { if (!response.startsWith("{")) {
// we got no JSON, we are not logged in // we got no JSON, we are not logged in
tick = new MainActivity.TickLine(false, "Nicht angemeldet", "WTC-Login", false); tick = new MainActivity.TickLine(false, context.getResources().getString(R.string.tickline_message_not_logged_in), context.getResources().getString(R.string.message_wtc_login), false);
} else { } else {
// logged in && can fetch username // logged in && can fetch username
username = getUsername(response); username = getUsername(response);
if (username == null) { if (username == null) {
tick = new MainActivity.TickLine(false, "Konnte Benutzer nicht abrufen", "WTC-Login", false); tick = new MainActivity.TickLine(false, context.getResources().getString(R.string.msg_not_receive_user), context.getResources().getString(R.string.message_wtc_login), false);
} else { } else {
tick = new MainActivity.TickLine(true, "Angemeldet als " + username, "WTC-Login", false); tick = new MainActivity.TickLine(true, context.getResources().getString(R.string.message_logged_in_as, username), context.getResources().getString(R.string.message_wtc_login), false);
} }
} }
tick._tag = install_order[0]; tick._tag = install_order[0];
...@@ -784,7 +778,7 @@ class Helper { ...@@ -784,7 +778,7 @@ class Helper {
@Override @Override
public void onErrorResponse(VolleyError error) { public void onErrorResponse(VolleyError error) {
Log.e("getInstallStatus", "check user", error); Log.e("getInstallStatus", "check user", error);
MainActivity.TickLine tick = new MainActivity.TickLine(false, "Fehler", "WTC-Login", false); MainActivity.TickLine tick = new MainActivity.TickLine(false, context.getResources().getString(R.string.error_message), context.getResources().getString(R.string.message_wtc_login), false);
tick._tag = install_order[0]; tick._tag = install_order[0];
ticks_install.add(tick); ticks_install.add(tick);
} }
...@@ -792,9 +786,9 @@ class Helper { ...@@ -792,9 +786,9 @@ class Helper {
MainActivity.TickLine tick; MainActivity.TickLine tick;
if (buildFromPreferences(context)) { if (buildFromPreferences(context)) {
tick = new MainActivity.TickLine(true, "Konfiguration erhalten", "Gerätepasswort", false); tick = new MainActivity.TickLine(true, context.getResources().getString(R.string.msg_configuration_received), context.getResources().getString(R.string.msg_device_password), false);
} else { } else {
tick = new MainActivity.TickLine(false, "Anfrage ausstehend", "Gerätepasswort", false); tick = new MainActivity.TickLine(false, context.getResources().getString(R.string.msg_request_pending), context.getResources().getString(R.string.msg_device_password), false);
} }
tick._tag = install_order[1]; tick._tag = install_order[1];
ticks_install.add(tick); ticks_install.add(tick);
...@@ -807,12 +801,12 @@ class Helper { ...@@ -807,12 +801,12 @@ class Helper {
int state = getReadyState(response); int state = getReadyState(response);
MainActivity.TickLine tick; MainActivity.TickLine tick;
if (state < 0) { if (state < 0) {
tick = new MainActivity.TickLine(false, "Konnte nicht angewendet werden!", "Passwort aktiv", false); tick = new MainActivity.TickLine(false, context.getResources().getString(R.string.msg_could_not_be_used), context.getResources().getString(R.string.msg_password_active), false);
} else if (state == 0) { } else if (state == 0) {
tick = new MainActivity.TickLine(false, "In Arbeit", "Passwort aktiv", false); tick = new MainActivity.TickLine(false, context.getResources().getString(R.string.msg_in_progress), context.getResources().getString(R.string.msg_password_active), false);
tick.working = true; tick.working = true;
} else { } else {
tick = new MainActivity.TickLine(true, "OK", "Passwort aktiv", false); tick = new MainActivity.TickLine(true, context.getResources().getString(R.string.okay), context.getResources().getString(R.string.msg_password_active), false);
} }
tick._tag = install_order[2]; tick._tag = install_order[2];
ticks_install.add(tick); ticks_install.add(tick);
...@@ -828,31 +822,31 @@ class Helper { ...@@ -828,31 +822,31 @@ class Helper {
MainActivity.TickLine login = getByTag(ticks_install, install_order[0]); MainActivity.TickLine login = getByTag(ticks_install, install_order[0]);
if (login != null) { if (login != null) {
login.ticked = false; login.ticked = false;
login.text = "Anmeldung fehlgeschlagen"; login.text = context.getResources().getString(R.string.msg_login_failed);
} }
} }
MainActivity.TickLine tick = new MainActivity.TickLine(false, "Netzwerkfehler", "Passwort aktiv", false); MainActivity.TickLine tick = new MainActivity.TickLine(false, context.getResources().getString(R.string.msg_network_error), context.getResources().getString(R.string.msg_password_active), false);
tick._tag = install_order[2]; tick._tag = install_order[2];
ticks_install.add(tick); ticks_install.add(tick);
} }
}, Request.Method.GET); }, Request.Method.GET);
tick = null; tick = null;
} else { } else {
tick = new MainActivity.TickLine(false, "Nicht überprüfbar", "Passwort aktiv", false); tick = new MainActivity.TickLine(false, context.getResources().getString(R.string.msg_not_verifiable), context.getResources().getString(R.string.msg_password_active), false);
} }
} else { } else {
tick = new MainActivity.TickLine(false, "Anfrage ausstehend", "Passwort aktiv", false); tick = new MainActivity.TickLine(false, context.getResources().getString(R.string.msg_request_pending), context.getResources().getString(R.string.msg_password_active), false);
} }
if (tick != null) { if (tick != null) {
tick._tag = install_order[2]; tick._tag = install_order[2];
ticks_install.add(tick); ticks_install.add(tick);
} }
tick = new MainActivity.TickLine(false, "Ausstehend", "Konfiguration angewendet", false); tick = new MainActivity.TickLine(false, context.getResources().getString(R.string.msg_pending), context.getResources().getString(R.string.msg_configuration_applied), false);
tick._tag = install_order[3]; tick._tag = install_order[3];
ticks_install.add(tick); ticks_install.add(tick);
} else { } else {
MainActivity.TickLine tick = new MainActivity.TickLine(false, "Kein Internetzugriff!", "Verfügbarkeit", false); MainActivity.TickLine tick = new MainActivity.TickLine(false, context.getResources().getString(R.string.tickline_message_not_connected_to_internet), context.getResources().getString(R.string.msg_available), false);
tick._tag = install_order[3]; tick._tag = install_order[3];
ticks_install.add(tick); ticks_install.add(tick);
} }
......
...@@ -13,7 +13,6 @@ import android.graphics.PorterDuff; ...@@ -13,7 +13,6 @@ import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.net.ConnectivityManager; import android.net.ConnectivityManager;
import android.net.NetworkInfo; import android.net.NetworkInfo;
import android.net.wifi.ScanResult;
import android.net.wifi.WifiInfo; import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager; import android.net.wifi.WifiManager;
import android.os.Build; import android.os.Build;
...@@ -114,8 +113,8 @@ public class MainActivity extends AppCompatActivity { ...@@ -114,8 +113,8 @@ public class MainActivity extends AppCompatActivity {
Helper.quickApply(this, total.toString()); Helper.quickApply(this, total.toString());
} }
} catch (Exception e) { } catch (Exception e) {
Toast.makeText(this, "Konnte Datei nicht lesen oder ungültiges Format!", Toast.LENGTH_LONG).show(); Toast.makeText(this, getResources().getString(R.string.error_message_invalid_format), Toast.LENGTH_LONG).show();
Log.e("ACTION_VIEW - handler", "Something went wrong!", e); Log.e("ACTION_VIEW - handler", getResources().getString(R.string.error_message_something_went_wrong), e);
} }
} }
...@@ -151,7 +150,7 @@ public class MainActivity extends AppCompatActivity { ...@@ -151,7 +150,7 @@ public class MainActivity extends AppCompatActivity {
networkChangeRecieverIntentFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION); networkChangeRecieverIntentFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
this.networkChangeReciever = new NetworkChangeReciever(); this.networkChangeReciever = new NetworkChangeReciever();
Log.d("network_change_broadcast", "register receiver"); Log.d("networkChange_broadcast", "register receiver");
this.registerReceiver(this.networkChangeReciever, networkChangeRecieverIntentFilter); this.registerReceiver(this.networkChangeReciever, networkChangeRecieverIntentFilter);
} }
...@@ -192,7 +191,7 @@ public class MainActivity extends AppCompatActivity { ...@@ -192,7 +191,7 @@ public class MainActivity extends AppCompatActivity {
protected void onPause() { protected void onPause() {
super.onPause(); super.onPause();
Log.d("network_change_broadcast", "unregister receiver"); Log.d("networkChange_broadcast", "unregister receiver");
this.unregisterReceiver(this.networkChangeReciever); this.unregisterReceiver(this.networkChangeReciever);
} }
...@@ -203,7 +202,7 @@ public class MainActivity extends AppCompatActivity { ...@@ -203,7 +202,7 @@ public class MainActivity extends AppCompatActivity {
@Override @Override
public void run() { public void run() {
boolean hasInternet = Helper.hasInternet(MainActivity.this); boolean hasInternet = Helper.hasInternet(MainActivity.this);
TickLine tick = new TickLine(hasInternet, hasInternet ? "Mit Internet verbunden" : "Kein Internetzugang", "Verbindung", false); TickLine tick = new TickLine(hasInternet, hasInternet ? getResources().getString(R.string.tickline_message_connected_to_internet) : getResources().getString(R.string.tickline_message_not_connected_to_internet), getResources().getString(R.string.tickline_category_connected), false);
tick._tag = Helper.status_tags[1]; tick._tag = Helper.status_tags[1];
ticks_status.add(0, tick); ticks_status.add(0, tick);
} }
...@@ -212,7 +211,7 @@ public class MainActivity extends AppCompatActivity { ...@@ -212,7 +211,7 @@ public class MainActivity extends AppCompatActivity {
KeyguardManager km = (KeyguardManager)MainActivity.this.getApplicationContext().getSystemService(Context.KEYGUARD_SERVICE); KeyguardManager km = (KeyguardManager)MainActivity.this.getApplicationContext().getSystemService(Context.KEYGUARD_SERVICE);
boolean isSecure = km.isKeyguardSecure(); boolean isSecure = km.isKeyguardSecure();
TickLine tick = new TickLine(isSecure, isSecure ? "Sperrbildschirm gesetzt" : "PIN- oder Passwortsperre erforderlich", "", false); TickLine tick = new TickLine(isSecure, isSecure ? getResources().getString(R.string.tickline_message_locked_screen_set) : getResources().getString(R.string.tickline_message_screen_lock_required), "", false);
tick._tag = Helper.status_tags[2]; tick._tag = Helper.status_tags[2];
ticks_status.add(tick); ticks_status.add(tick);
...@@ -240,7 +239,9 @@ public class MainActivity extends AppCompatActivity { ...@@ -240,7 +239,9 @@ public class MainActivity extends AppCompatActivity {
} }
Button btn = new Button(this); Button btn = new Button(this);
btn.setText(valid ? "Konfiguration " + (configured ? "erneut " : "") + "starten" : "Fehler lösen"); //btn.setText(valid ? getResources().getString(R.string.configuration) + (configured ? getResources().getString(R.string.msg_again) : "") + getResources().getString(R.string.msg_start) : getResources().getString(R.string.msg_resolve));
btn.setText(valid ? (configured ? getResources().getString(R.string.msg_configure_again) : getResources().getString(R.string.msg_start_configure)) : getResources().getString(R.string.msg_resolve_configuration));
btn.setTextSize(18); btn.setTextSize(18);
btn.setOnClickListener(new View.OnClickListener() { btn.setOnClickListener(new View.OnClickListener() {
@Override @Override
...@@ -277,7 +278,7 @@ public class MainActivity extends AppCompatActivity { ...@@ -277,7 +278,7 @@ public class MainActivity extends AppCompatActivity {
if (canLeaveInstall) { if (canLeaveInstall) {
Button btn = new Button(this); Button btn = new Button(this);
btn.setText("Verlassen"); btn.setText(getResources().getString(R.string.cancel));
btn.setTextSize(18); btn.setTextSize(18);
btn.setOnClickListener(new View.OnClickListener() { btn.setOnClickListener(new View.OnClickListener() {
@Override @Override
...@@ -322,7 +323,7 @@ public class MainActivity extends AppCompatActivity { ...@@ -322,7 +323,7 @@ public class MainActivity extends AppCompatActivity {
tick = Helper.getByTag(ticks_status, Helper.status_tags[2]); tick = Helper.getByTag(ticks_status, Helper.status_tags[2]);
if (tick == null || !tick.ticked) { // no lockscreen if (tick == null || !tick.ticked) { // no lockscreen
AlertDialog alert = new AlertDialog.Builder(this).create(); AlertDialog alert = new AlertDialog.Builder(this).create();
alert.setTitle("Sperrbildschirm"); alert.setTitle(getResources().getString(R.string.alert_box_title_locked_screen));
/*LinearLayout ll = new LinearLayout(this); /*LinearLayout ll = new LinearLayout(this);
ll.setOrientation(LinearLayout.VERTICAL); ll.setOrientation(LinearLayout.VERTICAL);
...@@ -335,9 +336,9 @@ public class MainActivity extends AppCompatActivity { ...@@ -335,9 +336,9 @@ public class MainActivity extends AppCompatActivity {
ll.addView(tv, params); ll.addView(tv, params);
builder.setView(ll);*/ builder.setView(ll);*/
alert.setMessage("Bitte setze dir einen PIN- oder Passwort-Sperrbildschirm."); alert.setMessage(getResources().getString(R.string.alert_box_message_put_pin_password_lock));
alert.setCancelable(false); alert.setCancelable(false);
alert.setButton(AlertDialog.BUTTON_NEUTRAL, "OK", new DialogInterface.OnClickListener() { alert.setButton(AlertDialog.BUTTON_NEUTRAL, getResources().getString(R.string.okay), new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
startActivity(new Intent(Settings.ACTION_SECURITY_SETTINGS)); startActivity(new Intent(Settings.ACTION_SECURITY_SETTINGS));
...@@ -351,7 +352,7 @@ public class MainActivity extends AppCompatActivity { ...@@ -351,7 +352,7 @@ public class MainActivity extends AppCompatActivity {
tick = Helper.getByTag(ticks_status, Helper.status_tags[1]); tick = Helper.getByTag(ticks_status, Helper.status_tags[1]);
if (tick == null || !tick.ticked) { // no internet if (tick == null || !tick.ticked) { // no internet
AlertDialog alert = new AlertDialog.Builder(this).create(); AlertDialog alert = new AlertDialog.Builder(this).create();
alert.setTitle("Internetzugriff"); alert.setTitle(getResources().getString(R.string.alext_box_title_internet_access));
/*LinearLayout ll = new LinearLayout(this); /*LinearLayout ll = new LinearLayout(this);
ll.setOrientation(LinearLayout.VERTICAL); ll.setOrientation(LinearLayout.VERTICAL);
...@@ -414,19 +415,19 @@ public class MainActivity extends AppCompatActivity { ...@@ -414,19 +415,19 @@ public class MainActivity extends AppCompatActivity {
if (hasConfig && useCache == 0) { if (hasConfig && useCache == 0) {
AlertDialog.Builder builder = new AlertDialog.Builder(this); AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Neue Konfiguration anfordern?"); builder.setTitle(getResources().getString(R.string.alert_box_title_request_new_config));
builder.setMessage("Es wurde bereits eine Konfiguration geladen, soll diese verwendet werden?"); builder.setMessage(getResources().getString(R.string.alert_box_message_request_new_config));
// Set up the buttons // Set up the buttons
builder.setPositiveButton("Ja", new DialogInterface.OnClickListener() { builder.setPositiveButton(getResources().getString(R.string.yes), new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
useCache = 1; useCache = 1;
setupEduroam(); setupEduroam();
} }
}); });
builder.setNegativeButton("Nein", new DialogInterface.OnClickListener() { builder.setNegativeButton(getResources().getString(R.string.no), new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
useCache = -1; useCache = -1;
...@@ -446,13 +447,13 @@ public class MainActivity extends AppCompatActivity { ...@@ -446,13 +447,13 @@ public class MainActivity extends AppCompatActivity {
if (Helper.device_name.equals("") && (!hasConfig || useCache < 0)) { if (Helper.device_name.equals("") && (!hasConfig || useCache < 0)) {
AlertDialog.Builder builder = new AlertDialog.Builder(this); AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Gerätename"); builder.setTitle(getResources().getString(R.string.alert_box_title_device_name));
LinearLayout ll = new LinearLayout(this); LinearLayout ll = new LinearLayout(this);
ll.setOrientation(LinearLayout.VERTICAL); ll.setOrientation(LinearLayout.VERTICAL);
TextView tv = new TextView(this); TextView tv = new TextView(this);
tv.setText("Bitte gib einen Namen für dieses Gerät an!\nDer Name kann später verwendet werden um das gerätespezifische Passwort im IdM-Portal zu verwalten."); tv.setText(getResources().getString(R.string.alert_box_message_device_name));
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
params.setMargins(10, 0, 10, 0); params.setMargins(10, 0, 10, 0);
...@@ -462,21 +463,22 @@ public class MainActivity extends AppCompatActivity { ...@@ -462,21 +463,22 @@ public class MainActivity extends AppCompatActivity {
final EditText input = new EditText(this); final EditText input = new EditText(this);
input.setInputType(InputType.TYPE_CLASS_TEXT); input.setInputType(InputType.TYPE_CLASS_TEXT);
if (Helper.device_name.equals("")) if (Helper.device_name.equals(""))
input.setText(Build.MANUFACTURER + " - " + Build.MODEL + " (API " + Build.VERSION.SDK_INT + ")"); input.setText(getApplicationContext().getResources().getString(R.string.input_device_name, Build.MANUFACTURER, Build.MODEL, Build.VERSION.SDK_INT));
//input.setText(Build.MANUFACTURER + " - " + Build.MODEL + " (API " + Build.VERSION.SDK_INT + ")");
else else
input.setText(Helper.device_name); input.setText(Helper.device_name);
ll.addView(input, params); ll.addView(input, params);
builder.setView(ll); builder.setView(ll);
// Set up the buttons // Set up the buttons
builder.setPositiveButton("OK", new DialogInterface.OnClickListener() { builder.setPositiveButton(getResources().getString(R.string.okay), new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
Helper.device_name = input.getText().toString(); Helper.device_name = input.getText().toString();
setupEduroam(); setupEduroam();
} }
}); });
builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { builder.setNegativeButton(getResources().getString(R.string.cancel), new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
dialog.cancel(); dialog.cancel();
...@@ -501,11 +503,11 @@ public class MainActivity extends AppCompatActivity { ...@@ -501,11 +503,11 @@ public class MainActivity extends AppCompatActivity {
} }
if (login == null) { if (login == null) {
AlertDialog alert = new AlertDialog.Builder(this).create(); AlertDialog alert = new AlertDialog.Builder(this).create();
alert.setTitle("Loginfehler"); alert.setTitle(getResources().getString(R.string.alert_box_title_login_error));
alert.setMessage("Konnte nicht feststellen ob Benutzer eingeloggt ist, bitte später erneut versuchen."); alert.setMessage(getResources().getString(R.string.msg_user_not_found));
alert.setCancelable(false); alert.setCancelable(false);
alert.setButton(AlertDialog.BUTTON_NEUTRAL, "OK", new DialogInterface.OnClickListener() { alert.setButton(AlertDialog.BUTTON_NEUTRAL, getResources().getString(R.string.okay), new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialogInterface, int i) { public void onClick(DialogInterface dialogInterface, int i) {
inInstall = false; inInstall = false;
...@@ -543,7 +545,7 @@ public class MainActivity extends AppCompatActivity { ...@@ -543,7 +545,7 @@ public class MainActivity extends AppCompatActivity {
TickLine completed = Helper.getByTag(Helper.ticks_install, Helper.install_order[3]); TickLine completed = Helper.getByTag(Helper.ticks_install, Helper.install_order[3]);
if (completed != null) { if (completed != null) {
completed.ticked = res; completed.ticked = res;
completed.text = res ? "Installation abgeschlossen!" : "Fehlgeschlagen, löschen Sie ggf. bestehende eduroam Konfiguration!"; completed.text = res ? getResources().getString(R.string.msg_installation_complete) : getResources().getString(R.string.msg_installation_failed);
} }
MainActivity.this.runOnUiThread(new Runnable() { MainActivity.this.runOnUiThread(new Runnable() {
@Override @Override
...@@ -559,7 +561,7 @@ public class MainActivity extends AppCompatActivity { ...@@ -559,7 +561,7 @@ public class MainActivity extends AppCompatActivity {
} else if (!isReady.working) { } else if (!isReady.working) {
TickLine completed = Helper.getByTag(Helper.ticks_install, Helper.install_order[3]); TickLine completed = Helper.getByTag(Helper.ticks_install, Helper.install_order[3]);
if (completed != null) { if (completed != null) {
completed.text = "Nicht ausführbar!";