Skip to content
This repository has been archived by the owner on Jul 30, 2020. It is now read-only.

Commit

Permalink
Merge pull request #117 from geeeeeeeeek/release/2.2
Browse files Browse the repository at this point in the history
Release/2.2
  • Loading branch information
Zhongyi Tong authored and Zhongyi Tong committed Feb 4, 2016
2 parents b7bcccf + d709c38 commit dd8e17c
Show file tree
Hide file tree
Showing 22 changed files with 472 additions and 93 deletions.
22 changes: 21 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,26 @@
# 更新日志

**[v2.1 (2016.01.30)](https://github.com/geeeeeeeeek/WeChatLuckyMoney/releases/tag/v2.1)**
**[v2.2 (2016.02.04)](https://github.com/geeeeeeeeek/WeChatLuckyMoney/releases/tag/v2.2)**

- 新增 延时拆开红包的可选项


- 新增 跳转至浏览器打开的入口
- 新增 接入腾讯Bugly
- 新增 自动回复的可选项(实验中)


- 优化 手动拆开的红包不返回


- 优化 适配三星等坑爹机型 (感谢 [@firesunCN](https://github.com/firesunCN) 对这项修改的贡献)


- 修复 拆开红包后的多次返回问题



**[v2.1 (2016.01.30)](https://github.com/geeeeeeeeek/WeChatLuckyMoney/releases/tag/v2.1.1)**

- 新增 屏蔽指定红包文字的可选项

Expand Down
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# 微信红包

[![forthebadge](http://forthebadge.com/images/badges/designed-in-ms-paint.svg)](http://forthebadge.com)[![forthebadge](http://forthebadge.com/images/badges/powered-by-electricity.svg)](http://forthebadge.com)

[![Gitter](https://badges.gitter.im/geeeeeeeeek/WeChatLuckyMoney.svg)](https://gitter.im/geeeeeeeeek/WeChatLuckyMoney?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=body_badge) [![Build Status](https://travis-ci.org/geeeeeeeeek/WeChatLuckyMoney.svg?branch=stable)](https://travis-ci.org/geeeeeeeeek/WeChatLuckyMoney) [**README IN ENGLISH**](https://github.com/geeeeeeeeek/WeChatLuckyMoney/blob/stable/README_EN.md)
[![Gitter](https://badges.gitter.im/geeeeeeeeek/WeChatLuckyMoney.svg)](https://gitter.im/geeeeeeeeek/WeChatLuckyMoney?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=body_badge) [![Build Status](https://travis-ci.org/geeeeeeeeek/WeChatLuckyMoney.svg?branch=stable)](https://travis-ci.org/geeeeeeeeek/WeChatLuckyMoney) [**ENGLISH**](https://github.com/geeeeeeeeek/WeChatLuckyMoney/blob/stable/README_EN.md)

一个帮助你在微信抢红包时战无不胜的Android应用。自动检测并且拆开红包,速度超乎你的想象。

Expand All @@ -16,7 +14,7 @@

- **不仅快人一步,红包识别更加智能**

多种特征标识,聊天时不再重复点击红包。智能过滤红包关键字[[?]](https://github.com/geeeeeeeeek/WeChatLuckyMoney/issues/97),避免落入“专属红包”、“抢到翻倍”的陷阱。
多种特征标识,聊天时不再重复点击红包。智能过滤红包关键字[[?]](https://github.com/geeeeeeeeek/WeChatLuckyMoney/issues/97),避免落入“专属红包”、“抢到翻倍”的陷阱。还可以设置延时抢红包和自动回复感谢语[[?]](https://github.com/geeeeeeeeek/WeChatLuckyMoney/issues/118)

- **紧跟微信更新,内置最新春节红包资讯**

Expand Down
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ android {
minSdkVersion 16
targetSdkVersion 22
versionCode 2
versionName "v2.1.1"
versionName "v2.2"
ndk {
//设置支持的SO库架构
abiFilters 'armeabi' //, 'x86', 'armeabi-v7a', 'x86_64', 'arm64-v8a'
Expand Down
15 changes: 9 additions & 6 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,32 @@
<uses-permission android:name="android.permission.DISABLE_KEYGUARD"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.READ_LOGS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.READ_LOGS"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name">
<activity
android:name=".activities.MainActivity"
android:label="@string/app_name"
android:theme="@style/Base.Theme.AppCompat.Light">
android:theme="@style/Base.Theme.AppCompat.Light"
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity android:name=".activities.SettingsActivity"
android:theme="@style/Base.Theme.AppCompat.Light">
android:theme="@style/Base.Theme.AppCompat.Light"
android:launchMode="standard">
</activity>
<activity android:name=".activities.WebViewActivity"
android:theme="@style/Base.Theme.AppCompat.Light">
android:theme="@style/Base.Theme.AppCompat.Light"
android:launchMode="standard">
</activity>
<service
android:name=".services.HongbaoService"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.os.Parcelable;
import android.preference.PreferenceManager;
import android.provider.Settings;
import android.view.View;
Expand All @@ -18,6 +19,7 @@
import java.util.List;

import xyz.monkeytong.hongbao.R;
import xyz.monkeytong.hongbao.fragments.GeneralSettingsFragment;
import xyz.monkeytong.hongbao.utils.ConnectivityUtil;
import xyz.monkeytong.hongbao.utils.UpdateTask;

Expand Down Expand Up @@ -49,7 +51,7 @@ protected void onCreate(Bundle savedInstanceState) {
}

private void explicitlyLoadPreferences() {
PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
PreferenceManager.setDefaultValues(this, R.xml.general_preferences, false);
}

/**
Expand Down Expand Up @@ -107,6 +109,8 @@ public void openGithubReleaseNotes(View view) {

public void openSettings(View view) {
Intent settingsIntent = new Intent(this, SettingsActivity.class);
settingsIntent.putExtra("title", "偏好设置");
settingsIntent.putExtra("frag_id", "GeneralSettingsFragment");
startActivity(settingsIntent);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
package xyz.monkeytong.hongbao.activities;

import android.content.Context;
import android.content.SharedPreferences;
import android.preference.DialogPreference;
import android.util.AttributeSet;
import android.view.View;
import android.widget.EditText;
import android.widget.SeekBar;
import android.widget.TextView;
import org.w3c.dom.Text;
import xyz.monkeytong.hongbao.R;

/**
* Created by Zhongyi on 2/3/16.
*/
public class SeekBarPreference extends DialogPreference {
private SeekBar seekBar;
private TextView textView;
private String hintText, prefKind;

public SeekBarPreference(Context context, AttributeSet attrs) {
super(context, attrs);
setDialogLayoutResource(R.layout.preference_seekbar);

for (int i = 0; i < attrs.getAttributeCount(); i++) {
String attr = attrs.getAttributeName(i);
if (attr.equalsIgnoreCase("pref_kind")) {
prefKind = attrs.getAttributeValue(i);
break;
}
}
if (prefKind.equals("pref_open_delay")) {
hintText = "拆开红包";
} else if (prefKind.equals("pref_comment_delay")) {
hintText = "发送回复(暂不支持延时)";
}
}

@Override
protected void onBindDialogView(View view) {
super.onBindDialogView(view);

SharedPreferences pref = getSharedPreferences();

int delay = pref.getInt(prefKind, 0);
this.seekBar = (SeekBar) view.findViewById(R.id.delay_seekBar);
this.seekBar.setProgress(delay);

if (prefKind.equals("pref_comment_delay")) {
this.seekBar.setEnabled(false);
}

this.textView = (TextView) view.findViewById(R.id.pref_seekbar_textview);
if (delay == 0) {
this.textView.setText("立即" + hintText);
} else {
this.textView.setText("延迟" + delay + "秒" + hintText);
}

this.seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int i, boolean b) {
if (i == 0) {
textView.setText("立即" + hintText);
} else {
textView.setText("延迟" + i + "秒" + hintText);
}
}

@Override
public void onStartTrackingTouch(SeekBar seekBar) {

}

@Override
public void onStopTrackingTouch(SeekBar seekBar) {

}
});
}

@Override
protected void onDialogClosed(boolean positiveResult) {
if (positiveResult) {
SharedPreferences.Editor editor = getEditor();
editor.putInt(prefKind, this.seekBar.getProgress());
editor.commit();
}
super.onDialogClosed(positiveResult);
}
}
Original file line number Diff line number Diff line change
@@ -1,76 +1,71 @@
package xyz.monkeytong.hongbao.activities;

import android.annotation.TargetApi;
import android.app.Activity;
import android.app.Fragment;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Parcelable;
import android.preference.Preference;
import android.preference.PreferenceActivity;
import android.preference.PreferenceManager;
import android.provider.Settings;
import android.support.v4.app.FragmentActivity;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.TextView;
import org.w3c.dom.Text;
import xyz.monkeytong.hongbao.R;
import xyz.monkeytong.hongbao.fragments.CommentSettingsFragment;
import xyz.monkeytong.hongbao.fragments.GeneralSettingsFragment;
import xyz.monkeytong.hongbao.utils.UpdateTask;

/**
* Created by Zhongyi on 1/19/16.
* Settings page.
*/
public class SettingsActivity extends PreferenceActivity {
public class SettingsActivity extends FragmentActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_preferences);

loadUI();
setPrefListeners();
prepareSettings();
}

private void setPrefListeners() {
// Check for updates
Preference updatePref = findPreference("pref_etc_check_update");
updatePref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
public boolean onPreferenceClick(Preference preference) {
new UpdateTask(getApplicationContext(), true).update();
return false;
}
});

// Open issue
Preference issuePref = findPreference("pref_etc_issue");
issuePref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
public boolean onPreferenceClick(Preference preference) {
Intent webViewIntent = new Intent(SettingsActivity.this, WebViewActivity.class);
webViewIntent.putExtra("title", "Github Issues");
webViewIntent.putExtra("url", getString(R.string.url_github_issues));
webViewIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(webViewIntent);
return false;
}
});

Preference excludeWordsPref = findPreference("pref_watch_exclude_words");
String summary = getResources().getString(R.string.pref_watch_exclude_words_summary);
String value = PreferenceManager.getDefaultSharedPreferences(this).getString("pref_watch_exclude_words", "");
if (value.length() > 0) excludeWordsPref.setSummary(summary + ":" + value);

excludeWordsPref.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object o) {
String summary = getResources().getString(R.string.pref_watch_exclude_words_summary);
if (o != null && o.toString().length() > 0) preference.setSummary(summary + ":" + o.toString());
return true;
}
});
private void prepareSettings() {
String title, fragId;
Bundle bundle = getIntent().getExtras();
if (bundle != null) {
title = bundle.getString("title");
fragId = bundle.getString("frag_id");
} else {
title = "偏好设置";
fragId = "GeneralSettingsFragment";
}

TextView textView = (TextView) findViewById(R.id.settings_bar);
textView.setText(title);

FragmentManager fragmentManager = getFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();

if ("GeneralSettingsFragment".equals(fragId)) {
fragmentTransaction.replace(R.id.preferences_fragment, new GeneralSettingsFragment());
} else if ("CommentSettingsFragment".equals(fragId)) {
fragmentTransaction.replace(R.id.preferences_fragment, new CommentSettingsFragment());
}
fragmentTransaction.commit();
}

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void loadUI() {
setContentView(R.layout.activity_preferences);
addPreferencesFromResource(R.xml.preferences);

if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) return;

Window window = this.getWindow();
Expand All @@ -80,7 +75,6 @@ private void loadUI() {
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);

window.setStatusBarColor(0xffd84e43);

}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
*/
public class WebViewActivity extends Activity {
private WebView webView;
private String webViewUrl, webViewTitle;

@Override
protected void onCreate(Bundle savedInstanceState) {
Expand All @@ -38,8 +39,8 @@ protected void onCreate(Bundle savedInstanceState) {

Bundle bundle = getIntent().getExtras();
if (bundle != null && !bundle.isEmpty()) {
String webViewTitle = bundle.getString("title");
String webViewUrl = bundle.getString("url");
webViewTitle = bundle.getString("title");
webViewUrl = bundle.getString("url");

TextView webViewBar = (TextView) findViewById(R.id.webview_bar);
webViewBar.setText(webViewTitle);
Expand Down Expand Up @@ -105,4 +106,10 @@ public boolean onKeyDown(int keyCode, KeyEvent event) {
}
return super.onKeyDown(keyCode, event);
}

public void openLink(View view) {
Intent intent = new Intent(Intent.ACTION_VIEW,
Uri.parse(this.webViewUrl));
startActivity(intent);
}
}
Loading

0 comments on commit dd8e17c

Please sign in to comment.