Skip to content

Commit

Permalink
UI reform.
Browse files Browse the repository at this point in the history
  • Loading branch information
Zhongyi Tong committed Aug 1, 2016
1 parent c3e2313 commit 6b1eba8
Show file tree
Hide file tree
Showing 20 changed files with 167 additions and 103 deletions.
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.media.Image;
import android.os.Build;
import android.os.Bundle;
import android.os.Parcelable;
Expand All @@ -14,11 +15,10 @@
import android.view.Window;
import android.view.WindowManager;
import android.view.accessibility.AccessibilityManager;
import android.widget.Button;
import android.widget.*;

import java.util.List;

import android.widget.Toast;
import xyz.monkeytong.hongbao.R;
import xyz.monkeytong.hongbao.fragments.GeneralSettingsFragment;
import xyz.monkeytong.hongbao.utils.ConnectivityUtil;
Expand All @@ -30,7 +30,8 @@
public class MainActivity extends Activity implements AccessibilityManager.AccessibilityStateChangeListener {

//开关切换按钮
private Button switchPlugin;
private TextView pluginStatusText;
private ImageView pluginStatusIcon;
//AccessibilityService 管理
private AccessibilityManager accessibilityManager;

Expand All @@ -39,7 +40,8 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
CrashReport.initCrashReport(getApplicationContext(), "900019352", false);
setContentView(R.layout.activity_main);
switchPlugin = (Button) findViewById(R.id.button_accessible);
pluginStatusText = (TextView) findViewById(R.id.layout_control_accessibility_text);
pluginStatusIcon = (ImageView) findViewById(R.id.layout_control_accessibility_icon);

handleMaterialStatusBar();

Expand Down Expand Up @@ -69,7 +71,7 @@ private void handleMaterialStatusBar() {

window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);

window.setStatusBarColor(0xffd84e43);
window.setStatusBarColor(0xffE46C62);

}

Expand All @@ -89,7 +91,7 @@ protected void onDestroy() {
super.onDestroy();
}

public void onButtonClicked(View view) {
public void openAccessibility(View view) {
try {
Intent accessibleIntent = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
startActivity(accessibleIntent);
Expand All @@ -100,17 +102,17 @@ public void onButtonClicked(View view) {

}

public void openGithub(View view) {
public void openGitHub(View view) {
Intent webViewIntent = new Intent(this, WebViewActivity.class);
webViewIntent.putExtra("title", "GitHub项目主页");
webViewIntent.putExtra("title", "GitHub 项目主页");
webViewIntent.putExtra("url", "https://github.com/geeeeeeeeek/WeChatLuckyMoney");
startActivity(webViewIntent);
}

public void openGithubReleaseNotes(View view) {
public void openUber(View view) {
Intent webViewIntent = new Intent(this, WebViewActivity.class);
webViewIntent.putExtra("title", "发布日志");
webViewIntent.putExtra("url", "https://github.com/geeeeeeeeek/WeChatLuckyMoney/issues?q=is%3Aissue+is%3Aopen+label%3A%22release+notes%22");
webViewIntent.putExtra("title", "Uber 优惠乘车机会");
webViewIntent.putExtra("url", "https://get.uber.com.cn/invite/rgk2wue");
startActivity(webViewIntent);
}

Expand All @@ -132,9 +134,11 @@ public void onAccessibilityStateChanged(boolean enabled) {
*/
private void updateServiceStatus() {
if (isServiceEnabled()) {
switchPlugin.setText(R.string.service_off);
pluginStatusText.setText(R.string.service_off);
pluginStatusIcon.setBackgroundResource(R.mipmap.ic_stop);
} else {
switchPlugin.setText(R.string.service_on);
pluginStatusText.setText(R.string.service_on);
pluginStatusIcon.setBackgroundResource(R.mipmap.ic_start);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ private void loadUI() {

window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);

window.setStatusBarColor(0xffd84e43);
window.setStatusBarColor(0xffE46C62);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ private void loadUI() {

window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);

window.setStatusBarColor(0xffd84e43);
window.setStatusBarColor(0xffE46C62);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ private void checkNodeInfo(int eventType) {
signature.commentString = null;
}

//meow meow meow
/* 聊天会话窗口,遍历节点匹配“领取红包”和"查看红包" */
AccessibilityNodeInfo node1 = (sharedPreferences.getBoolean("pref_watch_self", false)) ?
this.getTheLastNode(WECHAT_VIEW_OTHERS_CH, WECHAT_VIEW_SELF_CH) : this.getTheLastNode(WECHAT_VIEW_OTHERS_CH);
Expand Down
179 changes: 119 additions & 60 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,66 +6,125 @@
android:layout_width="fill_parent"
android:layout_height="0dp"
android:id="@+id/main_action_bar_placeholder" android:layout_alignParentTop="true"
android:background="#d65645" android:layout_alignTop="@+id/textView"/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:id="@+id/textView" android:background="@mipmap/bg_action_bar" android:text="微信红包" android:textColor="#fee1b4"
android:gravity="center_vertical|center_horizontal"
android:textSize="26dp" android:autoText="false"/>
android:background="#d65645"/>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="fill_parent" android:id="@+id/layout_header"
android:layout_above="@+id/layout_control" android:background="#E46C62" android:layout_marginBottom="12dp"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/textView" android:text="微信红包"
android:textColor="#fff"
android:gravity="center_vertical|center_horizontal"
android:textSize="28dp"
android:layout_above="@+id/layout_control"
android:layout_alignParentTop="true" android:layout_marginTop="40dp" android:textIsSelectable="false"/>
<TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/textView5"
android:text="v3.0" android:textColor="#fff" android:gravity="center_vertical|center_horizontal"
android:layout_above="@+id/layout_control" android:layout_alignParentTop="true"
android:layout_marginTop="4dp"/>
</LinearLayout>

<ImageView
android:layout_width="44dp"
android:layout_height="44dp"
android:id="@+id/imageView2"
android:src="@mipmap/ic_settings"
android:padding="10dp"
android:onClick="openSettings"
android:layout_alignRight="@+id/textView" android:layout_below="@+id/main_action_bar_placeholder"
android:layout_marginRight="6dp" android:layout_marginTop="6dp"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageView" android:src="@mipmap/open"
android:scaleType="centerInside"
android:layout_above="@+id/textView3"
android:layout_centerHorizontal="true" android:onClick="openGithub" android:clickable="true"
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="@android:style/TextAppearance.DeviceDefault.Medium"
android:text="@string/app_version"
android:id="@+id/textView3"
android:gravity="center" android:onClick="openGithub"
android:clickable="true" android:layout_centerInParent="true" android:textColor="#c5a45e"
android:paddingTop="6dp" android:paddingBottom="1dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="查看最新版本功能介绍"
android:id="@+id/textView2" android:layout_below="@+id/textView3"
android:layout_centerHorizontal="true" android:clickable="true" android:onClick="openGithubReleaseNotes"
android:layout_marginTop="3dp" android:textColor="#999999"/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="https://github.com/geeeeeeeeek/WeChatLuckyMoney"
android:id="@+id/github" android:gravity="center_horizontal"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true" android:layout_marginBottom="20dp" android:layout_marginTop="20dp"
android:textColor="#5272ae" android:clickable="true" android:onClick="openGithub"/>
<Button
android:id="@+id/button_accessible"
android:text="@string/service_name"
<LinearLayout android:id="@+id/layout_control" android:orientation="horizontal" android:layout_width="match_parent"
android:layout_height="110dp" android:layout_above="@+id/layout_uber" android:layout_marginLeft="16dp"
android:layout_marginRight="16dp" android:layout_marginTop="8dp"
android:layout_marginBottom="8dp">
<LinearLayout style="?android:attr/borderlessButtonStyle" android:id="@+id/layout_control_community"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:background="#fff" android:textColor="#858585"
android:layout_above="@+id/layout_uber" android:textSize="20dp" android:orientation="vertical"
android:layout_weight="0.35" android:layout_marginRight="5dp" android:onClick="openGitHub">
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:id="@+id/imageView" android:src="@mipmap/ic_community" android:layout_margin="10dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="社区"
android:id="@+id/textView2" android:layout_margin="5dp" android:textColor="#858585"/>
</LinearLayout>
<LinearLayout
android:id="@+id/layout_control_accessibility"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:onClick="openAccessibility"
android:background="#fff" android:textColor="#858585"
style="?android:attr/borderlessButtonStyle"
android:layout_above="@+id/layout_uber"
android:textSize="20dp" android:orientation="vertical" android:layout_weight="0.3"
android:layout_marginRight="5dp" android:layout_marginLeft="5dp">
<ImageView android:layout_width="32dp" android:layout_height="32dp" android:id="@+id/layout_control_accessibility_icon"
android:layout_marginBottom="4dp" android:layout_marginTop="4dp"
android:background="@mipmap/ic_start"/>
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="开启插件"
android:id="@+id/layout_control_accessibility_text" android:layout_margin="5dp" android:textColor="#dfaa6a"/>
</LinearLayout>
<LinearLayout style="?android:attr/borderlessButtonStyle" android:id="@+id/layout_control_settings"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:background="#fff" android:textColor="#858585"
android:layout_above="@+id/layout_uber" android:textSize="20dp" android:orientation="vertical"
android:layout_weight="0.35" android:layout_marginLeft="5dp" android:onClick="openSettings">
<ImageView android:layout_width="24dp" android:layout_height="24dp" android:id="@+id/imageView4"
android:layout_margin="10dp" android:src="@mipmap/ic_settings"/>
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="设置"
android:id="@+id/textView3" android:layout_margin="5dp" android:textColor="#858585"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/layout_uber"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="60dp"
android:onClick="onButtonClicked" android:layout_alignParentBottom="false"
android:background="#24e2b379" android:textColor="#c5a45e"
style="?android:attr/borderlessButtonStyle"
android:layout_marginRight="16dp" android:layout_marginLeft="16dp" android:layout_above="@+id/github"
android:textSize="20dp"/>
android:layout_height="72dp"
android:layout_marginLeft="16dp" android:layout_marginRight="16dp"
android:background="#ffffff" android:layout_marginTop="8dp"
android:layout_alignParentBottom="false" android:layout_above="@+id/linearLayout2"
android:layout_marginBottom="8dp" android:onClick="openUber">
<ImageView
android:layout_width="60dp"
android:layout_height="60dp"
android:id="@+id/icon_uber" android:src="@mipmap/ic_uber" android:layout_marginLeft="15dp"
android:layout_marginRight="10dp" android:layout_gravity="center_vertical"
android:layout_marginBottom="2dp"/>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content" android:id="@+id/layout_uber_text"
android:layout_gravity="center_vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="前 3 次乘车均可获得 ¥16 优惠"
android:id="@+id/label_uber_text" android:layout_margin="2dp" android:textColor="#858585"/>
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="立即获得免费乘车机会" android:id="@+id/label_uber_link" android:layout_margin="2dp"
android:textColor="#dfaa6a"/>
</LinearLayout>
</LinearLayout>
<LinearLayout android:id="@+id/linearLayout2" android:orientation="horizontal" android:layout_width="match_parent"
android:layout_height="40dp" android:layout_marginLeft="16dp" android:layout_marginRight="16dp"
android:background="#ffffff" android:layout_marginTop="8dp" android:layout_marginBottom="24dp"
android:layout_alignParentBottom="true" android:onClick="openGitHub">
<ImageView android:layout_width="20dp" android:layout_height="20dp" android:id="@+id/imageView2"
android:src="@mipmap/ic_github" android:layout_marginLeft="20dp" android:layout_marginRight="10dp"
android:layout_gravity="center_vertical"/>
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="在 GitHub 上" android:id="@+id/textView6" android:layout_margin="2dp"
android:textColor="#858585"
android:layout_gravity="center_vertical"/>
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text=""
android:id="@+id/textView7" android:textColor="#dfaa6a"
android:layout_gravity="center_vertical"
android:paddingBottom="1dp"/>
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Star"
android:id="@+id/textView8" android:textColor="#dfaa6a"
android:layout_gravity="center_vertical" android:layout_marginLeft="2dp"
android:layout_marginRight="2dp"/>
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="本项目,支持应用开源"
android:id="@+id/textView9" android:layout_margin="2dp" android:textColor="#858585"
android:layout_gravity="center_vertical"/>
</LinearLayout>
</RelativeLayout>
16 changes: 8 additions & 8 deletions app/src/main/res/layout/activity_preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,31 @@

<RelativeLayout android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#d84e43"
android:background="#E46C62"
tools:context=".SettingsActivity"
>
<TextView android:layout_width="wrap_content" android:layout_height="60dp"
<TextView android:layout_width="wrap_content" android:layout_height="54dp"
android:id="@+id/settings_bar"
android:text="@string/preference" android:textColor="#fde1b5"
android:text="@string/preference" android:textColor="#fff"
android:gravity="left|center_vertical|center_horizontal"
android:elegantTextHeight="false" android:textSize="20sp"
android:elegantTextHeight="false" android:textSize="18sp"
android:layout_toRightOf="@+id/preference_back"
/>
<ImageView
android:layout_width="40dp"
android:layout_height="match_parent"
android:id="@+id/preference_back"
android:layout_marginLeft="10dp"
android:layout_marginRight="8dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:clickable="true" android:onClick="performBack"
android:layout_alignBottom="@+id/settings_bar"
android:src="@mipmap/ic_back"/>
android:src="@mipmap/ic_back" android:padding="10dp"/>
<ImageView android:layout_width="40dp" android:layout_height="match_parent" android:id="@+id/imageView3"
android:clickable="true"
android:onClick="enterAccessibilityPage"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp" android:layout_marginLeft="8dp"
android:padding="6dp" android:src="@mipmap/ic_refresh"
android:padding="8dp" android:src="@mipmap/ic_refresh"
android:layout_alignBottom="@+id/settings_bar"/>
</RelativeLayout>
<FrameLayout android:layout_width="match_parent"
Expand Down
Loading

0 comments on commit 6b1eba8

Please sign in to comment.