Skip to content

Commit

Permalink
Added: #73 show test report in phone
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewleo committed Jun 13, 2017
1 parent 9e5bc2a commit e164c4a
Show file tree
Hide file tree
Showing 18 changed files with 482 additions and 49 deletions.
1 change: 1 addition & 0 deletions .classpath
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry kind="lib" path="libs/commons-io-2.5.jar"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>
6 changes: 6 additions & 0 deletions AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@
<activity
android:name=".activity.MailSettingsActivity"
android:screenOrientation="portrait" />
<activity
android:name=".activity.TestListActivity"
android:screenOrientation="portrait" />
<activity
android:name=".activity.TestReportActivity"
android:screenOrientation="portrait" />

<service android:name="com.netease.qa.emmagee.service.EmmageeService" />
</application>
Expand Down
Binary file added libs/commons-io-2.5.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
# project structure.

# Project target.
target=android-8
target=android-19
15 changes: 15 additions & 0 deletions res/drawable/table_border.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >

<stroke
android:width="1dp"
android:color="@color/gray" />

<padding
android:bottom="2dp"
android:left="2dp"
android:right="2dp"
android:top="2dp" />

</shape>
35 changes: 35 additions & 0 deletions res/layout/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:clickable="false"
android:background="@drawable/custom_checkbox"
android:button="@null"
android:checked="true"
Expand Down Expand Up @@ -131,6 +132,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:clickable="false"
android:background="@drawable/custom_checkbox"
android:button="@null"
android:checked="true"
Expand Down Expand Up @@ -158,6 +160,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:clickable="false"
android:background="@drawable/custom_checkbox"
android:button="@null"
android:checked="false"
Expand Down Expand Up @@ -196,6 +199,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:clickable="false"
android:background="@drawable/custom_checkbox"
android:button="@null"
android:checked="false"
Expand All @@ -212,7 +216,38 @@
android:layout_marginTop="@dimen/textview_horizontal_margin"
android:background="@color/white"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/test_report"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:padding="@dimen/layout_vertical_margin_small" >

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/test_report"
android:textColor="@color/black"
android:textSize="@dimen/text_size" />

<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="right" >

<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/right_arrow"
android:textSize="@dimen/text_size" />
</LinearLayout>
</LinearLayout>

<View
android:layout_width="match_parent"
android:layout_height="@dimen/line_height"
android:background="@color/light_gray" />

<LinearLayout
android:id="@+id/mail_settings"
android:layout_width="match_parent"
Expand Down
14 changes: 14 additions & 0 deletions res/layout/table_row.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/attrib_name"
android:textStyle="bold"/>
<TextView
android:id="@+id/attrib_value"
android:gravity="right"
android:textStyle="normal"/>

</LinearLayout>
28 changes: 28 additions & 0 deletions res/layout/test_list.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/light_purple"
android:gravity="bottom|center_horizontal|center_vertical"
android:orientation="vertical" >

<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >

<include
android:layout_width="match_parent"
android:layout_height="wrap_content"
layout="@layout/navigation_bar" />
</LinearLayout>

<ListView
android:id="@+id/test_list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:cacheColorHint="@color/light_purple"
android:listSelector="@color/light_purple" />

</LinearLayout>
19 changes: 19 additions & 0 deletions res/layout/test_list_item.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal" >

<TextView
android:id="@+id/package_name"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:ellipsize="end"
android:textSize="18sp"
android:gravity="center_vertical"
android:singleLine="true"
android:textColor="#5B5B5B"
android:paddingLeft="10dp"
android:paddingRight="10dp" />

</LinearLayout>
40 changes: 40 additions & 0 deletions res/layout/test_report.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/light_purple"
android:orientation="vertical" >

<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >

<include
android:layout_width="match_parent"
android:layout_height="wrap_content"
layout="@layout/navigation_bar" />
</LinearLayout>

<ScrollView
android:id="@+id/layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="horizontal|vertical" >

<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content" >

<TableLayout
android:id="@+id/table_layout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginLeft="3dp"
android:layout_marginRight="3dp"
android:layout_marginTop="3dp" >
</TableLayout>
</HorizontalScrollView>
</ScrollView>

</LinearLayout>
1 change: 1 addition & 0 deletions res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,5 @@

<string name="wake_lock">屏幕保持常亮</string>
<string name="wake_lock_on_toast">WakeLock已开启,屏幕会保持常亮</string>
<string name="test_report">测试报告</string>
</resources>
1 change: 1 addition & 0 deletions res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,5 @@
<string name="nougat_warning">Don\'t support 7.0 and above while Google has restricted access to shell commands and file system</string>
<string name="wake_lock">WakeLock</string>
<string name="wake_lock_on_toast">WakeLock is on,screen will stay awake</string>
<string name="test_report">Test Reports</string>
</resources>
48 changes: 20 additions & 28 deletions src/com/netease/qa/emmagee/activity/SettingsActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public class SettingsActivity extends Activity {
private TextView tvTime;
private LinearLayout about;
private LinearLayout mailSettings;
private LinearLayout testReport;

private SharedPreferences preferences;
private WakeLockHelper wakeLockHelper;
Expand All @@ -68,11 +69,13 @@ public void onCreate(Bundle savedInstanceState) {

wakeLockHelper = Settings.getDefaultWakeLock(this);

// init views
chkFloat = (CheckBox) findViewById(R.id.floating);
chkRoot = (CheckBox) findViewById(R.id.is_root);
chkAutoStop = (CheckBox) findViewById(R.id.auto_stop);
chkWakeLock = (CheckBox) findViewById(R.id.wake_lock);
tvTime = (TextView) findViewById(R.id.time);
testReport = (LinearLayout) findViewById(R.id.test_report);
about = (LinearLayout) findViewById(R.id.about);
mailSettings = (LinearLayout) findViewById(R.id.mail_settings);
SeekBar timeBar = (SeekBar) findViewById(R.id.timeline);
Expand All @@ -98,6 +101,12 @@ public void onCreate(Bundle savedInstanceState) {
chkAutoStop.setChecked(autoStop);
chkWakeLock.setChecked(wakeLock);

// start activity listener
layGoBack.setOnClickListener(startActivityListener(MainPageActivity.class));
testReport.setOnClickListener(startActivityListener(TestListActivity.class));
mailSettings.setOnClickListener(startActivityListener(MailSettingsActivity.class));
about.setOnClickListener(startActivityListener(AboutActivity.class));

timeBar.setProgress(interval);
timeBar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
@Override
Expand All @@ -117,34 +126,6 @@ public void onStopTrackingTouch(SeekBar arg0) {
}
});

layGoBack.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
SettingsActivity.this.finish();
Intent intent = new Intent();
intent.setClass(SettingsActivity.this, MainPageActivity.class);
startActivity(intent);
}
});

mailSettings.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
Intent intent = new Intent();
intent.setClass(SettingsActivity.this, MailSettingsActivity.class);
startActivity(intent);
}
});

about.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
Intent intent = new Intent();
intent.setClass(SettingsActivity.this, AboutActivity.class);
startActivity(intent);
}
});

floatingItem.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
Expand Down Expand Up @@ -203,6 +184,17 @@ public void onClick(View arg0) {
});
}

private OnClickListener startActivityListener(final Class<?> specClass) {
return new OnClickListener() {
@Override
public void onClick(View arg0) {
Intent intent = new Intent();
intent.setClass(SettingsActivity.this, specClass);
startActivityForResult(intent, Activity.RESULT_FIRST_USER);
}
};
}

@Override
protected void onDestroy() {
super.onDestroy();
Expand Down
Loading

0 comments on commit e164c4a

Please sign in to comment.