From a4f6642f6ae29bcf19f14ce2f9a713c9cf615ab7 Mon Sep 17 00:00:00 2001 From: Christian Basler Date: Sat, 6 Feb 2016 13:25:04 +0100 Subject: [PATCH] Added option to scan QR codes directly from the app --- app/build.gradle | 1 + .../dissem/apps/abit/AddressListFragment.java | 69 ++++++++++++++----- .../res/drawable/ic_action_create_contact.xml | 9 +++ .../main/res/drawable/ic_action_qr_code.xml | 7 ++ .../main/res/layout/fragment_address_list.xml | 39 ++++++----- app/src/main/res/menu/fab_address.xml | 27 ++++++++ app/src/main/res/values-de/strings.xml | 2 + app/src/main/res/values/strings.xml | 2 + 8 files changed, 120 insertions(+), 36 deletions(-) create mode 100644 app/src/main/res/drawable/ic_action_create_contact.xml create mode 100644 app/src/main/res/drawable/ic_action_qr_code.xml create mode 100644 app/src/main/res/menu/fab_address.xml diff --git a/app/build.gradle b/app/build.gradle index 2bed0e5..e1ac379 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -55,6 +55,7 @@ dependencies { compile 'com.journeyapps:zxing-android-embedded:3.1.0@aar' compile 'com.google.zxing:core:3.2.0' + compile 'io.github.yavski:fab-speed-dial:1.0.2' } idea.module { diff --git a/app/src/main/java/ch/dissem/apps/abit/AddressListFragment.java b/app/src/main/java/ch/dissem/apps/abit/AddressListFragment.java index 89d1489..be0ca68 100644 --- a/app/src/main/java/ch/dissem/apps/abit/AddressListFragment.java +++ b/app/src/main/java/ch/dissem/apps/abit/AddressListFragment.java @@ -17,25 +17,31 @@ package ch.dissem.apps.abit; import android.content.Context; +import android.content.Intent; +import android.net.Uri; import android.os.Bundle; import android.support.annotation.Nullable; -import android.support.design.widget.FloatingActionButton; import android.view.LayoutInflater; +import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.ImageView; import android.widget.TextView; -import ch.dissem.apps.abit.listener.ActionBarListener; -import ch.dissem.apps.abit.service.Singleton; -import ch.dissem.bitmessage.entity.BitmessageAddress; -import ch.dissem.bitmessage.entity.valueobject.Label; +import com.google.zxing.integration.android.IntentIntegrator; import java.util.Collections; import java.util.Comparator; import java.util.List; +import ch.dissem.apps.abit.listener.ActionBarListener; +import ch.dissem.apps.abit.service.Singleton; +import ch.dissem.bitmessage.entity.BitmessageAddress; +import ch.dissem.bitmessage.entity.valueobject.Label; +import io.github.yavski.fabspeeddial.FabSpeedDial; +import io.github.yavski.fabspeeddial.SimpleMenuListenerAdapter; + /** * Fragment that shows a list of all contacts, the ones we subscribed to first. */ @@ -48,7 +54,8 @@ public class AddressListFragment extends AbstractItemListFragment addresses = Singleton.getAddressRepository(getContext()).getContacts(); + List addresses = Singleton.getAddressRepository(getContext()) + .getContacts(); Collections.sort(addresses, new Comparator() { /** * Yields the following order: @@ -92,12 +99,15 @@ public class AddressListFragment extends AbstractItemListFragment + + diff --git a/app/src/main/res/drawable/ic_action_qr_code.xml b/app/src/main/res/drawable/ic_action_qr_code.xml new file mode 100644 index 0000000..ee40a97 --- /dev/null +++ b/app/src/main/res/drawable/ic_action_qr_code.xml @@ -0,0 +1,7 @@ + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_address_list.xml b/app/src/main/res/layout/fragment_address_list.xml index c62c831..c4a8950 100644 --- a/app/src/main/res/layout/fragment_address_list.xml +++ b/app/src/main/res/layout/fragment_address_list.xml @@ -5,25 +5,28 @@ android:layout_height="match_parent"> + android:clipToPadding="false" + android:paddingBottom="88dp" + android:scrollbarStyle="outsideOverlay"/> - + \ No newline at end of file diff --git a/app/src/main/res/menu/fab_address.xml b/app/src/main/res/menu/fab_address.xml new file mode 100644 index 0000000..d252755 --- /dev/null +++ b/app/src/main/res/menu/fab_address.xml @@ -0,0 +1,27 @@ + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index b7906bb..c5b6f5b 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -63,4 +63,6 @@ Teilen Sind Sie sicher dass dieser Kontakt gelöscht werden soll? Sind Sie sicher dass diese Identität gelöscht werden soll? Sie werden keine Nachrichten mehr empfangen können welche an diese Adresse gesendet werden, und es est nicht möglich diese Aktion rückgängig zu machen. + Kontakt erfassen + QR-Code scannen \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 3e37518..6744732 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -66,4 +66,6 @@ Share 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. Are you sure you want to delete this contact? + Scan QR code + Create contact