Add donate link.

This commit is contained in:
Brian Pellin
2009-10-06 22:19:07 -05:00
parent 6018341097
commit c320a6f9be
6 changed files with 76 additions and 11 deletions

View File

@@ -34,6 +34,7 @@
<string name="current_group">Current Group: </string> <string name="current_group">Current Group: </string>
<string name="current_group_root">Current Group: Root</string> <string name="current_group_root">Current Group: Root</string>
<string name="disclaimer_formal">KeePassDroid Copyright 2009 Brian Pellin comes with ABSOLUTELY NO WARRANTY; This is free software, and you are welcome to redistribute it under the conditions of the GPL version 2 or later.</string> <string name="disclaimer_formal">KeePassDroid Copyright 2009 Brian Pellin comes with ABSOLUTELY NO WARRANTY; This is free software, and you are welcome to redistribute it under the conditions of the GPL version 2 or later.</string>
<string name="donate_url"><![CDATA[https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8246230]]></string>
<string name="enter_filename">Enter database filename:</string> <string name="enter_filename">Enter database filename:</string>
<string name="entry_accessed">Accessed: </string> <string name="entry_accessed">Accessed: </string>
<string name="entry_and_or">Enter a password and/or a key file to unlock your database:</string> <string name="entry_and_or">Enter a password and/or a key file to unlock your database:</string>
@@ -52,6 +53,7 @@
<string name="error_could_not_create_group">Error creating group.</string> <string name="error_could_not_create_group">Error creating group.</string>
<string name="error_database_exists">This file already exists.</string> <string name="error_database_exists">This file already exists.</string>
<string name="error_database_settings">Failed to determine database settings.</string> <string name="error_database_settings">Failed to determine database settings.</string>
<string name="error_failed_to_launch_link">Failed to launch link.</string>
<string name="error_filename_required">A filename is required.</string> <string name="error_filename_required">A filename is required.</string>
<string name="error_file_not_create">Could not create file:</string> <string name="error_file_not_create">Could not create file:</string>
<string name="error_no_name">A name is required.</string> <string name="error_no_name">A name is required.</string>
@@ -80,6 +82,7 @@
<string name="menu_create">Create</string> <string name="menu_create">Create</string>
<string name="menu_db_settings">Database Settings</string> <string name="menu_db_settings">Database Settings</string>
<string name="menu_delete">Delete</string> <string name="menu_delete">Delete</string>
<string name="menu_donate">Donate</string>
<string name="menu_edit">Edit</string> <string name="menu_edit">Edit</string>
<string name="menu_hide_password">Hide Password</string> <string name="menu_hide_password">Hide Password</string>
<string name="menu_homepage">Go to Homepage</string> <string name="menu_homepage">Go to Homepage</string>

View File

@@ -49,11 +49,12 @@ public class EntryActivity extends LockingActivity {
public static final String KEY_ENTRY = "entry"; public static final String KEY_ENTRY = "entry";
public static final String KEY_REFRESH_POS = "refresh_pos"; public static final String KEY_REFRESH_POS = "refresh_pos";
private static final int MENU_PASS = Menu.FIRST; private static final int MENU_DONATE = Menu.FIRST;
private static final int MENU_GOTO_URL = Menu.FIRST + 1; private static final int MENU_PASS = Menu.FIRST + 1;
private static final int MENU_COPY_USER = Menu.FIRST + 2; private static final int MENU_GOTO_URL = Menu.FIRST + 2;
private static final int MENU_COPY_PASS = Menu.FIRST + 3; private static final int MENU_COPY_USER = Menu.FIRST + 3;
private static final int MENU_LOCK = Menu.FIRST + 4; private static final int MENU_COPY_PASS = Menu.FIRST + 4;
private static final int MENU_LOCK = Menu.FIRST + 5;
private static final long CLIP_CLEAR_TIME = 5 * 60 * 1000; private static final long CLIP_CLEAR_TIME = 5 * 60 * 1000;
@@ -144,6 +145,9 @@ public class EntryActivity extends LockingActivity {
public boolean onCreateOptionsMenu(Menu menu) { public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu); super.onCreateOptionsMenu(menu);
menu.add(0, MENU_DONATE, 0, R.string.menu_donate);
menu.findItem(MENU_DONATE).setIcon(android.R.drawable.ic_menu_share);
menu.add(0, MENU_PASS, 0, R.string.menu_show_password); menu.add(0, MENU_PASS, 0, R.string.menu_show_password);
menu.findItem(MENU_PASS).setIcon(android.R.drawable.ic_menu_view); menu.findItem(MENU_PASS).setIcon(android.R.drawable.ic_menu_view);
menu.add(0, MENU_GOTO_URL, 0, R.string.menu_url); menu.add(0, MENU_GOTO_URL, 0, R.string.menu_url);
@@ -171,6 +175,15 @@ public class EntryActivity extends LockingActivity {
@Override @Override
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
switch ( item.getItemId() ) { switch ( item.getItemId() ) {
case MENU_DONATE:
try {
Util.gotoUrl(this, R.string.donate_url);
} catch (ActivityNotFoundException e) {
Toast.makeText(this, R.string.error_failed_to_launch_link, Toast.LENGTH_LONG).show();
return false;
}
return true;
case MENU_PASS: case MENU_PASS:
if ( mShowPassword ) { if ( mShowPassword ) {
item.setTitle(R.string.menu_show_password); item.setTitle(R.string.menu_show_password);

View File

@@ -29,6 +29,7 @@ import org.phoneid.keepassj2me.PwGroup;
import org.phoneid.keepassj2me.Types; import org.phoneid.keepassj2me.Types;
import android.app.Activity; import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
@@ -51,7 +52,8 @@ public class EntryEditActivity extends LockingActivity {
public static final String KEY_ENTRY = "entry"; public static final String KEY_ENTRY = "entry";
public static final String KEY_PARENT = "parent"; public static final String KEY_PARENT = "parent";
private static final int MENU_PASS = Menu.FIRST; private static final int MENU_DONATE = Menu.FIRST;
private static final int MENU_PASS = Menu.FIRST + 1;
private PwEntry mEntry; private PwEntry mEntry;
private boolean mShowPassword = false; private boolean mShowPassword = false;
@@ -200,6 +202,9 @@ public class EntryEditActivity extends LockingActivity {
public boolean onCreateOptionsMenu(Menu menu) { public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu); super.onCreateOptionsMenu(menu);
menu.add(0, MENU_DONATE, 0, R.string.menu_donate);
menu.findItem(MENU_DONATE).setIcon(android.R.drawable.ic_menu_share);
menu.add(0, MENU_PASS, 0, R.string.menu_show_password); menu.add(0, MENU_PASS, 0, R.string.menu_show_password);
menu.findItem(MENU_PASS).setIcon(android.R.drawable.ic_menu_view); menu.findItem(MENU_PASS).setIcon(android.R.drawable.ic_menu_view);
@@ -208,6 +213,15 @@ public class EntryEditActivity extends LockingActivity {
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
switch ( item.getItemId() ) { switch ( item.getItemId() ) {
case MENU_DONATE:
try {
Util.gotoUrl(this, R.string.donate_url);
} catch (ActivityNotFoundException e) {
Toast.makeText(this, R.string.error_failed_to_launch_link, Toast.LENGTH_LONG).show();
return false;
}
return true;
case MENU_PASS: case MENU_PASS:
if ( mShowPassword ) { if ( mShowPassword ) {
item.setTitle(R.string.menu_hide_password); item.setTitle(R.string.menu_hide_password);

View File

@@ -22,6 +22,7 @@ package com.keepassdroid;
import org.phoneid.keepassj2me.PwGroup; import org.phoneid.keepassj2me.PwGroup;
import android.app.Activity; import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
@@ -32,6 +33,7 @@ import android.widget.BaseAdapter;
import android.widget.ListAdapter; import android.widget.ListAdapter;
import android.widget.ListView; import android.widget.ListView;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast;
import com.android.keepass.KeePass; import com.android.keepass.KeePass;
import com.android.keepass.R; import com.android.keepass.R;
@@ -42,10 +44,11 @@ public abstract class GroupBaseActivity extends LockingListActivity {
public static final String KEY_ENTRY = "entry"; public static final String KEY_ENTRY = "entry";
public static final String KEY_MODE = "mode"; public static final String KEY_MODE = "mode";
protected static final int MENU_LOCK = Menu.FIRST; protected static final int MENU_DONATE = Menu.FIRST;
protected static final int MENU_SEARCH = Menu.FIRST + 1; protected static final int MENU_LOCK = Menu.FIRST + 1;
protected static final int MENU_DB_SETTINGS = Menu.FIRST + 2; protected static final int MENU_SEARCH = Menu.FIRST + 2;
protected static final int MENU_CHANGE_MASTER_KEY = Menu.FIRST + 3; protected static final int MENU_DB_SETTINGS = Menu.FIRST + 3;
protected static final int MENU_CHANGE_MASTER_KEY = Menu.FIRST + 4;
protected PwGroup mGroup; protected PwGroup mGroup;
@@ -129,6 +132,9 @@ public abstract class GroupBaseActivity extends LockingListActivity {
public boolean onCreateOptionsMenu(Menu menu) { public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu); super.onCreateOptionsMenu(menu);
menu.add(0, MENU_DONATE, 0, R.string.menu_donate);
menu.findItem(MENU_DONATE).setIcon(android.R.drawable.ic_menu_share);
menu.add(0, MENU_LOCK, 0, R.string.menu_lock); menu.add(0, MENU_LOCK, 0, R.string.menu_lock);
menu.findItem(MENU_LOCK).setIcon(android.R.drawable.ic_lock_lock); menu.findItem(MENU_LOCK).setIcon(android.R.drawable.ic_lock_lock);
@@ -146,6 +152,15 @@ public abstract class GroupBaseActivity extends LockingListActivity {
@Override @Override
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
switch ( item.getItemId() ) { switch ( item.getItemId() ) {
case MENU_DONATE:
try {
Util.gotoUrl(this, R.string.donate_url);
} catch (ActivityNotFoundException e) {
Toast.makeText(this, R.string.error_failed_to_launch_link, Toast.LENGTH_LONG).show();
return false;
}
return true;
case MENU_LOCK: case MENU_LOCK:
KeePass.db.shutdown = true; KeePass.db.shutdown = true;
setResult(KeePass.EXIT_LOCK); setResult(KeePass.EXIT_LOCK);

View File

@@ -44,6 +44,10 @@ public class Util {
context.startActivity(new Intent(Intent.ACTION_VIEW, uri)); context.startActivity(new Intent(Intent.ACTION_VIEW, uri));
} }
} }
public static void gotoUrl(Context context, int resId) throws ActivityNotFoundException {
gotoUrl(context, context.getString(resId));
}
public static String getEditText(Activity act, int resId) { public static String getEditText(Activity act, int resId) {
TextView te = (TextView) act.findViewById(resId); TextView te = (TextView) act.findViewById(resId);
@@ -65,4 +69,6 @@ public class Util {
} }
} }
} }

View File

@@ -24,6 +24,7 @@ import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import android.app.ListActivity; import android.app.ListActivity;
import android.content.ActivityNotFoundException;
import android.content.Intent; import android.content.Intent;
import android.database.Cursor; import android.database.Cursor;
import android.os.Bundle; import android.os.Bundle;
@@ -48,7 +49,8 @@ import com.keepassdroid.intents.TimeoutIntents;
public class FileSelectActivity extends ListActivity { public class FileSelectActivity extends ListActivity {
private static final int MENU_ABOUT = Menu.FIRST; private static final int MENU_DONATE = Menu.FIRST;
private static final int MENU_ABOUT = Menu.FIRST + 1;
private FileDbHelper mDbHelper; private FileDbHelper mDbHelper;
private boolean recentMode = false; private boolean recentMode = false;
@@ -260,6 +262,9 @@ public class FileSelectActivity extends ListActivity {
public boolean onCreateOptionsMenu(Menu menu) { public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu); super.onCreateOptionsMenu(menu);
menu.add(0, MENU_DONATE, 0, R.string.menu_donate);
menu.findItem(MENU_DONATE).setIcon(android.R.drawable.ic_menu_share);
menu.add(0, MENU_ABOUT, 0, R.string.menu_about); menu.add(0, MENU_ABOUT, 0, R.string.menu_about);
menu.findItem(MENU_ABOUT).setIcon(android.R.drawable.ic_menu_help); menu.findItem(MENU_ABOUT).setIcon(android.R.drawable.ic_menu_help);
@@ -269,6 +274,15 @@ public class FileSelectActivity extends ListActivity {
@Override @Override
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) { switch (item.getItemId()) {
case MENU_DONATE:
try {
Util.gotoUrl(this, R.string.donate_url);
} catch (ActivityNotFoundException e) {
Toast.makeText(this, R.string.error_failed_to_launch_link, Toast.LENGTH_LONG).show();
return false;
}
return true;
case MENU_ABOUT: case MENU_ABOUT:
AboutDialog dialog = new AboutDialog(this); AboutDialog dialog = new AboutDialog(this);
dialog.show(); dialog.show();