This repository was archived by the owner on Jan 25, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 6 files changed +86
-4
lines changed
src/info/guardianproject/otr/app/im/app Expand file tree Collapse file tree 6 files changed +86
-4
lines changed Original file line number Diff line number Diff line change 185185 <activity
186186 android : name =" .ui.AboutActivity"
187187 android : exported =" false" />
188+ <activity
189+ android : name =" .app.PanicResponderActivity"
190+ android : noHistory =" true"
191+ android : theme =" @android:style/Theme.NoDisplay" >
192+ <intent-filter >
193+ <action android : name =" info.guardianproject.panic.action.TRIGGER" />
194+ <category android : name =" android.intent.category.DEFAULT" />
195+ </intent-filter >
196+ </activity >
197+ <activity
198+ android : name =" .app.ExitActivity"
199+ android : theme =" @android:style/Theme.NoDisplay" />
188200
189201 <service
190202 android : name =" .plugin.xmpp.XmppImPlugin"
Original file line number Diff line number Diff line change 2323
2424 <PreferenceCategory android : title =" @string/pref_group_security_title" >
2525
26- <ListPreference android : title =" Chat Encryption "
26+ <ListPreference android : title =" @string/chat_encryption_title "
2727 android : key =" pref_security_otr_mode"
2828 android : entryValues =" @array/otr_options_values"
2929 android : entries =" @array/otr_options"
Original file line number Diff line number Diff line change 1+
2+ package info .guardianproject .otr .app .im .app ;
3+
4+ import android .annotation .SuppressLint ;
5+ import android .app .Activity ;
6+ import android .content .Intent ;
7+ import android .os .Build ;
8+ import android .os .Bundle ;
9+
10+ public class ExitActivity extends Activity {
11+
12+ @ SuppressLint ("NewApi" )
13+ @ Override
14+ protected void onCreate (Bundle savedInstanceState ) {
15+ super .onCreate (savedInstanceState );
16+
17+ if (Build .VERSION .SDK_INT >= 21 ) {
18+ finishAndRemoveTask ();
19+ } else {
20+ finish ();
21+ }
22+
23+ System .exit (0 );
24+ }
25+
26+ public static void exitAndRemoveFromRecentApps (Activity activity ) {
27+ Intent intent = new Intent (activity , ExitActivity .class );
28+
29+ intent .addFlags (Intent .FLAG_ACTIVITY_NEW_TASK
30+ | Intent .FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS
31+ | Intent .FLAG_ACTIVITY_CLEAR_TASK
32+ | Intent .FLAG_ACTIVITY_NO_ANIMATION );
33+
34+ activity .startActivity (intent );
35+ }
36+ }
Original file line number Diff line number Diff line change @@ -982,6 +982,7 @@ public boolean onMenuItemClick(MenuItem item) {
982982
983983 case R .id .menu_exit :
984984 WelcomeActivity .shutdownAndLock (NewChatActivity .this );
985+ ExitActivity .exitAndRemoveFromRecentApps (NewChatActivity .this );
985986 return true ;
986987
987988 case R .id .menu_add_contact :
Original file line number Diff line number Diff line change 1+
2+ package info .guardianproject .otr .app .im .app ;
3+
4+ import android .annotation .SuppressLint ;
5+ import android .app .Activity ;
6+ import android .content .Intent ;
7+ import android .os .Build ;
8+ import android .os .Bundle ;
9+
10+ public class PanicResponderActivity extends Activity {
11+
12+ public static final String PANIC_TRIGGER_ACTION = "info.guardianproject.panic.action.TRIGGER" ;
13+
14+ @ SuppressLint ("NewApi" )
15+ @ Override
16+ protected void onCreate (Bundle savedInstanceState ) {
17+ super .onCreate (savedInstanceState );
18+
19+ Intent intent = getIntent ();
20+ if (intent != null && PANIC_TRIGGER_ACTION .equals (intent .getAction ())) {
21+ WelcomeActivity .shutdownAndLock (this );
22+ ExitActivity .exitAndRemoveFromRecentApps (this );
23+ }
24+
25+ if (Build .VERSION .SDK_INT >= 21 ) {
26+ finishAndRemoveTask ();
27+ } else {
28+ finish ();
29+ }
30+ }
31+ }
Original file line number Diff line number Diff line change @@ -61,6 +61,8 @@ public class WelcomeActivity extends ThemeableActivity implements ICacheWordSubs
6161
6262 private boolean mDoSignIn = true ;
6363
64+ private ProgressDialog dialog ;
65+
6466 static final String [] PROVIDER_PROJECTION = { Imps .Provider ._ID , Imps .Provider .NAME ,
6567 Imps .Provider .FULLNAME , Imps .Provider .CATEGORY ,
6668 Imps .Provider .ACTIVE_ACCOUNT_ID ,
@@ -218,6 +220,9 @@ protected void onDestroy() {
218220
219221 if (mCacheWord != null )
220222 mCacheWord .disconnect ();
223+
224+ if (dialog != null )
225+ dialog .dismiss ();
221226 }
222227
223228 @ Override
@@ -445,9 +450,6 @@ private void completeShutdown ()
445450 }
446451 new AsyncTask <String , Void , String >() {
447452
448- private ProgressDialog dialog ;
449-
450-
451453 @ Override
452454 protected void onPreExecute () {
453455 if (mApp .getActiveConnections ().size () > 0 )
You can’t perform that action at this time.
0 commit comments