some ui improvements (icons and return from pgphandler to top)
|
@ -177,7 +177,7 @@ public class PasswordStore extends Activity implements ToCloneOrNot.OnFragmentI
|
||||||
intent.putExtra("NAME", item.getName());
|
intent.putExtra("NAME", item.getName());
|
||||||
intent.putExtra("FILE_PATH", item.getFile().getAbsolutePath());
|
intent.putExtra("FILE_PATH", item.getFile().getAbsolutePath());
|
||||||
intent.putExtra("Operation", "DECRYPT");
|
intent.putExtra("Operation", "DECRYPT");
|
||||||
startActivity(intent);
|
startActivityForResult(intent, 0);
|
||||||
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -201,9 +201,16 @@ public class PasswordStore extends Activity implements ToCloneOrNot.OnFragmentI
|
||||||
intent.putExtra("NAME", "test.gpg");
|
intent.putExtra("NAME", "test.gpg");
|
||||||
intent.putExtra("FILE_PATH", this.currentDir.getAbsolutePath());
|
intent.putExtra("FILE_PATH", this.currentDir.getAbsolutePath());
|
||||||
intent.putExtra("Operation", "ENCRYPT");
|
intent.putExtra("Operation", "ENCRYPT");
|
||||||
|
// TODO Define different operations here
|
||||||
startActivityForResult(intent, 0);
|
startActivityForResult(intent, 0);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void onActivityResult(int requestCode, int resultCode,
|
||||||
|
Intent data) {
|
||||||
|
System.out.println(resultCode);
|
||||||
|
checkLocalRepository(this.currentDir);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,6 +92,11 @@ public class PgpHandler extends Activity {
|
||||||
mServiceConnection = new OpenPgpServiceConnection(
|
mServiceConnection = new OpenPgpServiceConnection(
|
||||||
PgpHandler.this, providerPackageName);
|
PgpHandler.this, providerPackageName);
|
||||||
mServiceConnection.bindToService();
|
mServiceConnection.bindToService();
|
||||||
|
|
||||||
|
ActionBar actionBar = getActionBar();
|
||||||
|
// actionBar.setHomeButtonEnabled(true);
|
||||||
|
// actionBar.setDisplayShowHomeEnabled(true);
|
||||||
|
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -108,8 +113,10 @@ public class PgpHandler extends Activity {
|
||||||
// automatically handle clicks on the Home/Up button, so long
|
// automatically handle clicks on the Home/Up button, so long
|
||||||
// as you specify a parent activity in AndroidManifest.xml.
|
// as you specify a parent activity in AndroidManifest.xml.
|
||||||
int id = item.getItemId();
|
int id = item.getItemId();
|
||||||
if (id == R.id.action_settings) {
|
switch (id) {
|
||||||
return true;
|
case android.R.id.home:
|
||||||
|
finish();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
@ -123,6 +130,7 @@ public class PgpHandler extends Activity {
|
||||||
encrypt(new Intent());
|
encrypt(new Intent());
|
||||||
break;
|
break;
|
||||||
case R.id.crypto_cancel_add:
|
case R.id.crypto_cancel_add:
|
||||||
|
finish();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// should not happen
|
// should not happen
|
||||||
|
@ -257,11 +265,12 @@ public class PgpHandler extends Activity {
|
||||||
+ ".gpg";
|
+ ".gpg";
|
||||||
OutputStream outputStream = FileUtils.openOutputStream(new File(path));
|
OutputStream outputStream = FileUtils.openOutputStream(new File(path));
|
||||||
outputStream.write(os.toByteArray());
|
outputStream.write(os.toByteArray());
|
||||||
finishActivity(0);
|
|
||||||
} else {
|
} else {
|
||||||
showToast(os.toString());
|
showToast(os.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setResult(998);
|
||||||
|
finish();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(Constants.TAG, "UnsupportedEncodingException", e);
|
Log.e(Constants.TAG, "UnsupportedEncodingException", e);
|
||||||
}
|
}
|
||||||
|
@ -330,6 +339,7 @@ public class PgpHandler extends Activity {
|
||||||
public void encrypt(Intent data) {
|
public void encrypt(Intent data) {
|
||||||
|
|
||||||
data.setAction(OpenPgpApi.ACTION_ENCRYPT);
|
data.setAction(OpenPgpApi.ACTION_ENCRYPT);
|
||||||
|
// TODO add preference so that the user sets his account name
|
||||||
data.putExtra(OpenPgpApi.EXTRA_USER_IDS, new String[] {"default"});
|
data.putExtra(OpenPgpApi.EXTRA_USER_IDS, new String[] {"default"});
|
||||||
data.putExtra(OpenPgpApi.EXTRA_REQUEST_ASCII_ARMOR, true);
|
data.putExtra(OpenPgpApi.EXTRA_REQUEST_ASCII_ARMOR, true);
|
||||||
|
|
||||||
|
|
Before Width: | Height: | Size: 9.2 KiB After Width: | Height: | Size: 1,021 B |
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 723 B |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 2.2 KiB |
|
@ -32,7 +32,7 @@
|
||||||
android:id="@+id/crypto_show_button"
|
android:id="@+id/crypto_show_button"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:src="@android:drawable/ic_input_get"
|
android:src="@drawable/ic_key"
|
||||||
android:background="@android:drawable/screen_background_light_transparent"
|
android:background="@android:drawable/screen_background_light_transparent"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
android:visibility="invisible"
|
android:visibility="invisible"
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
|
|
||||||
<string name="app_name">PwdStore</string>
|
<!-- Activity names -->
|
||||||
|
<string name="app_name">Password Store</string>
|
||||||
|
<string name="activity_clone_name">Clone a Git repo</string>
|
||||||
|
|
||||||
<string name="clone_settings">Clone</string>
|
<string name="clone_settings">Clone</string>
|
||||||
<string name="action_settings">Settings</string>
|
<string name="action_settings">Settings</string>
|
||||||
<string name="hello_world">Hello world!</string>
|
<string name="hello_world">Hello world!</string>
|
||||||
|
|