
package info.guardianproject.fakepanicresponder;

import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.util.Log;
import android.widget.Toast;

public class ResponseActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
        String msg = "FakePanicResponder got a panic trigger!";
        Log.i(TAG, msg);
        Toast.makeText(this, msg, Toast.LENGTH_SHORT).show();

        if (prefs.getBoolean(PanicConfigActivity.PREF_LOCK_AND_EXIT, true)) {
            ExitActivity.exitAndRemoveFromRecentApps(this);
        }
        if (prefs.getBoolean(PanicConfigActivity.PREF_UNINSTALL_THIS_APP, false)) {
            Intent intent = new Intent(Intent.ACTION_DELETE);
            intent.setData(Uri.parse("package:" + getPackageName()));
            startActivity(intent);
        }
        finish();
    }
}

@@ -300,56 +300,164 @@
 t;%0A%0A
-public class ResponseActivity extends Activity %7B
+import info.guardianproject.panic.PanicResponder;%0A%0Apublic class ResponseActivity extends Activity %7B%0A    public static final String TAG = %22ResponseActivity%22;
 %0A%0A  
@@ -574,95 +574,8 @@
 );%0A%0A
-        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);%0A
     
@@ -734,148 +734,159 @@
     
-if (prefs.getBoolean(PanicConfigActivity.PREF_LOCK_AND_EXIT, true)) %7B%0A            ExitActivity.exitAndRemoveFromRecent
+SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);%0A        if (PanicResponder.receivedTriggerFromConnected
 App
-s
 (this)
-;%0A        %7D%0A
+) %7B%0A    
     
@@ -981,21 +981,156 @@
     
-Intent intent
+    Log.i(TAG, PanicConfigActivity.PREF_UNINSTALL_THIS_APP);%0A                PanicResponder.deleteAllAppData(this);%0A                Intent uninstall
  = n
@@ -1174,22 +1174,29 @@
         
+    
-intent
+uninstall
 .setData
@@ -1251,16 +1251,20 @@
         
+    
 startAct
@@ -1273,26 +1273,709 @@
 ity(
-intent);%0A        %7D
+uninstall);%0A                ExitActivity.exitAndRemoveFromRecentApps(this);%0A            %7D else if (prefs.getBoolean(PanicConfigActivity.PREF_LOCK_AND_EXIT, true)) %7B%0A                Log.i(TAG, PanicConfigActivity.PREF_LOCK_AND_EXIT);%0A                ExitActivity.exitAndRemoveFromRecentApps(this);%0A            %7D%0A            // add other responses here, paying attention to if/else order%0A        %7D else if (PanicResponder.shouldUseDefaultResponseToTrigger(this)) %7B%0A            if (prefs.getBoolean(PanicConfigActivity.PREF_LOCK_AND_EXIT, true)) %7B%0A                Log.i(TAG, PanicConfigActivity.PREF_LOCK_AND_EXIT);%0A                ExitActivity.exitAndRemoveFromRecentApps(this);%0A            %7D%0A        %7D%0A
 %0A   

update to PanicKit v0.4 responder flow