Identity creation dialog improvements

This commit is contained in:
Christian Basler 2016-10-02 15:40:18 +02:00
parent dea9231fcf
commit bfd5a72b52
9 changed files with 150 additions and 155 deletions

View File

@ -65,7 +65,7 @@ dependencies {
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:1.10.19'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha8'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha9'
}
idea.module {

View File

@ -28,6 +28,7 @@ import android.support.v7.app.AppCompatDialogFragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RadioGroup;
import android.widget.TextView;
import android.widget.Toast;
@ -39,14 +40,11 @@ import ch.dissem.bitmessage.BitmessageContext;
import ch.dissem.bitmessage.entity.BitmessageAddress;
import ch.dissem.bitmessage.entity.payload.Pubkey;
import static android.app.Activity.RESULT_OK;
/**
* @author Christian Basler
*/
public class AddIdentityDialogFragment extends AppCompatDialogFragment {
private static final int IMPORT_IDENTITY_RESULT_CODE = 1;
private BitmessageContext bmc;
@Override
@ -61,57 +59,49 @@ public class AddIdentityDialogFragment extends AppCompatDialogFragment {
savedInstanceState) {
getDialog().setTitle(R.string.add_identity);
View view = inflater.inflate(R.layout.dialog_add_identity, container, false);
view.findViewById(R.id.create_identity)
.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
Toast.makeText(getActivity(),
R.string.toast_long_running_operation,
Toast.LENGTH_SHORT).show();
new AsyncTask<Void, Void, BitmessageAddress>() {
@Override
protected BitmessageAddress doInBackground(Void... args) {
return bmc.createIdentity(false, Pubkey.Feature.DOES_ACK);
}
@Override
protected void onPostExecute(BitmessageAddress chan) {
Toast.makeText(getActivity(),
R.string.toast_identity_created,
Toast.LENGTH_SHORT).show();
MainActivity mainActivity = MainActivity.getInstance();
if (mainActivity != null) {
mainActivity.addIdentityEntry(chan);
final RadioGroup radioGroup = (RadioGroup) view.findViewById(R.id.radioGroup);
view.findViewById(R.id.ok).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
switch (radioGroup.getCheckedRadioButtonId()) {
case R.id.create_identity:
Toast.makeText(getActivity(),
R.string.toast_long_running_operation,
Toast.LENGTH_SHORT).show();
new AsyncTask<Void, Void, BitmessageAddress>() {
@Override
protected BitmessageAddress doInBackground(Void... args) {
return bmc.createIdentity(false, Pubkey.Feature.DOES_ACK);
}
}
}.execute();
@Override
protected void onPostExecute(BitmessageAddress chan) {
Toast.makeText(getActivity(),
R.string.toast_identity_created,
Toast.LENGTH_SHORT).show();
MainActivity mainActivity = MainActivity.getInstance();
if (mainActivity != null) {
mainActivity.addIdentityEntry(chan);
}
}
}.execute();
break;
case R.id.import_identity:
startActivity(new Intent(getActivity(), ImportIdentityActivity.class));
break;
case R.id.add_chan:
addChanDialog();
break;
case R.id.add_deterministic_address:
new DeterministicIdentityDialogFragment().show(getFragmentManager(),
"dialog");
break;
default:
return;
}
});
view.findViewById(R.id.import_identity)
.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
startActivity(new Intent(getActivity(), ImportIdentityActivity.class));
}
});
view.findViewById(R.id.add_deterministic_address)
.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
new DeterministicIdentityDialogFragment().show(getFragmentManager(), "dialog");
}
});
view.findViewById(R.id.add_chan)
.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
addChanDialog();
}
});
dismiss();
}
});
view.findViewById(R.id.dismiss)
.setOnClickListener(new View.OnClickListener() {
@Override

View File

@ -70,7 +70,7 @@
<android.support.design.widget.TextInputLayout
android:id="@+id/number_of_identities_wrapper"
android:layout_width="312dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@id/passphrase_wrapper">
@ -88,7 +88,7 @@
<Switch
android:id="@+id/shorter"
android:layout_width="312dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/shorter"
app:layout_constraintLeft_toLeftOf="parent"

View File

@ -19,12 +19,12 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="18dp"
android:paddingEnd="24dp"
android:paddingStart="24dp"
android:paddingTop="18dp"
android:paddingBottom="18dp"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:paddingTop="18dp">
<TextView
android:id="@+id/description"
@ -36,58 +36,56 @@
tools:layout_constraintLeft_creator="1"
tools:layout_constraintTop_creator="1"/>
<Button
android:id="@+id/create_identity"
style="?android:attr/borderlessButtonStyle"
android:layout_width="wrap_content"
<RadioGroup
android:id="@+id/radioGroup"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/create_identity"
android:textColor="@color/colorAccent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintRight_toRightOf="@+id/description"
app:layout_constraintTop_toBottomOf="@+id/description"
tools:layout_constraintLeft_creator="1"
tools:layout_constraintRight_creator="1"
tools:layout_constraintTop_creator="1"/>
android:paddingBottom="24dp"
android:paddingTop="24dp"
app:layout_constraintLeft_toLeftOf="@+id/description"
app:layout_constraintTop_toBottomOf="@+id/description">
<RadioButton
android:id="@+id/add_chan"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="24dp"
android:text="@string/add_chan_description"/>
<RadioButton
android:id="@+id/add_deterministic_address"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="24dp"
android:text="@string/add_deterministic_address_description"/>
<RadioButton
android:id="@+id/import_identity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="24dp"
android:text="@string/import_identity_description"/>
<RadioButton
android:id="@+id/create_identity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/create_identity_description"/>
</RadioGroup>
<Button
android:id="@+id/import_identity"
android:id="@+id/ok"
style="?android:attr/borderlessButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/import_identity"
android:text="@string/ok"
android:textColor="@color/colorAccent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintRight_toRightOf="@+id/create_identity"
app:layout_constraintTop_toBottomOf="@+id/create_identity"
tools:layout_constraintLeft_creator="1"
tools:layout_constraintRight_creator="1"
tools:layout_constraintTop_creator="1"/>
<Button
android:id="@+id/add_deterministic_address"
style="?android:attr/borderlessButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/add_deterministic_address"
android:textColor="@color/colorAccent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintRight_toRightOf="@+id/import_identity"
app:layout_constraintTop_toBottomOf="@+id/import_identity"
tools:layout_constraintLeft_creator="1"
tools:layout_constraintRight_creator="1"
tools:layout_constraintTop_creator="1"/>
<Button
android:id="@+id/add_chan"
style="?android:attr/borderlessButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/add_chan"
android:textColor="@color/colorAccent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintRight_toRightOf="@+id/add_deterministic_address"
app:layout_constraintTop_toBottomOf="@+id/add_deterministic_address"
app:layout_constraintRight_toRightOf="@+id/radioGroup"
app:layout_constraintTop_toBottomOf="@+id/radioGroup"
tools:layout_constraintLeft_creator="1"
tools:layout_constraintRight_creator="1"
tools:layout_constraintTop_creator="1"/>
@ -99,6 +97,6 @@
android:layout_height="wrap_content"
android:text="@string/cancel"
android:textColor="@color/colorAccent"
app:layout_constraintLeft_toLeftOf="@+id/description"
app:layout_constraintTop_toBottomOf="@+id/add_deterministic_address"/>
app:layout_constraintRight_toLeftOf="@+id/ok"
app:layout_constraintTop_toBottomOf="@+id/radioGroup"/>
</android.support.constraint.ConstraintLayout>

View File

@ -27,7 +27,7 @@
<TextView
android:id="@+id/description"
android:layout_width="360dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/import_input_description"
app:layout_constraintLeft_toLeftOf="parent"

View File

@ -1,7 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="about">Über Abit</string>
<string name="about_app">Ein Bitmessage-Client für Android</string>
<string name="about_summary">Open Source Abhängigkeiten.</string>
<string name="library_jabit_libraryDescription">Jabit hat das Ziel eine einfach zu benutzende Bitmessage-Bibliothek für Java-Entwickler zu sein, um schnell eigene Bitmessage-Anwendungen zu implementieren.</string>
</resources>
</resources>

View File

@ -1,73 +1,83 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Abit</string>
<string name="about_app">Ein Bitmessage-Client für Android</string>
<string name="title_message_detail">Nachricht</string>
<string name="title_subscription_detail">Abonnement</string>
<string name="bitmessage_full_node">Bitmessage Netzknoten</string>
<string name="wifi_mode">Art der WLAN-Verbindung</string>
<string name="settings">Einstellungen</string>
<string name="wifi_only">Nur WLAN</string>
<string name="wifi_only_summary">Nicht mit Mobilfunknetz verbinden</string>
<string name="bitmessage_full_node">Bitmessage Netzknoten</string>
<string name="subject">Betreff</string>
<string name="to">An</string>
<string name="title_message_detail">Nachricht</string>
<string name="subscriptions">Abonnements</string>
<string name="wifi_mode">Art der WLAN-Verbindung</string>
<string name="action_settings">Einstellungen</string>
<string name="to">An</string>
<string name="subject">Betreff</string>
<string name="manage_identity">Identität verwalten</string>
<string name="add_identity">Identität hinzufügen</string>
<string name="add_identity_summary">Eine neue Identität erstellen</string>
<string name="create_identity">Erstellen</string>
<string name="create_identity_description">Eine neue, zufällige Identität erstellen</string>
<string name="import_identity">Importieren</string>
<string name="import_identity_description">Eine existierende Identität von PyBitmessage oder einem Export importieren</string>
<string name="add_deterministic_address">Deterministische Identität</string>
<string name="add_deterministic_address_description">Eine deterministische Identität erstellen oder wiederherstellen</string>
<string name="add_chan">Chan hinzufügen</string>
<string name="add_chan_summary">Einen Chan hinzufügen oder erstellen</string>
<string name="broadcast">Broadcast</string>
<string name="cancel">Abbrechen</string>
<string name="do_import">Importieren</string>
<string name="add_chan_description">Einen Chan erstellen oder einem beitreten</string>
<string name="title_activity_open_bitmessage_link">Kontakt importieren</string>
<string name="action_settings">Einstellungen</string>
<string name="connection_info_1">Stream %1$d: eine Verbindung</string>
<string name="connection_info_n">Stream %1$d: %2$d Verbindungen</string>
<string name="import_address">Adresse importieren</string>
<string name="import_contact">Kontakt hinzufügen</string>
<string name="label">Label</string>
<string name="manage_identity">Identität verwalten</string>
<string name="subscribe">Abonnieren</string>
<string name="title_activity_open_bitmessage_link">Kontakt importieren</string>
<string name="delete">Löschen</string>
<string name="reply">Antworten</string>
<string name="do_import">Importieren</string>
<string name="cancel">Abbrechen</string>
<string name="broadcast">Broadcast</string>
<string name="n_new_messages">%d neue Nachrichten</string>
<string name="reply">Antworten</string>
<string name="delete">Löschen</string>
<string name="mark_unread">Als ungelesen markieren</string>
<string name="archive">Archiv</string>
<string name="empty_trash">Papierkorb leeren</string>
<string name="mark_unread">Als ungelesen markieren</string>
<string name="stream_number">Stream %d</string>
<string name="enabled">Aktiv</string>
<string name="title_subscription_detail">Abonnement</string>
<string name="sync_timeout">Zeitbeschränkung der Synchronisierung</string>
<string name="sync_timeout_summary">Timeout in Sekunden</string>
<string name="trusted_node">Vertrauenswürdiger Knoten</string>
<string name="trusted_node_summary">Diese Adresse wird für die Synchronisation verwendet</string>
<string name="sync_timeout">Zeitbeschränkung der Synchronisierung</string>
<string name="sync_timeout_summary">Timeout in Sekunden</string>
<string name="write_message">Schreiben</string>
<string name="full_node">Aktiver Knoten</string>
<string name="send">Senden</string>
<string name="write_message">Schreiben</string>
<string name="connection_info_1">Stream %1$d: eine Verbindung</string>
<string name="connection_info_n">Stream %1$d: %2$d Verbindungen</string>
<string name="connection_info_disconnected">Getrennt</string>
<string name="connection_info_pending">Verbindung wird aufgebaut…</string>
<string name="proof_of_work_title">Proof of Work</string>
<string name="proof_of_work_text_0">Arbeite am Versenden</string>
<string name="proof_of_work_text_n">Arbeite am Versenden (%1$d in Warteschlange)</string>
<string name="proof_of_work_title">Proof of Work</string>
<string name="error_invalid_sync_host">Synchronisation fehlgeschlagen: der vertrauenswürdige Knoten konnte nicht erreicht werden.</string>
<string name="error_invalid_sync_port">Ungültiger Port in den Synchronisationseinstellungen: %s</string>
<string name="error_invalid_sync_host">Synchronisation fehlgeschlagen: der vertrauenswürdige Knoten konnte nicht erreicht werden.</string>
<string name="compose_body_hint">Nachricht schreiben</string>
<string name="contacts_and_subscriptions">Kontakte</string>
<string name="subscribed">Abonniert</string>
<string name="server_pow">Server POW</string>
<string name="server_pow_summary">Der vertrauenswürdige Knoten macht den Proof of Work</string>
<string name="full_node_warning">Ein aktiver Bitmessage-Knoten muss viel hoch- und herunterladen, was auf einem mobilen Netzwerk teuer sein kann. Soll tatsächlich ein aktiver Knoten gestartet werden?</string>
<string name="status">Debugging</string>
<string name="alias_default_identity">Ich</string>
<string name="about">Über Abit</string>
<string name="about_summary">Opensource Abhängigkeiten.</string>
<string name="title_activity_status">Debugging</string>
<string name="status">Debugging</string>
<string name="status_summary">Technische Infos</string>
<string name="alias_default_identity">Ich</string>
<string name="pubkey_available">Öffentlicher Schlüssel verfügbar</string>
<string name="pubkey_not_available">Öffentlicher Schlüssel noch nicht verfügbar</string>
<string name="alt_qr_code">QR-Code</string>
<string name="add_identity_warning">Mehrere Identitäten zu haben bedeutet einen höheren Resourcenverbrauch. Bist Du sicher?</string>
<string name="add_identity_warning">Mehrere Identitäten zu haben bedeutet einen höheren Resourcenverbrauch. Falls Du sicher bist dass du eine Identität hinzufügen willst, wähle bitte die Vorgehensweise:</string>
<string name="share">Teilen</string>
<string name="delete_contact_warning">Bist Du sicher dass dieser Kontakt gelöscht werden soll?</string>
<string name="delete_identity_warning">Bist Du sicher dass diese Identität gelöscht werden soll? Nachrichten, welche an diese Adresse gesendet werden, können nicht mehr empfangen werden und es est nicht möglich diese Aktion rückgängig zu machen.</string>
<string name="create_contact">Kontakt erfassen</string>
<string name="delete_contact_warning">Bist Du sicher dass dieser Kontakt gelöscht werden soll?</string>
<string name="scan_qr_code">QR-Code scannen</string>
<string name="create_contact">Kontakt erfassen</string>
<string name="full_node_description">Solange kein aktiver Knoten gestartet ist, werden keine Meldungen empfangen oder gesendet. Dies braucht jedoch viele Resourcen und Daten.
Als Alternative kann in den Einstellungen ein vertrauenswürdiger Knoten konfiguriert werden, aber im Moment muss dieser selbst bereitgestellt werden.</string>
@ -78,22 +88,19 @@ Als Alternative kann in den Einstellungen ein vertrauenswürdiger Knoten konfigu
<string name="confirm_export">Identität wirklich exportieren? Der Export wird die privaten Schlüssel unverschlüsselt enthalten.</string>
<string name="compose_message">Schreiben</string>
<string name="passphrase">Passphrase</string>
<string name="toast_chan_created">Chan erstellt</string>
<string name="toast_long_running_operation">Dies kann einige Minuten dauern</string>
<string name="toast_identity_created">Identität erstellt</string>
<string name="toast_identities_created">Identitäten erstellt</string>
<string name="import_identity">Importieren</string>
<string name="create_identity">Erstellen</string>
<string name="add_deterministic_address">Deterministische Identität</string>
<string name="toast_chan_created">Chan erstellt</string>
<string name="deterministic_address_warning">Merke dir diese Enstellungen und stelle sicher dass sie korrekt sind wenn du eine deterministische Addresse wiederherstellst.</string>
<string name="shorter">Kürzere Adressen suchen</string>
<string name="number_of_identities">Anzahl zu generierender Identitäten</string>
<string name="title_import_identity">Identität importieren</string>
<string name="wif_string">WIF / Inhalt von \'keys.dat\'</string>
<string name="select_identities_to_import">Bitte wähle die zu importierenden Identitäten:</string>
<string name="select_file_title">Datei auswählen</string>
<string name="open_file">Datei öffnen</string>
<string name="shorter">Kürzere Adressen suchen</string>
<string name="wif_string">WIF / Inhalt von keys.dat</string>
<string name="next">Weiter</string>
<string name="import_input_description">Du kannst einfach den Inhalt eines Exports oder einer \'keys.dat\'-Datei einfügen</string>
<string name="title_import_identity">Identität importieren</string>
<string name="open_file">Datei öffnen</string>
<string name="error_loading_data">Fehler beim Laden der Daten</string>
<string name="select_file_title">Datei auswählen</string>
<string name="select_identities_to_import">Bitte wähle die zu importierenden Identitäten:</string>
<string name="import_input_description">Du kannst einfach den Inhalt eines Exports oder einer keys.dat-Datei einfügen</string>
</resources>

View File

@ -16,5 +16,5 @@
<string name="library_jabit_classPath" translatable="false">ch.dissem.bitmessage.BitmessageContext</string>
<!-- License section -->
<string name="library_jabit_licenseId" translatable="false">apache_2_0</string>
<!-- Custom variables section -->
</resources>
<!-- Language specific section -->
</resources>

View File

@ -15,10 +15,13 @@
<string name="add_identity">Add Identity</string>
<string name="add_identity_summary">Create new identity</string>
<string name="create_identity">Create new</string>
<string name="create_identity_description">Create a new, random identity</string>
<string name="import_identity">Import existing</string>
<string name="import_identity_description">Import an existing identity from PyBitmessage or from an export</string>
<string name="add_deterministic_address">Deterministic identity</string>
<string name="add_deterministic_address_description">Create or recreate a deterministic identity</string>
<string name="add_chan">Add Chan</string>
<string name="add_chan_summary">Add or create a chan</string>
<string name="add_chan_description">Create or join a chan</string>
<string name="title_activity_open_bitmessage_link">Import Contact</string>
<string name="action_settings">Settings</string>
@ -68,7 +71,7 @@
<string name="pubkey_available">Public key available</string>
<string name="pubkey_not_available">Public key not yet available</string>
<string name="alt_qr_code">QR code</string>
<string name="add_identity_warning">Having more identities will reequire more resources. Are you sure you want to add an identity?</string>
<string name="add_identity_warning">Having more identities will reequire more resources. If you are sure you want to add an identity, please select what exactly you want to do:</string>
<string name="share">Share</string>
<string name="delete_identity_warning">Are you sure you want to delete this identity? You won\'t be able to receive any messages sent to this address and can\'t undo this operation.</string>
<string name="delete_contact_warning">Are you sure you want to delete this contact?</string>
@ -91,12 +94,12 @@ As an alternative you could configure a trusted node in the settings, but as of
<string name="deterministic_address_warning">Be sure to remember those settings correctly when recreating a deterministic address.</string>
<string name="number_of_identities">Number of identities to create</string>
<string name="shorter">Search for shorter addresses</string>
<string name="wif_string">WIF / contents of \'keys.dat\'</string>
<string name="wif_string">WIF / contents of keys.dat</string>
<string name="next">Continue</string>
<string name="title_import_identity">Import Identity</string>
<string name="open_file">Open File</string>
<string name="error_loading_data">Error loading data</string>
<string name="select_file_title">Select a File</string>
<string name="select_identities_to_import">Please select the identities you want to import:</string>
<string name="import_input_description">You can just paste the contents of an export or a \'keys.dat\' file</string>
<string name="import_input_description">You can just paste the contents of an export or a keys.dat file</string>
</resources>