Skip to content

Commit

Permalink
Merge pull request #1910 from 305zhengzesheng/master
Browse files Browse the repository at this point in the history
#7 #305 第七次实验
  • Loading branch information
zengsn authored May 20, 2019
2 parents f9c3024 + d7dcf54 commit 0b43fbf
Show file tree
Hide file tree
Showing 13 changed files with 41 additions and 670 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,18 @@
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.annotation.TargetApi;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.support.annotation.NonNull;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.app.LoaderManager.LoaderCallbacks;

Expand All @@ -28,11 +37,14 @@
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

import java.util.ArrayList;
import java.util.List;

import static android.Manifest.permission.READ_CONTACTS;
import static android.net.ConnectivityManager.TYPE_WIFI;
import static android.provider.ContactsContract.CommonDataKinds.Phone.TYPE_MOBILE;

/**
* A login screen that offers login via email/password.
Expand Down Expand Up @@ -346,5 +358,34 @@ protected void onCancelled() {
showProgress(false);
}
}

private boolean goToNetWork() {
// TODO Auto-generated method stub
ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo info = connectivityManager.getActiveNetworkInfo();
if (info == null || !info.isAvailable()) {
new AlertDialog.Builder(this).setTitle("提醒:").setMessage("抱歉,目前无法连接网络。\n请检查您的手机网络连接!").setPositiveButton("打开网络设置", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
Intent intent = null;
//判断手机系统的版本 即API大于10 就是3.0或以上版本
if (android.os.Build.VERSION.SDK_INT > 10) {
intent = new Intent(android.provider.Settings.ACTION_WIRELESS_SETTINGS);
} else {
intent = new Intent();
ComponentName component = new ComponentName("com.android.settings", "com.android.settings.WirelessSettings");
intent.setComponent(component);
intent.setAction("android.intent.action.VIEW");
}
startActivity(intent);
}
}).setNegativeButton("联知道了!", null).show();
return false;
} else {
//new AlertDialog.Builder(this).setMessage("网络正常可以使用").setPositiveButton("Ok", null).show();
return true;
}
}
}

5 changes: 0 additions & 5 deletions students/soft1714080902305/Soft1714080902305Activity.java

This file was deleted.

Binary file not shown.
42 changes: 0 additions & 42 deletions students/soft1714080902305/app/src/main/AndroidManifest.xml

This file was deleted.

192 changes: 0 additions & 192 deletions students/soft1714080902305/app/src/main/Scan_Activity.java

This file was deleted.

Loading

0 comments on commit 0b43fbf

Please sign in to comment.