com.gizwits.opensource.appkit.CommonModule.GosBaseActivity Java Examples

The following examples show how to use com.gizwits.opensource.appkit.CommonModule.GosBaseActivity. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GosWifiChangeReciver.java    From GOpenSource_AppKit_Android_AS with MIT License 6 votes vote down vote up
@Override
public void onReceive(Context context, Intent intent) {

	spf = context.getSharedPreferences(GosBaseActivity.SPF_Name, Context.MODE_PRIVATE);

	String wifiname = spf.getString("workSSID", "");
	String wifipass = spf.getString("workSSIDPsw", "");
	String connectWifiSsid = NetUtils.getConnectWifiSsid(context);
	if (connectWifiSsid != null && connectWifiSsid.contains(GosBaseActivity.SoftAP_Start)) {
	} else {

		if (connectWifiSsid.contains(wifiname)) {

			return;
		}
		WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
		WifiAutoConnectManager manager = new WifiAutoConnectManager(wifiManager);
		manager.connect(wifiname, wifipass, WifiAutoConnectManager.getCipherType(context, wifiname));
	}
}
 
Example #2
Source File: GosMessageHandler.java    From Gizwits-SmartBuld_Android with MIT License 6 votes vote down vote up
public void run() {
	if (mcContext == null) {
		return;
	}
	newDeviceList.clear();
	List<ScanResult> currentWifiScanResult = NetUtils.getCurrentWifiScanResult(mcContext);
	int flog = 0;
	for (ScanResult scanResult : currentWifiScanResult) {
		String ssid = scanResult.SSID;
		// 获取系统的NotificationManager服务
		nm = (NotificationManager) mcContext.getSystemService(Context.NOTIFICATION_SERVICE);
		if (ssid.contains(GosBaseActivity.SoftAP_Start) && ssid.length() > GosBaseActivity.SoftAP_Start.length()
				&& !newDeviceList.toString().contains(ssid)) {
			newDeviceList.add(ssid);
			flog++;
			send(ssid, flog);
		}
	}
	if (mainHandler != null && newDeviceList.size() > 0) {
		mainHandler.sendEmptyMessage(SHOWDIALOG);
	}

	looper.postDelayed(mRunnable, 2000);
}
 
Example #3
Source File: GosWifiChangeReciver.java    From Gizwits-SmartBuld_Android with MIT License 6 votes vote down vote up
@Override
public void onReceive(Context context, Intent intent) {

	spf = context.getSharedPreferences(GosBaseActivity.SPF_Name, Context.MODE_PRIVATE);

	String wifiname = spf.getString("workSSID", "");
	String wifipass = spf.getString("workSSIDPsw", "");
	String connectWifiSsid = NetUtils.getConnectWifiSsid(context);
	if (connectWifiSsid != null && connectWifiSsid.contains(GosBaseActivity.SoftAP_Start)) {
	} else {

		if (connectWifiSsid.contains(wifiname)) {

			return;
		}
		WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
		WifiAutoConnectManager manager = new WifiAutoConnectManager(wifiManager);
		manager.connect(wifiname, wifipass, WifiAutoConnectManager.getCipherType(context, wifiname));
	}
}
 
Example #4
Source File: GosWifiChangeReciver.java    From gokit-android with MIT License 6 votes vote down vote up
@Override
public void onReceive(Context context, Intent intent) {

	spf = context.getSharedPreferences(GosBaseActivity.SPF_Name, Context.MODE_PRIVATE);

	String wifiname = spf.getString("workSSID", "");
	String wifipass = spf.getString("workSSIDPsw", "");
	String connectWifiSsid = NetUtils.getConnectWifiSsid(context);
	if (connectWifiSsid != null && connectWifiSsid.contains(GosBaseActivity.SoftAP_Start)) {
	} else {

		if (connectWifiSsid.contains(wifiname)) {

			return;
		}
		WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
		WifiAutoConnectManager manager = new WifiAutoConnectManager(wifiManager);
		manager.connect(wifiname, wifipass, WifiAutoConnectManager.getCipherType(context, wifiname));
	}
}
 
Example #5
Source File: GosUserLoginActivity.java    From gokit-android with MIT License 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setTheme(R.style.AppTheme);
	if (!this.isTaskRoot()) {// 判断此activity是不是任务控件的源Activity,“非”也就是说是被系统重新实例化出来的
		Intent mainIntent = getIntent();
		String action = mainIntent.getAction();
		if (mainIntent.hasCategory(Intent.CATEGORY_LAUNCHER) && action.equals(Intent.ACTION_MAIN)) {
			finish();
			return;
		}
	}
	if (GosApplication.flag != 0) {
		GosBaseActivity.noIDAlert(this, R.string.AppID_Toast);
	}

	// 在配置文件中选择推送类型(0:不开启推送,1:极光推送,2:百度推送。默认为0)
	gosPushManager = new GosPushManager(GosDeploy.setPushType(), this);

	setContentView(R.layout.activity_gos_user_login);
	// 设置actionBar
	setActionBar(false, false, R.string.app_company);
	initView();
	initEvent();
}
 
Example #6
Source File: GosMessageHandler.java    From GOpenSource_AppKit_Android_AS with MIT License 5 votes vote down vote up
public void run() {
	if (mcContext == null) {
		return;
	}
	newDeviceList.clear();
	List<ScanResult> currentWifiScanResult = NetUtils
			.getCurrentWifiScanResult(mcContext);
	GosConstant.ssidList = currentWifiScanResult;
	int flog = 0;
	if (currentWifiScanResult != null) {
		for (ScanResult scanResult : currentWifiScanResult) {
			String ssid = scanResult.SSID;
			// 获取系统的NotificationManager服务
			nm = (NotificationManager) mcContext
					.getSystemService(Context.NOTIFICATION_SERVICE);
			if (ssid.contains(GosBaseActivity.SoftAP_Start)
					&& ssid.length() > GosBaseActivity.SoftAP_Start
							.length()
					&& !newDeviceList.toString().contains(ssid)) {
				newDeviceList.add(ssid);
				flog++;
				send(ssid, flog);
			}
		}
	}

	if (mainHandler != null && newDeviceList.size() > 0) {
		mainHandler.sendEmptyMessage(SHOWDIALOG);
	}

	looper.postDelayed(mRunnable, 2000);
}
 
Example #7
Source File: GosPushManager.java    From GOpenSource_AppKit_Android_AS with MIT License 5 votes vote down vote up
public void bDPush() {
	final String BDPushAppKey = GosDeploy.setBaiDuPushAppKey();
	if (TextUtils.isEmpty(BDPushAppKey) || BDPushAppKey.contains("your_bpush_api_key")) {
		GosBaseActivity.noIDAlert(context, R.string.BDPushAppID_Toast);
	} else {

		PushManager.startWork(context, PushConstants.LOGIN_TYPE_API_KEY, BDPushAppKey);
		PushSettings.enableDebugMode(context, true);

	}

}
 
Example #8
Source File: GosUserLoginActivity.java    From GOpenSource_AppKit_Android_AS with MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setTheme(R.style.AppTheme);
	if (!this.isTaskRoot()) {// 判断此activity是不是任务控件的源Activity,“非”也就是说是被系统重新实例化出来的
		Intent mainIntent = getIntent();
		String action = mainIntent.getAction();
		if (mainIntent.hasCategory(Intent.CATEGORY_LAUNCHER) && action.equals(Intent.ACTION_MAIN)) {
			finish();
			return;
		}
	}
	if (GosApplication.flag != 0) {
		GosBaseActivity.noIDAlert(this, R.string.AppID_Toast);
	}

	// 在配置文件中选择推送类型(0:不开启推送,1:极光推送,2:百度推送。默认为0)
	gosPushManager = new GosPushManager(GosDeploy.setPushType(), this);

	setContentView(R.layout.activity_gos_user_login);


	// 设置actionBar
	setActionBar(false, false, R.string.app_company);
	initView();
	initEvent();
}
 
Example #9
Source File: GosMessageHandler.java    From gokit-android with MIT License 5 votes vote down vote up
public void run() {
	if (mcContext == null) {
		return;
	}
	newDeviceList.clear();
	List<ScanResult> currentWifiScanResult = NetUtils
			.getCurrentWifiScanResult(mcContext);
	int flog = 0;
	if (currentWifiScanResult != null) {
		for (ScanResult scanResult : currentWifiScanResult) {
			String ssid = scanResult.SSID;
			// 获取系统的NotificationManager服务
			nm = (NotificationManager) mcContext
					.getSystemService(Context.NOTIFICATION_SERVICE);
			if (ssid.contains(GosBaseActivity.SoftAP_Start)
					&& ssid.length() > GosBaseActivity.SoftAP_Start
							.length()
					&& !newDeviceList.toString().contains(ssid)) {
				newDeviceList.add(ssid);
				flog++;
				send(ssid, flog);
			}
		}
	}

	if (mainHandler != null && newDeviceList.size() > 0) {
		mainHandler.sendEmptyMessage(SHOWDIALOG);
	}

	looper.postDelayed(mRunnable, 2000);
}
 
Example #10
Source File: GosPushManager.java    From gokit-android with MIT License 5 votes vote down vote up
public void bDPush() {
	final String BDPushAppKey = GosDeploy.setBaiDuPushAppKey();
	if (TextUtils.isEmpty(BDPushAppKey) || BDPushAppKey.contains("your_bpush_api_key")) {
		GosBaseActivity.noIDAlert(context, R.string.BDPushAppID_Toast);
	} else {

		PushManager.startWork(context, PushConstants.LOGIN_TYPE_API_KEY, BDPushAppKey);
		PushSettings.enableDebugMode(context, true);

	}

}