aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java
diff options
context:
space:
mode:
authorzeapo <mohamed@zenadi.com>2014-10-19 18:14:35 +0200
committerzeapo <mohamed@zenadi.com>2014-10-19 18:14:35 +0200
commit639031737f6cbfd2c9cf3bcede8d1c85e9ddac67 (patch)
treed6e55a7e4c4ea08bb463966e5b8729b6260c72c1 /app/src/main/java
parent24892e6a9555f36a5d6cbe5658edb6f51ab85eba (diff)
nicer layout for pass list
Diffstat (limited to 'app/src/main/java')
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/PasswordFragment.java4
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/crypto/PgpHandler.java7
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/utils/PasswordRecyclerAdapter.java26
3 files changed, 30 insertions, 7 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/PasswordFragment.java b/app/src/main/java/com/zeapo/pwdstore/PasswordFragment.java
index 67e3e858..615087c8 100644
--- a/app/src/main/java/com/zeapo/pwdstore/PasswordFragment.java
+++ b/app/src/main/java/com/zeapo/pwdstore/PasswordFragment.java
@@ -74,7 +74,7 @@ public class PasswordFragment extends Fragment{
}
@Override
- public void onAttach(Activity activity) {
+ public void onAttach(final Activity activity) {
super.onAttach(activity);
try {
mListener = new OnFragmentInteractionListener() {
@@ -89,6 +89,8 @@ public class PasswordFragment extends Fragment{
((ActionBarActivity) getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+ } else {
+ ((PasswordStore) getActivity()).decryptPassword(item);
}
}
diff --git a/app/src/main/java/com/zeapo/pwdstore/crypto/PgpHandler.java b/app/src/main/java/com/zeapo/pwdstore/crypto/PgpHandler.java
index efeabc3e..39010a53 100644
--- a/app/src/main/java/com/zeapo/pwdstore/crypto/PgpHandler.java
+++ b/app/src/main/java/com/zeapo/pwdstore/crypto/PgpHandler.java
@@ -31,6 +31,7 @@ import android.os.AsyncTask;
import android.os.Bundle;
import android.os.SystemClock;
import android.preference.PreferenceManager;
+import android.support.v7.app.ActionBarActivity;
import android.text.TextUtils;
import android.util.Log;
import android.view.Menu;
@@ -46,7 +47,7 @@ import com.zeapo.pwdstore.R;
import com.zeapo.pwdstore.UserPreference;
import com.zeapo.pwdstore.utils.PasswordRepository;
-public class PgpHandler extends Activity implements OpenPgpServiceConnection.OnBound{
+public class PgpHandler extends ActionBarActivity implements OpenPgpServiceConnection.OnBound{
private OpenPgpServiceConnection mServiceConnection;
@@ -109,9 +110,7 @@ public class PgpHandler extends Activity implements OpenPgpServiceConnection.OnB
bindingDialog.show();
registered = true;
-
- ActionBar actionBar = getActionBar();
- actionBar.setDisplayHomeAsUpEnabled(true);
+ getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
}
diff --git a/app/src/main/java/com/zeapo/pwdstore/utils/PasswordRecyclerAdapter.java b/app/src/main/java/com/zeapo/pwdstore/utils/PasswordRecyclerAdapter.java
index 47bcb41b..eb611995 100644
--- a/app/src/main/java/com/zeapo/pwdstore/utils/PasswordRecyclerAdapter.java
+++ b/app/src/main/java/com/zeapo/pwdstore/utils/PasswordRecyclerAdapter.java
@@ -1,5 +1,6 @@
package com.zeapo.pwdstore.utils;
+import android.graphics.Color;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
@@ -57,8 +58,29 @@ public class PasswordRecyclerAdapter extends RecyclerView.Adapter<PasswordRecycl
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
final PasswordItem pass = values.get(position);
- holder.name.setText(pass.getName());
- holder.type.setText((pass.getType() == PasswordItem.TYPE_CATEGORY ? "Category" : "Password"));
+ holder.name.setText(pass.toString());
+ int sdk = android.os.Build.VERSION.SDK_INT;
+
+ if (pass.getType() == PasswordItem.TYPE_CATEGORY) {
+ holder.type.setText("C");
+ if(sdk < android.os.Build.VERSION_CODES.JELLY_BEAN) {
+ holder.type.setBackgroundDrawable(activity.getResources().getDrawable(R.drawable.category_rectangle));
+ } else {
+ holder.type.setBackground(activity.getResources().getDrawable(R.drawable.category_rectangle));
+ }
+
+ holder.type.setTextColor(activity.getResources().getColor(R.color.deep_orange_50));
+ } else {
+ holder.type.setText("P");
+ if(sdk < android.os.Build.VERSION_CODES.JELLY_BEAN) {
+ holder.type.setBackgroundDrawable(activity.getResources().getDrawable(R.drawable.password_rectangle));
+ } else {
+ holder.type.setBackground(activity.getResources().getDrawable(R.drawable.password_rectangle));
+ }
+
+ holder.type.setTextColor(activity.getResources().getColor(R.color.blue_grey_50));
+ }
+
holder.position = position;
holder.view.setOnClickListener(new View.OnClickListener() {