summaryrefslogtreecommitdiffhomepage
path: root/app/src
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-07-25 02:37:36 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2018-07-25 02:59:26 +0200
commitd615304e83d349b3da741d8262e4c998ea74ae52 (patch)
tree6b8383d5b7c723d8fc2eb50689930fe791b015ae /app/src
parent8e0835e57084be1216e3ef1e71941295b2df909d (diff)
qrcode: minor adjustments
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'app/src')
-rw-r--r--app/src/main/java/com/wireguard/android/fragment/ConfigNamingDialogFragment.java2
-rw-r--r--app/src/main/java/com/wireguard/android/fragment/TunnelListFragment.java8
-rw-r--r--app/src/main/res/layout/tunnel_list_fragment.xml20
-rw-r--r--app/src/main/res/values/strings.xml4
4 files changed, 18 insertions, 16 deletions
diff --git a/app/src/main/java/com/wireguard/android/fragment/ConfigNamingDialogFragment.java b/app/src/main/java/com/wireguard/android/fragment/ConfigNamingDialogFragment.java
index 1a3ec0d2..d89938e1 100644
--- a/app/src/main/java/com/wireguard/android/fragment/ConfigNamingDialogFragment.java
+++ b/app/src/main/java/com/wireguard/android/fragment/ConfigNamingDialogFragment.java
@@ -70,7 +70,7 @@ public class ConfigNamingDialogFragment extends DialogFragment {
imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
final AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(activity);
- alertDialogBuilder.setTitle(R.string.create_tunnel);
+ alertDialogBuilder.setTitle(R.string.import_from_qrcode);
binding = ConfigNamingDialogFragmentBinding.inflate(getActivity().getLayoutInflater(), null, false);
binding.executePendingBindings();
diff --git a/app/src/main/java/com/wireguard/android/fragment/TunnelListFragment.java b/app/src/main/java/com/wireguard/android/fragment/TunnelListFragment.java
index 23e449b6..e2291f9c 100644
--- a/app/src/main/java/com/wireguard/android/fragment/TunnelListFragment.java
+++ b/app/src/main/java/com/wireguard/android/fragment/TunnelListFragment.java
@@ -83,10 +83,8 @@ public class TunnelListFragment extends BaseFragment {
// Config text is valid, now create the tunnel…
final FragmentManager fragmentManager = getFragmentManager();
- if (fragmentManager != null) {
- final ConfigNamingDialogFragment fragment = ConfigNamingDialogFragment.newInstance(configText);
- fragment.show(fragmentManager, null);
- }
+ if (fragmentManager != null)
+ ConfigNamingDialogFragment.newInstance(configText).show(fragmentManager, null);
} catch (final IllegalArgumentException|IOException exception) {
onTunnelImportFinished(Collections.emptyList(), Collections.singletonList(exception));
}
@@ -246,6 +244,8 @@ public class TunnelListFragment extends BaseFragment {
public void onRequestScanQRCode(@SuppressWarnings("unused") final View view) {
final IntentIntegrator intentIntegrator = IntentIntegrator.forSupportFragment(this);
intentIntegrator.setOrientationLocked(false);
+ intentIntegrator.setBeepEnabled(false);
+ intentIntegrator.setPrompt(getString(R.string.qrcode_hint));
intentIntegrator.initiateScan(Collections.singletonList(IntentIntegrator.QR_CODE));
if (binding != null)
diff --git a/app/src/main/res/layout/tunnel_list_fragment.xml b/app/src/main/res/layout/tunnel_list_fragment.xml
index 2a7de392..3e31159c 100644
--- a/app/src/main/res/layout/tunnel_list_fragment.xml
+++ b/app/src/main/res/layout/tunnel_list_fragment.xml
@@ -73,15 +73,6 @@
app:layout_behavior="com.wireguard.android.widget.fab.FloatingActionButtonBehavior" >
<com.wireguard.android.widget.fab.LabeledFloatingActionButton
- android:id="@+id/create_empty"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:onClick="@{fragment::onRequestCreateConfig}"
- app:fabSize="mini"
- app:srcCompat="@drawable/ic_action_edit_white"
- app:fab_title="@string/create_empty" />
-
- <com.wireguard.android.widget.fab.LabeledFloatingActionButton
android:id="@+id/create_from_file"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@@ -97,7 +88,16 @@
android:onClick="@{fragment::onRequestScanQRCode}"
app:srcCompat="@drawable/ic_action_scan_qr_code_white"
app:fabSize="mini"
- app:fab_title="@string/scan_qr_code" />
+ app:fab_title="@string/create_from_qrcode" />
+
+ <com.wireguard.android.widget.fab.LabeledFloatingActionButton
+ android:id="@+id/create_empty"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:onClick="@{fragment::onRequestCreateConfig}"
+ app:fabSize="mini"
+ app:srcCompat="@drawable/ic_action_edit_white"
+ app:fab_title="@string/create_empty" />
</com.wireguard.android.widget.fab.FloatingActionsMenu>
</android.support.design.widget.CoordinatorLayout>
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 1bb43fa0..991ac98d 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -30,6 +30,7 @@
<string name="create_activity_title">Create WireGuard Tunnel</string>
<string name="create_empty">Create from scratch</string>
<string name="create_from_file">Create from file or archive</string>
+ <string name="create_from_qrcode">Create from QR code</string>
<string name="create_tunnel">Create Tunnel</string>
<string name="dark_theme_title">Use dark theme</string>
<string name="dark_theme_summary_on">Currently using dark night theme</string>
@@ -51,6 +52,7 @@
<string name="hint_generated">(generated)</string>
<string name="hint_optional">(optional)</string>
<string name="hint_random">(random)</string>
+ <string name="import_from_qrcode">Import Tunnel from QR Code</string>
<string name="import_error">Unable to import tunnel: %s</string>
<string name="import_success">Imported “%s”</string>
<string name="interface_title">Interface</string>
@@ -69,10 +71,10 @@
<string name="private_key">Private key</string>
<string name="public_key">Public key</string>
<string name="public_key_description">Public key</string>
+ <string name="qrcode_hint">Tip: generate with `qrencode -t ansiutf8 &lt; tunnel.conf`.</string>
<string name="restore_on_boot_summary">Bring up previously-enabled tunnels on boot</string>
<string name="restore_on_boot_title">Restore on boot</string>
<string name="save">Save</string>
- <string name="scan_qr_code">Scan QR Code</string>
<plurals name="set_excluded_applications">
<item quantity="one">%d Excluded Application</item>
<item quantity="other">%d Excluded Applications</item>