Skip to content

Commit

Permalink
Added: optimize ui and floating window
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewleo committed Sep 22, 2014
1 parent ec85393 commit 39036cb
Show file tree
Hide file tree
Showing 20 changed files with 128 additions and 122 deletions.
3 changes: 2 additions & 1 deletion AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
android:versionCode="30"
android:versionName="2.0" >

<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="15"/>
<uses-sdk android:minSdkVersion="8" />

<application android:name=".utils.MyApplication"
android:icon="@drawable/icon"
Expand All @@ -22,6 +22,7 @@
</activity>

<activity android:name=".activity.SettingsActivity"
android:theme="@style/customTheme"
android:screenOrientation="portrait"/>

<activity android:name=".activity.AboutActivity"
Expand Down
Binary file modified res/drawable-hdpi/btn_back.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified res/drawable-hdpi/btn_save.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed res/drawable-hdpi/setting.png
Binary file not shown.
Binary file modified res/drawable-hdpi/settings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified res/drawable-hdpi/settings_pressed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed res/drawable-hdpi/topbar_back_black.png
Binary file not shown.
23 changes: 23 additions & 0 deletions res/drawable/float_button.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >

<!-- 连框颜色值 -->
<item>
<shape>
<solid android:color="@color/red" />
<corners android:radius="3dp" />
</shape>
</item>
<!-- 主体背景颜色值 -->
<item
android:bottom="1dp"
android:right="1dp"
android:left="1dp"
android:top="1dp">
<shape>
<solid android:color="@color/mix_gray" />
<corners android:radius="3dp" />
</shape>
</item>

</layer-list>
15 changes: 10 additions & 5 deletions res/layout/floating.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,23 @@
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_weight="0.4">

<Button
android:id="@+id/wifi"
android:textSize = "12dp"
android:layout_width="80dp"
android:layout_height="40dp" />
android:layout_width="60dp"
android:layout_height="30dp"
android:layout_marginRight="@dimen/image_padding_small"
android:textColor="@color/black"
android:background="@drawable/float_button" />
<Button
android:id="@+id/stop"
android:text="@string/stop_test"
android:textSize = "12dp"
android:layout_width="80dp"
android:layout_height="40dp" />
android:layout_width="60dp"
android:layout_height="30dp"
android:textColor="@color/black"
android:background="@drawable/float_button" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
Expand Down
10 changes: 5 additions & 5 deletions res/layout/mainpage.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@
android:listSelector="@color/light_purple"/>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="80dp"
android:layout_height="50dp"
android:background="@drawable/bottom_bg" >

<Button
android:id="@+id/test"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginTop="15dp"
android:layout_marginBottom="15dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="6dp"
android:layout_marginBottom="2dp"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:background="@drawable/test_button"
android:text="@string/start_test"
android:textColor="#ffffff"
Expand Down
41 changes: 28 additions & 13 deletions res/layout/navigation_bar.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,48 @@
android:layout_height="@dimen/action_bar_height"
android:background="@drawable/actionbar_bg"
android:gravity="center_horizontal|center_vertical"
android:padding="@dimen/image_padding_small"
android:orientation="horizontal" >

<ImageView
android:id="@+id/go_back"
<LinearLayout
android:id="@+id/lay_go_back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingRight ="@dimen/image_padding"
android:src="@drawable/btn_back"
android:clickable="true" />
android:layout_height="match_parent"
android:layout_weight="0.1"
android:gravity="center_horizontal|center_vertical" >

<ImageView
android:id="@+id/go_back"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:src="@drawable/btn_back" />
</LinearLayout>

<TextView
android:id="@+id/nb_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:singleLine="true"
android:text="@string/setting"
android:textColor="@color/white"
android:textSize="@dimen/text_size_big" />

<ImageView
android:id="@+id/btn_set"
<LinearLayout
android:id="@+id/lay_btn_set"
android:layout_width="wrap_content"
android:padding="@dimen/image_padding"
android:src="@drawable/btn_save"
android:layout_height="wrap_content"
android:clickable="true" />
android:layout_height="match_parent"
android:layout_weight="0.1"
android:gravity="center_horizontal|center_vertical" >

<ImageView
android:id="@+id/btn_set"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_marginRight="5dp"
android:src="@drawable/btn_save" />
</LinearLayout>

</LinearLayout>
4 changes: 3 additions & 1 deletion res/layout/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,12 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:focusable="true"
android:max="60"
android:max="59"
android:maxHeight="4.0dip"
android:minHeight="4.0dip"
android:paddingLeft="16.0dip"
android:paddingRight="16.0dip"
android:paddingBottom="@dimen/layout_vertical_margin_small"
android:progress="5"
android:progressDrawable="@drawable/custom_seekbar"
android:thumb="@drawable/seekbar_thumb" />
Expand All @@ -84,6 +85,7 @@
android:background="@color/light_gray" />

<RelativeLayout
android:id="@+id/floating_item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/layout_vertical_margin_small" >
Expand Down
1 change: 1 addition & 0 deletions res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
<string name="ok">确定</string>
<string name="cancel">取消</string>
<string name="confirm">确定退出程序?</string>
<string name="quite_alert">再点击一次退出应用</string>

<string name="about">关于</string>
<string name="mail_settings">邮件配置</string>
Expand Down
7 changes: 4 additions & 3 deletions res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
<string name="password">Password:</string>
<string name="smtp">SMTP Server:</string>
<string name="receiver">Receivers(separated by space):</string>
<string name="floating_window">Show floating window</string>
<string name="floating_window">Show Floating Window</string>
<string name="save">Save</string>

<string name="calculating">Calculating...</string>
<string name="open_wifi">Enable WIFI</string>
<string name="close_wifi">Disable WIFI</string>
<string name="open_wifi">WIFI Off</string>
<string name="close_wifi">WIFI On</string>
<string name="process_free_mem">App/Available Memory:</string>
<string name="process_overall_cpu">App/System CPU:</string>
<string name="start_time">Start Time:</string>
Expand Down Expand Up @@ -63,6 +63,7 @@
<string name="ok">OK</string>
<string name="cancel">Cancel</string>
<string name="confirm">Are you sure to exit?</string>
<string name="quite_alert">Click again to exit</string>

<string name="about">About</string>
<string name="mail_settings">Mail Settings</string>
Expand Down
7 changes: 7 additions & 0 deletions res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Activity主题 -->
<style name="customTheme" parent="@android:style/Theme">
<item name="android:windowIsTranslucent">true</item>
</style>
</resources>
9 changes: 6 additions & 3 deletions src/com/netease/qa/emmagee/activity/AboutActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import android.view.Window;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.netease.qa.emmagee.R;
Expand Down Expand Up @@ -53,14 +54,16 @@ public void onCreate(Bundle savedInstanceState) {
appVersion = (TextView)findViewById(R.id.app_version);
appVersion.setText(getVersion());

goBack = (ImageView)findViewById(R.id.go_back);
TextView title = (TextView)findViewById(R.id.nb_title);
title.setText(R.string.about);

ImageView btnSave = (ImageView) findViewById(R.id.btn_set);
btnSave.setImageResource(R.drawable.actionbar_bg);
btnSave.setVisibility(ImageView.INVISIBLE);

goBack = (ImageView)findViewById(R.id.go_back);
LinearLayout layGoBack = (LinearLayout) findViewById(R.id.lay_go_back);

goBack.setOnClickListener(new OnClickListener() {
layGoBack.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
AboutActivity.this.finish();
Expand Down
12 changes: 7 additions & 5 deletions src/com/netease/qa/emmagee/activity/MailSettingsActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import android.view.View.OnClickListener;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;

Expand Down Expand Up @@ -79,7 +80,9 @@ public void onCreate(Bundle savedInstanceState) {
edtSmtp = (EditText) findViewById(R.id.smtp);
title = (TextView)findViewById(R.id.nb_title);
ImageView btnSave = (ImageView) findViewById(R.id.btn_set);
ImageView goBack = (ImageView) findViewById(R.id.go_back);
LinearLayout layGoBack = (LinearLayout) findViewById(R.id.lay_go_back);
LinearLayout layBtnSet = (LinearLayout) findViewById(R.id.lay_btn_set);

boolean floatingTag = true;

title.setText(R.string.mail_settings);
Expand Down Expand Up @@ -108,13 +111,13 @@ public void onCreate(Bundle savedInstanceState) {
edtPassword.setText(prePassword);
edtSmtp.setText(smtp);

goBack.setOnClickListener(new OnClickListener() {
layGoBack.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
MailSettingsActivity.this.finish();
}
});
btnSave.setOnClickListener(new OnClickListener() {
layBtnSet.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
sender = edtSender.getText().toString().trim();
Expand Down Expand Up @@ -202,11 +205,10 @@ private int checkMailConfig(String sender, String recipients, String smtp,
* @return true: valid email address
*/
private boolean checkMailFormat(String mail) {
String strPattern = "^[a-zA-Z][\\w\\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\\w\\.-]*"
String strPattern = "^[a-zA-Z0-9][\\w\\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\\w\\.-]*"
+ "[a-zA-Z0-9]\\.[a-zA-Z][a-zA-Z\\.]*[a-zA-Z]$";
Pattern p = Pattern.compile(strPattern);
Matcher m = p.matcher(mail);
return m.matches();
}

}
Loading

0 comments on commit 39036cb

Please sign in to comment.