Implement clipboard timeout setting.

This commit is contained in:
Brian Pellin committed 2009-11-27 18:07:25 -06:00
1 parent ab6bc03101
commit 54f30e9972
4 files changed
+37 -3

No files matched your search

+11 -3
View File
@@ -37,8 +37,10 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Handler;
import android.preference.PreferenceManager;
import android.text.method.PasswordTransformationMethod;
import android.view.Menu;
import android.view.MenuItem;
@@ -64,8 +66,6 @@ public class EntryActivity extends LockCloseActivity {
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;
public static final int NOTIFY_USERNAME = 1;
public static final int NOTIFY_PASSWORD = 2;
@@ -321,7 +321,15 @@ public class EntryActivity extends LockCloseActivity {
private void timeoutCopyToClipboard(String text) {
Util.copyToClipboard(this, text);
mTimer.schedule(new ClearClipboardTask(this, text), CLIP_CLEAR_TIME);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
String sClipClear = prefs.getString(getString(R.string.clipboard_timeout_key), getString(R.string.clipboard_timeout_default));
long clipClearTime = Integer.parseInt(sClipClear);
if ( clipClearTime > 0 ) {
mTimer.schedule(new ClearClipboardTask(this, text), clipClearTime);
}
}