Added Changelog, moved version info to about dialog, translations, added license and disclaimer stuff

This commit is contained in:
vanitasvitae 2015-03-14 00:29:43 +01:00
parent a324466a42
commit 5f841fa797
25 changed files with 395 additions and 156 deletions

View file

@ -3,7 +3,21 @@ package de.vanitasvitae.enigmandroid;
/**
* Enigma-machine
*
*Copyright (C) 2015 Paul Schaub
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* @author vanitasvitae
*/
public class Enigma

View file

@ -1,3 +1,21 @@
/**
* Copyright (C) 2015 Paul Schaub
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package de.vanitasvitae.enigmandroid;
import android.app.Activity;
@ -5,6 +23,7 @@ import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.view.View;
@ -29,6 +48,7 @@ public class MainActivity extends Activity
private EditText output;
private static final int RESULT_SETTINGS = 1;
private static final String URI_CHANGELOG = "https://github.com/vanitasvitae/EnigmAndroid/blob/master/CHANGELOG.txt";
private Enigma enigma;
//memory for the ringsettings
@ -59,13 +79,7 @@ public class MainActivity extends Activity
public boolean onOptionsItemSelected(MenuItem item)
{
int id = item.getItemId();
if (id == R.id.action_version)
{
Toast.makeText(this.getApplicationContext(), R.string.version,
Toast.LENGTH_SHORT).show();
return true;
}
else if (id == R.id.action_reset)
if (id == R.id.action_reset)
{
this.reset();
Toast.makeText(getApplicationContext(), R.string.message_reset,
@ -82,6 +96,11 @@ public class MainActivity extends Activity
Intent i = new Intent(this, SettingsActivity.class);
startActivityForResult(i, RESULT_SETTINGS);
}
else if (id == R.id.action_about)
{
showAboutDialog();
return true;
}
return super.onOptionsItemSelected(item);
}
@ -241,7 +260,7 @@ public class MainActivity extends Activity
}
/**
* Show the dialog where the user can pick the ringsettings and set them if the user doesnt abort.
* Show the dialog where the user can pick the ringsettings and set them if the user doesn't abort.
*/
public void showRingsettingsDialog()
{
@ -290,6 +309,31 @@ public class MainActivity extends Activity
}).show();
}
public void showAboutDialog()
{
final View aboutView = View.inflate(this, R.layout.dialog_about, null);
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(R.string.title_about_dialog);
builder.setView(aboutView)
.setCancelable(true)
.setPositiveButton(R.string.dialog_positiv, new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int id)
{
dialog.dismiss();
}
})
.setNegativeButton(R.string.button_show_changelog, new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int id)
{
dialog.cancel();
openWebPage(URI_CHANGELOG);
}
}).show();
}
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
@ -297,11 +341,17 @@ public class MainActivity extends Activity
case RESULT_SETTINGS:
{
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
boolean an = sharedPrefs.getBoolean("prefAnomaly", true);
System.out.println(an);
this.anomaly = an;
this.anomaly = sharedPrefs.getBoolean("prefAnomaly", true);
break;
}
}
}
public void openWebPage(String url) {
Uri webpage = Uri.parse(url);
Intent intent = new Intent(Intent.ACTION_VIEW, webpage);
if (intent.resolveActivity(getPackageManager()) != null) {
startActivity(intent);
}
}
}

View file

@ -2,7 +2,21 @@ package de.vanitasvitae.enigmandroid;
/**
* Class representing the plugboard
*
*Copyright (C) 2015 Paul Schaub
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* @author vanitasvitae
*/
public class Plugboard

View file

@ -2,7 +2,21 @@ package de.vanitasvitae.enigmandroid;
/**
* Class representing a rotor of the Enigma machine (I-V,A-C)
*
*Copyright (C) 2015 Paul Schaub
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* @author vanitas
*/
public class Rotor

View file

@ -3,6 +3,25 @@ package de.vanitasvitae.enigmandroid;
import android.os.Bundle;
import android.preference.PreferenceActivity;
/**
* Class that represents the settings activity.
* Copyright (C) 2015 Paul Schaub
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*@author vanitasvitae
*/
public class SettingsActivity extends PreferenceActivity
{
@Override

View file

@ -8,6 +8,7 @@
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context=".MainActivity">
<!-- Hints of the spinners-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -55,8 +56,11 @@
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="@string/hint_rotor1_position"/>
</LinearLayout>
<!-- Spinners -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -115,12 +119,14 @@
</LinearLayout>
<!-- Plugboard and button-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/buttons_lay"
android:layout_below="@+id/lin_lay_1"
android:orientation="horizontal">
<EditText
android:layout_width="0dp"
android:layout_weight="75"
@ -134,18 +140,22 @@
android:layout_width="0dp"
android:layout_weight="25"
android:layout_height="wrap_content"
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"/>
</LinearLayout>
<!-- Textboxes for input and output -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/buttons_lay"
android:layout_alignParentBottom="true"
android:id="@+id/text_layer">
<EditText
android:layout_width="0dp"
android:layout_weight=".50"
@ -157,12 +167,11 @@
android:layout_width="0dp"
android:layout_weight=".50"
android:layout_height="match_parent"
android:editable="false"
android:inputType="none"
android:textIsSelectable="true"
android:id="@+id/output"
android:hint="@string/hint_enigma_code"/>
</LinearLayout>
</RelativeLayout>

View file

@ -0,0 +1,93 @@
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="@+id/ringstellung_layout_hint">
<!-- About Enigma. -->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="@android:style/TextAppearance.Holo.Medium"
android:text="@string/title_about_dialog"
android:id="@+id/title_section_app_description_text"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="@android:style/TextAppearance.Holo.Small"
android:text="@string/description_text"
android:id="@+id/about_app_description"/>
<!-- About Version -->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="@android:style/TextAppearance.Holo.Medium"
android:text="@string/action_version"
android:id="@+id/title_section_version"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="@android:style/TextAppearance.Holo.Small"
android:text="@string/version"
android:id="@+id/about_version_section"/>
<!-- About How To -->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="@android:style/TextAppearance.Holo.Medium"
android:text="@string/title_section_how_to_use"
android:id="@+id/title_section_how_to_use"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="@android:style/TextAppearance.Holo.Small"
android:text="@string/section_how_to_use"
android:id="@+id/section_how_to_use"/>
<!-- About Developer -->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="@android:style/TextAppearance.Holo.Medium"
android:text="@string/title_section_developer"
android:id="@+id/title_section_developer_text"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="@android:style/TextAppearance.Holo.Small"
android:text="@string/section_developer"
android:id="@+id/about_developer_section"/>
<!-- About Disclaimer -->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="@android:style/TextAppearance.Holo.Medium"
android:text="@string/title_section_disclaimer"
android:id="@+id/title_section_disclaimer_text"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="@android:style/TextAppearance.Holo.Small"
android:text="@string/section_disclaimer"
android:id="@+id/about_disclaimer_section"/>
</LinearLayout>
</ScrollView>
</RelativeLayout>

View file

@ -2,10 +2,6 @@
xmlns:tools="http://schemas.android.com/tools"
tools:context=".MainActivity" >
<item android:id="@+id/action_version"
android:title="@string/action_version"
android:orderInCategory="100"
android:showAsAction="never" />
<item android:id="@+id/action_reset"
android:orderInCategory="97"
android:showAsAction="ifRoom"
@ -18,4 +14,8 @@
android:title="@string/action_settings"
android:orderInCategory="99"
android:showAsAction="never" />
<item android:id="@+id/action_about"
android:title="@string/title_action_about"
android:orderInCategory="100"
android:showAsAction="never" />
</menu>

View file

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="button_show_changelog">Changelog</string>
<string name="title_action_about">Über</string>
<string name="title_about_dialog">Über EnigmAndroid</string>
<string name="description_text">EnigmAndroid ist die Implementation einer Simulation der Enigma Maschine.
Die Enigma Maschine ist eine in den 1920er Jahren entwickelte Verschlüsselungsmaschine,
die unter anderem im zweiten Weltkrieg von der deutschen Wehrmacht eingesetzt wurde,
um geheime Nachrichten zu verschlüsseln. Dabei wird jeder einzelne Buchstabe elektronisch
durch eine Reihe von rotierbaren Walzen geleitet, sodass nach jedem Buchstaben ein anderes
Verschlüsselungsalphabet genutzt wird (Polyalphabetische Substitution).
Die Walzen konnte man aus einem Set von 5 Walzen wählen. Zusätzlich gab es ein Steckbrett, an dem
man Buchstaben von Hand vertauschen konnte.
</string>
<string name="title_section_how_to_use">Bedienungsanleitung</string>
<string name="section_how_to_use">Um einen Text mit EnigmAndroid zu ver- oder entschlüsseln, tippen Sie den Klar- oder Geheimtext in das Feld \"Hier tippen\".
Wählen Sie anschließend eine Umkehrwalze, und Walzen für die Plätze 1 bis 3 aus. Legen Sie außerdem die Startpositionen der Walzen fest.
Zuletzt können Sie noch einige Steckerpaare auf dem Steckbrett festlegen. Tippen Sie dazu die gewünschten Paare mit Komma getrennt in das entsprechende Textfeld (zb. \"ab,cd\").
Beachten Sie, dass Sie einen Stecker nicht doppelt nutzen dürfen.
Optional können Sie auch noch die Ringstellung definieren. Öffnen Sie dazu das Optionsmenü und wählen Sie den Punkt \"Ringstellung\".
Haben Sie alle Einstellungen getätigt klicken Sie auf den Button \"Ver-Entschlüsseln\".</string>
<string name="title_section_developer">Entwickler</string>
<string name="section_developer">EnigmAndroid wird entwickelt von: \nPaul Schaub</string>
<string name="title_section_disclaimer">Disclaimer</string>
<string name="section_disclaimer">THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</string>
</resources>

View file

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="button_show_changelog">Changelog</string>
<string name="title_action_about">About</string>
<string name="title_about_dialog">About EnigmAndroid</string>
<string name="description_text">EnigmAndroid is an implementation of a simulation of the Enigma Machine.
The Enigma Machine is a cypher machine developed in the 1920s. It was used by the german Wehrmacht to
encipher secret messaged during the second world war. For enciphering text, every letter is passed through 3 mechanical rotors that rotate with every keypress.
That way the enigma achieves polyalphabetic substitution and the output appears random. The rotors could be chosen from a set of 5. Additionally there was a
so called plugboard, where one could switch over pairs of letters.
</string>
<string name="title_section_how_to_use">How to use</string>
<string name="section_how_to_use">To encrypt/decrpyt a message, you can type it into the input field.
Afterwards you can select a reflector and the three rotors. Also select their initial positions.
Then you can set pairs on the plugboard. Therefore you just type the pairs separated by commas (e.g. \"ab,cd\").
Notice that you can\'t plug a letter twice.
Optionally you can set custom ring settings. Open the options menu and select \"Ringsettings\".
When you are ready press \"En-/Decrypt!\".</string>
<string name="title_section_developer">Developer</string>
<string name="section_developer">EnigmAndroid is developed by: \nPaul Schaub</string>
<string name="title_section_disclaimer">Disclaimer</string>
<string name="section_disclaimer">THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</string>
</resources>

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="version" translatable="false">0.1.2-24.02.2015</string>
<string name="version" translatable="false">0.1.3-14.03.2015</string>
<string name="app_name">EnigmAndroid</string>
<string name="action_version">Version</string>
<string name="action_reset">Reset</string>