mirror of
https://github.com/android-password-store/Android-Password-Store.git
synced 2025-09-06 04:51:38 +02:00
Use android support library (for fab)
This commit is contained in:
parent
61ae170f6c
commit
395309e39e
|
@ -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'
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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>
|
||||
|
|
4
app/src/main/res/values-v21/dimens.xml
Normal file
4
app/src/main/res/values-v21/dimens.xml
Normal file
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="fab_compat_margin">16dp</dimen>
|
||||
</resources>
|
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue