<action android:name="org.openintents.action.SET_PASSWORD" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
- <intent-filter android:label="@string/intent_restart_timer">
- <action android:name="org.openintents.action.RESTART_TIMER" />
- <category android:name="android.intent.category.DEFAULT" />
- </intent-filter>
</activity>
<activity class=".PassGen" android:name="PassGen" android:label="@string/app_name" />
}
public boolean onOptionsItemSelected(MenuItem item) {
- startActivity (restartTimerIntent);
+ sendBroadcast (restartTimerIntent);
AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
int position=-1;
protected void onListItemClick(ListView l, View v, int position, long id) {
super.onListItemClick(l, v, position, id);
- startActivity (restartTimerIntent);
+ sendBroadcast (restartTimerIntent);
launchPassList(rows.get(position).id);
}
if ((name==null) || (name=="")) return -1;
CategoryEntry entry = new CategoryEntry();
- startActivity (restartTimerIntent);
+ sendBroadcast (restartTimerIntent);
String namePlain = name;
try {
} else if (externalAccess){\r
\r
// which action?\r
- if (action.equals (CryptoIntents.ACTION_RESTART_TIMER)) {\r
- if (service != null) {\r
- try {\r
- service.restartTimer();\r
- callbackResult = RESULT_OK;\r
- } catch (RemoteException e) {\r
- // TODO Auto-generated catch block\r
- Log.e (TAG, "remoteException in Restart Timer");\r
- }\r
- }\r
- } else if (action.equals (CryptoIntents.ACTION_ENCRYPT)) {\r
+ if (action.equals (CryptoIntents.ACTION_ENCRYPT)) {\r
callbackResult = encryptIntent(thisIntent, callbackIntent);\r
} else if (action.equals (CryptoIntents.ACTION_DECRYPT)) {\r
callbackResult = decryptIntent(thisIntent, callbackIntent);\r
}
public boolean onOptionsItemSelected(MenuItem item) {
- startActivity (restartTimerIntent);
+ sendBroadcast (restartTimerIntent);
AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
int position=-1;
if (info==null) {
String encrypt (String clearText);\r
String decrypt (String cryptoText);\r
void setTimeoutMinutes(int timeoutMinutesIn);\r
- void restartTimer();\r
}\r
import android.app.Service;
+import android.content.BroadcastReceiver;
+import android.content.Context;
import android.content.Intent;
+import android.content.IntentFilter;
import android.os.IBinder;
import android.util.Log;
import android.os.CountDownTimer;
public void onCreate() {
super.onCreate();
+ BroadcastReceiver mIntentReceiver = new BroadcastReceiver() {
+ public void onReceive(Context context, Intent intent) {
+ if (intent.getAction().equals(CryptoIntents.ACTION_RESTART_TIMER)) {
+ restartTimer();
+ }
+ }
+ };
+
+ IntentFilter filter = new IntentFilter();
+ filter.addAction (CryptoIntents.ACTION_RESTART_TIMER);
+ registerReceiver(mIntentReceiver, filter);
+
Log.d( TAG,"onCreate" );
}
t.start();
Log.d(TAG, "Timer started with: " + timeoutUntilStop );
}
-
+
+ public void restartTimer () {
+ // must be started with startTimer first.
+ Log.d(TAG,"timer restarted");
+ if (t != null) {
+ t.cancel();
+ t.start();
+ }
+ }
/**
* The ServiceDispatch is defined through IDL
timeoutUntilStop = timeoutMinutes * 60000;
Log.d(TAG,"set timeout to "+timeoutMinutes);
}
-
- public void restartTimer () {
- // must be started with startTimer first.
- if (t != null) {
- t.cancel();
- t.start();
- }
- }
+
};
}