Quellcode durchsuchen

Apex Mobile
调整search 界面
统一按钮样式

Ray Zhang vor 8 Jahren
Ursprung
Commit
3209bafab4

+ 1 - 1
Apex Mobile/app/src/main/java/com/usai/apex/InnerMapActivity.java

@@ -159,7 +159,7 @@ public class InnerMapActivity extends AppCompatActivity
 
 
 
-		m_bhasgoogleframework= true;
+//		m_bhasgoogleframework= true;
 
 		Fragment slFragment = null;
 		if (m_bhasgoogleframework )

+ 44 - 5
Apex Mobile/app/src/main/java/com/usai/apex/RetrievePasswordActivity.java

@@ -1,23 +1,25 @@
 package com.usai.apex;
 
-import com.usai.util.Network;
-
 import android.animation.Animator;
 import android.animation.AnimatorListenerAdapter;
 import android.annotation.TargetApi;
-import android.app.Activity;
 import android.app.AlertDialog;
 import android.app.AlertDialog.Builder;
+import android.content.Context;
 import android.content.DialogInterface;
 import android.content.DialogInterface.OnClickListener;
-import android.content.Context;
+import android.content.Intent;
 import android.os.AsyncTask;
 import android.os.Build;
 import android.os.Bundle;
+import android.support.v7.app.ActionBar;
+import android.support.v7.app.AppCompatActivity;
 import android.text.TextUtils;
 import android.util.Log;
 import android.view.Gravity;
 import android.view.KeyEvent;
+import android.view.LayoutInflater;
+import android.view.MenuItem;
 import android.view.View;
 import android.view.inputmethod.EditorInfo;
 import android.view.inputmethod.InputMethodManager;
@@ -25,11 +27,13 @@ import android.widget.EditText;
 import android.widget.TextView;
 import android.widget.Toast;
 
+import com.usai.util.Network;
+
 /**
  * Activity which displays a login screen to the user, offering registration as
  * well.
  */
-public class RetrievePasswordActivity extends Activity
+public class RetrievePasswordActivity extends AppCompatActivity
 {
 
 	/**
@@ -48,6 +52,40 @@ public class RetrievePasswordActivity extends Activity
 	private View			mLoginStatusView;
 	private TextView		mLoginStatusMessageView;
 
+
+
+	@Override
+	public boolean onOptionsItemSelected(MenuItem item)
+	{
+		Intent intent = new Intent();
+		switch (item.getItemId())
+		{
+			case android.R.id.home:
+				finish();
+				break;
+
+			default:
+				break;
+		}
+		return super.onOptionsItemSelected(item);
+	}
+
+	private void setCustomActionBar() {
+		ActionBar.LayoutParams lp =new ActionBar.LayoutParams(ActionBar.LayoutParams.MATCH_PARENT, ActionBar.LayoutParams.MATCH_PARENT, Gravity.CENTER);
+		View mActionBarView = LayoutInflater.from(this).inflate(R.layout.actionbar_customtitle, null);
+
+		TextView titleview = mActionBarView.findViewById(R.id.title);
+		titleview.setText("Retrieve Password");
+
+		ActionBar actionBar = getSupportActionBar();
+		actionBar.setCustomView(mActionBarView, lp);
+		actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
+		actionBar.setDisplayShowCustomEnabled(true);
+		actionBar.setDisplayHomeAsUpEnabled(true);
+
+
+		actionBar.setDisplayShowTitleEnabled(false);
+	}
 	@Override
 	protected void onCreate(Bundle savedInstanceState)
 	{
@@ -55,6 +93,7 @@ public class RetrievePasswordActivity extends Activity
 
 		setContentView(R.layout.activity_retrieve_password);
 
+		setCustomActionBar();
 		// Set up the login form.
 		m_userView = (EditText) findViewById(R.id.user);
 		// m_sEmail = getIntent().getStringExtra(EXTRA_EMAIL);

+ 4 - 4
Apex Mobile/app/src/main/java/com/usai/apex/SearchListActivity.java

@@ -9,6 +9,7 @@ import android.content.Intent;
 import android.database.Cursor;
 import android.database.sqlite.SQLiteDatabase;
 import android.os.Bundle;
+import android.support.constraint.ConstraintLayout;
 import android.support.v7.app.ActionBar;
 import android.support.v7.app.AppCompatActivity;
 import android.text.Editable;
@@ -29,7 +30,6 @@ import android.widget.Button;
 import android.widget.DatePicker;
 import android.widget.EditText;
 import android.widget.LinearLayout;
-import android.widget.RelativeLayout;
 import android.widget.Spinner;
 import android.widget.TextView;
 
@@ -179,7 +179,7 @@ public class SearchListActivity extends AppCompatActivity implements OnClickList
 
 			if (field_type.equals("boolean"))
 			{
-				RelativeLayout spinneritem = (RelativeLayout) this
+				ConstraintLayout spinneritem = (ConstraintLayout) this
 						.getLayoutInflater().inflate(
 								R.layout.search_item_spinner, null);
 				spinneritem.setTag("search_item_spinner");
@@ -254,7 +254,7 @@ public class SearchListActivity extends AppCompatActivity implements OnClickList
 			else if (field_type.equals("time"))
 			{
 
-				RelativeLayout timeitem = (RelativeLayout) this
+				ConstraintLayout timeitem = (ConstraintLayout) this
 						.getLayoutInflater().inflate(
 								R.layout.search_item_datepicker, null);
 				timeitem.setTag("search_item_datepicker");
@@ -372,7 +372,7 @@ public class SearchListActivity extends AppCompatActivity implements OnClickList
 			}
 			else
 			{
-				RelativeLayout edititem = (RelativeLayout) this
+				ConstraintLayout edititem = (ConstraintLayout) this
 						.getLayoutInflater().inflate(R.layout.search_item_edit,
 								null);
 				edititem.setTag("search_item_edit");

+ 28 - 0
Apex Mobile/app/src/main/res/drawable/btn_bg.xml

@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+
+    <!-- 按壓時 -->
+    <item android:state_pressed="true">
+        <!--rectangle 長方形 可以畫出直角形,圓角形,弧形等-->
+        <shape android:shape="rectangle">
+            <!--設定圓角,當設置的圓角半徑很大,就可變成弧形邊了-->
+            <corners android:radius="5dp" />
+            <!--邊框-->
+            <stroke android:width="0.5dp" android:color="@color/icon_red" />
+            <!--漸層顏色-->
+            <!--<gradient android:angle="-90" android:endColor="#017DAB" android:startColor="#0099CC" />-->
+            <solid android:color="#99FFFFFF" />
+        </shape>
+    </item>
+
+    <!-- 預設時 -->
+    <item android:color="@android:color/black">
+        <shape android:shape="rectangle">
+            <corners android:radius="5dp" />
+            <stroke android:width="0.5dp" android:color="@color/icon_gray" />
+            <!--<gradient android:angle="-90" android:endColor="#1D2C50" android:startColor="#0E2252" />-->
+            <solid android:color="#99FFFFFF" />
+        </shape>
+    </item>
+
+</selector>

+ 28 - 7
Apex Mobile/app/src/main/res/layout/activity_search_list.xml

@@ -25,31 +25,52 @@
         android:layout_height="wrap_content"
         android:layout_alignParentBottom="true"
         android:layout_alignParentLeft="true"
-        android:orientation="horizontal" >
+        android:orientation="horizontal">
 
         <Button
             android:id="@+id/btncancel"
-            style="?android:attr/buttonStyleSmall"
             android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
+            android:layout_height="39dp"
+            android:layout_marginBottom="2dp"
+            android:layout_marginLeft="4dp"
+            android:layout_marginRight="4dp"
+            android:layout_marginTop="2dp"
             android:layout_weight="1"
+            android:background="@drawable/btn_bg"
             android:text="@android:string/cancel" />
 
         <Button
             android:id="@+id/btn_clear"
-            style="?android:attr/buttonStyleSmall"
+
             android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
+            android:layout_height="39dp"
+            android:layout_marginBottom="2dp"
+            android:layout_marginLeft="4dp"
+            android:layout_marginRight="4dp"
+            android:layout_marginTop="2dp"
             android:layout_weight="1"
+            android:background="@drawable/btn_bg"
             android:text="@string/str_reset" />
 
         <Button
             android:id="@+id/btnok"
-            style="?android:attr/buttonStyleSmall"
+
             android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
+            android:layout_height="39dp"
+            android:layout_marginBottom="2dp"
+            android:layout_marginLeft="4dp"
+            android:layout_marginRight="4dp"
+            android:layout_marginTop="2dp"
             android:layout_weight="1"
+            android:background="@drawable/btn_bg"
             android:text="@string/search" />
     </LinearLayout>
 
+    <View
+        android:id="@+id/view3"
+        android:layout_width="match_parent"
+        android:layout_height="1dp"
+        android:layout_above="@id/foot"
+        android:background="@drawable/bottom_shadow" />
+
 </RelativeLayout>

+ 64 - 60
Apex Mobile/app/src/main/res/layout/search_item_datepicker.xml

@@ -1,75 +1,79 @@
 <?xml version="1.0" encoding="utf-8"?>
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:id="@+id/relativeLayout3"
     android:layout_width="match_parent"
-    android:layout_height="wrap_content" >
+    android:layout_height="wrap_content"
+    android:background="@drawable/border">
 
     <TextView
         android:id="@+id/aname"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:layout_alignParentLeft="true"
-        android:layout_alignParentTop="true"
+        android:layout_marginStart="7dp"
+        android:layout_marginTop="7dp"
         android:text="Medium Text"
-        android:textAppearance="?android:attr/textAppearanceMedium" />
+        android:textAppearance="?android:attr/textAppearanceMedium"
+        android:textSize="14sp"
+        android:textStyle="bold"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent"
+        app:layout_constraintVertical_chainStyle="packed" />
 
 
-
-    <LinearLayout
-        android:layout_width="fill_parent"
+    <EditText
+        android:id="@+id/et_from"
+        android:layout_width="0dp"
         android:layout_height="wrap_content"
-        android:layout_below="@+id/aname"
-        android:orientation="vertical" >
-
-        <LinearLayout
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content" >
-
-            <EditText
-                android:id="@+id/et_from"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_weight="1"
-                android:ems="10"
-                android:hint="@string/str_from"
-
-                android:focusable="false"
-                />
-
-            <Button
-                android:id="@+id/btn_clear_from"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_weight="1"
-                android:text="@string/str_clear"  />
-
-        </LinearLayout>
 
-        <LinearLayout
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content" >
+        android:ems="10"
+        android:focusable="false"
+        android:hint="@string/str_from"
+        app:layout_constraintEnd_toStartOf="@+id/btn_clear_from"
+        app:layout_constraintStart_toStartOf="@+id/aname"
+        app:layout_constraintTop_toBottomOf="@+id/aname" />
 
-            <EditText
-                android:id="@+id/et_to"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_weight="1"
-                android:ems="10"
-                android:hint="@string/str_to"
-                android:focusable="false"
-                 >
-
-                <requestFocus />
-            </EditText>
-
-            <Button
-                android:id="@+id/btn_clear_to"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_weight="1"
-                android:text="@string/str_clear"/>
-
-        </LinearLayout>
+    <Button
+        android:id="@+id/btn_clear_from"
+        android:layout_width="wrap_content"
+        android:layout_height="39dp"
+        android:layout_marginEnd="7dp"
+        android:background="@drawable/btn_bg"
+        android:text="@string/str_clear"
+        app:layout_constraintBottom_toBottomOf="@+id/et_from"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintTop_toTopOf="@+id/et_from" />
+
+
+    <EditText
+        android:id="@+id/et_to"
+        android:layout_width="0dp"
+        android:layout_height="wrap_content"
+        android:layout_marginBottom="7dp"
+        android:ems="10"
+        android:focusable="false"
+        android:hint="@string/str_to"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintEnd_toStartOf="@+id/btn_clear_to"
+        app:layout_constraintStart_toStartOf="@+id/et_from"
+        app:layout_constraintTop_toBottomOf="@+id/et_from">
+
+        <requestFocus
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content" />
+    </EditText>
+
+    <Button
+        android:id="@+id/btn_clear_to"
+        android:layout_width="wrap_content"
+        android:layout_height="39dp"
+        android:layout_marginEnd="7dp"
+        android:background="@drawable/btn_bg"
+        android:text="@string/str_clear"
+        app:layout_constraintBottom_toBottomOf="@+id/et_to"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintTop_toBottomOf="@+id/et_from" />
 
-    </LinearLayout>
 
-</RelativeLayout>
+</android.support.constraint.ConstraintLayout>

+ 22 - 10
Apex Mobile/app/src/main/res/layout/search_item_edit.xml

@@ -1,30 +1,42 @@
 <?xml version="1.0" encoding="utf-8"?>
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:id="@+id/relativeLayout4"
     android:layout_width="match_parent"
-    android:layout_height="wrap_content" >
+    android:layout_height="wrap_content"
+    android:background="@drawable/border">
 
     <TextView
         android:id="@+id/aname"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:layout_alignParentLeft="true"
-        android:layout_alignParentTop="true"
+        android:layout_marginStart="7dp"
+        android:layout_marginTop="7dp"
         android:text="Medium Text"
-        android:textAppearance="?android:attr/textAppearanceMedium" />
+        android:textAppearance="?android:attr/textAppearanceMedium"
+        android:textSize="14sp"
+        android:textStyle="bold"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent" />
 
     <AutoCompleteTextView
         android:id="@+id/edit_val"
         android:layout_width="fill_parent"
         android:layout_height="wrap_content"
-        android:layout_alignParentLeft="true"
-        android:layout_below="@+id/aname"
+        android:layout_marginBottom="7dp"
+        android:layout_marginEnd="7dp"
+        android:layout_marginStart="7dp"
         android:completionThreshold="1"
         android:ems="15"
         android:hint="@string/prompt_search_criterion"
         android:inputType="textAutoComplete"
         android:maxLines="1"
         android:singleLine="true"
-        android:text="" >
-    </AutoCompleteTextView>
+        android:text=""
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toBottomOf="@+id/aname"></AutoCompleteTextView>
 
-</RelativeLayout>
+</android.support.constraint.ConstraintLayout>

+ 21 - 8
Apex Mobile/app/src/main/res/layout/search_item_spinner.xml

@@ -1,23 +1,36 @@
 <?xml version="1.0" encoding="utf-8"?>
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:id="@+id/relativeLayout2"
     android:layout_width="match_parent"
-    android:layout_height="wrap_content" >
+    android:layout_height="wrap_content"
+    android:background="@drawable/border">
 
     <TextView
         android:id="@+id/aname"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:layout_alignParentLeft="true"
-        android:layout_alignParentTop="true"
+        android:layout_marginStart="7dp"
+
+        android:layout_marginTop="7dp"
         android:text="Medium Text"
-        android:textAppearance="?android:attr/textAppearanceMedium" />
+        android:textSize="14sp"
+        android:textStyle="bold"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent" />
 
     <Spinner
         android:id="@+id/sp_bool"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:layout_below="@+id/aname"
+        android:layout_marginBottom="7dp"
+        android:layout_marginEnd="7dp"
+        android:layout_marginStart="7dp"
         android:drawSelectorOnTop="true"
-        />
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toBottomOf="@+id/aname" />
 
-</RelativeLayout>
+</android.support.constraint.ConstraintLayout>

+ 5 - 5
Apex Mobile/app/src/main/res/layout/web_content.xml

@@ -1,12 +1,12 @@
 <?xml version="1.0" encoding="utf-8"?>
 <WebView xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
-    android:layout_height="match_parent" 
-    android:scrollbarFadeDuration="0"
+    android:layout_height="match_parent"
     android:fadeScrollbars="false"
-    android:focusable="true"
     android:fastScrollEnabled="true"
-    >
-    
+    android:focusable="true"
+    android:scrollbarFadeDuration="0"
+    android:scrollbarSize="5dp">
+
 
 </WebView>