qrcode: minor adjustments

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld 2018-07-25 02:37:36 +02:00
parent 8e0835e570
commit d615304e83
4 changed files with 18 additions and 16 deletions

View File

@ -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();

View File

@ -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)

View File

@ -72,15 +72,6 @@
app:fab_labelsPosition="@integer/label_position"
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"
@ -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>

View File

@ -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>