Skip to content

Commit

Permalink
4.1
Browse files Browse the repository at this point in the history
精简UI
  • Loading branch information
qsboy committed Mar 26, 2017
1 parent ec45306 commit d215cb8
Show file tree
Hide file tree
Showing 26 changed files with 101 additions and 206 deletions.
29 changes: 0 additions & 29 deletions Java/FAbout.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,13 @@
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;


public class FAbout extends Fragment {

TextView version;

ImageView image1;
ImageView image2;
ImageView image3;
ImageView image4;
ImageView image5;

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
Expand All @@ -40,13 +33,6 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
version = (TextView) view.findViewById(R.id.version);

setVersion();

image1 = (ImageView) view.findViewById(R.id.about_me_image_1);
image2 = (ImageView) view.findViewById(R.id.about_me_image_2);
image3 = (ImageView) view.findViewById(R.id.about_me_image_3);
image4 = (ImageView) view.findViewById(R.id.about_me_image_4);
image5 = (ImageView) view.findViewById(R.id.about_me_image_5);

view.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Expand Down Expand Up @@ -89,21 +75,6 @@ public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {

String TAG = "about";

@Override
public void onDestroy() {
super.onDestroy();
Log.i(TAG, "on destroy");

image1 = null;
image2 = null;
image3 = null;
image4 = null;
image5 = null;

System.gc();

}

@Override
public void onDetach() {
super.onDetach();
Expand Down
23 changes: 18 additions & 5 deletions Java/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,13 @@ public void onCreate(Bundle savedInstanceState) {

xFile = new XFile(this);

//wifi环境下检查更新
if (isWifi())
if (ifCheckVersion())
new XUpdate(this).checkUpdate();
checkUpdate();

checkPermission();

}


void initView() {

setContentView(R.layout.activity);
Expand Down Expand Up @@ -126,7 +124,6 @@ protected void onResume() {

void checkPermission() {
if (!XCheckPermission.checkFloatWindowPermission(this)) {
// TODO: 2017/3/19 加一个对话框再跳转
AlertDialog dialog;
AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.Dialog);
builder.setMessage("检测到您是小米手机, 请打开悬浮窗权限以保证软件正常运行");
Expand Down Expand Up @@ -240,6 +237,22 @@ private boolean isWifi() {
return false;
}

public void checkUpdate(View view) {
//wifi环境下检查更新
XUpdate xUpdate = new XUpdate(this);
xUpdate.checkUpdate();
if (!xUpdate.needUpdate)
XToast.makeText(this, "已是最新版").show();

}

void checkUpdate() {
//wifi环境下检查更新
if (isWifi())
if (ifCheckVersion())
new XUpdate(this).checkUpdate();
}

/**
* 之前的版本加了"清除数据"的按钮,后来去掉了
*/
Expand Down
13 changes: 8 additions & 5 deletions Java/XUpdate.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ class XUpdate {
private String TAG = "X-Update";
private Intent intent;

boolean needUpdate = true;

XUpdate(Context context) {

mContext = context;
Expand Down Expand Up @@ -111,10 +113,12 @@ private boolean needUpdate() {
} catch (NameNotFoundException e) {
e.printStackTrace();
}
boolean a = serverVersion > localVersion;
boolean b = serverVersion > localVersion;
Log.i(TAG, "local version code : " + localVersion);
Log.i(TAG, "need update? " + a);
return a;
Log.i(TAG, "need update? " + b);

needUpdate = b;
return b;
}

private void showNoticeDialog() {
Expand Down Expand Up @@ -169,14 +173,13 @@ public void run() {
Log.w(TAG, "用时 " + (end.getTime() - start.getTime()) + " mm");
Log.w(TAG, "存储位置 : " + apkFile);

new XNotification(mContext,intent).showInstall();

break;
}
fos.write(buffer, 0, readNumber);
}
fos.close();
is.close();
new XNotification(mContext,intent).showInstall();

} catch (Exception e) {
e.printStackTrace();
Expand Down
2 changes: 0 additions & 2 deletions res/anim/menu_enter.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
<!--
~ Copyright (c) 2017.
~ qsboy.com 版权所有
~
~ Last modified 17-2-21 下午5:58
-->

<set xmlns:android="http://schemas.android.com/apk/res/android"
Expand Down
2 changes: 0 additions & 2 deletions res/anim/menu_exit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
<!--
~ Copyright (c) 2017.
~ qsboy.com 版权所有
~
~ Last modified 17-2-21 下午5:58
-->

<set xmlns:android="http://schemas.android.com/apk/res/android">
Expand Down
2 changes: 0 additions & 2 deletions res/anim/toast_enter.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
<!--
~ Copyright (c) 2017.
~ qsboy.com 版权所有
~
~ Last modified 17-2-21 下午5:58
-->

<set xmlns:android="http://schemas.android.com/apk/res/android">
Expand Down
2 changes: 0 additions & 2 deletions res/anim/toast_exit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
<!--
~ Copyright (c) 2017.
~ qsboy.com 版权所有
~
~ Last modified 17-2-21 下午5:58
-->

<set xmlns:android="http://schemas.android.com/apk/res/android">
Expand Down
2 changes: 0 additions & 2 deletions res/drawable/bg_content.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<!--
~ Copyright (c) 2017.
~ qsboy.com 版权所有
~
~ Last modified 17-2-21 下午5:58
-->

<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
Expand Down
2 changes: 0 additions & 2 deletions res/drawable/bg_head.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
<!--
~ Copyright (c) 2017.
~ qsboy.com 版权所有
~
~ Last modified 17-2-21 下午5:58
-->

<shape xmlns:android="http://schemas.android.com/apk/res/android" >
Expand Down
2 changes: 0 additions & 2 deletions res/drawable/bg_toast.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
<!--
~ Copyright (c) 2017.
~ qsboy.com 版权所有
~
~ Last modified 17-2-21 下午5:58
-->

<shape xmlns:android="http://schemas.android.com/apk/res/android" >
Expand Down
2 changes: 0 additions & 2 deletions res/drawable/bg_top.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
<!--
~ Copyright (c) 2017.
~ qsboy.com 版权所有
~
~ Last modified 17-2-21 下午5:58
-->

<shape xmlns:android="http://schemas.android.com/apk/res/android" >
Expand Down
2 changes: 0 additions & 2 deletions res/drawable/ic_menu.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<!--
~ Copyright (c) 2017.
~ qsboy.com 版权所有
~
~ Last modified 17-2-21 下午5:58
-->

<vector
Expand Down
2 changes: 0 additions & 2 deletions res/layout/activity.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
<!--
~ Copyright (c) 2017.
~ qsboy.com 版权所有
~
~ Last modified 17-2-21 下午5:58
-->

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
Expand Down
Loading

0 comments on commit d215cb8

Please sign in to comment.