From 037328ff265cced83c0d9f0aa22f480509acb13a Mon Sep 17 00:00:00 2001 From: Felix Prahl-Kamps Date: Sun, 7 Jul 2019 15:51:52 +0200 Subject: [PATCH] extracted string resources change material preference switch to display current state as subtitle --- .../activities/UploadInfoActivity.java | 4 +- .../customViews/MaterialPreferenceSwitch.java | 17 ++++- app/src/main/res/anim/push_up_in.xml | 5 ++ app/src/main/res/anim/push_up_out.xml | 5 ++ app/src/main/res/layout/activity_exchange.xml | 74 +++++++++---------- app/src/main/res/layout/activity_login.xml | 8 +- app/src/main/res/layout/activity_profile.xml | 18 +++-- app/src/main/res/layout/activity_upload.xml | 10 +-- .../layout/fragment_upload_credentials.xml | 8 +- .../res/layout/fragment_upload_settings.xml | 22 +++--- .../res/layout/material_preference_switch.xml | 4 +- app/src/main/res/values-de/strings.xml | 32 +++++++- app/src/main/res/values/attrs.xml | 3 +- app/src/main/res/values/strings.xml | 36 ++++++++- 14 files changed, 164 insertions(+), 82 deletions(-) create mode 100644 app/src/main/res/anim/push_up_in.xml create mode 100644 app/src/main/res/anim/push_up_out.xml diff --git a/app/src/main/java/lu/circl/mispbump/activities/UploadInfoActivity.java b/app/src/main/java/lu/circl/mispbump/activities/UploadInfoActivity.java index baf61dc..80fc022 100644 --- a/app/src/main/java/lu/circl/mispbump/activities/UploadInfoActivity.java +++ b/app/src/main/java/lu/circl/mispbump/activities/UploadInfoActivity.java @@ -248,10 +248,10 @@ public class UploadInfoActivity extends AppCompatActivity { public CharSequence getPageTitle(int position) { switch (position) { case 0: - return "Settings"; + return getString(R.string.settings); case 1: - return "Credentials"; + return getString(R.string.credentials); default: return "N/A"; diff --git a/app/src/main/java/lu/circl/mispbump/customViews/MaterialPreferenceSwitch.java b/app/src/main/java/lu/circl/mispbump/customViews/MaterialPreferenceSwitch.java index 06d4ba5..f065ea2 100644 --- a/app/src/main/java/lu/circl/mispbump/customViews/MaterialPreferenceSwitch.java +++ b/app/src/main/java/lu/circl/mispbump/customViews/MaterialPreferenceSwitch.java @@ -5,6 +5,7 @@ import android.content.res.TypedArray; import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.View; +import android.widget.CompoundButton; import android.widget.Switch; import android.widget.TextView; @@ -27,14 +28,15 @@ public class MaterialPreferenceSwitch extends ConstraintLayout { TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.MaterialPreferenceSwitch); String title = a.getString(R.styleable.MaterialPreferenceSwitch_title); - String subTitle = a.getString(R.styleable.MaterialPreferenceSwitch_subtitle); + final String onText = a.getString(R.styleable.MaterialPreferenceSwitch_onText); + final String offText = a.getString(R.styleable.MaterialPreferenceSwitch_offText); a.recycle(); titleView = view.findViewById(R.id.material_preference_title); titleView.setText(title); subTitleView = view.findViewById(R.id.material_preference_subtitle); - subTitleView.setText(subTitle); + subTitleView.setText(offText); switchView = view.findViewById(R.id.material_preference_switch); @@ -46,6 +48,17 @@ public class MaterialPreferenceSwitch extends ConstraintLayout { } } }); + + switchView.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + if (isChecked) { + subTitleView.setText(onText); + } else { + subTitleView.setText(offText); + } + } + }); } public void setEnabled(boolean enabled) { diff --git a/app/src/main/res/anim/push_up_in.xml b/app/src/main/res/anim/push_up_in.xml new file mode 100644 index 0000000..cc7bcec --- /dev/null +++ b/app/src/main/res/anim/push_up_in.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/anim/push_up_out.xml b/app/src/main/res/anim/push_up_out.xml new file mode 100644 index 0000000..9153144 --- /dev/null +++ b/app/src/main/res/anim/push_up_out.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_exchange.xml b/app/src/main/res/layout/activity_exchange.xml index 40557ad..3ed9bbd 100644 --- a/app/src/main/res/layout/activity_exchange.xml +++ b/app/src/main/res/layout/activity_exchange.xml @@ -1,5 +1,6 @@ - - - + + + android:padding="8dp" + android:text="@string/activity_exchange_scan_partner_qr_hint" + android:textColor="@color/black" /> - - - - - - - - + + + app:srcCompat="@drawable/ic_arrow_back" + android:contentDescription="@string/button_prev" /> + app:srcCompat="@drawable/ic_arrow_forward" + android:contentDescription="@string/button_continue" /> diff --git a/app/src/main/res/layout/activity_login.xml b/app/src/main/res/layout/activity_login.xml index f7bce35..1c8c184 100644 --- a/app/src/main/res/layout/activity_login.xml +++ b/app/src/main/res/layout/activity_login.xml @@ -2,11 +2,9 @@ @@ -29,15 +27,13 @@ app:layout_constraintTop_toTopOf="parent"> - - diff --git a/app/src/main/res/layout/activity_profile.xml b/app/src/main/res/layout/activity_profile.xml index 2c3a33b..b19dd5d 100644 --- a/app/src/main/res/layout/activity_profile.xml +++ b/app/src/main/res/layout/activity_profile.xml @@ -26,10 +26,11 @@ app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="parent" /> + app:layout_constraintTop_toTopOf="parent" + tools:ignore="ContentDescription" /> + app:layout_constraintTop_toBottomOf="@id/toolbar" + tools:ignore="ContentDescription" /> + app:layout_constraintTop_toBottomOf="@+id/accountImage" /> + app:title="@string/nationality"/> + app:title="@string/sector"/> + app:title="@string/description"/> diff --git a/app/src/main/res/layout/activity_upload.xml b/app/src/main/res/layout/activity_upload.xml index 0611fab..1575324 100644 --- a/app/src/main/res/layout/activity_upload.xml +++ b/app/src/main/res/layout/activity_upload.xml @@ -26,7 +26,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="@style/TextAppearance.AppCompat.Widget.ActionBar.Title" - android:text="Upload" + android:text="@string/upload" android:layout_gravity="center"/> @@ -48,7 +48,7 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" app:layout_constraintEnd_toEndOf="parent" - app:description="MISP instance available" /> + app:description="@string/upload_action_available" /> + app:description="@string/upload_action_add_org" /> + app:description="@string/upload_action_add_user" /> + app:description="@string/upload_action_add_server" /> + app:title="@string/url"/> + app:title="@string/email"/> \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_upload_settings.xml b/app/src/main/res/layout/fragment_upload_settings.xml index 03504b4..96b3a08 100644 --- a/app/src/main/res/layout/fragment_upload_settings.xml +++ b/app/src/main/res/layout/fragment_upload_settings.xml @@ -18,7 +18,7 @@ android:layout_marginStart="16dp" android:layout_marginTop="16dp" android:layout_marginEnd="16dp" - android:text="This Organisation will have the following rights on your MISP instance" + android:text="@string/fragment_upload_settings_title" android:textAppearance="@style/TextAppearance.MaterialComponents.Overline" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" @@ -33,8 +33,9 @@ app:layout_constraintHorizontal_bias="0.0" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/text" - app:subtitle="Server certificate must not be from a trusted CA (not recomended)" - app:title="Allow self signed certificates"/> + app:onText="@string/settings_self_signed_on" + app:offText="@string/settings_self_signed_off" + app:title="@string/settings_self_signed_title"/> + app:onText="@string/settings_push_on" + app:offText="@string/settings_push_off" + app:title="@string/settings_push_title"/> + app:onText="@string/settings_pull_on" + app:offText="@string/settings_pull_off" + app:title="@string/settings_pull_title"/> + app:onText="@string/settings_cache_on" + app:offText="@string/settings_cache_off" + app:title="@string/settings_cache_title"/> diff --git a/app/src/main/res/layout/material_preference_switch.xml b/app/src/main/res/layout/material_preference_switch.xml index addb71a..7bd64ca 100644 --- a/app/src/main/res/layout/material_preference_switch.xml +++ b/app/src/main/res/layout/material_preference_switch.xml @@ -42,7 +42,9 @@ app:layout_constraintEnd_toStartOf="@id/material_preference_switch" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/material_preference_title" - tools:text="Subtitle" /> + tools:text="Subtitle" + android:inAnimation="@anim/push_up_in" + android:outAnimation="@anim/push_up_out"/> - MispBump Anmelden Abmelden Hilfe MISP Automatisierungs-Schlüssel Keine Informationen Automatisierungs-Schlüssel speichern - MISP Server URL\nDie URL unter der Ihre MISP Instanz erreichbar ist.\n\nMISP Automatisierungs Schlüssel\nZu finden unter ... + MISP Server URL\nDie URL unter der Ihre MISP Instanz erreichbar ist.\n\nMISP Automatisierungs Schlüssel QR code Synchronisation Sie haben noch keine MISP Instanzen verknüpft + Scannen den QR code ihres Partners + Fahren sie fort, sobald dieser QR Code gescannt wurde + Weiter + Zurück + Nationalität + Sektor + Beschreibung + Einstellungen + Zugangsdaten + Authentifizierungsschlüssel + Passwort + Diese Organisation soll die folgenden Rechte erhalten + Selbstsignierte Zertifikate erlauben + Zertifikate von unbekannten CA\'s werden akzeptiert (nicht empfohlen) + Nur Zertifikate von bekannten CA\'s werden akzeptiert + Ereignisse und deren Attribute können nicht hochgeladen werden + Ereignisse und deren Attribute können hochgeladen werden + Ereignisse und deren Attribute können nicht heruntergeladen werden + Ereignisse und deren Attribute können heruntergeladen werden + Ereignisse und deren Attribute werden nicht zwischengespeichert + Ereignisse und deren Attribute werden zwischengespeichert + Zwischenspeichern + Herunterladen + Hochladen + Hochladen + MISP Instanz erreichbar + Organisation hinzufügen + Server hinzufügen + Benutzer hinzufügen \ No newline at end of file diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml index 2de5bd2..d9cf405 100644 --- a/app/src/main/res/values/attrs.xml +++ b/app/src/main/res/values/attrs.xml @@ -12,7 +12,8 @@ - + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index f60dae6..5688842 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,5 +1,5 @@ - MispBump + MISPbump Log in Log out MISP Server URL @@ -7,12 +7,42 @@ No Information Save Automation Key Help - MISP Server URL\nPublic MISP URL\n\nMISP Automation key\nZu finden unter ... + MISP Server URL\nPublic MISP URL\n\nMISP Automation key Okay QR code Synchronization You have not synced any MISP instances yet - Hello blank fragment + Scan your partners QR code + Continue if your partner also scanned this QR code + next + previous + Nationality + Sector + Description + Settings + Credentials + Password + Authkey + URL + Email + This Organisation should have the following permissions + Allow self signed certificates + Server certificate can be from any CA (not recommended) + Push + Events and their attributes cannot be uploaded + Pull + Events and their attributes cannot be downloaded + Cache + Events and their attributes will not be cached + Only certificates from trusted CA\'s are accepted + Events and their attributes can be uploaded + Events and their attributes can be downloaded + Events and their attributes will be cached + Upload + MISP instance available + Add organisation + Add sync user + Add sync server