Clear clipboard when CopyToClipboardService is stopped (e.g. due to lock database)

-> https://keepass2android.codeplex.com/workitem/162
This commit is contained in:
Philipp Crocoll 2014-03-10 08:02:01 +01:00
parent 3c349f68bc
commit e5dea1895d

View File

@ -139,6 +139,11 @@ namespace keepass2android
_numElementsToWaitFor= 0; _numElementsToWaitFor= 0;
ClearKeyboard(true); ClearKeyboard(true);
} }
if (_clearClipboardTask != null)
{
Kp2aLog.Log("Clearing clipboard due to stop CopyToClipboardService");
_clearClipboardTask.Run();
}
Kp2aLog.Log("Destroyed Show-Notification-Receiver."); Kp2aLog.Log("Destroyed Show-Notification-Receiver.");
@ -351,9 +356,10 @@ namespace keepass2android
long clipClearTime = long.Parse(sClipClear); long clipClearTime = long.Parse(sClipClear);
_clearClipboardTask = new ClearClipboardTask(this, text, _uiThreadCallback);
if ( clipClearTime > 0 ) { if ( clipClearTime > 0 ) {
_numElementsToWaitFor++; _numElementsToWaitFor++;
_timer.Schedule(new ClearClipboardTask(this, text, _uiThreadCallback), clipClearTime); _timer.Schedule(_clearClipboardTask, clipClearTime);
} }
} }
@ -385,6 +391,7 @@ namespace keepass2android
// Setup to allow the toast to happen in the foreground // Setup to allow the toast to happen in the foreground
readonly Handler _uiThreadCallback = new Handler(); readonly Handler _uiThreadCallback = new Handler();
private ClearClipboardTask _clearClipboardTask;
private Notification GetNotification(String intentText, int descResId, int drawableResId, String entryName) { private Notification GetNotification(String intentText, int descResId, int drawableResId, String entryName) {
String desc = GetString(descResId); String desc = GetString(descResId);