]> hydra-www.ietfng.org Git - android-vcpass-oisafe/commitdiff
OI Safe: Include EULA activity.
authorpeli0101 <peli0101@72b678ce-9140-0410-bee8-679b907dd61a>
Sat, 17 Jan 2009 13:20:48 +0000 (13:20 +0000)
committerpeli0101 <peli0101@72b678ce-9140-0410-bee8-679b907dd61a>
Sat, 17 Jan 2009 13:20:48 +0000 (13:20 +0000)
git-svn-id: http://openintents.googlecode.com/svn/trunk/Safe@1750 72b678ce-9140-0410-bee8-679b907dd61a

AndroidManifest.xml
res/raw/license_short.txt
src/org/openintents/distribution/EulaActivity.java
src/org/openintents/safe/AskPassword.java

index 54bd7ed13af1b345ef66c2b415d9801b43e20e6d..329b9d86aee50eb974e69b5e29a420f7e987286e 100644 (file)
@@ -62,6 +62,8 @@
         <activity class=".Restore" android:name="Restore" android:label="@string/app_name" />
         <activity class=".Preferences" android:name="Preferences" android:label="@string/app_name" />
         <activity class=".LogOffActivity" android:name="LogOffActivity" android:label="@string/app_name" />
+        \r
+        <activity android:name="org.openintents.distribution.EulaActivity" android:label="@string/eula_title" />\r
         
         <service class=".service.ServiceDispatchImpl" android:name=".service.ServiceDispatchImpl"
             android:label="@string/app_name"
index 99a0b46ea0eaf3cba7f679e2f80021c499bc2c9b..2c000974293ade0f3c3dfe27ec7ab457f4f68e80 100644 (file)
@@ -1,5 +1,5 @@
 Copyright (C) 2008-2009 Steven Osborn - http://steven.bitsetters.com and
-Randy McEoin (and others, see About box)
+Randy McEoin (and others, see About)
 
 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
index 363bbba935713ba2c259190e84aef55596e13833..830d89758971ab050961ca5960af65422c42a68c 100644 (file)
@@ -11,6 +11,7 @@ import android.content.Intent;
 import android.content.SharedPreferences;\r
 import android.content.res.Resources;\r
 import android.os.Bundle;\r
+import android.os.Parcel;\r
 import android.preference.PreferenceManager;\r
 import android.text.TextUtils;\r
 import android.util.Log;\r
@@ -21,7 +22,7 @@ import android.widget.TextView;
 /**\r
  * Displays the Eula for the first time, reading it from a raw resource.\r
  * \r
- * @version 2009-01-17\r
+ * @version 2009-01-17, 13:00 UTC\r
  * @author Peli\r
  *\r
  */\r
@@ -38,12 +39,14 @@ public class EulaActivity extends Activity {
         */\r
        private static final String EXTRA_LAUNCH_ACTIVITY_PACKAGE = "org.openintents.extra.launch_activity_package";\r
        private static final String EXTRA_LAUNCH_ACTIVITY_CLASS = "org.openintents.extra.launch_activity_class";\r
+       private static final String EXTRA_LAUNCH_ACTIVITY_INTENT = "org.openintents.extra.launch_activity_intent";\r
        \r
        private Button mAgree;\r
        private Button mDisagree;\r
        \r
        private String mLaunchPackage;\r
        private String mLaunchClass;\r
+       private Intent mLaunchIntent;\r
        \r
        /** Called when the activity is first created. */\r
        @Override\r
@@ -57,6 +60,8 @@ public class EulaActivity extends Activity {
                Bundle b = i.getExtras();\r
                mLaunchPackage = b.getString(EXTRA_LAUNCH_ACTIVITY_PACKAGE);\r
                mLaunchClass = b.getString(EXTRA_LAUNCH_ACTIVITY_CLASS);\r
+               //mLaunchIntent \r
+               mLaunchIntent = b.getParcelable(EXTRA_LAUNCH_ACTIVITY_INTENT);\r
                \r
                //mIntroContinue = (Button) findViewById(R.id.intro_continue);\r
                mAgree = (Button) findViewById(RD.id.button1);\r
@@ -88,8 +93,14 @@ public class EulaActivity extends Activity {
                e.commit();\r
                \r
                // Call the activity that originally called checkEula()\r
-               Intent i = new Intent();\r
-               i.setClassName(mLaunchPackage, mLaunchClass);\r
+               Intent i;\r
+               if (mLaunchIntent != null) {\r
+                       i = mLaunchIntent;\r
+               } else {\r
+                       i = new Intent();\r
+                       i.setClassName(mLaunchPackage, mLaunchClass);\r
+               }\r
+               i.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);\r
                startActivity(i);\r
                finish();\r
        }\r
@@ -106,12 +117,16 @@ public class EulaActivity extends Activity {
                finish();\r
        }\r
 \r
+       public static boolean checkEula(Activity activity) {\r
+               return checkEula(activity, null);\r
+       }\r
+       \r
        /**\r
         * Test whether EULA has been accepted. Otherwise display EULA.\r
         * \r
         * @return True if Eula has been accepted.\r
         */\r
-       public static boolean checkEula(Activity activity) {\r
+       public static boolean checkEula(Activity activity, Intent intent) {\r
                SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(activity);\r
                boolean accepted = sp.getBoolean(PREFERENCES_EULA_ACCEPTED, false);\r
                \r
@@ -131,6 +146,10 @@ public class EulaActivity extends Activity {
                        Log.d(TAG, "Local class name: " + ci.getClassName());\r
                        i.putExtra(EXTRA_LAUNCH_ACTIVITY_PACKAGE, ci.getPackageName());\r
                        i.putExtra(EXTRA_LAUNCH_ACTIVITY_CLASS, ci.getClassName());\r
+                       if (intent != null) {\r
+                               i.putExtra(EXTRA_LAUNCH_ACTIVITY_INTENT, intent);\r
+                       }\r
+                       i.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);\r
                        activity.startActivity(i);\r
                        activity.finish();\r
                        return false;\r
index be585a44399be8aa88d215c8c61a2de0ac932a8f..dfee99415135fa4681cc45d1437f5640626eb63a 100644 (file)
@@ -16,6 +16,7 @@
  */
 package org.openintents.safe;
 
+import org.openintents.distribution.EulaActivity;
 import org.openintents.util.VersionUtils;
 
 import android.app.Activity;
@@ -63,6 +64,11 @@ public class AskPassword extends Activity {
        @Override
        public void onCreate(Bundle icicle) {
                super.onCreate(icicle);
+        
+               if (!EulaActivity.checkEula(this, getIntent())) {
+            return;
+        }
+        
                Intent thisIntent = getIntent();
                
                boolean isLocal = thisIntent.getBooleanExtra (EXTRA_IS_LOCAL, false);