diff options
-rw-r--r-- | PwdStore.iml | 19 | ||||
-rw-r--r-- | app/build.gradle | 2 | ||||
-rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/GitAsyncTask.java | 12 | ||||
-rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/GitHandler.java | 4 | ||||
-rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/PasswordFragment.java | 35 | ||||
-rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/PasswordStore.java | 65 | ||||
-rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/crypto/PgpHandler.java | 33 | ||||
-rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/utils/PasswordAdapter.java | 142 | ||||
-rw-r--r-- | app/src/main/res/drawable-xxhdpi/blue_rectangle.xml | 24 | ||||
-rw-r--r-- | app/src/main/res/drawable-xxhdpi/red_rectangle.xml | 2 | ||||
-rw-r--r-- | app/src/main/res/layout/child_row_layout.xml | 28 | ||||
-rw-r--r-- | app/src/main/res/layout/decrypt_layout.xml | 82 | ||||
-rw-r--r-- | app/src/main/res/layout/fragment_password_list.xml | 5 | ||||
-rw-r--r-- | app/src/main/res/values/strings.xml | 3 |
14 files changed, 333 insertions, 123 deletions
diff --git a/PwdStore.iml b/PwdStore.iml deleted file mode 100644 index 0bb6048a..00000000 --- a/PwdStore.iml +++ /dev/null @@ -1,19 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4"> - <component name="FacetManager"> - <facet type="java-gradle" name="Java-Gradle"> - <configuration> - <option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" /> - </configuration> - </facet> - </component> - <component name="NewModuleRootManager" inherit-compiler-output="true"> - <exclude-output /> - <content url="file://$MODULE_DIR$"> - <excludeFolder url="file://$MODULE_DIR$/.gradle" /> - </content> - <orderEntry type="inheritedJdk" /> - <orderEntry type="sourceFolder" forTests="false" /> - </component> -</module> - diff --git a/app/build.gradle b/app/build.gradle index 82bf9fbb..d453f775 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -6,7 +6,7 @@ android { defaultConfig { applicationId "com.zeapo.pwdstore" - minSdkVersion 15 + minSdkVersion 14 targetSdkVersion 19 versionCode 1 versionName "1.0" diff --git a/app/src/main/java/com/zeapo/pwdstore/GitAsyncTask.java b/app/src/main/java/com/zeapo/pwdstore/GitAsyncTask.java index 8db11c43..11071018 100644 --- a/app/src/main/java/com/zeapo/pwdstore/GitAsyncTask.java +++ b/app/src/main/java/com/zeapo/pwdstore/GitAsyncTask.java @@ -16,11 +16,13 @@ import org.eclipse.jgit.api.errors.TransportException; public class GitAsyncTask extends AsyncTask<GitCommand, Integer, Integer> { private Activity activity; private boolean finishOnEnd; + private boolean refreshListOnEnd; private ProgressDialog dialog; - public GitAsyncTask(Activity activity, boolean finishOnEnd) { + public GitAsyncTask(Activity activity, boolean finishOnEnd, boolean refreshListOnEnd) { this.activity = activity; this.finishOnEnd = finishOnEnd; + this.refreshListOnEnd = refreshListOnEnd; dialog = new ProgressDialog(this.activity); } @@ -62,5 +64,13 @@ public class GitAsyncTask extends AsyncTask<GitCommand, Integer, Integer> { this.activity.setResult(Activity.RESULT_OK); this.activity.finish(); } + + if (refreshListOnEnd) { + try { + ((PasswordStore) this.activity).refreshListAdapter(); + } catch (ClassCastException e){ + // oups, mistake + } + } } } diff --git a/app/src/main/java/com/zeapo/pwdstore/GitHandler.java b/app/src/main/java/com/zeapo/pwdstore/GitHandler.java index aed6b776..7dc25567 100644 --- a/app/src/main/java/com/zeapo/pwdstore/GitHandler.java +++ b/app/src/main/java/com/zeapo/pwdstore/GitHandler.java @@ -441,7 +441,7 @@ public class GitHandler extends Activity { + ":" + settings.getString("git_remote_location", "path/to/repository")); - new GitAsyncTask(activity, true).execute(new Git(PasswordRepository.getRepository(new File(""))) + new GitAsyncTask(activity, true, false).execute(new Git(PasswordRepository.getRepository(new File(""))) .pull() .setRebase(true) .setRemote("origin") @@ -481,7 +481,7 @@ public class GitHandler extends Activity { + ":" + settings.getString("git_remote_location", "path/to/repository")); - new GitAsyncTask(activity, true).execute(new Git(PasswordRepository.getRepository(new File(""))) + new GitAsyncTask(activity, true, false).execute(new Git(PasswordRepository.getRepository(new File(""))) .push() .setPushAll() .setRemote("origin") diff --git a/app/src/main/java/com/zeapo/pwdstore/PasswordFragment.java b/app/src/main/java/com/zeapo/pwdstore/PasswordFragment.java index ab7c8a77..db214cc5 100644 --- a/app/src/main/java/com/zeapo/pwdstore/PasswordFragment.java +++ b/app/src/main/java/com/zeapo/pwdstore/PasswordFragment.java @@ -10,6 +10,8 @@ import android.view.ViewGroup; import android.widget.AbsListView; import android.widget.AdapterView; import android.widget.ArrayAdapter; +import android.widget.ExpandableListAdapter; +import android.widget.ExpandableListView; import android.widget.ListAdapter; import android.widget.ListView; @@ -27,14 +29,14 @@ import java.util.List; * with a GridView. * <p /> */ -public class PasswordFragment extends Fragment implements AbsListView.OnItemClickListener { +public class PasswordFragment extends Fragment implements ExpandableListView.OnGroupClickListener { private OnFragmentInteractionListener mListener; /** * The fragment's ListView/GridView. */ - private ListView mListView; + private ExpandableListView mListView; /** * The Adapter which will be used to populate the ListView/GridView with @@ -53,7 +55,7 @@ public class PasswordFragment extends Fragment implements AbsListView.OnItemClic super.onCreate(savedInstanceState); String path = getArguments().getString("Path"); - mAdapter = new PasswordAdapter(getActivity(), PasswordRepository.getPasswords(new File(path))); + mAdapter = new PasswordAdapter((PasswordStore) getActivity(), PasswordRepository.getPasswords(new File(path))); } @Override @@ -62,11 +64,11 @@ public class PasswordFragment extends Fragment implements AbsListView.OnItemClic View view = inflater.inflate(R.layout.fragment_password, container, false); // Set the adapter - mListView = (ListView) view.findViewById(R.id.pass_list); - ((AdapterView<ListAdapter>) mListView).setAdapter(mAdapter); + mListView = (ExpandableListView) view.findViewById(R.id.pass_list); + mListView.setAdapter((android.widget.ExpandableListAdapter) mAdapter); // Set OnItemClickListener so we can be notified on item clicks - mListView.setOnItemClickListener(this); + mListView.setOnGroupClickListener(this); mListView.setSelectionFromTop(getArguments().getInt("Position"), 0); return view; @@ -97,12 +99,22 @@ public class PasswordFragment extends Fragment implements AbsListView.OnItemClic } @Override - public void onItemClick(AdapterView<?> parent, View view, int position, long id) { - if (null != mListener) { - // Notify the active callbacks interface (the activity, if the - // fragment is attached to one) that an item has been selected. - mListener.onFragmentInteraction(mAdapter.getItem(position)); + public boolean onGroupClick(ExpandableListView expandableListView, View view, int i, long l) { + if( ((PasswordItem) mAdapter.getGroup(i)).getType() == PasswordItem.TYPE_CATEGORY ){ + if (null != mListener) { + // Notify the active callbacks interface (the activity, if the + // fragment is attached to one) that an item has been selected. + mListener.onFragmentInteraction(mAdapter.getItem(i)); + } + } else { + if (expandableListView.isGroupExpanded(i)) { + expandableListView.collapseGroup(i); + } else { + expandableListView.expandGroup(i); + } } + + return true; } public interface OnFragmentInteractionListener { @@ -113,6 +125,7 @@ public class PasswordFragment extends Fragment implements AbsListView.OnItemClic public void updateAdapter() { mAdapter.clear(); mAdapter.addAll(PasswordRepository.getPasswords(new File(getArguments().getString("Path")))); + mListView.setAdapter((ExpandableListAdapter) mAdapter); } } diff --git a/app/src/main/java/com/zeapo/pwdstore/PasswordStore.java b/app/src/main/java/com/zeapo/pwdstore/PasswordStore.java index 6d51858b..62475867 100644 --- a/app/src/main/java/com/zeapo/pwdstore/PasswordStore.java +++ b/app/src/main/java/com/zeapo/pwdstore/PasswordStore.java @@ -16,6 +16,7 @@ import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.EditText; +import android.widget.ExpandableListView; import android.widget.LinearLayout; import com.jcraft.jsch.JSch; @@ -42,7 +43,7 @@ import java.util.Stack; public class PasswordStore extends Activity implements ToCloneOrNot.OnFragmentInteractionListener, PasswordFragment.OnFragmentInteractionListener { private Stack<Integer> scrollPositions; /** if we leave the activity to do something, do not add any other fragment */ - private boolean leftActivity = false; + public boolean leftActivity = false; private File currentDir; private SharedPreferences settings; private Activity activity; @@ -171,6 +172,7 @@ public class PasswordStore extends Activity implements ToCloneOrNot.OnFragmentI return; } PasswordRepository.createRepository(localDir); + checkLocalRepository(); } } @@ -249,19 +251,6 @@ public class PasswordStore extends Activity implements ToCloneOrNot.OnFragmentI checkLocalRepository(item.getFile()); } else { try { - try { - this.leftActivity = true; - - Intent intent = new Intent(this, PgpHandler.class); - intent.putExtra("PGP-ID", FileUtils.readFileToString(PasswordRepository.getFile("/.gpg-id"))); - intent.putExtra("NAME", item.toString()); - intent.putExtra("FILE_PATH", item.getFile().getAbsolutePath()); - intent.putExtra("Operation", "DECRYPT"); - startActivityForResult(intent, PgpHandler.REQUEST_CODE_DECRYPT_AND_VERIFY); - - } catch (IOException e) { - e.printStackTrace(); - } } catch (Exception e) { @@ -270,6 +259,21 @@ public class PasswordStore extends Activity implements ToCloneOrNot.OnFragmentI } } } + public void decryptPassword(PasswordItem item) { + try { + this.leftActivity = true; + + Intent intent = new Intent(this, PgpHandler.class); + intent.putExtra("PGP-ID", FileUtils.readFileToString(PasswordRepository.getFile("/.gpg-id"))); + intent.putExtra("NAME", item.toString()); + intent.putExtra("FILE_PATH", item.getFile().getAbsolutePath()); + intent.putExtra("Operation", "DECRYPT"); + startActivityForResult(intent, PgpHandler.REQUEST_CODE_DECRYPT_AND_VERIFY); + + } catch (IOException e) { + e.printStackTrace(); + } + } public void createPassword(View v) { this.currentDir = getCurrentDir(); @@ -287,7 +291,36 @@ public class PasswordStore extends Activity implements ToCloneOrNot.OnFragmentI } } - private void refreshListAdapter() { + public void deletePassword(final PasswordItem item) { + new AlertDialog.Builder(this). + setMessage("Are you sure you want to delete the password \"" + + item + "\"") + .setPositiveButton("YES", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialogInterface, int i) { + String path = item.getFile().getAbsolutePath(); + item.getFile().delete(); + + setResult(RESULT_CANCELED); + Git git = new Git(PasswordRepository.getRepository(new File(""))); + GitAsyncTask tasks = new GitAsyncTask(activity, false, true); + System.out.println(tasks); + tasks.execute( + git.rm().addFilepattern(path.replace(PasswordRepository.getWorkTree() + "/", "")), + git.commit().setMessage("[ANDROID PwdStore] Remove " + item + " from store.") + ); + } + }) + .setNegativeButton("NO", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialogInterface, int i) { + + } + }) + .show(); + } + + public void refreshListAdapter() { PasswordFragment plist; if (null != (plist = (PasswordFragment) getFragmentManager().findFragmentByTag("PasswordsList"))) { @@ -310,7 +343,7 @@ public class PasswordStore extends Activity implements ToCloneOrNot.OnFragmentI switch (requestCode) { case PgpHandler.REQUEST_CODE_ENCRYPT : Git git = new Git(PasswordRepository.getRepository(new File(""))); - GitAsyncTask tasks = new GitAsyncTask(this, false); + GitAsyncTask tasks = new GitAsyncTask(this, false, false); tasks.execute( git.add().addFilepattern("."), git.commit().setMessage("[ANDROID PwdStore] Add " + data.getExtras().getString("NAME") + " from store.") 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 35404c76..68c71c4b 100644 --- a/app/src/main/java/com/zeapo/pwdstore/crypto/PgpHandler.java +++ b/app/src/main/java/com/zeapo/pwdstore/crypto/PgpHandler.java @@ -20,6 +20,7 @@ import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.EditText; +import android.widget.GridLayout; import android.widget.LinearLayout; import android.widget.ProgressBar; import android.widget.TextView; @@ -98,6 +99,10 @@ public class PgpHandler extends Activity { if (extra.getString("Operation").equals("DECRYPT")) { setContentView(R.layout.decrypt_layout); ((TextView) findViewById(R.id.crypto_password_file)).setText(extra.getString("NAME")); + String cat = new File(extra.getString("FILE_PATH").replace(PasswordRepository.getWorkTree().getAbsolutePath(), "")) + .getParentFile().getName(); + + ((TextView) findViewById(R.id.crypto_password_category)).setText(cat + "/"); } else if (extra.getString("Operation").equals("ENCRYPT")) { setContentView(R.layout.encrypt_layout); String cat = extra.getString("FILE_PATH"); @@ -150,7 +155,7 @@ public class PgpHandler extends Activity { finish(); break; case R.id.crypto_delete_button: - deletePassword(); +// deletePassword(); break; case R.id.crypto_get_key_ids: getKeyIds(new Intent()); @@ -221,6 +226,7 @@ public class PgpHandler extends Activity { protected void onPostExecute(Boolean b) { //clear password ((TextView) findViewById(R.id.crypto_password_show)).setText(""); + ((TextView) findViewById(R.id.crypto_extra_show)).setText(""); findViewById(R.id.crypto_extra_show_layout).setVisibility(View.INVISIBLE); findViewById(R.id.crypto_container).setVisibility(View.INVISIBLE); } @@ -456,30 +462,5 @@ public class PgpHandler extends Activity { } - private void deletePassword() { - new AlertDialog.Builder(this). - setMessage("Are you sure you want to delete the password \"" + - getIntent().getExtras().getString("NAME") + "\"") - .setPositiveButton("YES", new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialogInterface, int i) { - (new File(getIntent().getExtras().getString("FILE_PATH"))).delete(); - - setResult(RESULT_CANCELED); - Git git = new Git(PasswordRepository.getRepository(new File(""))); - GitAsyncTask tasks = new GitAsyncTask(activity, true); - tasks.execute( - git.rm().addFilepattern(getIntent().getExtras().getString("FILE_PATH").replace(PasswordRepository.getWorkTree() + "/", "")), - git.commit().setMessage("[ANDROID PwdStore] Remove " + getIntent().getExtras().getString("FILE_PATH") + " from store.") - ); - } - }) - .setNegativeButton("NO", new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialogInterface, int i) { - } - }) - .show(); - } } diff --git a/app/src/main/java/com/zeapo/pwdstore/utils/PasswordAdapter.java b/app/src/main/java/com/zeapo/pwdstore/utils/PasswordAdapter.java index b0cdb5a5..fbc7d817 100644 --- a/app/src/main/java/com/zeapo/pwdstore/utils/PasswordAdapter.java +++ b/app/src/main/java/com/zeapo/pwdstore/utils/PasswordAdapter.java @@ -1,19 +1,30 @@ package com.zeapo.pwdstore.utils; import android.content.Context; +import android.content.DialogInterface; +import android.content.Intent; +import android.database.DataSetObserver; import android.graphics.Typeface; +import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; +import android.widget.Button; +import android.widget.ExpandableListAdapter; +import android.widget.ImageButton; import android.widget.TextView; +import com.zeapo.pwdstore.PasswordStore; import com.zeapo.pwdstore.R; +import com.zeapo.pwdstore.crypto.PgpHandler; + +import org.apache.commons.io.FileUtils; import java.util.ArrayList; -public class PasswordAdapter extends ArrayAdapter<PasswordItem> { - private final Context context; +public class PasswordAdapter extends ArrayAdapter<PasswordItem> implements ExpandableListAdapter{ + private final PasswordStore activity; private final ArrayList<PasswordItem> values; static class ViewHolder { @@ -21,20 +32,68 @@ public class PasswordAdapter extends ArrayAdapter<PasswordItem> { public TextView type; } - public PasswordAdapter(Context context, ArrayList<PasswordItem> values) { - super(context, R.layout.password_row_layout, values); - this.context = context; + public PasswordAdapter(PasswordStore activity, ArrayList<PasswordItem> values) { + super(activity, R.layout.password_row_layout, values); this.values = values; + this.activity = activity; + } + + @Override + public void registerDataSetObserver(DataSetObserver dataSetObserver) { + + } + + @Override + public void unregisterDataSetObserver(DataSetObserver dataSetObserver) { + + } + + @Override + public int getGroupCount() { + return values.size(); + } + + @Override + public int getChildrenCount(int i) { + if (values.get(i).getType() == PasswordItem.TYPE_CATEGORY) + return 0; + else + return 1; + } + + @Override + public Object getGroup(int i) { + return values.get(i); + } + + @Override + public Object getChild(int i, int i2) { + return null; + } + + @Override + public long getGroupId(int i) { + return 0; + } + + @Override + public long getChildId(int i, int i2) { + return 0; + } + + @Override + public boolean hasStableIds() { + return false; } @Override - public View getView(int position, View convertView, ViewGroup parent) { + public View getGroupView(int i, boolean b, View convertView, ViewGroup viewGroup) { View rowView = convertView; - PasswordItem pass = values.get(position); + PasswordItem pass = values.get(i); // reuse for performance, holder pattern! if (rowView == null) { - LayoutInflater inflater = (LayoutInflater) context + LayoutInflater inflater = (LayoutInflater) activity .getSystemService(Context.LAYOUT_INFLATER_SERVICE); rowView = inflater.inflate(R.layout.password_row_layout, null); @@ -49,15 +108,78 @@ public class PasswordAdapter extends ArrayAdapter<PasswordItem> { holder.name.setText(pass.toString()); if (pass.getType() == PasswordItem.TYPE_CATEGORY) { - holder.name.setTextColor(this.context.getResources().getColor(android.R.color.holo_blue_dark)); + holder.name.setTextColor(this.activity.getResources().getColor(android.R.color.holo_blue_dark)); holder.name.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.BOLD)); holder.type.setText("Category: "); } else { holder.type.setText("Password: "); - holder.name.setTextColor(this.context.getResources().getColor(android.R.color.holo_orange_dark)); + holder.name.setTextColor(this.activity.getResources().getColor(android.R.color.holo_orange_dark)); holder.name.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.NORMAL)); } return rowView; } + + @Override + public View getChildView(int i, int i2, boolean b, View view, ViewGroup viewGroup) { + final PasswordItem pass = values.get(i); + + LayoutInflater inflater = (LayoutInflater) this.activity + .getSystemService(Context.LAYOUT_INFLATER_SERVICE); + view = inflater.inflate(R.layout.child_row_layout, null); + + View.OnClickListener onClickListener = new View.OnClickListener() { + @Override + public void onClick(View view) { + switch (view.getId()) { + case R.id.crypto_show_button: + activity.decryptPassword(pass); + break; + case R.id.crypto_delete_button: + activity.deletePassword(pass); + break; + } + } + }; + + ((ImageButton) view.findViewById(R.id.crypto_show_button)).setOnClickListener(onClickListener); + ((ImageButton) view.findViewById(R.id.crypto_delete_button)).setOnClickListener(onClickListener); + + return view; + } + + @Override + public boolean isChildSelectable(int i, int i2) { + return false; + } + + @Override + public boolean areAllItemsEnabled() { + return false; + } + + @Override + public boolean isEmpty() { + return false; + } + + @Override + public void onGroupExpanded(int i) { + + } + + @Override + public void onGroupCollapsed(int i) { + + } + + @Override + public long getCombinedChildId(long l, long l2) { + return 0; + } + + @Override + public long getCombinedGroupId(long l) { + return 0; + } }
\ No newline at end of file diff --git a/app/src/main/res/drawable-xxhdpi/blue_rectangle.xml b/app/src/main/res/drawable-xxhdpi/blue_rectangle.xml new file mode 100644 index 00000000..61cb44f5 --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/blue_rectangle.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="utf-8"?> + +<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> + <item> + <shape android:shape="rectangle" + android:dither="true"> + <corners android:radius="2dp"/> + <solid android:color="#ccc" /> + + </shape> + </item> + + <item> + <shape android:shape="rectangle" android:dither="true"> + <corners android:radius="2dp" /> + <solid android:color="@android:color/holo_blue_light" /> + + <padding android:bottom="8dp" + android:left="8dp" + android:right="8dp" + android:top="8dp" /> + </shape> + </item> +</layer-list>
\ No newline at end of file diff --git a/app/src/main/res/drawable-xxhdpi/red_rectangle.xml b/app/src/main/res/drawable-xxhdpi/red_rectangle.xml index b8e6a5d6..a6c48d0f 100644 --- a/app/src/main/res/drawable-xxhdpi/red_rectangle.xml +++ b/app/src/main/res/drawable-xxhdpi/red_rectangle.xml @@ -10,7 +10,7 @@ </shape> </item> - <item android:bottom="2dp"> + <item> <shape android:shape="rectangle" android:dither="true"> <corners android:radius="2dp" /> <solid android:color="@android:color/holo_red_light" /> diff --git a/app/src/main/res/layout/child_row_layout.xml b/app/src/main/res/layout/child_row_layout.xml new file mode 100644 index 00000000..0fc5e33d --- /dev/null +++ b/app/src/main/res/layout/child_row_layout.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8"?> + +<GridLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="vertical" android:layout_width="match_parent" + android:layout_height="match_parent"> + + <ImageButton + android:id="@+id/crypto_delete_button" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:src="@drawable/ico_del" + android:background="@drawable/red_rectangle" + android:layout_gravity="center_vertical" + android:layout_column="1" + android:layout_row="0"/> + + <ImageButton + android:id="@+id/crypto_show_button" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:src="@drawable/ico_key" + android:background="@drawable/blue_rectangle" + android:layout_gravity="center_vertical" + android:layout_marginLeft="8dp" + android:layout_column="2" + android:layout_row="0"/> + +</GridLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout/decrypt_layout.xml b/app/src/main/res/layout/decrypt_layout.xml index c1ae7c6c..e81f288b 100644 --- a/app/src/main/res/layout/decrypt_layout.xml +++ b/app/src/main/res/layout/decrypt_layout.xml @@ -1,12 +1,8 @@ <?xml version="1.0" encoding="utf-8"?> -<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" +<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" - android:paddingLeft="@dimen/activity_horizontal_margin" - android:paddingRight="@dimen/activity_horizontal_margin" - android:paddingTop="@dimen/activity_vertical_margin" - android:paddingBottom="@dimen/activity_vertical_margin" tools:context="com.zeapo.pwdstore.crypto.PgpHandler" android:orientation="vertical" android:background="#eee"> @@ -19,30 +15,59 @@ <GridLayout android:layout_width="match_parent" android:layout_height="wrap_content" - android:background="@drawable/rectangle" - android:orientation="horizontal"> + android:background="@drawable/rectangle"> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textColor="@android:color/holo_blue_light" + android:text="CATEGORY HERE" + android:id="@+id/crypto_password_category" + android:layout_gravity="center_vertical" + android:layout_marginLeft="8dp" + android:layout_column="0" + android:layout_row="0" + android:layout_columnSpan="2"/> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="@android:color/holo_orange_dark" - android:text="Large Text" + android:textStyle="bold" + android:textAppearance="@android:style/TextAppearance.DeviceDefault.Medium" + android:text="PASSWORD FILE NAME HERE" android:id="@+id/crypto_password_file" android:layout_gravity="center_vertical" android:layout_marginLeft="8dp" android:layout_column="0" - android:layout_row="0"/> + android:layout_columnSpan="2" + android:layout_row="1"/> + + + <ImageButton + android:id="@+id/crypto_delete_button" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:src="@drawable/ico_del" + android:background="@drawable/red_rectangle" + android:layout_gravity="center_vertical" + android:onClick="handleClick" + android:layout_column="3" + android:layout_row="0" + android:layout_rowSpan="2"/> <ImageButton android:id="@+id/crypto_show_button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/ico_key" - android:background="@android:drawable/screen_background_light_transparent" + android:background="@drawable/blue_rectangle" android:layout_gravity="center_vertical" + android:layout_marginLeft="8dp" android:onClick="handleClick" - android:layout_column="2" - android:layout_row="0"/> + android:layout_column="4" + android:layout_row="0" + android:layout_rowSpan="2"/> </GridLayout> @@ -53,6 +78,10 @@ android:layout_height="wrap_content" android:background="@drawable/rectangle" android:layout_marginTop="@dimen/activity_vertical_margin" + android:paddingLeft="@dimen/activity_horizontal_margin" + android:paddingRight="@dimen/activity_horizontal_margin" + android:paddingTop="@dimen/activity_vertical_margin" + android:paddingBottom="@dimen/activity_vertical_margin" android:visibility="invisible"> <GridLayout @@ -102,16 +131,12 @@ android:textStyle="bold" android:textColor="@android:color/black" android:text="Extra content: "/> - <ScrollView - android:layout_width="wrap_content" - android:layout_height="wrap_content"> - <TextView - android:id="@+id/crypto_extra_show" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:textColor="@android:color/black" - android:typeface="monospace"/> - </ScrollView> + <TextView + android:id="@+id/crypto_extra_show" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:textColor="@android:color/black" + android:typeface="monospace"/> </LinearLayout> </LinearLayout> @@ -119,15 +144,4 @@ </LinearLayout> - <ImageButton - android:id="@+id/crypto_delete_button" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:src="@drawable/ico_del" - android:background="@drawable/oval" - android:layout_gravity="center_vertical" - android:onClick="handleClick" - android:layout_alignParentBottom="true" - android:layout_alignParentLeft="true"/> - -</RelativeLayout>
\ No newline at end of file +</ScrollView>
\ No newline at end of file diff --git a/app/src/main/res/layout/fragment_password_list.xml b/app/src/main/res/layout/fragment_password_list.xml index 64dd3d94..6ae0c0d8 100644 --- a/app/src/main/res/layout/fragment_password_list.xml +++ b/app/src/main/res/layout/fragment_password_list.xml @@ -5,11 +5,12 @@ android:layout_height="match_parent" tools:context="com.zeapo.pwdstore.PasswordFragment"> - <ListView + <ExpandableListView android:id="@+id/pass_list" android:layout_width="match_parent" android:layout_height="match_parent" android:dividerHeight="@dimen/activity_vertical_margin" - android:divider="@android:color/transparent"/> + android:divider="@android:color/transparent" + android:groupIndicator="@android:drawable/screen_background_light_transparent"/> </FrameLayout> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 51ebc463..9c874b12 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -26,5 +26,8 @@ <string name="crypto_pass_label">Password</string> <string name="crypto_extra_label">Extra</string> + <!-- DECRYPT Layout --> + <string name="crypto_category">Category</string> + </resources> |