Skip to content

Commit

Permalink
4.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
qsboy committed Mar 25, 2017
1 parent 189e72c commit ec45306
Show file tree
Hide file tree
Showing 37 changed files with 614 additions and 279 deletions.
12 changes: 12 additions & 0 deletions Java/FMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.content.ContextCompat;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import static com.qiansheng.messagecapture.Debug.DebugEnabled;

public class FMenu extends Fragment implements View.OnClickListener {

private final String TAG = "FMenu";
Expand Down Expand Up @@ -62,6 +65,15 @@ void initBtn(View view) {
btn_skip.setOnClickListener(this);
btn_debug.setOnClickListener(this);

if (DebugEnabled) {
XLogcat.getInstance().start();
view.findViewById(R.id.textView_debug).setBackgroundColor(ContextCompat.getColor(getContext(), R.color.colorBtnOn));

} else {
XLogcat.getInstance().stop();
view.findViewById(R.id.textView_debug).setBackgroundColor(ContextCompat.getColor(getContext(), R.color.colorBtnOff));

}
}

@Override
Expand Down
36 changes: 19 additions & 17 deletions Java/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ public void onCreate(Bundle savedInstanceState) {
if (ifCheckVersion())
new XUpdate(this).checkUpdate();

checkPermission();

}

void initView() {
Expand Down Expand Up @@ -122,22 +124,24 @@ protected void onResume() {

}

@Override
protected void onStop() {
super.onStop();
Log.i(TAG, "on stop");

System.gc();
void checkPermission() {
if (!XCheckPermission.checkFloatWindowPermission(this)) {
// TODO: 2017/3/19 加一个对话框再跳转
AlertDialog dialog;
AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.Dialog);
builder.setMessage("检测到您是小米手机, 请打开悬浮窗权限以保证软件正常运行");
builder.setPositiveButton("带我去设置", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
XCheckPermission.applyMiuiPermission(MainActivity.this);
}
});

dialog = builder.create();
dialog.show();

}
}

@Override
protected void onDestroy() {
super.onDestroy();
Log.i(TAG, "on destroy");
finish();
System.gc();
Log.i(TAG, "gc");
}

public void removeItem(int position, XListAdapter mAdapter) {
Expand Down Expand Up @@ -228,10 +232,8 @@ private boolean isWifi() {
ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
if (cm != null) {
NetworkInfo networkInfo = cm.getActiveNetworkInfo();
if (networkInfo != null
&& networkInfo.getType() == ConnectivityManager.TYPE_WIFI) {
if (networkInfo != null && networkInfo.getType() == ConnectivityManager.TYPE_WIFI) {
Log.i(TAG, "isWifi");

return true;
}
}
Expand Down
Loading

0 comments on commit ec45306

Please sign in to comment.