Forráskód Böngészése

1.修改Android CommonEditor Range Cell,增加Reset。

Pen Li 8 éve
szülő
commit
40fd29f746

+ 15 - 0
RedAnt Mobile/app/src/main/java/com/usai/redant/CommonEditor/CommonEditor/CommonEditorDateRangeCellHolder.java

@@ -7,6 +7,7 @@ import android.view.View;
 import android.widget.Button;
 import android.widget.TextView;
 
+import com.usai.redant.CommonEditor.CommonEditorActivity;
 import com.usai.redant.CommonEditor.DatePickerActivity;
 import com.usai.redant.redantmobile.R;
 
@@ -21,6 +22,7 @@ public class CommonEditorDateRangeCellHolder extends CommonEditorCellHolder {
     public TextView title_lb;
     public Button min_btn;
     public Button max_btn;
+    public Button reset_btn;
     public DateButtonClickListener clickListener;
 
     public CommonEditorDateRangeCellHolder(Context context, View view) {
@@ -29,13 +31,26 @@ public class CommonEditorDateRangeCellHolder extends CommonEditorCellHolder {
         title_lb = view.findViewById(R.id.range_title_tv);
         min_btn = view.findViewById(R.id.range_minimum_btn);
         max_btn = view.findViewById(R.id.range_maximum_btn);
+        reset_btn = view.findViewById(R.id.range_reset_btn);
 
         clickListener = new DateButtonClickListener();
         min_btn.setOnClickListener(clickListener);
         max_btn.setOnClickListener(clickListener);
 
+        reset_btn.setOnClickListener(new ResetClickListener());
+
     }
 
+    private class ResetClickListener implements View.OnClickListener {
+
+        @Override
+        public void onClick(View view) {
+            ((CommonEditorActivity)mCtx).commonEditorRangeDidChange("","",group,child);
+        }
+    }
+
+
+
     @Override
     public void setItem(JSONObject item_json, boolean readonly, View view) {
         super.setItem(item_json, readonly, view);

+ 12 - 0
RedAnt Mobile/app/src/main/java/com/usai/redant/CommonEditor/CommonEditor/CommonEditorRangeCellHolder.java

@@ -4,6 +4,7 @@ import android.content.Context;
 import android.text.Editable;
 import android.text.TextWatcher;
 import android.view.View;
+import android.widget.Button;
 import android.widget.EditText;
 import android.widget.TextView;
 
@@ -21,6 +22,7 @@ public class CommonEditorRangeCellHolder extends CommonEditorCellHolder {
     public TextView title_lb;
     public EditText min_et;
     public EditText max_et;
+    public Button reset_btn;
 
     public TextWatcher minTextChangeListener;
 
@@ -166,6 +168,14 @@ public class CommonEditorRangeCellHolder extends CommonEditorCellHolder {
 
     }
 
+    private class ResetClickListener implements View.OnClickListener {
+
+        @Override
+        public void onClick(View view) {
+            ((CommonEditorActivity)mCtx).commonEditorRangeDidChange("","",group,child);
+        }
+    }
+
 
     public CommonEditorRangeCellHolder(Context context, View view) {
         super(context, view);
@@ -173,7 +183,9 @@ public class CommonEditorRangeCellHolder extends CommonEditorCellHolder {
         title_lb = view.findViewById(R.id.range_title_tv);
         min_et = view.findViewById(R.id.range_minimum_et);
         max_et = view.findViewById(R.id.range_maximum_et);
+        reset_btn = view.findViewById(R.id.range_reset_btn);
 
+        reset_btn.setOnClickListener(new ResetClickListener());
     }
 
     @Override

+ 9 - 4
RedAnt Mobile/app/src/main/java/com/usai/redant/util/Network.java

@@ -247,10 +247,15 @@ public class Network
 			// 传递自定义参数
 //			connection.setRequestProperty("MyProperty", "this is me!");
 
-			if(!TextUtils.isEmpty(RedAntApplication.user))
-				parms.putString("user", AES.encrypt("usai", RedAntApplication.user));
-			if(!TextUtils.isEmpty(RedAntApplication.password))
-				parms.putString("password", AES.encrypt("usai", RedAntApplication.password));
+			if(!TextUtils.isEmpty(RedAntApplication.user)) {
+//				parms.putString("user", AES.encrypt("usai", RedAntApplication.user));
+				parms.putString("user", AES.encrypt("Usai2010", RedAntApplication.user));
+
+			}
+			if(!TextUtils.isEmpty(RedAntApplication.password)) {
+//				parms.putString("password", AES.encrypt("usai", RedAntApplication.password));
+				parms.putString("pwd", AES.encrypt("Usai2010", RedAntApplication.password));
+			}
 
 			parms.putString("app_ver", RedAntApplication.getInstance()
 					.getPackageManager()

+ 64 - 39
RedAnt Mobile/app/src/main/res/layout/common_editor_date_range_cell.xml

@@ -23,53 +23,78 @@
 
     </RelativeLayout>
 
-    <RelativeLayout
-        android:layout_width="match_parent"
+
+
+    <LinearLayout
         android:layout_height="80dp"
+        android:layout_width="match_parent"
         >
+        <!--left-->
+        <RelativeLayout
+            android:layout_height="match_parent"
+            android:layout_width="0dp"
+            android:layout_weight="1"
+            >
+
+            <Button
+                android:id="@+id/range_minimum_btn"
+                android:layout_width="100dp"
+                android:layout_height="40dp"
+                android:layout_centerVertical="true"
+                android:layout_marginLeft="10dp"
+                android:layout_marginRight="10dp"
+                android:background="@drawable/black_border"
+                android:gravity="center"
+                android:hint="minimum"
+                android:textSize="17sp"/>
 
-        <View
-            android:id="@+id/date_start_place"
-            android:layout_width="1dp"
+        </RelativeLayout>
+
+        <!--mid-->
+        <RelativeLayout
             android:layout_height="match_parent"
-            android:layout_alignParentStart="true"
-            />
+            android:layout_width="0dp"
+            android:layout_weight="1"
+            >
 
-        <Button
-            android:id="@+id/range_minimum_btn"
-            android:layout_width="100dp"
-            android:layout_height="40dp"
-            android:layout_centerVertical="true"
-            android:layout_marginLeft="10dp"
-            android:layout_marginRight="10dp"
-            android:layout_toEndOf="@+id/date_start_place"
-            android:background="@drawable/black_border"
-            android:gravity="center"
-            android:hint="minimum"
-            android:textSize="17sp"/>
-
-
-        <View
-            android:id="@+id/date_end_place"
-            android:layout_width="1dp"
+            <Button
+                android:id="@+id/range_maximum_btn"
+                android:layout_width="100dp"
+                android:layout_height="40dp"
+                android:layout_centerVertical="true"
+                android:layout_marginLeft="10dp"
+                android:layout_marginRight="10dp"
+                android:background="@drawable/black_border"
+                android:gravity="center"
+                android:hint="maximum"
+                android:textSize="17sp"/>
+
+
+        </RelativeLayout>
+
+        <!--right-->
+        <RelativeLayout
             android:layout_height="match_parent"
-            android:layout_alignParentEnd="true"
-            />
+            android:layout_width="0dp"
+            android:layout_weight="1"
+            >
 
-        <Button
-            android:id="@+id/range_maximum_btn"
-            android:layout_width="100dp"
-            android:layout_height="40dp"
-            android:layout_alignBottom="@id/range_minimum_btn"
-            android:layout_alignTop="@id/range_minimum_btn"
-            android:layout_marginEnd="10dp"
-            android:layout_toStartOf="@id/date_end_place"
-            android:background="@drawable/black_border"
-            android:gravity="center"
-            android:hint="maximum"
-            android:textSize="17sp"/>
+            <Button
+                android:id="@+id/range_reset_btn"
+                android:layout_width="100dp"
+                android:layout_height="40dp"
+                android:layout_centerVertical="true"
+                android:layout_marginLeft="10dp"
+                android:layout_marginRight="10dp"
+                android:background="#00000000"
+                android:gravity="center"
+                android:textSize="17sp"
+                android:text="Reset"
+                android:textAllCaps="false"/>
 
-    </RelativeLayout>
+        </RelativeLayout>
+
+    </LinearLayout>
 
 
 </LinearLayout>

+ 61 - 36
RedAnt Mobile/app/src/main/res/layout/common_editor_range_cell.xml

@@ -24,52 +24,77 @@
 
     </RelativeLayout>
 
-    <RelativeLayout
+
+
+
+    <LinearLayout
+        android:layout_height="80dp"
         android:layout_width="match_parent"
-        android:layout_height="0dp"
-        android:layout_weight="2"
         >
+        <!--left-->
+        <RelativeLayout
+            android:layout_height="match_parent"
+            android:layout_width="0dp"
+            android:layout_weight="1"
+            >
+
+            <EditText
+                android:id="@+id/range_minimum_et"
+                android:layout_width="100dp"
+                android:layout_height="40dp"
+                android:layout_centerVertical="true"
+                android:layout_margin="10dp"
+                android:gravity="center"
+                android:hint="minimum"
+                android:textSize="17sp"
+                />
 
-        <View
-            android:id="@+id/start_place"
-            android:layout_width="1dp"
+        </RelativeLayout>
+
+        <!--mid-->
+        <RelativeLayout
             android:layout_height="match_parent"
-            android:layout_alignParentStart="true"
-            />
+            android:layout_width="0dp"
+            android:layout_weight="1"
+            >
+
+            <EditText
+                android:id="@+id/range_maximum_et"
+                android:layout_width="100dp"
+                android:layout_height="40dp"
+                android:layout_centerVertical="true"
+                android:layout_margin="10dp"
+                android:gravity="center"
+                android:hint="maximum"
+                android:textSize="17sp"
+                />
 
-        <EditText
-            android:id="@+id/range_minimum_et"
-            android:layout_width="100dp"
-            android:layout_height="40dp"
-            android:layout_toEndOf="@id/start_place"
-            android:layout_centerVertical="true"
-            android:layout_margin="10dp"
-            android:gravity="center"
-            android:hint="minimum"
-            android:textSize="17sp"
-            />
 
+        </RelativeLayout>
 
-        <View
-            android:id="@+id/end_place"
-            android:layout_width="1dp"
+        <!--right-->
+        <RelativeLayout
             android:layout_height="match_parent"
-            android:layout_alignParentEnd="true"
-            />
+            android:layout_width="0dp"
+            android:layout_weight="1"
+            >
 
-        <EditText
-            android:id="@+id/range_maximum_et"
-            android:layout_width="100dp"
-            android:layout_height="40dp"
-            android:layout_marginEnd="10dp"
-            android:gravity="center"
-            android:hint="maximum"
-            android:textSize="17sp"
-            android:layout_alignBottom="@id/range_minimum_et"
-            android:layout_toStartOf="@id/end_place"
-            android:layout_alignTop="@id/range_minimum_et"/>
+            <Button
+                android:id="@+id/range_reset_btn"
+                android:layout_width="100dp"
+                android:layout_height="40dp"
+                android:layout_centerVertical="true"
+                android:layout_marginLeft="10dp"
+                android:layout_marginRight="10dp"
+                android:background="#00000000"
+                android:gravity="center"
+                android:textSize="17sp"
+                android:text="Reset"
+                android:textAllCaps="false"/>
 
-    </RelativeLayout>
+        </RelativeLayout>
+
+    </LinearLayout>
 
 
 </LinearLayout>