Ray Zhang 11 years ago
parent
commit
6aa2798cec

+ 107 - 98
RedAnt Photo/AndroidManifest.xml

@@ -1,109 +1,118 @@
-<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="com.usai.redant.photo"
-    android:versionCode="1"
-    android:versionName="1.0" >
-
-    <uses-sdk
-        android:minSdkVersion="14"
-        android:targetSdkVersion="18" />
-
-    <uses-permission android:name="android.permission.CAMERA" />
-    <uses-permission android:name="android.permission.VIBRATE" />
-    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
-    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
-    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
-    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
-    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
-    <uses-permission android:name="android.permission.INTERNET" />
-
-    <application
-        android:name="com.usai.redant.photo.RedAntApplication"
-        android:allowBackup="true"
-        android:icon="@drawable/ic_shipping"
-        android:label="@string/app_name"
-        android:theme="@style/AppTheme" >
-        <activity
-            android:name="com.usai.redant.photo.MainActivity"
-            android:configChanges="orientation|keyboardHidden"
-            android:label="@string/app_name"
-            
-            android:screenOrientation="landscape"
-            android:stateNotNeeded="true"
-            android:theme="@style/CaptureTheme" >
-
-            <!--
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="com.usai.redant.photo"
+    android:versionCode="1"
+    android:versionName="A140821" >
+
+    <uses-sdk
+        android:minSdkVersion="14"
+        android:targetSdkVersion="18" />
+
+    <uses-permission android:name="android.permission.CAMERA" />
+    <uses-permission android:name="android.permission.VIBRATE" />
+    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
+    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
+    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
+    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
+    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
+    <uses-permission android:name="android.permission.INTERNET" />
+
+    <application
+        android:name=".RedAntApplication"
+        android:allowBackup="true"
+        android:icon="@drawable/ic_shipping"
+        android:label="@string/app_name"
+        android:theme="@style/AppTheme" >
+        <activity
+            android:name=".MainActivity"
+            android:configChanges="orientation|keyboardHidden"
+            android:label="@string/app_name"
+            android:screenOrientation="sensorLandscape"
+            android:stateNotNeeded="true"
+            android:theme="@style/CaptureTheme" >
+
+            <!--
                  <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
 
                 <category android:name="android.intent.category.LAUNCHER" />
             </intent-filter>
-            -->
-        </activity>
-        <activity
-            android:name="com.usai.redant.photo.CaptureActivity"
-            android:clearTaskOnLaunch="true"
-            android:label="Scan"
-            android:stateNotNeeded="true"
-            android:screenOrientation="landscape"
-            android:theme="@style/CaptureTheme"
-            android:windowSoftInputMode="stateAlwaysHidden" >
-
-            <!--
+            -->
+        </activity>
+        <activity
+            android:name=".CaptureActivity"
+            android:clearTaskOnLaunch="true"
+            android:label="Scan"
+            android:screenOrientation="sensorLandscape"
+            android:stateNotNeeded="true"
+            android:theme="@style/CaptureTheme"
+            android:windowSoftInputMode="stateAlwaysHidden" >
+
+            <!--
                  <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
 
                 <category android:name="android.intent.category.LAUNCHER" />
             </intent-filter>
-            -->
-        </activity>
-        <activity
-            android:name="com.usai.redant.photo.LoginActivity"
-            android:label="@string/app_name"
-            android:screenOrientation="sensorLandscape"
-            android:windowSoftInputMode="stateHidden|adjustResize" >
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-
-                <category android:name="android.intent.category.LAUNCHER" />
-            </intent-filter>
-        </activity>
-        <activity
-            android:name="com.usai.redant.photo.UploadQueueActivity"
-            android:label="Upload queue"
-
-            android:theme="@style/CaptureTheme"
-            android:screenOrientation="landscape">
-            
-        </activity>
-        <activity
-            android:name="com.usai.redant.photo.PreferencesActivityvity"
-            android:label="@string/preferences_name"
-            android:stateNotNeeded="true" >
-        </activity>
-                <activity
-            android:name="com.usai.redant.photo.PhotoPreviewActivity"
-            android:label="@string/preferences_name"
-             >
-        </activity>
-        <activity
-            android:name="com.usai.redant.photo.LockerActivity"
-            android:label="@string/title_activity_locker"
-            android:screenOrientation="landscape"
-            android:windowSoftInputMode="adjustResize|stateVisible" >
-        </activity>
-
-        <receiver android:name="com.usai.redant.photo.BootReceiver" >
-            <intent-filter android:priority="2147483647" >
-                <action android:name="android.intent.action.BOOT_COMPLETED" />
-                <action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
-            </intent-filter>
-        </receiver>
-
-        <service
-            android:name="com.usai.redant.photo.UploadService"
-            android:label="usai upload service" >
-        </service>
-    </application>
-
+            -->
+        </activity>
+        <activity
+            android:name=".LoginActivity"
+            android:label="@string/app_name"
+            android:screenOrientation="sensorLandscape"
+            android:windowSoftInputMode="stateHidden|adjustResize" >
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter>
+        </activity>
+        <activity
+            android:name=".UploadQueueActivity"
+            android:label="Upload queue"
+            android:screenOrientation="sensorLandscape"
+            android:theme="@style/CaptureTheme" >
+        </activity>
+        <activity
+            android:name=".PreferencesActivityvity"
+            android:label="@string/preferences_name"
+            android:stateNotNeeded="true" >
+        </activity>
+        <activity
+            android:name=".PhotoPreviewActivity"
+            android:label="Photo preview"
+            android:screenOrientation="sensorLandscape"
+            android:windowSoftInputMode="stateHidden|adjustResize" >
+        </activity>
+        <activity
+            android:name=".LockerActivity"
+            android:label="@string/title_activity_locker"
+            android:screenOrientation="sensorLandscape"
+            android:windowSoftInputMode="adjustResize|stateVisible" >
+        </activity>
+
+        <receiver android:name=".BootReceiver" >
+            <intent-filter android:priority="2147483647" >
+                <action android:name="android.intent.action.BOOT_COMPLETED" />
+                <action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
+            </intent-filter>
+        </receiver>
+
+        <service
+            android:name=".UploadService"
+            android:label="usai upload service" >
+        </service>
+
+        <activity
+            android:name=".AboutActivity"
+            android:screenOrientation="sensorLandscape"
+            android:label="@string/title_activity_about" >
+        </activity>
+        <activity
+            android:name=".LicenseActivity"
+            android:screenOrientation="sensorLandscape"
+            android:label="@string/title_activity_license" >
+        </activity>
+    </application>
+
 </manifest>

+ 107 - 98
RedAnt Photo/bin/AndroidManifest.xml

@@ -1,109 +1,118 @@
-<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="com.usai.redant.photo"
-    android:versionCode="1"
-    android:versionName="1.0" >
-
-    <uses-sdk
-        android:minSdkVersion="14"
-        android:targetSdkVersion="18" />
-
-    <uses-permission android:name="android.permission.CAMERA" />
-    <uses-permission android:name="android.permission.VIBRATE" />
-    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
-    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
-    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
-    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
-    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
-    <uses-permission android:name="android.permission.INTERNET" />
-
-    <application
-        android:name="com.usai.redant.photo.RedAntApplication"
-        android:allowBackup="true"
-        android:icon="@drawable/ic_shipping"
-        android:label="@string/app_name"
-        android:theme="@style/AppTheme" >
-        <activity
-            android:name="com.usai.redant.photo.MainActivity"
-            android:configChanges="orientation|keyboardHidden"
-            android:label="@string/app_name"
-            
-            android:screenOrientation="landscape"
-            android:stateNotNeeded="true"
-            android:theme="@style/CaptureTheme" >
-
-            <!--
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="com.usai.redant.photo"
+    android:versionCode="1"
+    android:versionName="A140821" >
+
+    <uses-sdk
+        android:minSdkVersion="14"
+        android:targetSdkVersion="18" />
+
+    <uses-permission android:name="android.permission.CAMERA" />
+    <uses-permission android:name="android.permission.VIBRATE" />
+    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
+    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
+    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
+    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
+    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
+    <uses-permission android:name="android.permission.INTERNET" />
+
+    <application
+        android:name=".RedAntApplication"
+        android:allowBackup="true"
+        android:icon="@drawable/ic_shipping"
+        android:label="@string/app_name"
+        android:theme="@style/AppTheme" >
+        <activity
+            android:name=".MainActivity"
+            android:configChanges="orientation|keyboardHidden"
+            android:label="@string/app_name"
+            android:screenOrientation="sensorLandscape"
+            android:stateNotNeeded="true"
+            android:theme="@style/CaptureTheme" >
+
+            <!--
                  <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
 
                 <category android:name="android.intent.category.LAUNCHER" />
             </intent-filter>
-            -->
-        </activity>
-        <activity
-            android:name="com.usai.redant.photo.CaptureActivity"
-            android:clearTaskOnLaunch="true"
-            android:label="Scan"
-            android:stateNotNeeded="true"
-            android:screenOrientation="landscape"
-            android:theme="@style/CaptureTheme"
-            android:windowSoftInputMode="stateAlwaysHidden" >
-
-            <!--
+            -->
+        </activity>
+        <activity
+            android:name=".CaptureActivity"
+            android:clearTaskOnLaunch="true"
+            android:label="Scan"
+            android:screenOrientation="sensorLandscape"
+            android:stateNotNeeded="true"
+            android:theme="@style/CaptureTheme"
+            android:windowSoftInputMode="stateAlwaysHidden" >
+
+            <!--
                  <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
 
                 <category android:name="android.intent.category.LAUNCHER" />
             </intent-filter>
-            -->
-        </activity>
-        <activity
-            android:name="com.usai.redant.photo.LoginActivity"
-            android:label="@string/app_name"
-            android:screenOrientation="sensorLandscape"
-            android:windowSoftInputMode="stateHidden|adjustResize" >
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-
-                <category android:name="android.intent.category.LAUNCHER" />
-            </intent-filter>
-        </activity>
-        <activity
-            android:name="com.usai.redant.photo.UploadQueueActivity"
-            android:label="Upload queue"
-
-            android:theme="@style/CaptureTheme"
-            android:screenOrientation="landscape">
-            
-        </activity>
-        <activity
-            android:name="com.usai.redant.photo.PreferencesActivityvity"
-            android:label="@string/preferences_name"
-            android:stateNotNeeded="true" >
-        </activity>
-                <activity
-            android:name="com.usai.redant.photo.PhotoPreviewActivity"
-            android:label="@string/preferences_name"
-             >
-        </activity>
-        <activity
-            android:name="com.usai.redant.photo.LockerActivity"
-            android:label="@string/title_activity_locker"
-            android:screenOrientation="landscape"
-            android:windowSoftInputMode="adjustResize|stateVisible" >
-        </activity>
-
-        <receiver android:name="com.usai.redant.photo.BootReceiver" >
-            <intent-filter android:priority="2147483647" >
-                <action android:name="android.intent.action.BOOT_COMPLETED" />
-                <action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
-            </intent-filter>
-        </receiver>
-
-        <service
-            android:name="com.usai.redant.photo.UploadService"
-            android:label="usai upload service" >
-        </service>
-    </application>
-
+            -->
+        </activity>
+        <activity
+            android:name=".LoginActivity"
+            android:label="@string/app_name"
+            android:screenOrientation="sensorLandscape"
+            android:windowSoftInputMode="stateHidden|adjustResize" >
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter>
+        </activity>
+        <activity
+            android:name=".UploadQueueActivity"
+            android:label="Upload queue"
+            android:screenOrientation="sensorLandscape"
+            android:theme="@style/CaptureTheme" >
+        </activity>
+        <activity
+            android:name=".PreferencesActivityvity"
+            android:label="@string/preferences_name"
+            android:stateNotNeeded="true" >
+        </activity>
+        <activity
+            android:name=".PhotoPreviewActivity"
+            android:label="Photo preview"
+            android:screenOrientation="sensorLandscape"
+            android:windowSoftInputMode="stateHidden|adjustResize" >
+        </activity>
+        <activity
+            android:name=".LockerActivity"
+            android:label="@string/title_activity_locker"
+            android:screenOrientation="sensorLandscape"
+            android:windowSoftInputMode="adjustResize|stateVisible" >
+        </activity>
+
+        <receiver android:name=".BootReceiver" >
+            <intent-filter android:priority="2147483647" >
+                <action android:name="android.intent.action.BOOT_COMPLETED" />
+                <action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
+            </intent-filter>
+        </receiver>
+
+        <service
+            android:name=".UploadService"
+            android:label="usai upload service" >
+        </service>
+
+        <activity
+            android:name=".AboutActivity"
+            android:screenOrientation="sensorLandscape"
+            android:label="@string/title_activity_about" >
+        </activity>
+        <activity
+            android:name=".LicenseActivity"
+            android:screenOrientation="sensorLandscape"
+            android:label="@string/title_activity_license" >
+        </activity>
+    </application>
+
 </manifest>

BIN
RedAnt Photo/bin/RedAnt Photo.apk


BIN
RedAnt Photo/bin/classes.dex


BIN
RedAnt Photo/bin/resources.ap_


+ 62 - 0
RedAnt Photo/res/layout/activity_about.xml

@@ -0,0 +1,62 @@
+<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:id="@+id/scrollView1"
+    android:layout_width="fill_parent"
+    android:layout_height="wrap_content"
+    android:paddingBottom="@dimen/activity_vertical_margin"
+    android:paddingLeft="@dimen/activity_horizontal_margin"
+    android:paddingRight="@dimen/activity_horizontal_margin"
+    android:paddingTop="@dimen/activity_vertical_margin"
+    tools:context=".AboutActivity" >
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:orientation="vertical" >
+
+
+
+        <TextView
+            android:id="@+id/tv_version"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center_horizontal"
+            android:gravity="center_horizontal"
+            android:text="@string/str_version" 
+           	android:textSize="20sp"/>
+
+        <TextView
+            android:id="@+id/tv_content"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center_horizontal"
+
+            android:autoLink="email"
+            android:gravity="center_horizontal"
+            android:text="@string/str_tech_support"
+            android:textSize="20sp"/>
+
+
+        <TextView
+            android:id="@+id/tv_3rd"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+             android:gravity="center_horizontal"
+            android:text="Third part library"
+            android:layout_marginTop="40dp"
+            android:layout_gravity="center_horizontal"
+            
+            android:textAppearance="?android:attr/textAppearanceLarge" />
+        <TextView
+            android:id="@+id/zxing"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+             android:gravity="center_horizontal"
+            android:text="ZXing"
+            android:layout_gravity="center_horizontal"
+            
+            android:textAppearance="?android:attr/textAppearanceMedium" />
+
+    </LinearLayout>
+
+</ScrollView>

+ 17 - 0
RedAnt Photo/res/layout/activity_license.xml

@@ -0,0 +1,17 @@
+<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:id="@+id/scrollView1"
+    android:layout_width="fill_parent"
+    android:layout_height="wrap_content"
+    android:paddingBottom="@dimen/activity_vertical_margin"
+    android:paddingLeft="@dimen/activity_horizontal_margin"
+    android:paddingRight="@dimen/activity_horizontal_margin"
+    android:paddingTop="@dimen/activity_vertical_margin"
+    tools:context=".AboutActivity" >
+
+    <WebView
+        android:id="@+id/webView1"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content" />
+
+</ScrollView>

+ 1 - 1
RedAnt Photo/res/layout/activity_locker.xml

@@ -71,7 +71,7 @@
                 android:layout_marginTop="16dp"
                 android:paddingLeft="32dp"
                 android:paddingRight="32dp"
-                android:text="@string/action_sign_in_register" />
+                android:text="@string/action_sign_in_short" />
         </LinearLayout>
     </ScrollView>
 

+ 27 - 12
RedAnt Photo/res/layout/activity_login.xml

@@ -45,10 +45,10 @@
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 android:hint="@string/prompt_Name"
+                android:imeOptions="flagNoExtractUi"
                 android:inputType="textAutoComplete"
                 android:maxLines="1"
                 android:singleLine="true"
-                android:imeOptions="flagNoExtractUi"
                 android:text="" />
 
             <EditText
@@ -58,23 +58,38 @@
                 android:hint="@string/prompt_password"
                 android:imeActionId="@+id/login"
                 android:imeActionLabel="@string/action_sign_in_short"
-
+                android:imeOptions="flagNoExtractUi"
                 android:inputType="textPassword"
                 android:maxLines="1"
-                android:imeOptions="flagNoExtractUi"
                 android:singleLine="true"
                 android:text="" />
 
-            <Button
-                android:id="@+id/sign_in_button"
-                android:layout_width="wrap_content"
+            <RelativeLayout
+                android:layout_width="match_parent"
                 android:layout_height="wrap_content"
-                android:layout_gravity="right"
-                android:layout_marginTop="16dp"
-                android:paddingLeft="32dp"
-                android:paddingRight="32dp"
-                android:text="@string/action_sign_in_register" />
+                android:layout_marginTop="16dp" >
+
+                <CheckBox
+                    android:id="@+id/cb_save"
+                    android:layout_width="wrap_content"
+                    android:layout_height="match_parent"
+                    android:layout_alignParentLeft="true"
+                    android:layout_centerVertical="true"
+                    
+                    android:text="@string/str_savepass" />
+
+                <Button
+                    android:id="@+id/sign_in_button"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_alignParentRight="true"
+                    android:layout_alignParentTop="true"
+                    android:gravity="right|center_vertical"
+                    android:paddingLeft="32dp"
+                    android:paddingRight="32dp"
+                    android:text="@string/action_sign_in_short" />
+            </RelativeLayout>
         </LinearLayout>
     </ScrollView>
 
-</merge>
+</merge>

+ 11 - 0
RedAnt Photo/res/menu/about.xml

@@ -0,0 +1,11 @@
+<menu xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    tools:context="com.usai.redant.photo.AboutActivity" >
+
+    <item
+        android:id="@+id/action_settings"
+        android:orderInCategory="100"
+        android:showAsAction="never"
+        android:title="@string/action_settings"/>
+
+</menu>

+ 11 - 0
RedAnt Photo/res/menu/license.xml

@@ -0,0 +1,11 @@
+<menu xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    tools:context="com.usai.redant.photo.LicenseActivity" >
+
+    <item
+        android:id="@+id/action_settings"
+        android:orderInCategory="100"
+        android:showAsAction="never"
+        android:title="@string/action_settings"/>
+
+</menu>

+ 2 - 2
RedAnt Photo/res/menu/login.xml

@@ -1,8 +1,8 @@
 <menu xmlns:android="http://schemas.android.com/apk/res/android" >
 
     <item
-        android:id="@+id/action_forgot_password"
+        android:id="@+id/action_about"
         android:showAsAction="never"
-        android:title="@string/action_forgot_password"/>
+        android:title="@string/action_about"/>
 
 </menu>

+ 9 - 0
RedAnt Photo/res/menu/preview.xml

@@ -0,0 +1,9 @@
+<menu xmlns:android="http://schemas.android.com/apk/res/android" >
+
+    <item
+        android:id="@+id/action_delete"
+       
+        android:showAsAction="never"
+        android:title="@string/action_delete"/> 
+    
+</menu>

+ 201 - 0
RedAnt Photo/res/raw/license.txt

@@ -0,0 +1,201 @@
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.

+ 10 - 0
RedAnt Photo/res/values-w820dp/dimens.xml

@@ -0,0 +1,10 @@
+<resources>
+
+    <!--
+         Example customization of dimensions originally defined in res/values/dimens.xml
+         (such as screen margins) for screens with more than 820dp of available width. This
+         would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively).
+    -->
+    <dimen name="activity_horizontal_margin">64dp</dimen>
+
+</resources>

+ 77 - 68
RedAnt Photo/res/values/strings.xml

@@ -1,69 +1,78 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
-   <string name="title_activity_login">Sign in</string>
-   <string name="title_activity_locker">Unlock App</string>
-
-    <!-- Strings related to login -->
-    <string name="prompt_email">Email</string>
-    <string name="prompt_Name">Name</string>
-    <string name="prompt_password">Password</string>
-    <string name="action_sign_in_register"><b>Sign in</b> or register</string>
-    <string name="action_sign_in_short">Sign in</string>
-    <string name="action_forgot_password">Recover lost password</string>
-    <string name="login_progress_signing_in">Signing in&#8230;</string>
-    <string name="error_invalid_email">This email address is invalid</string>
-    <string name="error_invalid_password">This password is too short</string>
-    <string name="error_incorrect_password">Not authorized or wrong password</string>
-    <string name="error_field_required">This field is required</string>
-    <string name="action_settings">Settings</string>
-    <string name="action_clear">Clear</string>
-    <string name="action_type_pid">Type PID</string>
-    <string name="action_view_queue">View upload queue</string>
-    <string name="preferences_name">Settings</string>
-    <string name="app_name">RedAnt Photo</string>
-    <string name="button_ok">OK</string>
-    <string name="title_activity_scan">ScanActivity</string>
-    <string name="menu_help">Help</string>
-    <string name="menu_settings">Settings</string>
-    <string name="msg_camera_framework_bug">Sorry, the Android camera encountered a problem. You may need to restart the device.</string>
-    <string name="msg_default_status">Place a barcode inside the viewfinder rectangle to scan it.</string>
-    <string name="msg_user_wrong">Wrong user name or password.</string>
-    <string name="msg_net_error">Can not connect to server</string>
-    <string name="msg_connection_none">No available connection </string>
-    <string name="preferences_actions_title">When a barcode is found\u2026</string>
-    <string name="preferences_auto_focus_title">Use auto focus</string>
-    <string name="preferences_bulk_mode_summary">Scan and save many barcodes continuously</string>
-    <string name="preferences_bulk_mode_title">Bulk scan mode</string>
-    <string name="preferences_copy_to_clipboard_title">Copy to clipboard</string>
-    <string name="preferences_custom_product_search_summary" formatted="false">Substitutions: %s = contents, %f = format, %t = type</string>
-    <string name="preferences_custom_product_search_title">Custom search URL</string>
-    <string name="preferences_decode_1D_title">1D barcodes</string>
-    <string name="preferences_decode_Data_Matrix_title">Data Matrix</string>
-    <string name="preferences_decode_QR_title">QR Codes</string>
-    <string name="preferences_device_bug_workarounds_title">Device Bug Workarounds</string>
-    <string name="preferences_disable_continuous_focus_summary">Use only standard focus mode</string>
-    <string name="preferences_disable_continuous_focus_title">No continuous focus</string>
-    <string name="preferences_front_light_summary">Improves scanning in low light on some phones, but may cause glare. Does not work on all phones.</string>
-    <string name="preferences_front_light_title">Use front light</string>
-    <string name="preferences_front_light_auto">Automatic</string>
-    <string name="preferences_front_light_off">Off</string>
-    <string name="preferences_front_light_on">On</string>
-    <string name="preferences_general_title">General settings</string>
-    <string name="preferences_invert_scan_title">Invert scan</string>
-    <string name="preferences_invert_scan_summary">Scan for white barcodes on black background. Not available on some devices.</string>
-    <string name="preferences_play_beep_title">Beep</string>
-    <string name="preferences_remember_duplicates_summary">Store multiple scans of the same barcode in History</string>
-    <string name="preferences_remember_duplicates_title">Remember duplicates</string>
-    <string name="preferences_result_title">Result settings</string>
-    <string name="preferences_scanning_title">When scanning for barcodes, decode\u2026</string>
-    <string name="preferences_search_country">Search country</string>
-    <string name="preferences_try_bsplus">Try Barcode Scanner+</string>
-    <string name="preferences_try_bsplus_summary">Enhanced with new features and interface</string>
-    <string name="preferences_supplemental_summary">Try to retrieve more information about the barcode contents</string>
-    <string name="preferences_supplemental_title">Retrieve more info</string>
-    <string name="preferences_vibrate_title">Vibrate</string>
-    <string name="title_activity_main_activity1">MainActivity1</string>
-    <string name="title_input_pid">Input PID</string>
-    <string name="hello_world">Hello world!</string>
-
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+
+    <string name="title_activity_login">Sign in</string>
+    <string name="title_activity_locker">Unlock Redant Photo</string>
+
+    <!-- Strings related to login -->
+    <string name="prompt_email">Email</string>
+    <string name="prompt_Name">Name</string>
+    <string name="prompt_password">Password</string>
+    <string name="action_sign_in_register"><b>Sign in</b> or register</string>
+    <string name="action_sign_in_short">Sign in</string>
+    <string name="str_savepass">Save Password</string>
+    <string name="action_about">About</string>
+    <string name="action_forgot_password">Recover lost password</string>
+    <string name="login_progress_signing_in">Signing in&#8230;</string>
+    <string name="error_invalid_email">This email address is invalid</string>
+    <string name="error_invalid_password">This password is too short</string>
+    <string name="error_incorrect_password">Not authorized or wrong password</string>
+    <string name="error_field_required">This field is required</string>
+    <string name="action_settings">Settings</string>
+    <string name="action_clear">Clear</string>
+    <string name="action_delete">Delete photo</string>
+    <string name="action_type_pid">Type PID</string>
+    <string name="action_view_queue">View upload queue</string>
+    <string name="preferences_name">Settings</string>
+    <string name="app_name">RedAnt Photo</string>
+    <string name="button_ok">OK</string>
+    <string name="title_activity_scan">ScanActivity</string>
+    <string name="menu_help">Help</string>
+    <string name="menu_settings">Settings</string>
+    <string name="msg_camera_framework_bug">Sorry, the Android camera encountered a problem. You may need to restart the device.</string>
+    <string name="msg_default_status">Place a barcode inside the viewfinder rectangle to scan it.</string>
+    <string name="msg_user_wrong">Wrong user name or password.</string>
+    <string name="msg_net_error">Can not connect to server</string>
+    <string name="msg_connection_none">No available connection </string>
+    <string name="preferences_actions_title">When a barcode is found\u2026</string>
+    <string name="preferences_auto_focus_title">Use auto focus</string>
+    <string name="preferences_bulk_mode_summary">Scan and save many barcodes continuously</string>
+    <string name="preferences_bulk_mode_title">Bulk scan mode</string>
+    <string name="preferences_copy_to_clipboard_title">Copy to clipboard</string>
+    <string name="preferences_custom_product_search_summary" formatted="false">Substitutions: %s = contents, %f = format, %t = type</string>
+    <string name="preferences_custom_product_search_title">Custom search URL</string>
+    <string name="preferences_decode_1D_title">1D barcodes</string>
+    <string name="preferences_decode_Data_Matrix_title">Data Matrix</string>
+    <string name="preferences_decode_QR_title">QR Codes</string>
+    <string name="preferences_device_bug_workarounds_title">Device Bug Workarounds</string>
+    <string name="preferences_disable_continuous_focus_summary">Use only standard focus mode</string>
+    <string name="preferences_disable_continuous_focus_title">No continuous focus</string>
+    <string name="preferences_front_light_summary">Improves scanning in low light on some phones, but may cause glare. Does not work on all phones.</string>
+    <string name="preferences_front_light_title">Use front light</string>
+    <string name="preferences_front_light_auto">Automatic</string>
+    <string name="preferences_front_light_off">Off</string>
+    <string name="preferences_front_light_on">On</string>
+    <string name="preferences_general_title">General settings</string>
+    <string name="preferences_invert_scan_title">Invert scan</string>
+    <string name="preferences_invert_scan_summary">Scan for white barcodes on black background. Not available on some devices.</string>
+    <string name="preferences_play_beep_title">Beep</string>
+    <string name="preferences_remember_duplicates_summary">Store multiple scans of the same barcode in History</string>
+    <string name="preferences_remember_duplicates_title">Remember duplicates</string>
+    <string name="preferences_result_title">Result settings</string>
+    <string name="preferences_scanning_title">When scanning for barcodes, decode\u2026</string>
+    <string name="preferences_search_country">Search country</string>
+    <string name="preferences_try_bsplus">Try Barcode Scanner+</string>
+    <string name="preferences_try_bsplus_summary">Enhanced with new features and interface</string>
+    <string name="preferences_supplemental_summary">Try to retrieve more information about the barcode contents</string>
+    <string name="preferences_supplemental_title">Retrieve more info</string>
+    <string name="preferences_vibrate_title">Vibrate</string>
+    <string name="title_activity_main_activity1">MainActivity1</string>
+    <string name="title_input_pid">Input PID</string>
+    <string name="hello_world">Hello world!</string>
+    <string name="str_tech_support">Tech support:\nusairedant@united-us.net</string>
+    <string name="str_version">version:</string>
+    <string name="str_ver">ver:</string>
+    <string name="title_activity_about">About</string>
+    <string name="title_activity_license">License</string>
+
 </resources>

+ 76 - 0
RedAnt Photo/src/com/usai/redant/photo/AboutActivity.java

@@ -0,0 +1,76 @@
+package com.usai.redant.photo;
+
+
+import android.app.Activity;
+import android.content.Intent;
+import android.content.pm.PackageManager.NameNotFoundException;
+import android.os.Bundle;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.TextView;
+
+public class AboutActivity extends Activity
+{
+
+	@Override
+	protected void onCreate(Bundle savedInstanceState)
+	{
+		super.onCreate(savedInstanceState);
+		setContentView(R.layout.activity_about);
+		 TextView tv_ver = (TextView) findViewById(R.id.tv_version);
+
+		 TextView zxing = (TextView) findViewById(R.id.zxing);
+		 zxing.setOnClickListener(new OnClickListener()
+		{
+			
+			@Override
+			public void onClick(View v)
+			{
+				
+				Intent intent = new Intent();
+				intent.setClass(AboutActivity.this, LicenseActivity.class);
+				startActivity(intent);
+				
+				
+			}
+		});
+		
+		try
+		{
+			
+			tv_ver.setText(getText(R.string.str_ver)
+					+ RedAntApplication.getInstance()
+							.getPackageManager()
+							.getPackageInfo("com.usai.redant.photo", 0).versionName);
+		}
+		catch (NameNotFoundException e1)
+		{
+			// TODO Auto-generated catch block
+			e1.printStackTrace();
+		}
+	}
+
+//	@Override
+//	public boolean onCreateOptionsMenu(Menu menu)
+//	{
+//		// Inflate the menu; this adds items to the action bar if it is present.
+//		getMenuInflater().inflate(R.menu.about, menu);
+//		return true;
+//	}
+//
+//	@Override
+//	public boolean onOptionsItemSelected(MenuItem item)
+//	{
+//		// Handle action bar item clicks here. The action bar will
+//		// automatically handle clicks on the Home/Up button, so long
+//		// as you specify a parent activity in AndroidManifest.xml.
+//		int id = item.getItemId();
+//		if (id == R.id.action_settings)
+//		{
+//			return true;
+//		}
+//		return super.onOptionsItemSelected(item);
+//	}
+}

+ 1 - 4
RedAnt Photo/src/com/usai/redant/photo/BootReceiver.java

@@ -29,10 +29,7 @@ public class BootReceiver extends BroadcastReceiver {
 			
 			
 			// Log.e("hg","�յ��㲥");
-		} else if (intent.getAction().equals(
-				ConnectivityManager.CONNECTIVITY_ACTION)) {
-
-		}
+		} 
 	}
 
 }

+ 36 - 36
RedAnt Photo/src/com/usai/redant/photo/CaptureActivity.java

@@ -380,42 +380,42 @@ public final class CaptureActivity extends Activity implements
 		return super.onKeyDown(keyCode, event);
 	}
 
-	@Override
-	public boolean onCreateOptionsMenu(Menu menu)
-	{
-		MenuInflater menuInflater = getMenuInflater();
-		menuInflater.inflate(R.menu.capture, menu);
-		return super.onCreateOptionsMenu(menu);
-	}
-
-	@Override
-	public boolean onOptionsItemSelected(MenuItem item)
-	{
-		Intent intent = new Intent(Intent.ACTION_VIEW);
-		intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
-		switch (item.getItemId())
-		{
-		// case R.id.menu_share:
-		// intent.setClassName(this, ShareActivity.class.getName());
-		// startActivity(intent);
-		// break;
-		// case R.id.menu_history:
-		// intent.setClassName(this, HistoryActivity.class.getName());
-		// startActivityForResult(intent, HISTORY_REQUEST_CODE);
-		// break;
-			case R.id.menu_settings:
-				intent.setClassName(this, PreferencesActivity.class.getName());
-				startActivity(intent);
-				break;
-			// case R.id.menu_help:
-			// intent.setClassName(this, HelpActivity.class.getName());
-			// startActivity(intent);
-			// break;
-			default:
-				return super.onOptionsItemSelected(item);
-		}
-		return true;
-	}
+//	@Override
+//	public boolean onCreateOptionsMenu(Menu menu)
+//	{
+//		MenuInflater menuInflater = getMenuInflater();
+//		menuInflater.inflate(R.menu.capture, menu);
+//		return super.onCreateOptionsMenu(menu);
+//	}
+//
+//	@Override
+//	public boolean onOptionsItemSelected(MenuItem item)
+//	{
+//		Intent intent = new Intent(Intent.ACTION_VIEW);
+//		intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
+//		switch (item.getItemId())
+//		{
+//		// case R.id.menu_share:
+//		// intent.setClassName(this, ShareActivity.class.getName());
+//		// startActivity(intent);
+//		// break;
+//		// case R.id.menu_history:
+//		// intent.setClassName(this, HistoryActivity.class.getName());
+//		// startActivityForResult(intent, HISTORY_REQUEST_CODE);
+//		// break;
+//			case R.id.menu_settings:
+//				intent.setClassName(this, PreferencesActivity.class.getName());
+//				startActivity(intent);
+//				break;
+//			// case R.id.menu_help:
+//			// intent.setClassName(this, HelpActivity.class.getName());
+//			// startActivity(intent);
+//			// break;
+//			default:
+//				return super.onOptionsItemSelected(item);
+//		}
+//		return true;
+//	}
 
 	// @Override
 	// public void onActivityResult(int requestCode, int resultCode, Intent

+ 65 - 0
RedAnt Photo/src/com/usai/redant/photo/LicenseActivity.java

@@ -0,0 +1,65 @@
+package com.usai.redant.photo;
+
+import java.io.InputStream;
+
+import org.apache.http.util.EncodingUtils;
+
+
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.webkit.WebView;
+
+public class LicenseActivity extends Activity
+{
+
+	@Override
+	protected void onCreate(Bundle savedInstanceState)
+	{
+		super.onCreate(savedInstanceState);
+		setContentView(R.layout.activity_license);
+		WebView wv = (WebView) findViewById(R.id.webView1);
+		String content = "";
+		try
+		{
+			InputStream in = getResources().openRawResource(R.raw.license);
+			// 获取文件的字节数
+			int lenght = in.available();
+			// 创建byte数组
+			byte[] buffer = new byte[lenght];
+			// 将文件中的数据读到byte数组中
+			in.read(buffer);
+			content = EncodingUtils.getString(buffer, "UTF-8");
+		}
+		catch (Exception e)
+		{
+			e.printStackTrace();
+		}
+		wv.getSettings().setDefaultTextEncodingName("UTF-8");
+		wv.loadData(content, "text/html", null);		
+	}
+
+//	@Override
+//	public boolean onCreateOptionsMenu(Menu menu)
+//	{
+//		// Inflate the menu; this adds items to the action bar if it is present.
+//		getMenuInflater().inflate(R.menu.license, menu);
+//		return true;
+//	}
+//
+//	@Override
+//	public boolean onOptionsItemSelected(MenuItem item)
+//	{
+//		// Handle action bar item clicks here. The action bar will
+//		// automatically handle clicks on the Home/Up button, so long
+//		// as you specify a parent activity in AndroidManifest.xml.
+//		int id = item.getItemId();
+//		if (id == R.id.action_settings)
+//		{
+//			return true;
+//		}
+//		return super.onOptionsItemSelected(item);
+//	}
+}

+ 28 - 14
RedAnt Photo/src/com/usai/redant/photo/LockerActivity.java

@@ -136,14 +136,27 @@ public class LockerActivity extends Activity
 				dbUtil.get_userlist());
 		m_etName.setAdapter(adapter);
 	}
-
 	@Override
-	public boolean onCreateOptionsMenu(Menu menu)
+	public boolean onKeyDown(int keyCode, KeyEvent event)
 	{
-		super.onCreateOptionsMenu(menu);
-		getMenuInflater().inflate(R.menu.login, menu);
-		return true;
+		if (keyCode == KeyEvent.KEYCODE_BACK)
+		{
+			// Intent myIntent = new Intent();
+			// myIntent = new Intent(EditActivity.this, tabActivity.class);
+			// startActivity(myIntent);
+			// this.finish();
+			return true;
+		}
+		return super.onKeyDown(keyCode, event);
+
 	}
+//	@Override
+//	public boolean onCreateOptionsMenu(Menu menu)
+//	{
+//		super.onCreateOptionsMenu(menu);
+//		getMenuInflater().inflate(R.menu.login, menu);
+//		return true;
+//	}
 
 	/**
 	 * Attempts to sign in or register the account specified by the login form.
@@ -336,6 +349,7 @@ public class LockerActivity extends Activity
 			{
 				switch (verifyuser)
 				{
+					case Network.RESULT_NET_ERROR:
 					case Network.RESULT_NET_NOTAVAILABLE:
 					{
 						SQLiteDatabase db = dbUtil.OpenDB(LockerActivity.this,
@@ -409,15 +423,15 @@ public class LockerActivity extends Activity
 
 						break;
 					}
-					case Network.RESULT_NET_ERROR:
-					{
-						Toast toast = Toast.makeText(getApplicationContext(),
-								getText(R.string.msg_net_error),
-								Toast.LENGTH_LONG);
-						toast.setGravity(Gravity.CENTER, 0, 0);
-						toast.show();
-						return;
-					}
+//					case Network.RESULT_NET_ERROR:
+//					{
+//						Toast toast = Toast.makeText(getApplicationContext(),
+//								getText(R.string.msg_net_error),
+//								Toast.LENGTH_LONG);
+//						toast.setGravity(Gravity.CENTER, 0, 0);
+//						toast.show();
+//						return;
+//					}
 					case Network.RESULT_FALSE:
 					{
 						Toast toast = Toast.makeText(getApplicationContext(),

+ 116 - 60
RedAnt Photo/src/com/usai/redant/photo/LoginActivity.java

@@ -1,9 +1,5 @@
 package com.usai.redant.photo;
 
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-
 import com.usai.util.Crypto;
 import com.usai.util.Network;
 import com.usai.util.dbUtil;
@@ -12,33 +8,29 @@ import com.usai.util.dbUtil;
 //import com.example.com.apex.usa.test1.R.menu;
 //import com.example.com.apex.usa.test1.R.string;
 
-import android.R.bool;
 import android.animation.Animator;
 import android.animation.AnimatorListenerAdapter;
 import android.annotation.TargetApi;
 import android.app.Activity;
-import android.content.ContentValues;
 import android.content.Intent;
 import android.content.SharedPreferences;
 import android.database.Cursor;
 import android.database.sqlite.SQLiteDatabase;
-import android.nfc.Tag;
 import android.os.AsyncTask;
 import android.os.Build;
 import android.os.Bundle;
-import android.os.Looper;
-import android.telephony.PhoneNumberUtils;
-import android.text.InputType;
 import android.text.TextUtils;
 import android.util.Log;
 import android.view.Gravity;
 import android.view.KeyEvent;
 import android.view.Menu;
+import android.view.MenuItem;
 import android.view.View;
 import android.view.inputmethod.EditorInfo;
 import android.view.inputmethod.InputMethodManager;
 import android.widget.ArrayAdapter;
 import android.widget.AutoCompleteTextView;
+import android.widget.CheckBox;
 import android.widget.EditText;
 import android.widget.TextView;
 import android.widget.Toast;
@@ -71,28 +63,29 @@ public class LoginActivity extends Activity
 	/**
 	 * Keep track of the login task to ensure we can cancel it if requested.
 	 */
-	private UserLoginTask	mAuthTask	= null;
-	ArrayAdapter<String>		adapter							= null;
+	private UserLoginTask			mAuthTask	= null;
+	ArrayAdapter<String>			adapter		= null;
 	// SQLiteDatabase m_db;
 	// Values for email and password at the time of the login attempt.
-	private String			m_sName;
-	private String			m_sPassword;
+	private String					m_sName;
+	private String					m_sPassword;
 
 	// UI references.
-	private AutoCompleteTextView		m_etName;
-	private EditText		m_etPassword;
-	private View			mLoginFormView;
-	private View			mLoginStatusView;
-	private TextView		mLoginStatusMessageView;
-
-//	@Override
-//	protected void onDestroy()
-//	{
-//		// TODO Auto-generated method stub
-////		dbUtil.CloseDB(m_db);
-////		super.onDestroy();
-//
-//	}
+	private AutoCompleteTextView	m_etName;
+	private EditText				m_etPassword;
+	private View					mLoginFormView;
+	private View					mLoginStatusView;
+	private TextView				mLoginStatusMessageView;
+	private CheckBox				m_cbSave;
+
+	// @Override
+	// protected void onDestroy()
+	// {
+	// // TODO Auto-generated method stub
+	// // dbUtil.CloseDB(m_db);
+	// // super.onDestroy();
+	//
+	// }
 
 	@Override
 	protected void onCreate(Bundle savedInstanceState)
@@ -108,6 +101,28 @@ public class LoginActivity extends Activity
 		// m_etName.setText(m_sName);
 
 		m_etPassword = (EditText) findViewById(R.id.password);
+
+		m_cbSave = (CheckBox) findViewById(R.id.cb_save);
+		SharedPreferences pref = RedAntApplication.getInstance()
+				.getSharedPreferences("POP", 0);
+		String u = pref.getString("user", null);
+		String p = pref.getString("password", null);
+		if (u != null && p != null)
+		{
+			try
+			{
+				m_etName.setText(Crypto.decrypt("apexu", u));
+				m_etPassword.setText(Crypto.decrypt("apexp", p));
+				m_cbSave.setChecked(true);
+			}
+			catch (Exception e)
+			{
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}
+
+		}
+
 		m_etPassword
 				.setOnEditorActionListener(new TextView.OnEditorActionListener()
 				{
@@ -146,8 +161,7 @@ public class LoginActivity extends Activity
 					}
 				});
 		adapter = new ArrayAdapter<String>(this,
-				android.R.layout.simple_list_item_1,
-				dbUtil.get_userlist());
+				android.R.layout.simple_list_item_1, dbUtil.get_userlist());
 		m_etName.setAdapter(adapter);
 	}
 
@@ -159,6 +173,26 @@ public class LoginActivity extends Activity
 		return true;
 	}
 
+	@Override
+	public boolean onOptionsItemSelected(MenuItem item)
+	{
+		// TODO Auto-generated method stub
+		switch (item.getItemId())
+		{
+			case R.id.action_about:
+			{
+				Intent intent = new Intent();
+				intent.setClass(LoginActivity.this, AboutActivity.class);
+				startActivity(intent);
+
+			}
+				break;
+			default:
+				break;
+		}
+		return super.onOptionsItemSelected(item);
+	}
+
 	/**
 	 * Attempts to sign in or register the account specified by the login form.
 	 * If there are form errors (invalid email, missing fields, etc.), the
@@ -306,12 +340,12 @@ public class LoginActivity extends Activity
 
 			if (success)
 			{
-				String encryptUser="";
-				String encryptPass="";
+				String encryptUser = "";
+				String encryptPass = "";
 				try
 				{
-					encryptUser=Crypto.encrypt("apexu", m_sName);
-					encryptPass=Crypto.encrypt("apexp", m_sPassword);
+					encryptUser = Crypto.encrypt("apexu", m_sName);
+					encryptPass = Crypto.encrypt("apexp", m_sPassword);
 				}
 				catch (Exception e1)
 				{
@@ -321,9 +355,9 @@ public class LoginActivity extends Activity
 
 				SQLiteDatabase db = dbUtil.OpenDB(LoginActivity.this, null,
 						true);
-				Cursor cursor = db
-						.query("users", new String[] { "_id" }, "name='"
-								+ encryptUser + "'", null, null, null, "_id", null);
+				Cursor cursor = db.query("users", new String[] { "_id" },
+						"name='" + encryptUser + "'", null, null, null, "_id",
+						null);
 				if (cursor.moveToNext())
 				{
 					int _id = cursor.getInt(0);
@@ -340,6 +374,25 @@ public class LoginActivity extends Activity
 				dbUtil.CloseCursor(cursor);
 				dbUtil.CloseDB(db);
 
+				SharedPreferences pref = RedAntApplication.getInstance()
+						.getSharedPreferences("POP", 0);
+				SharedPreferences.Editor editor = pref.edit();
+
+				if (m_cbSave.isChecked()&&!TextUtils.isEmpty(encryptPass)&&!TextUtils.isEmpty(encryptUser))
+				{
+					editor.putString("user", encryptUser);
+					editor.putString("password", encryptPass);
+					editor.putBoolean("kepppass", true);
+				}
+				else
+				{
+					editor.putString("user", null);
+					editor.putString("password", null);
+					editor.putBoolean("kepppass", false);
+				}
+
+				editor.commit();
+
 				RedAntApplication.user = m_sName;
 				RedAntApplication.password = m_sPassword;
 				Intent intent = new Intent();
@@ -352,15 +405,16 @@ public class LoginActivity extends Activity
 			{
 				switch (verifyuser)
 				{
+					case Network.RESULT_NET_ERROR:
 					case Network.RESULT_NET_NOTAVAILABLE:
 					{
 						SQLiteDatabase db = dbUtil.OpenDB(LoginActivity.this,
 								null, true);
 
-						String encryptUser="";
+						String encryptUser = "";
 						try
 						{
-							encryptUser=Crypto.encrypt("apexu", m_sName);
+							encryptUser = Crypto.encrypt("apexu", m_sName);
 						}
 						catch (Exception e1)
 						{
@@ -372,10 +426,11 @@ public class LoginActivity extends Activity
 								null, null, null, "_id desc", null);
 						if (cursor.moveToNext())
 						{
-							String pass="";
+							String pass = "";
 							try
 							{
-								pass = Crypto.decrypt("apexp", cursor.getString(0));
+								pass = Crypto.decrypt("apexp",
+										cursor.getString(0));
 							}
 							catch (Exception e)
 							{
@@ -398,28 +453,30 @@ public class LoginActivity extends Activity
 							else
 							{
 								// wrong password
-								Toast toast = Toast.makeText(getApplicationContext(),
+								Toast toast = Toast.makeText(
+										getApplicationContext(),
 										getText(R.string.msg_user_wrong),
 										Toast.LENGTH_LONG);
 								toast.setGravity(Gravity.CENTER, 0, 0);
 								toast.show();
 								m_etPassword
-								.setError(getString(R.string.error_incorrect_password));
-						m_etPassword.requestFocus();
+										.setError(getString(R.string.error_incorrect_password));
+								m_etPassword.requestFocus();
 								dbUtil.CloseCursor(cursor);
 								dbUtil.CloseDB(db);
 							}
 						}
 						else
-						{//user not exist
-							Toast toast = Toast.makeText(getApplicationContext(),
+						{// user not exist
+							Toast toast = Toast.makeText(
+									getApplicationContext(),
 									getText(R.string.msg_net_error),
 									Toast.LENGTH_LONG);
 							toast.setGravity(Gravity.CENTER, 0, 0);
 							toast.show();
 							m_etPassword
-							.setError(getString(R.string.error_incorrect_password));
-					m_etPassword.requestFocus();
+									.setError(getString(R.string.error_incorrect_password));
+							m_etPassword.requestFocus();
 							dbUtil.CloseCursor(cursor);
 							dbUtil.CloseDB(db);
 
@@ -427,15 +484,15 @@ public class LoginActivity extends Activity
 
 						break;
 					}
-					case Network.RESULT_NET_ERROR:
-					{
-						Toast toast = Toast.makeText(getApplicationContext(),
-								getText(R.string.msg_net_error),
-								Toast.LENGTH_LONG);
-						toast.setGravity(Gravity.CENTER, 0, 0);
-						toast.show();
-						return;
-					}
+					// case Network.RESULT_NET_ERROR:
+					// {
+					// Toast toast = Toast.makeText(getApplicationContext(),
+					// getText(R.string.msg_net_error),
+					// Toast.LENGTH_LONG);
+					// toast.setGravity(Gravity.CENTER, 0, 0);
+					// toast.show();
+					// return;
+					// }
 					case Network.RESULT_FALSE:
 					{
 						Toast toast = Toast.makeText(getApplicationContext(),
@@ -444,8 +501,8 @@ public class LoginActivity extends Activity
 						toast.setGravity(Gravity.CENTER, 0, 0);
 						toast.show();
 						m_etPassword
-						.setError(getString(R.string.error_incorrect_password));
-				m_etPassword.requestFocus();
+								.setError(getString(R.string.error_incorrect_password));
+						m_etPassword.requestFocus();
 						return;
 					}
 
@@ -453,7 +510,6 @@ public class LoginActivity extends Activity
 						break;
 				}
 
-
 			}
 		}
 

+ 179 - 483
RedAnt Photo/src/com/usai/redant/photo/MainActivity.java

@@ -27,10 +27,12 @@ import android.content.Context;
 import android.content.DialogInterface;
 import android.content.Intent;
 import android.content.IntentFilter;
+import android.content.SharedPreferences;
 import android.database.sqlite.SQLiteDatabase;
 import android.text.Editable;
 import android.text.TextWatcher;
 import android.util.Log;
+import android.view.KeyEvent;
 import android.view.Menu;
 import android.view.MenuItem;
 import android.view.View;
@@ -44,108 +46,30 @@ public class MainActivity extends Activity
 	// static final int ACTIVITY_CAMERA = 0;
 	// static final int ACTIVITY_VIEW = 1;
 	// static final String serverurl = "http://192.168.23.1/xampp/";
-	static final String				TAG						= "MainActivity";
-	static final int				REQUEST_TAKE_PHOTO		= 1;
-	static final int				REQUEST_SCAN_BARCODE	= 2;
-	static final int				REQUEST_LOCKER			= 3;
+	static final String	TAG						= "MainActivity";
+	static final int	REQUEST_TAKE_PHOTO		= 1;
+	static final int	REQUEST_PREVIEW			= 4;
+	static final int	REQUEST_SCAN_BARCODE	= 2;
+	static final int	REQUEST_LOCKER			= 3;
 	// HashMap<String, String> hashMap = new HashMap<String, String>();
 
 	// ArrayList<String> pic_file = new ArrayList<String>();
 	// ArrayList<bitmap>
 	// ArrayList<>
 	// private String thumbpath = null;
-	private int						iwidth					= 640;
-	private int						iheight					= 480;
-	private File					photoFile				= null;
-	Bitmap							thumbBitmap				= null;
+	private int			iwidth					= 640;
+	private int			iheight					= 480;
+	private File		photoFile				= null;
+	Bitmap				thumbBitmap				= null;
 	// private int iPhotoCount = 0;
-	public String					LastFileName			= "";
-	private boolean					m_blocked				= false;
-	TextView						m_tvalert;
+	public String		LastFileName			= "";
+	private boolean		m_blocked				= false;
+	TextView			m_tvalert;
 	// private String user;
 	// private String password;
 	// String m_sName;
 	// String m_sPassword;
-	ArrayList<String>				photoList				= new ArrayList<String>();
-	// private SurfaceView picSV;
-	// private Camera camera;
-	//
-//	private final BroadcastReceiver	m_lockedReceiver		= new BroadcastReceiver()
-//															{
-//																@Override
-//																public void onReceive(
-//																		Context context,
-//																		Intent intent)
-//																{
-//																	String action = intent
-//																			.getAction();
-//																	if (action
-//																			.equals(Intent.ACTION_SCREEN_OFF))
-//																	{
-//																		Log.e("hg",
-//																				"�յ��㲥!!!=======>m_blocked="
-//																						+ m_blocked);
-//																		if (m_blocked == true)
-//																			return;
-//																		Intent activityintent = new Intent();
-//																		activityintent
-//																				.setClass(
-//																						MainActivity.this,
-//																						LockerActivity.class);
-//																		startActivityForResult(
-//																				activityintent,
-//																				REQUEST_LOCKER);
-//																		Log.e(TAG,
-//																				"===================>start locker");
-//																		m_blocked = true;
-//																	}
-//																	// if
-//																	// (action.equals(Intent.ACTION_USER_PRESENT))
-//																	// {
-//																	//
-//																	// Log.e("hg",
-//																	// "�յ��㲥!!!=======>m_blocked="
-//																	// +
-//																	// m_blocked);
-//																	// if
-//																	// (m_blocked
-//																	// == true)
-//																	// return;
-//																	// Intent
-//																	// activityintent
-//																	// = new
-//																	// Intent();
-//																	// activityintent
-//																	// .setClass(MainActivity.this,
-//																	// LockerActivity.class);
-//																	// startActivityForResult(activityintent,
-//																	// REQUEST_LOCKER);
-//																	// Log.e(TAG,
-//																	// "===================>start locker");
-//																	// m_blocked
-//																	// = true;
-//																	// }
-//																}
-//															};
-
-	// @Override
-	// protected void onStart() {
-	// Log.i(TAG, "onStart========>m_blocked="+m_blocked);
-	// // TODO Auto-generated method stub
-	//
-	// if (m_blocked) {
-	//
-	// }
-	// super.onStart();
-	// }
-	//
-	// @Override
-	// protected void onStop() {
-	// Log.i(TAG, "onStop========>");
-	// // TODO Auto-generated method stub
-	//
-	// super.onStop();
-	// }
+	ArrayList<String>	photoList				= new ArrayList<String>();
 
 	private void StartCamera()
 	{
@@ -179,6 +103,18 @@ public class MainActivity extends Activity
 		}
 	}
 
+	@Override
+	public boolean onKeyDown(int keyCode, KeyEvent event)
+	{
+		if (keyCode == KeyEvent.KEYCODE_BACK)
+		{
+			clear();
+
+		}
+		return super.onKeyDown(keyCode, event);
+
+	}
+
 	@Override
 	protected void onCreate(Bundle savedInstanceState)
 	{
@@ -186,7 +122,6 @@ public class MainActivity extends Activity
 		super.onCreate(savedInstanceState);
 		setContentView(R.layout.activity_main1);
 
-
 		ImageView thumbsImageView = (ImageView) findViewById(R.id.ivThumbs);
 		thumbsImageView.setOnClickListener(new View.OnClickListener()
 		{
@@ -194,24 +129,14 @@ public class MainActivity extends Activity
 			@Override
 			public void onClick(View v)
 			{
+				if (photoList.size() < 1)
+					return;
 
 				Intent intent = new Intent(MainActivity.this,
 						PhotoPreviewActivity.class);
 				intent.putExtra("pic_list", (Serializable) photoList);
-				startActivity(intent);
+				startActivityForResult(intent, REQUEST_PREVIEW);
 
-				// File folder = new
-				// File(Environment.getExternalStorageDirectory().getPath()+"/redant/pop/temp");
-				// File[] allFiles = folder.listFiles();
-				// new SingleMediaScanner(MainActivity.this, allFiles[0]);
-				// Intent intent = new Intent();
-				// // Intent.ACTION_PICK,
-				// //
-				// android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
-				// // startActivityForResult(intent, REQUEST_SCAN_BARCODE);
-				//
-				// intent.setClass(MainActivity.this, CaptureActivity.class);
-				// startActivityForResult(intent, REQUEST_SCAN_BARCODE);
 			}
 		});
 		// m_sName = intent.getStringExtra("user");
@@ -222,7 +147,7 @@ public class MainActivity extends Activity
 		IntentFilter msgFilter = new IntentFilter();
 		Intent intent = getIntent();
 		msgFilter.addAction("android.intent.action.SCREEN_OFF");
-//		msgFilter.addAction("REDANT.POP.USER_CHECK_FAILED");
+		// msgFilter.addAction("REDANT.POP.USER_CHECK_FAILED");
 		msgFilter.addAction("REDANT.POP.FINISH_UPLOAD_QUEUE");
 		msgFilter.addAction("REDANT.POP.FINISH_UPLOAD_QUEUE_WITH_ERROR");
 		msgFilter.setPriority(2147483647);
@@ -239,14 +164,7 @@ public class MainActivity extends Activity
 			// photoList = A
 			// savedInstanceState.getStringArrayList("photoList");
 			photoFile = (File) savedInstanceState.getSerializable("photoFile");
-			// iPhotoCount = savedInstanceState.getInt("iPhotoCount");
-			// thumbpath = savedInstanceState.getString("thumbpath");
-			// if (savedInstanceState.getString("m_sName") != null)
-			// m_sName = savedInstanceState.getString("m_sName");
-			// if (savedInstanceState.getString("m_sPassword") != null)
-			// m_sPassword = savedInstanceState.getString("m_sPassword");
-			// ImageView thumbsImageView = (ImageView)
-			// findViewById(R.id.ivThumbs);
+
 			if (thumbBitmap != null)
 			{
 				thumbsImageView.setImageBitmap(thumbBitmap);
@@ -257,48 +175,7 @@ public class MainActivity extends Activity
 			countTextView.setText(photoList.size() + " Photos");
 
 		}
-//		EditText edit = (EditText) findViewById(R.id.pidval);
-
-//		edit.addTextChangedListener(new TextWatcher()
-//		{
-//			@Override
-//			public void onTextChanged(CharSequence s, int start, int before,
-//					int count)
-//			{
-//
-//			}
-//
-//			@Override
-//			public void beforeTextChanged(CharSequence s, int start, int count,
-//					int after)
-//			{
-//			}
-//
-//			@Override
-//			public void afterTextChanged(Editable s)
-//			{
-//				// EditText edit = (EditText) findViewById(R.id.edit);
-//				ImageButton ibtnUpload = (ImageButton) findViewById(R.id.ibtnOk);
-//				if (photoList.size() > 0 && s.length() > 0)
-//				{
-//					ibtnUpload.setVisibility(View.VISIBLE);
-//
-//				}
-//				else
-//				{
-//					ibtnUpload.setVisibility(View.INVISIBLE);
-//
-//				}
-//			}
-//		});
-		// if (getRequestedOrientation() ==
-		// ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) {
-		// LinearLayout landLayout = (LinearLayout) findViewById(R.id.land);
-		// landLayout.setVisibility(View.VISIBLE);
-		// } else {
-		// LinearLayout portLayout = (LinearLayout) findViewById(R.id.port);
-		// portLayout.setVisibility(View.VISIBLE);
-		// }
+
 		ImageButton ibtnscan = (ImageButton) findViewById(R.id.ibtnScan);
 		ibtnscan.setOnClickListener(new View.OnClickListener()
 		{
@@ -306,11 +183,8 @@ public class MainActivity extends Activity
 			@Override
 			public void onClick(View v)
 			{
-				Log.e(TAG,"==============>Click Scan button");
+				Log.e(TAG, "==============>Click Scan button");
 				Intent intent = new Intent();
-				// Intent.ACTION_PICK,
-				// android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
-				// startActivityForResult(intent, REQUEST_SCAN_BARCODE);
 
 				intent.setClass(MainActivity.this, CaptureActivity.class);
 				startActivityForResult(intent, REQUEST_SCAN_BARCODE);
@@ -426,30 +300,6 @@ public class MainActivity extends Activity
 		return image;
 	}
 
-	// public static void savePic(Bitmap b, String strFileName)
-	// {
-	// FileOutputStream fos = null;
-	// try
-	// {
-	// fos = new FileOutputStream(strFileName);
-	// if (null != fos)
-	// {
-	//
-	// b.compress(Bitmap.CompressFormat.PNG, 90, fos);
-	// fos.flush();
-	// fos.close();
-	// }
-	// }
-	// catch (FileNotFoundException e)
-	// {
-	// e.printStackTrace();
-	// }
-	// catch (IOException e)
-	// {
-	// e.printStackTrace();
-	// }
-	// }
-
 	boolean createDir(String path)
 	{
 		Log.i(TAG, "readFile:createDir=" + path);
@@ -503,26 +353,10 @@ public class MainActivity extends Activity
 			if (resultCode == Activity.RESULT_OK) // ��������
 
 			{
-				// Log.e(TAG, msg)
-				// Bundle bundle = data.getExtras();
-				// if(thumbBitmap!=null)
-				// thumbBitmap=null;
-				// thumbBitmap = (Bitmap) bundle.get("data");
-				// // ��ȡ������ص����ݣ���ת��ΪBitmapͼƬ��ʽ
-				// Bitmap thumbBitmap = BitmapFactory.decodeFile(photoFile
-				// .toString());
-
-				// CreateThumb(photoFile);
+
 				Log.e(TAG, photoFile.toString());
 				photoList.add(photoFile.toString());
 
-				// Bitmap.createScaledBitmap(
-				// thumbBitmap, thumbsImageView.getWidth(),
-				// thumbsImageView.getHeight(), false));
-				// Log.i(TAG, "thumb size" + thumbBitmap.getHeight() + "x"
-				// + thumbBitmap.getWidth());
-				// thumbpath = photoFile.toString();
-				// Log.e(TAG, "get thumbpath==" + thumbpath);
 				StartCamera();
 				// iPhotoCount++;
 				super.onActivityResult(requestCode, resultCode, data);
@@ -530,14 +364,9 @@ public class MainActivity extends Activity
 			}
 			else
 			{
-				// �˳�����
-				// File emptyFile = new File(LastFileName);
-				// boolean b=emptyFile.delete();
-				// Log.i(TAG, "lastpicPath: " + thumbpath);
+
 				ImageView thumbsImageView = (ImageView) findViewById(R.id.ivThumbs);
-				// LayerDrawable
-				// thumbsImageView.setImageDrawable(drawable);
-				// thumbBitmap=getImageThumbnail(thumbpath, iwidth,iheight);
+
 				if (photoList.size() > 0)
 				{
 					thumbBitmap = ThumbnailUtils.extractThumbnail(BitmapFactory
@@ -546,11 +375,7 @@ public class MainActivity extends Activity
 					if (thumbBitmap != null)
 						thumbsImageView.setImageBitmap(thumbBitmap);
 				}
-				// thumbBitmap = ThumbnailUtils.extractThumbnail(
-				// BitmapFactory.decodeFile(thumbpath), iwidth, iheight);
-				// saveMyBitmap("thumbtest",thumbBitmap);
-				// if (thumbBitmap != null)
-				// thumbsImageView.setImageBitmap(thumbBitmap);
+
 				photoFile.delete();
 				TextView countTextView = (TextView) findViewById(R.id.tvPhotoCount);
 				countTextView.setText(photoList.size() + " Photos");
@@ -565,6 +390,26 @@ public class MainActivity extends Activity
 			if (resultCode == Activity.RESULT_OK)
 				m_blocked = false;
 		}
+		else if (requestCode == REQUEST_PREVIEW)
+		{
+			for (int i = 0; i < photoList.size(); i++)
+			{
+				File file = new File(photoList.get(i));
+				if (!file.exists())
+				{
+					photoList.remove(i);
+					i--;
+				}
+			}
+			TextView countTextView = (TextView) findViewById(R.id.tvPhotoCount);
+			countTextView.setText(photoList.size() + " Photos");
+			if (photoList.size() == 0)
+			{
+				ImageView thumbsImageView = (ImageView) findViewById(R.id.ivThumbs);
+				thumbsImageView.setImageResource(R.drawable.no_pic);
+				thumbBitmap = null;
+			}
+		}
 		else if (requestCode == REQUEST_SCAN_BARCODE)
 		{
 			if (resultCode == Activity.RESULT_OK)
@@ -629,38 +474,46 @@ public class MainActivity extends Activity
 		switch (item.getItemId())
 		{
 			case R.id.action_clear:
-				clearfornew();
+				clear();
 				break;
 			case R.id.action_type_pid:
 			{
-	            final View edit = new EditText(this);
-	             new AlertDialog.Builder(this)
-	                .setIconAttribute(android.R.attr.alertDialogIcon)
-	                .setTitle(R.string.title_input_pid)
-	                .setView(edit)
-	                .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
-	                    public void onClick(DialogInterface dialog, int whichButton) {
-	                    	String pid = ((EditText)edit).getText().toString();
-	                    	TextView pidval = (TextView) findViewById(R.id.pidval);
-	                    	pidval.setText(pid);              	
-	    
-	                        /* User clicked OK so do some stuff */
-	                    }
-	                })
-	                .setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
-	                    public void onClick(DialogInterface dialog, int whichButton) {
-
-	                        /* User clicked cancel so do some stuff */
-	                    }
-	                })
-	                .create().show();				
+				final View edit = new EditText(this);
+				new AlertDialog.Builder(this)
+						.setIconAttribute(android.R.attr.alertDialogIcon)
+						.setTitle(R.string.title_input_pid)
+						.setView(edit)
+						.setPositiveButton(android.R.string.ok,
+								new DialogInterface.OnClickListener()
+								{
+									public void onClick(DialogInterface dialog,
+											int whichButton)
+									{
+										String pid = ((EditText) edit)
+												.getText().toString();
+										TextView pidval = (TextView) findViewById(R.id.pidval);
+										pidval.setText(pid);
+
+										/* User clicked OK so do some stuff */
+									}
+								})
+						.setNegativeButton(android.R.string.cancel,
+								new DialogInterface.OnClickListener()
+								{
+									public void onClick(DialogInterface dialog,
+											int whichButton)
+									{
+
+										/* User clicked cancel so do some stuff */
+									}
+								}).create().show();
 			}
 				break;
 			case R.id.action_view_queue:
 			{
-				  Intent intent = new Intent();
-				  intent.setClass(MainActivity.this, UploadQueueActivity.class);
-				  startActivity(intent);
+				Intent intent = new Intent();
+				intent.setClass(MainActivity.this, UploadQueueActivity.class);
+				startActivity(intent);
 				break;
 			}
 			default:
@@ -705,8 +558,13 @@ public class MainActivity extends Activity
 		return BitmapFactory.decodeByteArray(data, 0, data.length);// ���ֽ��������λͼ
 	}
 
-	private void clearfornew()
+	private void clear()
 	{
+		for (int i = 0; i < photoList.size(); i++)
+		{
+			File file = new File(photoList.get(i));
+			file.delete();
+		}
 		photoList.clear();
 		TextView pidval = (TextView) findViewById(R.id.pidval);
 		pidval.setText("");
@@ -719,255 +577,93 @@ public class MainActivity extends Activity
 
 	}
 
-	// public class UploadTask extends AsyncTask<Void, Void, Boolean>
-	// {
-	// String err_msg="";
-	// @Override
-	// protected Boolean doInBackground(Void... params)
-	// {
-	// boolean bret=true;
-	//
-	//
-	// SQLiteDatabase db = dbUtil.OpenDB(MainActivity.this, null, true);
-	// EditText edit = (EditText) findViewById(R.id.edit);
-	// String pid = edit.getText().toString();
-	//
-	// if (Network.NetworkIsAvailable(MainActivity.this))
-	// {
-	// int verifyresult = Network.VerifyUser(m_sName, m_sPassword);
-	// if (verifyresult == Network.RESULT_TRUE)
-	// {
-	// /* user is authorized */
-	// for (int i = 0; i < photoList.size(); i++)
-	// {
-	// int uploadresult = Network.UploadFile(photoList.get(i),
-	// m_sName, m_sPassword, pid);
-	// if (uploadresult != Network.RESULT_TRUE)
-	// {
-	// /*
-	// * upload failed write to local db upload when
-	// * connect to network next time;
-	// */
-	//
-	// /*
-	// * serious error occur must notify user
-	// * immediately
-	// */
-	// if (uploadresult == Network.RESULT_LOCALFILE_ERROR)
-	// err_msg+="Warring! Local picture file not found!      ";
-	// if( uploadresult == Network.RESULT_USERAUTH_ERROR)
-	// err_msg+="Warring! Authorize check failed when uploading photos!      ";
-	//
-	// ContentValues cv = new ContentValues();
-	// cv.put("picker", m_sName);
-	// cv.put("err_code", uploadresult);
-	// cv.put("pid", pid);
-	// cv.put("local_path", photoList.get(i));
-	// db.insert("pics", null, cv);
-	// bret=false;
-	// }
-	// else
-	// {
-	// /* upload success delete file */
-	// File file = new File(photoList.get(i));
-	// file.delete();
-	// }
-	//
-	// }
-	//
-	// }
-	// else
-	// if (verifyresult == Network.RESULT_FALSE)
-	// {
-	// /*
-	// * user is not authorized serious error occur must
-	// * notify user
-	// */
-	// Log.e(TAG, "notification====================>");
-	// // String text=m_tvalert.getText().toString();
-	// err_msg+="Warring! Authorize check failed when uploading photos!";
-	// bret=false;
-	// for (int i = 0; i < photoList.size(); i++)
-	// {
-	// ContentValues cv = new ContentValues();
-	// cv.put("picker", m_sName);
-	// cv.put("err_code", Network.RESULT_USERAUTH_ERROR);
-	// cv.put("pid", pid);
-	// cv.put("local_path", photoList.get(i));
-	// db.insert("pics", null, cv);
-	// }
-	//
-	// }
-	// else
-	// {
-	// /* an error occur */
-	// for (int i = 0; i < photoList.size(); i++)
-	// {
-	// ContentValues cv = new ContentValues();
-	// cv.put("picker", m_sName);
-	// cv.put("err_code", Network.RESULT_NET_ERROR);
-	// cv.put("pid", pid);
-	// cv.put("local_path", photoList.get(i));
-	// db.insert("pics", null, cv);
-	// }
-	// bret = false;
-	// }
-	// }
-	// else
-	// {
-	// /*
-	// * net work is not available store into local DB it will auto
-	// * upload when connect to network next time;
-	// */
-	//
-	// for (int i = 0; i < photoList.size(); i++)
-	// {
-	// ContentValues cv = new ContentValues();
-	// cv.put("picker", m_sName);
-	// cv.put("err_code", Network.RESULT_NET_ERROR);
-	// cv.put("pid", pid);
-	// cv.put("local_path", photoList.get(i));
-	// db.insert("pics", null, cv);
-	// }
-	// bret=false;
-	// // m_tvalert.setText("Upload failed when uploading photos!");
-	//
-	// }
-	//
-	// dbUtil.CloseDB(db);
-	// return bret;
-	// }
-	//
-	// @Override
-	// protected void onPostExecute(final Boolean success)
-	// {
-	// if(success)
-	// {
-	// m_tvalert.setTextColor(getResources().getColor(R.color.message_success));
-	// m_tvalert.setText("Upload successed!");
-	// }
-	// else
-	// {
-	// m_tvalert.setTextColor(getResources().getColor(R.color.message_fail));
-	// m_tvalert.setText(err_msg);
-	// }
-	//
-	//
-	// // mAuthTask = null;
-	// // showProgress(false);
-	// //
-	// // if (success) {
-	// //
-	// // // SharedPreferences.Editor editor = RunOnce.edit();
-	// // // editor.putBoolean("FirstRun"+globalUtil.getVerName(this),
-	// // false);
-	// // // // Don't forget to commit your edits!!!
-	// // // editor.commit();
-	// // Intent intent = new Intent();
-	// // intent.setClass(LoginActivity.this, MainActivity.class);
-	// // startActivity(intent);
-	// // finish();
-	// // } else {
-	// // m_etPassword
-	// // .setError(getString(R.string.error_incorrect_password));
-	// // m_etPassword.requestFocus();
-	// // }
-	// }
-	//
-	// @Override
-	// protected void onCancelled()
-	// {
-	// // mAuthTask = null;
-	// // showProgress(false);
-	// }
-	// }
-	// public class SingleMediaScanner implements MediaScannerConnectionClient {
-	//
-	// private MediaScannerConnection mMs;
-	// private File mFile;
-	//
-	// public SingleMediaScanner(Context context, File f) {
-	// mFile = f;
-	// mMs = new MediaScannerConnection(context, this);
-	// mMs.connect();
-	// }
-	//
-	// public void onMediaScannerConnected() {
-	// Log.d(null, ""+mFile.getAbsolutePath());
-	// Log.d(null,
-	// ""+Environment.getExternalStorageDirectory().getPath()+"/photo/");
-	// Log.d(null, new
-	// File(Environment.getExternalStorageDirectory().getPath()+"/photo/").getAbsolutePath());
-	//
-	// mMs.scanFile(mFile.getAbsolutePath(), null);
-	// }
-	//
-	// public void onScanCompleted(String path, Uri uri) {
-	// Intent intent = new Intent(Intent.ACTION_VIEW);
-	// intent.setData(uri);
-	// startActivity(intent);
-	// mMs.disconnect();
-	// }
-	//
-	// }
-
-	private final BroadcastReceiver	MainActivityReceiver	= new BroadcastReceiver()
-														{
-
-															public void onReceive(
-																	Context context,
-																	Intent intent)
-															{
-																String action = intent
-																		.getAction();
-																// 如果捕捉到的action是ACTION_BATTERY_CHANGED
+	private void clearfornew()
+	{
 
-																if ("REDANT.POP.USER_CHECK_FAILED"
-																		.equals(action))
-																{
-																	m_tvalert
-																			.setTextColor(getResources()
-																					.getColor(
-																							R.color.message_fail));
-																	m_tvalert
-																			.setText("Upload failed:user verify failure.");
+		photoList.clear();
+		TextView pidval = (TextView) findViewById(R.id.pidval);
+		pidval.setText("");
+		updateUploadButton();
+		ImageView thumbsImageView = (ImageView) findViewById(R.id.ivThumbs);
+		thumbsImageView.setImageResource(R.drawable.no_pic);
+		thumbBitmap = null;
+		TextView countTextView = (TextView) findViewById(R.id.tvPhotoCount);
+		countTextView.setText("no photo");
 
-																}
-																else if ("REDANT.POP.FINISH_UPLOAD_QUEUE"
-																		.equals(action))
-																{
-																	 m_tvalert.setTextColor(getResources().getColor(R.color.message_success));
-																	 m_tvalert.setText("Upload successes!");
+	}
 
-																}
-																else if ("REDANT.POP.FINISH_UPLOAD_QUEUE_WITH_ERROR"
-																		.equals(action))
-																{
-																	 m_tvalert.setTextColor(getResources().getColor(R.color.message_fail));
-																	 m_tvalert.setText("Upload finish with some error!");
+	private final BroadcastReceiver	MainActivityReceiver	= new BroadcastReceiver()
+															{
 
-																}
-																else if (action
-																		.equals(Intent.ACTION_SCREEN_OFF))
+																public void onReceive(
+																		Context context,
+																		Intent intent)
 																{
-																	Log.e("hg",
-																			"�յ��㲥!!!=======>m_blocked="
-																					+ m_blocked);
-																	if (m_blocked == true)
-																		return;
-																	Intent activityintent = new Intent();
-																	activityintent
-																			.setClass(
-																					MainActivity.this,
-																					LockerActivity.class);
-																	startActivityForResult(
-																			activityintent,
-																			REQUEST_LOCKER);
-																	Log.e(TAG,
-																			"===================>start locker");
-																	m_blocked = true;
+																	String action = intent
+																			.getAction();
+																	// 如果捕捉到的action是ACTION_BATTERY_CHANGED
+
+																	if ("REDANT.POP.USER_CHECK_FAILED"
+																			.equals(action))
+																	{
+																		m_tvalert
+																				.setTextColor(getResources()
+																						.getColor(
+																								R.color.message_fail));
+																		m_tvalert
+																				.setText("Upload failed:user verify failure.");
+
+																	}
+																	else if ("REDANT.POP.FINISH_UPLOAD_QUEUE"
+																			.equals(action))
+																	{
+																		m_tvalert
+																				.setTextColor(getResources()
+																						.getColor(
+																								R.color.message_success));
+																		m_tvalert
+																				.setText("Upload successes!");
+
+																	}
+																	else if ("REDANT.POP.FINISH_UPLOAD_QUEUE_WITH_ERROR"
+																			.equals(action))
+																	{
+																		m_tvalert
+																				.setTextColor(getResources()
+																						.getColor(
+																								R.color.message_fail));
+																		m_tvalert
+																				.setText("Upload finish with some error!");
+
+																	}
+																	else if (action
+																			.equals(Intent.ACTION_SCREEN_OFF))
+																	{
+																		Log.e("hg",
+																				"�յ��㲥!!!=======>m_blocked="
+																						+ m_blocked);
+																		if (m_blocked == true)
+																			return;
+																		
+																		SharedPreferences pref = RedAntApplication.getInstance()
+																				.getSharedPreferences("POP", 0);
+																		boolean autologin = pref.getBoolean("kepppass", false);
+																		if(autologin)
+																			return;
+																		
+																		Intent activityintent = new Intent();
+																		activityintent
+																				.setClass(
+																						MainActivity.this,
+																						LockerActivity.class);
+																		startActivityForResult(
+																				activityintent,
+																				REQUEST_LOCKER);
+																		Log.e(TAG,
+																				"===================>start locker");
+																		m_blocked = true;
+																	}
 																}
-															}
-														};
+															};
 
 }

+ 128 - 90
RedAnt Photo/src/com/usai/redant/photo/PhotoPreviewActivity.java

@@ -5,43 +5,74 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Map;
 
+import com.usai.redant.photo.LockerActivity.UserLoginTask;
+import com.usai.util.Crypto;
+import com.usai.util.Network;
+import com.usai.util.dbUtil;
+
 import android.R.integer;
 import android.app.Activity;
+import android.app.AlertDialog;
 import android.content.BroadcastReceiver;
 import android.content.Context;
+import android.content.DialogInterface;
 import android.content.Intent;
 import android.content.IntentFilter;
+import android.database.Cursor;
+import android.database.sqlite.SQLiteDatabase;
 import android.graphics.Bitmap;
 import android.graphics.BitmapFactory;
+import android.graphics.Color;
 import android.media.ThumbnailUtils;
 import android.net.Uri;
+import android.os.AsyncTask;
 import android.os.Bundle;
 import android.util.Log;
 import android.view.View;
 import android.view.View.OnClickListener;
+import android.view.Gravity;
+import android.view.Menu;
+import android.view.MenuItem;
 import android.view.ViewGroup;
 import android.view.Window;
 import android.view.animation.AnimationUtils;
 import android.widget.AdapterView;
 import android.widget.BaseAdapter;
+import android.widget.EditText;
 import android.widget.Gallery;
 import android.widget.HorizontalScrollView;
 import android.widget.ImageSwitcher;
 import android.widget.ImageView;
 import android.widget.LinearLayout;
+import android.widget.TextView;
+import android.widget.Toast;
 import android.widget.ViewSwitcher;
 import android.widget.Gallery.LayoutParams;
 import android.widget.ViewSwitcher.ViewFactory;
 
 public class PhotoPreviewActivity extends Activity implements
-		 ViewSwitcher.ViewFactory
+		ViewSwitcher.ViewFactory
 {
+	private ImageSwitcher	mSwitcher;
+
+	View					current_view	= null;
+	ArrayList<String>		pic_file;
+
+//	
+//
+//	@Override
+//	protected void onDestroy()
+//	{
+//		Intent intent = new Intent();
+//		setResult(Activity.RESULT_OK, intent);
+//		super.onDestroy();
+//	}
 
 	@Override
 	public void onCreate(Bundle savedInstanceState)
 	{
 		super.onCreate(savedInstanceState);
-		requestWindowFeature(Window.FEATURE_NO_TITLE);
+		// requestWindowFeature(Window.FEATURE_NO_TITLE);
 
 		setContentView(R.layout.activity_photo_preview);
 
@@ -57,51 +88,59 @@ public class PhotoPreviewActivity extends Activity implements
 
 		findViewById(R.id.hsv);
 		HorizontalScrollView hsv = (HorizontalScrollView) findViewById(R.id.hsv);
-		
-		LinearLayout ll = (LinearLayout)findViewById(R.id.linearLayout);
-	
-		for(int i=0;i<pic_file.size();i++)
+
+		LinearLayout ll = (LinearLayout) findViewById(R.id.linearLayout);
+
+		for (int i = 0; i < pic_file.size(); i++)
 		{
 			ImageView imgview = new ImageView(this);
-//
-//			Bitmap thumb = thumbs.get(i);
-//			if (thumb == null)
-//			{
-				Log.d("getView", "create thumb position:" + i);
-				Bitmap thumb = ThumbnailUtils.extractThumbnail(
-						BitmapFactory.decodeFile(pic_file.get(i)), 160,
-						120);
-			//	thumbs.put(i, thumb);
-//			}
-			imgview.setImageBitmap(thumb);
+			//
+			// Bitmap thumb = thumbs.get(i);
+			// if (thumb == null)
+			// {
+			Log.d("getView", "create thumb position:" + i);
+
+			// thumbs.put(i, thumb);
+			// }
+			// Thread thread = new Thread()
+
 			// i.setImageResource(mThumbIds[position]);
 			imgview.setAdjustViewBounds(true);
 			LinearLayout.LayoutParams searchParams = new LinearLayout.LayoutParams(
-					LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT,1);
+					LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT, 1);
 			searchParams.leftMargin = 40;
+			searchParams.topMargin = 10;
+			searchParams.bottomMargin = 10;
 			imgview.setScaleType(ImageView.ScaleType.FIT_CENTER);
 			imgview.setLayoutParams(searchParams);
 			imgview.setBackgroundResource(R.drawable.picture_frame);
-			imgview.setTag(pic_file.get(i));
+			imgview.setTag(i);
+			Loadtask t = new Loadtask();
+			t.execute(imgview, null);
 			imgview.setOnClickListener(new OnClickListener()
 			{
-				
+
 				@Override
 				public void onClick(View v)
 				{
-					v.getTag();
-					mSwitcher.setImageURI(Uri.fromFile(new File(v.getTag().toString())));
+					current_view = v;
+					Integer idx = (Integer) v.getTag();
+					mSwitcher.setImageURI(Uri.fromFile(new File(pic_file
+							.get(idx))));
+
+					// v.setSelected(true);
 					// TODO Auto-generated method stub
-					
+
 				}
 			});
-			
+
 			ll.addView(imgview);
-			
-			
-			mSwitcher.setImageURI(Uri.fromFile(new File(pic_file.get(0))));
-			
+
+			if (i == 0)
+				current_view = imgview;
+
 		}
+		mSwitcher.setImageURI(Uri.fromFile(new File(pic_file.get(0))));
 		// hsv.inflate(context, resource, root)
 
 		// Gallery g = (Gallery) findViewById(R.id.gallery);
@@ -109,16 +148,37 @@ public class PhotoPreviewActivity extends Activity implements
 		// g.setOnItemSelectedListener(this);
 	}
 
-//	public void onItemSelected(AdapterView<?> parent, View v, int position,
-//			long id)
-//	{
-//		mSwitcher.setImageURI(Uri.fromFile(new File(pic_file.get(position))));
-//		// mSwitcher.setImageResource(mImageIds[position]);
-//	}
-//
-//	public void onNothingSelected(AdapterView<?> parent)
-//	{
-//	}
+	@Override
+	public boolean onCreateOptionsMenu(Menu menu)
+	{
+		// Inflate the menu; this adds items to the action bar if it is present.
+		getMenuInflater().inflate(R.menu.preview, menu);
+		return true;
+	}
+
+	@Override
+	public boolean onOptionsItemSelected(MenuItem item)
+	{
+		// TODO Auto-generated method stub
+		switch (item.getItemId())
+		{
+			case R.id.action_delete:
+			{
+				LinearLayout ll = (LinearLayout) findViewById(R.id.linearLayout);
+				// ImageView iv= (ImageView) ll.findViewWithTag(current_path);
+				ll.removeView(current_view);
+				mSwitcher.setImageURI(null);
+				Integer idx = (Integer) current_view.getTag();
+				new File(pic_file.get(idx)).delete();
+				current_view = null;
+				// // pic_file.remove(idx);
+			}
+				break;
+			default:
+				break;
+		}
+		return super.onOptionsItemSelected(item);
+	}
 
 	public View makeView()
 	{
@@ -130,62 +190,40 @@ public class PhotoPreviewActivity extends Activity implements
 		return i;
 	}
 
-	private ImageSwitcher	mSwitcher;
-
-//	public class ImageAdapter extends BaseAdapter
-//	{
-//		public ImageAdapter(Context c)
-//		{
-//			mContext = c;
-//		}
-//
-//		public int getCount()
-//		{
-//			return pic_file.size();// mThumbIds.length;
-//		}
-//
-//		public Object getItem(int position)
-//		{
-//			return position;
-//		}
-//
-//		public long getItemId(int position)
-//		{
-//			return position;
-//		}
-//
-//		public View getView(int position, View convertView, ViewGroup parent)
-//		{
-//			ImageView i = new ImageView(mContext);
-//
-//			Bitmap thumb = thumbs.get(position);
-//			if (thumb == null)
-//			{
-//				Log.d("getView", "create thumb position:" + position);
-//				thumb = ThumbnailUtils.extractThumbnail(
-//						BitmapFactory.decodeFile(pic_file.get(position)), 320,
-//						240);
-//				thumbs.put(position, thumb);
-//			}
-//			i.setImageBitmap(thumb);
-//			// i.setImageResource(mThumbIds[position]);
-//			i.setAdjustViewBounds(true);
-//			i.setLayoutParams(new Gallery.LayoutParams(
-//					LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
-//			i.setBackgroundResource(R.drawable.picture_frame);
-//			return i;
-//		}
-//
-//		private Context	mContext;
-//
-//	}
-
-	ArrayList<String>			pic_file;
-//	HashMap<Integer, Bitmap>	thumbs	= new HashMap<Integer, Bitmap>();
+	// HashMap<Integer, Bitmap> thumbs = new HashMap<Integer, Bitmap>();
 	// private Integer[] mThumbIds = {
 	// };
 
 	// private Integer[] mImageIds = {
 	// };
+	public class Loadtask extends AsyncTask<ImageView, Integer, Boolean>
+	{
+		// int err_code = ERR_CODE_NONE;
+		ImageView	iv		= null;
+		Bitmap		thumb	= null;
+
+		// int netconnect;
+
+		@Override
+		protected Boolean doInBackground(ImageView... params)
+		{
+			iv = params[0];
+			Integer idx = (Integer) iv.getTag();
+			thumb = ThumbnailUtils.extractThumbnail(
+					BitmapFactory.decodeFile(pic_file.get(idx)), 160, 120);
+			return true;
+		}
 
+		@Override
+		protected void onPostExecute(final Boolean success)
+		{
+			iv.setImageBitmap(thumb);
+		}
+
+		@Override
+		protected void onCancelled()
+		{
+
+		}
+	}
 }

+ 65 - 0
RedAnt Photo/src/com/usai/redant/photo/UploadService.java

@@ -2,9 +2,11 @@ package com.usai.redant.photo;
 
 import java.io.File;
 
+
 import com.usai.util.Crypto;
 import com.usai.util.Network;
 import com.usai.util.dbUtil;
+import com.usai.util.dbgUtil;
 
 import android.app.Service;
 import android.content.BroadcastReceiver;
@@ -14,6 +16,8 @@ import android.content.Intent;
 import android.content.IntentFilter;
 import android.database.Cursor;
 import android.database.sqlite.SQLiteDatabase;
+import android.net.ConnectivityManager;
+import android.net.NetworkInfo;
 import android.os.Bundle;
 import android.os.IBinder;
 import android.util.Log;
@@ -50,6 +54,7 @@ public class UploadService extends Service
 		
 		msgFilter.addAction("REDANT.POP.MODIFY_QUEUE");
 		msgFilter.addAction("REDANT.POP.QUERY_UPLOAD_STATE");
+		msgFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
 
 		
 		registerReceiver(uploadReceiver, msgFilter);
@@ -254,6 +259,66 @@ public class UploadService extends Service
 															else {
 																sendBroadcast(new Intent("REDANT.POP.UPLOAD_STATE_FALSE"));
 															}
+														}
+														else if (intent.getAction().equals(
+																ConnectivityManager.CONNECTIVITY_ACTION)) {
+															
+															ConnectivityManager connManager = (ConnectivityManager) context
+																	.getSystemService(Context.CONNECTIVITY_SERVICE);
+
+															NetworkInfo networkInfo = connManager.getActiveNetworkInfo();
+															if (networkInfo == null)
+															{
+																dbgUtil.Logd( "Current Network info",
+																		"can not get Active NetworkInfo!");
+																return ;
+															}
+															NetworkInfo.State netState = networkInfo.getState();
+															if (netState != NetworkInfo.State.CONNECTED)
+															{
+																dbgUtil.Logd( "Current Network info",
+																		"not Connected!State=" + netState);
+																return ;
+															}
+															int iconntype = -1;
+															iconntype = networkInfo.getType();
+
+//															boolean bUseMobileNetwork = context.getSharedPreferences(
+//																	"PhoneAsstPref", 0).getBoolean("UseMobileNetwork", false);
+//
+//															if (bUseMobileNetwork == false
+//																	&& iconntype != ConnectivityManager.TYPE_WIFI && iconntype != 9/* earthnet */)
+//															{
+//																dbgUtil.Log(Log.DEBUG, "Current Network info",
+//																		"not allowed!Connection type=" + networkInfo.getTypeName());
+//																return false;
+//															}
+															boolean bavailable = networkInfo.isAvailable();
+															String strtype = networkInfo.getTypeName();
+
+															dbgUtil.Logd("Current Network info", " type = " + strtype
+																	+ " abailable = " + bavailable + " state " + netState);
+															if(bavailable)
+															{
+																if (uploadThread
+																		.isAlive())
+																{
+
+																	Log.e("uploadReceiver",
+																			"upload thread alive");
+																}
+																else
+																{
+																	Log.e("uploadReceiver",
+																			"start upload thread");
+																	uploadThread = new UploadThread();
+																	uploadThread
+																			.start();
+																}	
+															}
+															
+															
+
 														}
 													}
 												};

+ 4 - 136
RedAnt Photo/src/com/usai/util/Network.java

@@ -94,139 +94,7 @@ public class Network
 	static String				URL_UPLOAD_PHOTO				= "https://cherry.united-us.com/handset.php";
 	static String				URL_VERIFY_USER					= "https://cherry.united-us.com/handset_login.php";
 
-	// public static String VerifyUser(String user, String password,
-	// Context context)
-	// {
-	// String TAG = "net_dbg@VerifyUser";
-	// Log.d(TAG, "entry");
-	// try
-	// {
-	// BasicHttpParams httpParams = new BasicHttpParams();
-	// HttpConnectionParams.setConnectionTimeout(httpParams,
-	// REQUEST_TIMEOUT);
-	// HttpConnectionParams.setSoTimeout(httpParams, SO_TIMEOUT);
-	// HttpClient client = new DefaultHttpClient(httpParams);
-	// HttpPost post = new HttpPost(URL_VERIFY_USER);
-	// MultipartEntity reqEntity = new MultipartEntity(
-	// HttpMultipartMode.BROWSER_COMPATIBLE);
-	// reqEntity.addPart("user", new StringBody(user));
-	// reqEntity.addPart("password", new StringBody(password));
-	//
-	// post.setEntity(reqEntity);
-	// HttpResponse response = client.execute(post);
-	// int statucode = response.getStatusLine().getStatusCode();
-	// if (statucode == HttpStatus.SC_OK)
-	// {
-	// HttpEntity resEntity = response.getEntity();
-	// if (resEntity != null)
-	// {
-	// Log.d(TAG,
-	// "Response: content len==>"
-	// + resEntity.getContentLength());
-	// InputStream is = resEntity.getContent();
-	// try
-	// {
-	//
-	// BufferedReader br = new BufferedReader(
-	// new InputStreamReader(is, "utf-8"), 8);
-	// StringBuilder sb = new StringBuilder();
-	// String line = null;
-	// while ((line = br.readLine()) != null)
-	// {
-	// sb.append(line + "\n");
-	// }
-	//
-	// Log.d(TAG, "Response: content begin");
-	// Log.d(TAG, sb.toString());
-	// Log.d(TAG, "Response: content end");
-	// return sb.toString();
-	// }
-	// catch (Exception e)
-	// {
-	// Log.e(TAG, e.toString());
-	// // TODO: handle exception
-	// }
-	// finally
-	// {
-	// is.close();
-	//
-	// }
-	//
-	// }
-	// else
-	// {
-	// /*
-	// * resEntity is null
-	// */
-	// Log.d(TAG, "RESPONSE ENTITY IS NULL");
-	// return null;
-	// }
-	//
-	// }
-	// else
-	// {
-	// /*
-	// * Http error; out put error code;
-	// */
-	// Log.d(TAG, "HTTP " + statucode);
-	//
-	// HttpEntity resEntity = response.getEntity();
-	// if (resEntity != null)
-	// {
-	//
-	// InputStream is = resEntity.getContent();
-	// try
-	// {
-	//
-	// BufferedReader br = new BufferedReader(
-	// new InputStreamReader(is, "utf-8"), 8);
-	// StringBuilder sb = new StringBuilder();
-	// String line = null;
-	// while ((line = br.readLine()) != null)
-	// {
-	// sb.append(line + "\n");
-	// }
-	//
-	// Log.d(TAG, "Response: content begin");
-	// Log.d(TAG, sb.toString());
-	// Log.d(TAG, "Response: content end");
-	// return null;
-	// }
-	// catch (Exception e)
-	// {
-	// Log.e(TAG, e.toString());
-	// // TODO: handle exception
-	// }
-	// finally
-	// {
-	// is.close();
-	//
-	// }
-	//
-	// }
-	// else
-	// {
-	// /*
-	// * resEntity is null
-	// */
-	// Log.e(TAG, "RESPONSE ENTITY IS NULL");
-	// return null;
-	// }
-	// return null;
-	// }
-	//
-	// }
-	// catch (ConnectTimeoutException e)
-	// {
-	// Log.d(TAG, "request time out");
-	//
-	// }
-	// catch (Exception e)
-	// {
-	// Log.d(TAG, e.toString());
-	// }
-	// return null;
-	// }
+
 	public static class SSLSocketFactoryEx extends SSLSocketFactory
 	{
 
@@ -831,7 +699,7 @@ public class Network
 					catch (Exception e)
 					{
 						Log.e(TAG, e.toString());
-						return RESULT_ERROR;
+						return RESULT_NET_ERROR;
 						// TODO: handle exception
 					}
 					finally
@@ -878,12 +746,12 @@ public class Network
 						Log.d(TAG, "Response: content begin");
 						Log.d(TAG, sb.toString());
 						Log.d(TAG, "Response: content end");
-						return RESULT_ERROR;
+						return RESULT_NET_ERROR;
 					}
 					catch (Exception e)
 					{
 						Log.e(TAG, e.toString());
-						return RESULT_ERROR;
+						return RESULT_NET_ERROR;
 						// TODO: handle exception
 					}
 					finally