diff --git a/.idea/libraries/support_annotations_21_0_3.xml b/.idea/libraries/support_annotations_21_0_3.xml
new file mode 100644
index 0000000..64c9f2a
--- /dev/null
+++ b/.idea/libraries/support_annotations_21_0_3.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/support_v4_21_0_3.xml b/.idea/libraries/support_v4_21_0_3.xml
new file mode 100644
index 0000000..71d6b73
--- /dev/null
+++ b/.idea/libraries/support_v4_21_0_3.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/app.iml b/app/app.iml
index 119070b..4a23228 100644
--- a/app/app.iml
+++ b/app/app.iml
@@ -9,10 +9,12 @@
+
-
-
+
+
+
@@ -23,6 +25,7 @@
+
@@ -30,37 +33,60 @@
-
-
-
-
-
+
+
+
+
+
+
+
+
-
+
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/build.gradle b/app/build.gradle
index 6a744d0..81f6060 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -13,12 +13,11 @@ android {
}
buildTypes {
release {
- runProguard false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
+ compile 'com.android.support:support-v4:21.+'
}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 6017c5a..28ecdea 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -1,6 +1,6 @@
+ package="de.vanitasvitae.enigmandroid" >
+
+
diff --git a/app/src/main/java/de/vanitasvitae/enigmandroid/MainActivity.java b/app/src/main/java/de/vanitasvitae/enigmandroid/MainActivity.java
index 9dc0de2..eee9702 100644
--- a/app/src/main/java/de/vanitasvitae/enigmandroid/MainActivity.java
+++ b/app/src/main/java/de/vanitasvitae/enigmandroid/MainActivity.java
@@ -3,6 +3,7 @@ package de.vanitasvitae.enigmandroid;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
+import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.Menu;
@@ -71,6 +72,11 @@ public class MainActivity extends Activity
showRingsettingsDialog();
return true;
}
+ else if (id == R.id.action_settings)
+ {
+ Intent i = new Intent(this, SettingsActivity.class);
+ startActivityForResult(i, 0);
+ }
return super.onOptionsItemSelected(item);
}
diff --git a/app/src/main/java/de/vanitasvitae/enigmandroid/SettingsActivity.java b/app/src/main/java/de/vanitasvitae/enigmandroid/SettingsActivity.java
new file mode 100644
index 0000000..d9eb9f5
--- /dev/null
+++ b/app/src/main/java/de/vanitasvitae/enigmandroid/SettingsActivity.java
@@ -0,0 +1,181 @@
+package de.vanitasvitae.enigmandroid;
+
+import android.annotation.TargetApi;
+import android.content.Context;
+import android.content.res.Configuration;
+import android.media.Ringtone;
+import android.media.RingtoneManager;
+import android.net.Uri;
+import android.os.Build;
+import android.os.Bundle;
+import android.preference.ListPreference;
+import android.preference.Preference;
+import android.preference.PreferenceActivity;
+import android.preference.PreferenceCategory;
+import android.preference.PreferenceFragment;
+import android.preference.PreferenceManager;
+import android.preference.RingtonePreference;
+import android.text.TextUtils;
+
+
+import java.util.List;
+
+/**
+ * A {@link PreferenceActivity} that presents a set of application settings. On
+ * handset devices, settings are presented as a single list. On tablets,
+ * settings are split by category, with category headers shown to the left of
+ * the list of settings.
+ *
+ * See
+ * Android Design: Settings for design guidelines and the Settings
+ * API Guide for more information on developing a Settings UI.
+ */
+public class SettingsActivity extends PreferenceActivity
+{
+ /**
+ * Determines whether to always show the simplified settings UI, where
+ * settings are presented in a single list. When false, settings are shown
+ * as a master/detail two-pane view on tablets. When true, a single pane is
+ * shown on tablets.
+ */
+ private static final boolean ALWAYS_SIMPLE_PREFS = false;
+
+
+ @Override
+ protected void onPostCreate(Bundle savedInstanceState)
+ {
+ super.onPostCreate(savedInstanceState);
+
+ setupSimplePreferencesScreen();
+ }
+
+ /**
+ * Shows the simplified settings UI if the device configuration if the
+ * device configuration dictates that a simplified, single-pane UI should be
+ * shown.
+ */
+ private void setupSimplePreferencesScreen()
+ {
+ if (!isSimplePreferences(this))
+ {
+ return;
+ }
+
+ // In the simplified UI, fragments are not used at all and we instead
+ // use the older PreferenceActivity APIs.
+
+ // Add 'simulation' preferences.
+ addPreferencesFromResource(R.xml.pref_simulation);
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean onIsMultiPane()
+ {
+ return isXLargeTablet(this) && !isSimplePreferences(this);
+ }
+
+ /**
+ * Helper method to determine if the device has an extra-large screen. For
+ * example, 10" tablets are extra-large.
+ */
+ private static boolean isXLargeTablet(Context context)
+ {
+ return (context.getResources().getConfiguration().screenLayout
+ & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE;
+ }
+
+ /**
+ * Determines whether the simplified settings UI should be shown. This is
+ * true if this is forced via {@link #ALWAYS_SIMPLE_PREFS}, or the device
+ * doesn't have newer APIs like {@link PreferenceFragment}, or the device
+ * doesn't have an extra-large screen. In these cases, a single-pane
+ * "simplified" settings UI should be shown.
+ */
+ private static boolean isSimplePreferences(Context context)
+ {
+ return ALWAYS_SIMPLE_PREFS
+ || Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB
+ || !isXLargeTablet(context);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ @TargetApi(Build.VERSION_CODES.HONEYCOMB)
+ public void onBuildHeaders(List target)
+ {
+ if (!isSimplePreferences(this))
+ {
+ loadHeadersFromResource(R.xml.pref_headers, target);
+ }
+ }
+
+ /**
+ * A preference value change listener that updates the preference's summary
+ * to reflect its new value.
+ */
+ private static Preference.OnPreferenceChangeListener sBindPreferenceSummaryToValueListener = new Preference.OnPreferenceChangeListener()
+ {
+ @Override
+ public boolean onPreferenceChange(Preference preference, Object value)
+ {
+ String stringValue = value.toString();
+ // For all other preferences, set the summary to the value's
+ // simple string representation.
+ preference.setSummary(stringValue);
+
+ return true;
+ }
+ };
+
+ /**
+ * Binds a preference's summary to its value. More specifically, when the
+ * preference's value is changed, its summary (line of text below the
+ * preference title) is updated to reflect the value. The summary is also
+ * immediately updated upon calling this method. The exact display format is
+ * dependent on the type of preference.
+ *
+ * @see #sBindPreferenceSummaryToValueListener
+ */
+ private static void bindPreferenceSummaryToValue(Preference preference)
+ {
+ // Set the listener to watch for value changes.
+ preference.setOnPreferenceChangeListener(sBindPreferenceSummaryToValueListener);
+
+ // Trigger the listener immediately with the preference's
+ // current value.
+ sBindPreferenceSummaryToValueListener.onPreferenceChange(preference,
+ PreferenceManager
+ .getDefaultSharedPreferences(preference.getContext())
+ .getString(preference.getKey(), ""));
+ }
+
+ /**
+ * This fragment shows simulation preferences only. It is used when the
+ * activity is showing a two-pane settings UI.
+ */
+ @TargetApi(Build.VERSION_CODES.HONEYCOMB)
+ public static class SimulationPreferenceFragment extends PreferenceFragment
+ {
+ @Override
+ public void onCreate(Bundle savedInstanceState)
+ {
+ super.onCreate(savedInstanceState);
+ addPreferencesFromResource(R.xml.pref_simulation);
+
+ // Bind the summaries of EditText/List/Dialog/Ringtone preferences
+ // to their values. When their values change, their summaries are
+ // updated to reflect the new value, per the Android Design
+ // guidelines.
+ bindPreferenceSummaryToValue(findPreference("example_text"));
+ bindPreferenceSummaryToValue(findPreference("example_list"));
+ }
+ }
+
+}
diff --git a/app/src/main/res/drawable/button.xml b/app/src/main/res/drawable/button.xml
new file mode 100644
index 0000000..5f30a66
--- /dev/null
+++ b/app/src/main/res/drawable/button.xml
@@ -0,0 +1,39 @@
+
+
+ -
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 743015c..4d66f99 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -181,7 +181,9 @@
android:layout_below="@+id/text_layer"
android:id="@+id/button_crypt"
android:onClick="doCrypto"
- android:text="@string/button_crypt"/>
+ android:text="@string/button_crypt"
+ android:background="@drawable/button"
+ />
diff --git a/app/src/main/res/menu/main.xml b/app/src/main/res/menu/main.xml
index 59ac26d..5a23c78 100644
--- a/app/src/main/res/menu/main.xml
+++ b/app/src/main/res/menu/main.xml
@@ -7,11 +7,15 @@
android:orderInCategory="100"
android:showAsAction="never" />
+
diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml
index 6615adb..8bd8f50 100644
--- a/app/src/main/res/values-de/strings.xml
+++ b/app/src/main/res/values-de/strings.xml
@@ -4,7 +4,7 @@
EnigmAndroid
Version
Zurücksetzen
- Version
+ Einstellungen
Ringstellung
Wähle die Ringstellungen für die Walzen:
Hier Tippen
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index e6e77ec..0df2e9e 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -6,6 +6,7 @@
Version
Reset
Ringsettings
+ Settings
Choose ringsettings for the rotors:
Type here
EnigmaCode
diff --git a/app/src/main/res/values/strings_activity_settings.xml b/app/src/main/res/values/strings_activity_settings.xml
new file mode 100644
index 0000000..bcb6a47
--- /dev/null
+++ b/app/src/main/res/values/strings_activity_settings.xml
@@ -0,0 +1,14 @@
+
+ Settings
+
+
+
+
+ Simulation
+
+ Simulate Anomaly
+ The double step anomaly causes the middle rotor
+ to rotate twice, if one step from turnover point.
+
+
+
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
index ff6c9d2..8e64f09 100644
--- a/app/src/main/res/values/styles.xml
+++ b/app/src/main/res/values/styles.xml
@@ -1,7 +1,7 @@
-
diff --git a/app/src/main/res/xml/pref_headers.xml b/app/src/main/res/xml/pref_headers.xml
new file mode 100644
index 0000000..00a087e
--- /dev/null
+++ b/app/src/main/res/xml/pref_headers.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
diff --git a/app/src/main/res/xml/pref_simulation.xml b/app/src/main/res/xml/pref_simulation.xml
new file mode 100644
index 0000000..5b4d4a1
--- /dev/null
+++ b/app/src/main/res/xml/pref_simulation.xml
@@ -0,0 +1,8 @@
+
+
+
+
diff --git a/build.gradle b/build.gradle
index a75fc81..d3ff69d 100644
--- a/build.gradle
+++ b/build.gradle
@@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:0.12.+'
+ classpath 'com.android.tools.build:gradle:1.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
diff --git a/build/intermediates/dex-cache/cache.xml b/build/intermediates/dex-cache/cache.xml
new file mode 100644
index 0000000..0497f23
--- /dev/null
+++ b/build/intermediates/dex-cache/cache.xml
@@ -0,0 +1,26 @@
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
diff --git a/build/intermediates/model_data.bin b/build/intermediates/model_data.bin
index 092fdf5..e400526 100644
Binary files a/build/intermediates/model_data.bin and b/build/intermediates/model_data.bin differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 1e61d1f..0497007 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Wed Apr 10 15:27:10 PDT 2013
+#Tue Feb 24 19:07:06 CET 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
diff --git a/local.properties b/local.properties
index 20d199a..9b5e2d0 100644
--- a/local.properties
+++ b/local.properties
@@ -1,10 +1,11 @@
## This file is automatically generated by Android Studio.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
-# This file should *NOT* be checked into Version Control Systems,
+# This file must *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
#
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
-sdk.dir=/media/Daten/android-studio/sdk
\ No newline at end of file
+#Tue Feb 24 18:25:34 CET 2015
+sdk.dir=/media/Daten/android-studio/android-sdk-linux