aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/build.gradle2
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/PasswordFragment.java11
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/PasswordStore.java2
-rw-r--r--app/src/main/res/layout/password_recycler_view.xml29
-rw-r--r--app/src/main/res/values-v21/dimens.xml4
-rw-r--r--app/src/main/res/values/dimens.xml1
6 files changed, 30 insertions, 19 deletions
diff --git a/app/build.gradle b/app/build.gradle
index 7d2bd5fd..8a3903d2 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -32,7 +32,7 @@ dependencies {
compile 'com.jcraft:jsch:0.1.52'
compile 'org.apache.commons:commons-io:1.3.2'
compile 'com.jayway.android.robotium:robotium-solo:5.3.1'
- compile 'com.melnykov:floatingactionbutton:1.2.0'
+ compile 'com.android.support:design:22.2.0'
compile 'net.rdrei.android.dirchooser:library:2.1@aar'
compile group: 'com.google.guava', name: 'guava', version: '18.0'
}
diff --git a/app/src/main/java/com/zeapo/pwdstore/PasswordFragment.java b/app/src/main/java/com/zeapo/pwdstore/PasswordFragment.java
index 07ed9895..7d54edf2 100644
--- a/app/src/main/java/com/zeapo/pwdstore/PasswordFragment.java
+++ b/app/src/main/java/com/zeapo/pwdstore/PasswordFragment.java
@@ -5,6 +5,7 @@ import android.app.Fragment;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
+import android.support.design.widget.FloatingActionButton;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
@@ -13,7 +14,6 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
-import com.melnykov.fab.FloatingActionButton;
import com.zeapo.pwdstore.utils.PasswordItem;
import com.zeapo.pwdstore.utils.PasswordRecyclerAdapter;
import com.zeapo.pwdstore.utils.PasswordRepository;
@@ -78,8 +78,13 @@ public class PasswordFragment extends Fragment{
// // Set the adapter
recyclerView.setAdapter(recyclerAdapter);
- FloatingActionButton fab = (FloatingActionButton) view.findViewById(R.id.fab);
- fab.attachToRecyclerView(recyclerView);
+ final FloatingActionButton fab = (FloatingActionButton) view.findViewById(R.id.fab);
+ fab.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ ((PasswordStore) getActivity()).createPassword();
+ }
+ });
registerForContextMenu(recyclerView);
return view;
diff --git a/app/src/main/java/com/zeapo/pwdstore/PasswordStore.java b/app/src/main/java/com/zeapo/pwdstore/PasswordStore.java
index 5562f0b9..57386c00 100644
--- a/app/src/main/java/com/zeapo/pwdstore/PasswordStore.java
+++ b/app/src/main/java/com/zeapo/pwdstore/PasswordStore.java
@@ -353,7 +353,7 @@ public class PasswordStore extends AppCompatActivity {
startActivityForResult(intent, PgpHandler.REQUEST_CODE_DECRYPT_AND_VERIFY);
}
- public void createPassword(View v) {
+ public void createPassword() {
if (!PasswordRepository.isInitialized()) {
new AlertDialog.Builder(this)
.setMessage(this.getResources().getString(R.string.creation_dialog_text))
diff --git a/app/src/main/res/layout/password_recycler_view.xml b/app/src/main/res/layout/password_recycler_view.xml
index b9a4231f..1b922a17 100644
--- a/app/src/main/res/layout/password_recycler_view.xml
+++ b/app/src/main/res/layout/password_recycler_view.xml
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- xmlns:fab="http://schemas.android.com/apk/res-auto"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical"
- tools:context="com.zeapo.pwdstore.PasswordFragment">
+ xmlns:tools="http://schemas.android.com/tools"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ tools:context="com.zeapo.pwdstore.PasswordFragment">
<android.support.v7.widget.RecyclerView
android:id="@+id/pass_recycler"
@@ -17,17 +17,18 @@
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"/>
- <com.melnykov.fab.FloatingActionButton
+ <android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:src="@drawable/ic_action_new"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_alignParentEnd="true"
- android:layout_alignParentRight="true"
+ android:layout_gravity="bottom|end"
+ app:elevation="6dp"
+ app:pressedTranslationZ="12dp"
+ app:backgroundTint="@color/blue_grey_500"
+ app:rippleColor="@color/blue_grey_50"
+ app:borderWidth="0dp"
+ android:layout_margin="@dimen/fab_compat_margin"
android:layout_alignParentBottom="true"
- android:layout_margin="@dimen/activity_vertical_margin"
- android:onClick="createPassword"
- fab:fab_colorNormal="@color/blue_grey_500"
- fab:fab_colorPressed="@color/blue_grey_800"
- fab:fab_colorRipple="@color/blue_grey_50"/>
+ android:layout_alignParentRight="true"/>
</RelativeLayout>
diff --git a/app/src/main/res/values-v21/dimens.xml b/app/src/main/res/values-v21/dimens.xml
new file mode 100644
index 00000000..daaecce2
--- /dev/null
+++ b/app/src/main/res/values-v21/dimens.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <dimen name="fab_compat_margin">16dp</dimen>
+</resources> \ No newline at end of file
diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml
index 47c82246..8a517840 100644
--- a/app/src/main/res/values/dimens.xml
+++ b/app/src/main/res/values/dimens.xml
@@ -2,4 +2,5 @@
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
+ <dimen name="fab_compat_margin">0dp</dimen>
</resources>