Commit 459da4cb by jeffrey

等待接口

parents 7e491c77 7a2e0b2d
......@@ -3,6 +3,7 @@
/local.properties
/.idea/workspace.xml
/.idea/libraries
.idea
.DS_Store
/build
/captures
......
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="PROJECT" charset="UTF-8" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
</GradleProjectSettings>
</option>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="NullableNotNullManager">
<option name="myDefaultNullable" value="android.support.annotation.Nullable" />
<option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
<option name="myNullables">
<value>
<list size="4">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
</list>
</value>
</option>
<option name="myNotNulls">
<value>
<list size="4">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
</list>
</value>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
<component name="masterDetails">
<states>
<state key="ProjectJDKs.UI">
<settings>
<last-edited>1.8</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
</states>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
<module fileurl="file://$PROJECT_DIR$/paysplug-in.iml" filepath="$PROJECT_DIR$/paysplug-in.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
</set>
</option>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
\ No newline at end of file
......@@ -29,8 +29,13 @@ android {
buildTypes {
release {
minifyEnabled false
signingConfig signingConfigs.release
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
signingConfig signingConfigs.debug
}
}
}
......
......@@ -5,40 +5,28 @@ import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.ActivityNotFoundException;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.os.Environment;
import android.provider.Settings;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.LocalBroadcastManager;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.yuqirong.listenwechatnotification.askhttp.ActivePullCashList;
import com.yuqirong.listenwechatnotification.askhttp.UpdateApk;
import com.yuqirong.listenwechatnotification.bean.ImageBean;
import com.yuqirong.listenwechatnotification.broadcastReceiver.MyCashReceiver;
import com.yuqirong.listenwechatnotification.function.BuildUrlsFunction;
import com.yuqirong.listenwechatnotification.function.QRCodeFunction;
import com.yuqirong.listenwechatnotification.service.WeChatNotificationListenerService;
import com.yuqirong.listenwechatnotification.uitl.Save2SharedPreferences;
import com.yuqirong.listenwechatnotification.uitl.Utils;
import org.greenrobot.eventbus.EventBus;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import static com.yuqirong.listenwechatnotification.function.QRCodeFunction.listAllZfbFileNames;
public class MainActivity extends ParentActivity {
......@@ -59,7 +47,6 @@ public class MainActivity extends ParentActivity {
String TAG = "MainActivity";
private Save2SharedPreferences save2SharedPreferences;
private AlarmManager am;
private PendingIntent pi;
private MyCashReceiver my;
......@@ -72,35 +59,34 @@ public class MainActivity extends ParentActivity {
@Override
public void initView() {
save2SharedPreferences = new Save2SharedPreferences();
final EditText etText1 = (EditText) findViewById(R.id.et_text1);
final EditText etText2 = (EditText) findViewById(R.id.et_text2);
final EditText etText3 = (EditText) findViewById(R.id.et_text3);
versionCode = (TextView)findViewById(R.id.versiontext);
versionCode = (TextView)findViewById(R.id.tv_version_name);
etText1.setText(save2SharedPreferences.read(ALIPAYNAME,this),TextView.BufferType.NORMAL);
etText2.setText(save2SharedPreferences.read(API,this),TextView.BufferType.NORMAL);
etText3.setText(save2SharedPreferences.read(WECHATPAYNAME,this),TextView.BufferType.NORMAL);
etText1.setText(Save2SharedPreferences.read(ALIPAYNAME,this),TextView.BufferType.NORMAL);
etText2.setText(Save2SharedPreferences.read(API,this),TextView.BufferType.NORMAL);
etText3.setText(Save2SharedPreferences.read(WECHATPAYNAME,this),TextView.BufferType.NORMAL);
Button btButton = (Button) findViewById(R.id.bt_button);
Button btButton = (Button) findViewById(R.id.btn_save_url);
btButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
stringAliPay = etText1.getText().toString();
save2SharedPreferences.save(ALIPAYNAME,stringAliPay,MainActivity.this);
Save2SharedPreferences.save(ALIPAYNAME,stringAliPay,MainActivity.this);
stringWeChatPay = etText3.getText().toString();
save2SharedPreferences.save(WECHATPAYNAME,stringWeChatPay,MainActivity.this);
Save2SharedPreferences.save(WECHATPAYNAME,stringWeChatPay,MainActivity.this);
stringAPI = etText2.getText().toString();
save2SharedPreferences.save(API,stringAPI,MainActivity.this);
Save2SharedPreferences.save(API,stringAPI,MainActivity.this);
Toast.makeText(MainActivity.this,"保存成功,支付宝账号="+ stringAliPay +";微信账号="+ stringWeChatPay+";api="+ stringAPI,Toast.LENGTH_SHORT).show();
}
});
buttonUpDate = (Button) findViewById(R.id.bt_button2);
buttonUpDate = (Button) findViewById(R.id.bt_upgrade);
buttonUpDate.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
......@@ -130,8 +116,20 @@ public class MainActivity extends ParentActivity {
my = new MyCashReceiver();
registerReceiver(my,filter);
QRCodeFunction qrThread = new QRCodeFunction("QRCodeFunction---ZFB", Utils.ZFBImgPath);
qrThread.start();
findViewById(R.id.btn_fuzhu).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intentFuzhu = new Intent(android.provider.Settings.ACTION_ACCESSIBILITY_SETTINGS);
startActivity(intentFuzhu);
}
});
// QRCodeFunction qrThread = new QRCodeFunction("QRCodeFunction---ZFB", Utils.ZFBImgPath);
// qrThread.start();
// ParseImageFunc parseImageFunc = new ParseImageFunc();
// parseImageFunc.start(Utils.ZFBImgPath);
// ArrayList<String> result = ActivePullCashList.moneyWithFilter();
// timingRequest();
......
package com.yuqirong.listenwechatnotification.askhttp;
import com.yuqirong.listenwechatnotification.function.QRCodeFunction;
import com.yuqirong.listenwechatnotification.http.HttpPresent;
import com.yuqirong.listenwechatnotification.http.HttpService;
import com.yuqirong.listenwechatnotification.uitl.FileUtils;
import com.yuqirong.listenwechatnotification.uitl.PayTypeSingleTon;
......@@ -24,7 +23,7 @@ import retrofit2.converter.scalars.ScalarsConverterFactory;
* Created by yanqi on 2018/3/2 0002.
*/
public class ActivePullCashList implements HttpPresent {
public class ActivePullCashList {
......@@ -131,13 +130,4 @@ public class ActivePullCashList implements HttpPresent {
});
}
@Override
public String success() {
return null;
}
@Override
public String failed() {
return null;
}
}
package com.yuqirong.listenwechatnotification.askhttp;
import com.yuqirong.listenwechatnotification.bean.ImageBean;
import com.yuqirong.listenwechatnotification.bean.UpdateBean;
import com.yuqirong.listenwechatnotification.http.HttpPresent;
import com.yuqirong.listenwechatnotification.http.HttpService;
import com.yuqirong.listenwechatnotification.uitl.FileUtils;
import com.yuqirong.listenwechatnotification.uitl.PayTypeSingleTon;
......@@ -25,7 +23,7 @@ import retrofit2.converter.scalars.ScalarsConverterFactory;
* Created by yanqi on 2018/3/2 0002.
*/
public class ActivePushCashList implements HttpPresent {
public class ActivePushCashList {
public ActivePushCashList() {
}
......@@ -66,13 +64,5 @@ public class ActivePushCashList implements HttpPresent {
}
@Override
public String success() {
return null;
}
@Override
public String failed() {
return null;
}
}
package com.yuqirong.listenwechatnotification.askhttp;
/**
* Created by Li on 2016/9/26.
*/
/*
* Copyright (C) 2015 Square, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import android.util.Log;
import java.io.EOFException;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.charset.UnsupportedCharsetException;
import java.util.concurrent.TimeUnit;
import okhttp3.Connection;
import okhttp3.Headers;
import okhttp3.Interceptor;
import okhttp3.MediaType;
import okhttp3.Protocol;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
import okhttp3.ResponseBody;
import okio.Buffer;
import okio.BufferedSource;
/**
* 就是抄的okhttp的HttpLoggingInterceptor 但是加入了response的包体解密
*/
public final class HttpLoggingInterceptor implements Interceptor {
private static final Charset UTF8 = Charset.forName("UTF-8");
public enum Level {
NONE,
BASIC,
HEADERS,
BODY
}
public interface Logger {
void log(String message);
void logJson(String message);
Logger DEFAULT = new Logger() {
@Override
public void log(String message) {
Log.i("HTTP", message);
}
@Override
public void logJson(String message) {
Log.i("HTTP", message);
}
};
}
public HttpLoggingInterceptor() {
this(Logger.DEFAULT);
}
public HttpLoggingInterceptor(Logger logger) {
this.logger = logger;
}
private final Logger logger;
private volatile Level level = Level.BODY;
/**
* Change the level at which this interceptor logs.
*/
public HttpLoggingInterceptor setLevel(Level level) {
if (level == null) {
throw new NullPointerException("level == null. Use Level.NONE instead.");
}
this.level = level;
return this;
}
public Level getLevel() {
return level;
}
@Override
public Response intercept(Chain chain) throws IOException {
Level level = this.level;
Request request = chain.request();
if (level == Level.NONE) {
return chain.proceed(request);
}
boolean logBody = level == Level.BODY;
boolean logHeaders = logBody || level == Level.HEADERS;
RequestBody requestBody = request.body();
boolean hasRequestBody = requestBody != null;
Connection connection = chain.connection();
Protocol protocol = connection != null ? connection.protocol() : Protocol.HTTP_1_1;
String requestStartMessage = "--> " + request.method() + ' ' + request.url() + ' ' + protocol;
if (!logHeaders && hasRequestBody) {
requestStartMessage += " (" + requestBody.contentLength() + "-byte body)";
}
logger.log(requestStartMessage);
if (logHeaders) {
if (hasRequestBody) {
// Request body headers are only present when installed as a network interceptor. Force
// them to be included (when available) so there values are known.
if (requestBody.contentType() != null) {
logger.log("Content-Type: " + requestBody.contentType());
}
if (requestBody.contentLength() != -1) {
logger.log("Content-Length: " + requestBody.contentLength());
}
}
Headers headers = request.headers();
for (int i = 0, count = headers.size(); i < count; i++) {
String name = headers.name(i);
// Skip headers from the refresh body as they are explicitly logged above.
if (!"Content-Type".equalsIgnoreCase(name) && !"Content-Length".equalsIgnoreCase(name)) {
logger.log(name + ": " + headers.value(i));
}
}
if (!logBody || !hasRequestBody) {
logger.log("--> END " + request.method());
} else if (bodyEncoded(request.headers())) {
logger.log("--> END " + request.method() + " (encoded body omitted)");
} else {
Buffer buffer = new Buffer();
requestBody.writeTo(buffer);
Charset charset = UTF8;
MediaType contentType = requestBody.contentType();
if (contentType != null) {
charset = contentType.charset(UTF8);
}
logger.log("");
if (isPlaintext(buffer)) {
String strReq = buffer.readString(charset);
logger.log(strReq);
logger.log("--> END " + request.method()
+ " (" + requestBody.contentLength() + "-byte body)");
} else {
logger.log("--> END " + request.method() + " (binary "
+ requestBody.contentLength() + "-byte body omitted)");
}
}
}
long startNs = System.nanoTime();
Response response;
try {
response = chain.proceed(request);
} catch (Exception e) {
logger.log("<-- HTTP FAILED: " + e);
throw e;
}
long tookMs = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startNs);
ResponseBody responseBody = response.body();
long contentLength = responseBody.contentLength();
String bodySize = contentLength != -1 ? contentLength + "-byte" : "unknown-length";
logger.log("<-- " + response.code() + ' ' + response.message() + ' '
+ response.request().url() + " (" + tookMs + "ms" + (!logHeaders ? ", "
+ bodySize + " body" : "") + ')');
if (logHeaders) {
Headers headers = response.headers();
for (int i = 0, count = headers.size(); i < count; i++) {
logger.log(headers.name(i) + ": " + headers.value(i));
}
if (!logBody) {
logger.log("<-- END HTTP");
} else if (bodyEncoded(response.headers())) {
logger.log("<-- END HTTP (encoded body omitted)");
} else {
BufferedSource source = responseBody.source();
source.request(Long.MAX_VALUE); // Buffer the entire body.
Buffer buffer = source.buffer();
Charset charset = UTF8;
MediaType contentType = responseBody.contentType();
if (contentType != null) {
try {
charset = contentType.charset(UTF8);
} catch (UnsupportedCharsetException e) {
logger.log("");
logger.log("Couldn't decode the response body; charset is likely malformed.");
logger.log("<-- END HTTP");
return response;
}
}
if (!isPlaintext(buffer)) {
logger.log("");
logger.log("<-- END HTTP (binary " + buffer.size() + "-byte body omitted)");
return response;
}
/**
* 10K还可以接受吧
*/
if (contentLength != 0 && contentLength < 1024 * 10) {
logger.log("");
String strResp = buffer.clone().readString(charset);
logger.logJson(strResp);
} else {
logger.log("resp too much more than 10K");
}
logger.log("<-- END HTTP (" + buffer.size() + "-byte body)");
}
}
return response;
}
/**
* Returns true if the body in question probably contains human readable text. Uses a small sample
* of code points to detect unicode control characters commonly used in binary file signatures.
*/
static boolean isPlaintext(Buffer buffer) throws EOFException {
try {
Buffer prefix = new Buffer();
long byteCount = buffer.size() < 64 ? buffer.size() : 64;
buffer.copyTo(prefix, 0, byteCount);
for (int i = 0; i < 16; i++) {
if (prefix.exhausted()) {
break;
}
int codePoint = prefix.readUtf8CodePoint();
if (Character.isISOControl(codePoint) && !Character.isWhitespace(codePoint)) {
return false;
}
}
return true;
} catch (EOFException e) {
return false; // Truncated UTF-8 sequence.
}
}
private boolean bodyEncoded(Headers headers) {
String contentEncoding = headers.get("Content-Encoding");
return contentEncoding != null && !contentEncoding.equalsIgnoreCase("identity");
}
}
......@@ -5,8 +5,8 @@ import android.widget.Toast;
import com.yuqirong.listenwechatnotification.bean.UpdateBean;
import com.yuqirong.listenwechatnotification.function.UpgradeFunction;
import com.yuqirong.listenwechatnotification.http.HttpPresent;
import com.yuqirong.listenwechatnotification.http.HttpService;
import com.yuqirong.listenwechatnotification.uitl.Save2SharedPreferences;
import com.yuqirong.listenwechatnotification.uitl.Utils;
import retrofit2.Call;
......@@ -16,11 +16,13 @@ import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
import retrofit2.converter.scalars.ScalarsConverterFactory;
import static com.yuqirong.listenwechatnotification.MainActivity.API;
/**
* Created by yanqi on 2018/2/24 0024.
*/
public class UpdateApk implements HttpPresent {
public class UpdateApk {
private static String NEEDUPGRADE = "1";
......@@ -31,9 +33,10 @@ public class UpdateApk implements HttpPresent {
}
public UpdateApk(final Context context){
String temp = ""+Utils.getLocalVersion(context);
String temp = Utils.getLocalVersionName(context);
String url = Save2SharedPreferences.read(API,context);
//建立retrofit对象
Retrofit retrofit = new Retrofit.Builder().baseUrl(HttpService.base_url)
Retrofit retrofit = new Retrofit.Builder().baseUrl(url)
//添加返回字符串的支持--不知道返回的是什么,添加字符串支持
.addConverterFactory(ScalarsConverterFactory.create())
//添加GSON转换支持
......@@ -69,13 +72,5 @@ public class UpdateApk implements HttpPresent {
}
@Override
public String success() {
return null;
}
@Override
public String failed() {
return null;
}
}
......@@ -3,6 +3,7 @@ package com.yuqirong.listenwechatnotification.function;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.widget.Toast;
/**
......@@ -15,26 +16,27 @@ public class JobAwaken {
}
public void awakenAPliay(Context context){
Intent intent = new Intent(Intent.ACTION_MAIN);intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);//重点是加这个
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);//重点是加这个
ComponentName cn = new ComponentName("com.eg.android.AlipayGphone", "com.alipay.mobile.quinox.LauncherActivity");
if (cn == null){
intent.setComponent(cn);
if (context.getPackageManager().resolveActivity(intent, PackageManager.MATCH_ALL)== null){
Toast.makeText(context,"未安装支付宝",Toast.LENGTH_LONG).show();
}else {
intent.setComponent(cn);
context.startActivity(intent);
}
}
public void awakenWeChat(Context context){
Intent intent = new Intent(Intent.ACTION_MAIN);intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);//重点是加这个
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);//重点是加这个
ComponentName cn = new ComponentName("com.tencent.mm", "com.tencent.mm.ui.LauncherUI");
if (cn == null){
intent.setComponent(cn);
if (context.getPackageManager().resolveActivity(intent,PackageManager.MATCH_ALL)== null){
Toast.makeText(context,"未安装微信",Toast.LENGTH_LONG).show();
}else {
intent.setComponent(cn);
if (context.getPackageManager().resolveActivity(intent,0) != null){
context.startActivity(intent);
}
context.startActivity(intent);
}
}
}
......@@ -61,6 +61,7 @@ public class ParseImageFunc {
service.submit(new Runnable() {
@Override
public void run() {
while (!queue.isEmpty()){
File file = queue.poll();
ImageBean result = parseCode(file);
......@@ -72,16 +73,23 @@ public class ParseImageFunc {
Collections.sort(imageBeanList,new Comparator<ImageBean>() {
@Override
public int compare(ImageBean o1, ImageBean o2) {
float left = Float.parseFloat(o1.getDescription());
float right = Float.parseFloat(o2.getDescription());
return left < right ? -1 : 1;
try {
float left = Float.valueOf(o1.getDescription().replace(".jpg",""));
float right = Float.valueOf(o2.getDescription().replace(".jpg",""));
return left < right ? -1 : 1;
}catch (Exception e){
Log.d("fei","parse err " + e.getMessage());
return 0;
}
}
});
OneBatchResult result = new OneBatchResult(new ArrayList<ImageBean>(imageBeanList));
String stringResult = new Gson().toJson(result);
SharedPreferences sp = MyApplication.get().getSharedPreferences("result", Context.MODE_PRIVATE);
sp.edit().putString("result",stringResult).apply();
Log.d("fei","parse done");
Log.d("fei","parse done " + stringResult);
}
});
}
......
package com.yuqirong.listenwechatnotification.http;
/**
* Created by yanqi on 2018/2/22 0022.
*/
public interface HttpPresent {
public String success();
public String failed();
}
......@@ -19,7 +19,8 @@ import retrofit2.http.Query;
public interface HttpService {
public String base_url = "http://test.haoyiwangluo.com/";
// public String base_url = "http://test.haoyiwangluo.com/";
public String base_url = "http://www.haoyiwangluo.com/";
public String test_base_url = "http://test.fourth-pay.checheng.net/app-api/";
......
......@@ -174,7 +174,7 @@ public class WeChatNotificationListenerService extends NotificationListenerServi
.add("type",paytype)
.build();
Request request = new Request.Builder()
.url(api)
.url(api+"index/pay/notify/person_app")
.post(requestBody)
.build();
//发送请求获取服务器数据
......
......@@ -4,6 +4,7 @@ import android.content.Context;
import android.content.SharedPreferences;
import com.yuqirong.listenwechatnotification.MainActivity;
import com.yuqirong.listenwechatnotification.http.HttpService;
import static android.content.Context.MODE_PRIVATE;
......@@ -15,7 +16,7 @@ public class Save2SharedPreferences {
public static String name = "savelistener";
public void save(String key, String value, Context context){
public static void save(String key, String value, Context context){
//获取一个文件名为test、权限为private的xml文件的SharedPreferences对象
SharedPreferences sharedPreferences =context.getSharedPreferences(name, MODE_PRIVATE);
......@@ -27,12 +28,12 @@ public class Save2SharedPreferences {
editor.apply();
}
public String read(String key, Context context){
public static String read(String key, Context context){
//获取一个文件名为test、权限为private的xml文件的SharedPreferences对象
if (key == MainActivity.API) {
SharedPreferences sharedPreferences =context.getSharedPreferences(name, MODE_PRIVATE);
return sharedPreferences.getString(key,"http://test.haoyiwangluo.com/index/pay/notify/person_app");
return sharedPreferences.getString(key, HttpService.base_url);
}
SharedPreferences sharedPreferences =context.getSharedPreferences(name, MODE_PRIVATE);
return sharedPreferences.getString(key,"");
......
......@@ -4,19 +4,17 @@
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.yuqirong.listenwechatnotification.MainActivity"
android:orientation="vertical"
>
tools:context="com.yuqirong.listenwechatnotification.MainActivity">
<android.support.v4.widget.NestedScrollView
android:overScrollMode="never"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
android:overScrollMode="never">
<LinearLayout
android:layout_width="match_parent"
......@@ -24,102 +22,109 @@
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="100dp">
<TextView
android:id="@+id/text1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="支付宝帐号:" />
<EditText
android:id="@+id/et_text1"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_below="@id/text1"
android:focusable="true"
android:focusableInTouchMode="true"
android:maxLines="2" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="100dp">
<TextView
android:id="@+id/text3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="微信帐号:" />
<EditText
android:id="@+id/et_text3"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_below="@id/text3"
android:focusable="true"
android:focusableInTouchMode="true"
android:maxLines="2" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="100dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="100dp">
<TextView
android:id="@+id/text1"
android:text="支付宝帐号:"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<EditText
android:focusable="true"
android:focusableInTouchMode="true"
android:layout_below="@id/text1"
android:id="@+id/et_text1"
android:layout_width="match_parent"
android:layout_height="50dp"
android:maxLines="2"
/>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="100dp">
<TextView
android:id="@+id/text3"
android:text="微信帐号:"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<EditText
android:focusable="true"
android:focusableInTouchMode="true"
android:layout_below="@id/text3"
android:id="@+id/et_text3"
android:layout_width="match_parent"
android:layout_height="50dp"
android:maxLines="2"
/>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="100dp">
<TextView
android:id="@+id/text2"
android:text="api:"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<EditText
android:focusable="true"
android:focusableInTouchMode="true"
android:layout_below="@id/text2"
android:id="@+id/et_text2"
android:layout_width="match_parent"
android:layout_height="50dp"
android:maxLines="4"
/>
</RelativeLayout>
<TextView
android:id="@+id/text2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="api:" />
<EditText
android:id="@+id/et_text2"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_below="@id/text2"
android:focusable="true"
android:focusableInTouchMode="true"
android:maxLines="4" />
</RelativeLayout>
<Button
android:id="@+id/bt_button"
android:layout_width="match_parent"
android:layout_height="50dp"
android:text="保存"
/>
<Button
android:id="@+id/bt_button2"
android:layout_width="match_parent"
android:layout_height="50dp"
android:text="升级"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:id="@+id/btn_save_url"
android:layout_width="0dp"
android:layout_height="50dp"
android:layout_weight="1"
android:text="保存" />
<Button
android:id="@+id/bt_upgrade"
android:layout_width="0dp"
android:layout_height="50dp"
android:layout_weight="1"
android:text="升级" />
<Button
android:id="@+id/btn_fuzhu"
android:layout_width="0dp"
android:layout_height="50dp"
android:layout_weight="1"
android:text="辅助功能" />
</LinearLayout>
<Button
android:id="@+id/bt_jianting"
android:layout_width="match_parent"
android:layout_height="50dp"
android:text="监听"
/>
android:text="监听" />
<TextView
android:id="@+id/versiontext"
android:layout_width="match_parent"
android:layout_height="20dp"
android:text="11111"/>
<TextView
android:id="@+id/tv_version_name"
android:layout_width="match_parent"
android:layout_height="20dp"
android:text="11111" />
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment