当前位置: 首页>>代码示例>>Java>>正文


Java ExtensionData.icon方法代码示例

本文整理汇总了Java中com.google.android.apps.dashclock.api.ExtensionData.icon方法的典型用法代码示例。如果您正苦于以下问题:Java ExtensionData.icon方法的具体用法?Java ExtensionData.icon怎么用?Java ExtensionData.icon使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.android.apps.dashclock.api.ExtensionData的用法示例。


在下文中一共展示了ExtensionData.icon方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onUpdateData

import com.google.android.apps.dashclock.api.ExtensionData; //导入方法依赖的package包/类
@Override
protected void onUpdateData(int reason) {
    sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);

    Countdown countdown = new Countdown(this, getCountdownNumber());
    int[] diffs = countdown.getTimeRemaining();

    ExtensionData extensionData = new ExtensionData();

    extensionData.status(countdown.getStatus(diffs));
    extensionData.expandedTitle(sharedPreferences.getString("pref_title_" + getCountdownNumber(), getString(R.string.no_countdown_title)));
    extensionData.expandedBody(countdown.getBody(diffs));
    extensionData.icon(sharedPreferences.getInt("pref_icon_" + getCountdownNumber(), R.drawable.ic_launcher));
    extensionData.clickIntent(getClickIntent());
    extensionData.visible(true);

    publishUpdate(extensionData);
}
 
开发者ID:cr5315,项目名称:countdown-for-dashclock,代码行数:19,代码来源:BaseExtension.java

示例2: onUpdateData

import com.google.android.apps.dashclock.api.ExtensionData; //导入方法依赖的package包/类
@Override
protected void onUpdateData(int intReason) {

	Log.d(getTag(), "Checking for any wireless displays on the network");
	final ExtensionData edtInformation = new ExtensionData();
	setUpdateWhenScreenOn(true);

	try {

		Integer intDisplays = hndDiscoverer.getDetectedDisplays();
		if (hndDiscoverer.getDetectedDisplays() > 0) {
			edtInformation.expandedTitle(getString(R.string.found_devices));
		} else {
			edtInformation.expandedTitle(getString(R.string.no_devices));
		}
		edtInformation.expandedBody(getQuantityString(R.plurals.devices, intDisplays, intDisplays));
		edtInformation.status(hndDiscoverer.getDetectedDisplays().toString());
		edtInformation.visible(true);

	} catch (Exception e) {
		edtInformation.visible(false);
		Log.e(getTag(), "Encountered an error", e);
		ACRA.getErrorReporter().handleSilentException(e);
	}

	edtInformation.icon(R.drawable.ic_dashclock);
	edtInformation.clickIntent(new Intent().setComponent(new ComponentName("com.android.settings", "com.android.settings.Settings$WifiDisplaySettingsActivity")));
	doUpdate(edtInformation);

}
 
开发者ID:mridang,项目名称:dashclock-displays,代码行数:31,代码来源:ChromerWidget.java

示例3: onUpdateData

import com.google.android.apps.dashclock.api.ExtensionData; //导入方法依赖的package包/类
@Override
protected void onUpdateData(int intReason) {

    Log.d(getTag(), "Calculating the amount of data transferred");
    ExtensionData edtInformation = new ExtensionData();
    setUpdateWhenScreenOn(true);

    try {

        ComponentName cmpActivity = new ComponentName("com.android.settings", "com.android.settings.Settings$DataUsageSummaryActivity");

        Long lngMobile = this.lngMobile + TrafficStats.getMobileRxBytes() + TrafficStats.getMobileTxBytes();
        Long lngTotal = this.lngTotal + TrafficStats.getTotalRxBytes() + TrafficStats.getTotalTxBytes();
        Long lngWifi = lngTotal - lngMobile;

        String strMobile = Formatter.formatFileSize(getApplicationContext(), lngMobile);
        String strTotal = Formatter.formatFileSize(getApplicationContext(), lngTotal);
        String strWifi = Formatter.formatFileSize(getApplicationContext(), lngWifi);

        edtInformation.expandedTitle(String.format(getString(R.string.status), strTotal));
        edtInformation.status(strTotal);
        edtInformation.expandedBody(String.format(getString(R.string.message), strMobile, strWifi));
        edtInformation.visible(true);
        edtInformation.clickIntent(new Intent().setComponent(cmpActivity));

    } catch (Exception e) {
        edtInformation.visible(false);
        Log.e(getTag(), "Encountered an error", e);
        ACRA.getErrorReporter().handleSilentException(e);
    }

    edtInformation.icon(R.drawable.ic_dashclock);
    doUpdate(edtInformation);

}
 
开发者ID:mridang,项目名称:dashclock-network,代码行数:36,代码来源:TrafficWidget.java

示例4: onUpdateData

import com.google.android.apps.dashclock.api.ExtensionData; //导入方法依赖的package包/类
@Override
protected void onUpdateData(int intReason) {

	Log.d(getTag(), "Getting the status of the processes");
	ExtensionData edtInformation = new ExtensionData();
	setUpdateWhenScreenOn(true);

	try {

		Log.d(getTag(), "Calculating the number of tasks and services");
		ActivityManager mgrActivity = (ActivityManager) this.getSystemService(ACTIVITY_SERVICE);
		Integer intServices = mgrActivity.getRunningServices(Integer.MAX_VALUE).size();
		Integer intRecents = mgrActivity.getRecentTasks(Integer.MAX_VALUE, 2).size() - 1;
		Integer intProcess = mgrActivity.getRunningAppProcesses().size();
		String strServices = getQuantityString(R.plurals.service, intServices, intServices);
		String strRecents = getQuantityString(R.plurals.activity, intRecents, intRecents);

		Log.d(getTag(), String.format("%d running processes", intProcess));

		edtInformation.clickIntent(new Intent(Intent.ACTION_VIEW).setClassName("com.android.settings", "com.android.settings.RunningServices"));
		edtInformation.status(Integer.toString(intRecents + intServices));
		edtInformation.expandedTitle(getString(R.string.and, strRecents, strServices));
		edtInformation.expandedBody(getQuantityString(R.plurals.process, intProcess, intProcess));
		edtInformation.visible(true);

	} catch (Exception e) {
		edtInformation.visible(false);
		Log.e(getTag(), "Encountered an error", e);
		ACRA.getErrorReporter().handleSilentException(e);
	}

	edtInformation.icon(R.drawable.ic_dashclock);
	doUpdate(edtInformation);

}
 
开发者ID:mridang,项目名称:dashclock-processes,代码行数:36,代码来源:ProcessesWidget.java

示例5: onUpdateData

import com.google.android.apps.dashclock.api.ExtensionData; //导入方法依赖的package包/类
@Override
protected void onUpdateData(int intReason) {

	Log.d(getTag(), "Fetching processor and memory utilisation information");
	final ExtensionData edtInformation = new ExtensionData();
	setUpdateWhenScreenOn(true);

	try {

		ActivityManager mgrActivity = ((ActivityManager) getSystemService(Context.ACTIVITY_SERVICE));

		MemoryInfo memInformation = new MemoryInfo();
		mgrActivity.getMemoryInfo(memInformation);
		Long lngFree = memInformation.availMem / 1048576L;
		Long lngTotal = memInformation.totalMem / 1048576L;
		Integer intLevel = (int) ((100.0 * (lngFree / (lngTotal + 0.01))) / 25);

		edtInformation.status(hndNotifier.getUsagePercentage().toString());
		edtInformation.expandedTitle(getString(R.string.processor, hndNotifier.getUsagePercentage()));
		edtInformation.expandedBody(getString(R.string.memory, lngFree, lngTotal));
		edtInformation.visible(true);

		notBuilder = notBuilder.setContentTitle(getResources().getStringArray(R.array.usage)[intLevel]);
		notBuilder = notBuilder.setContentText(getString(R.string.memory, lngFree, lngTotal));

	} catch (Exception e) {
		edtInformation.visible(false);
		Log.e(getTag(), "Encountered an error", e);
		ACRA.getErrorReporter().handleSilentException(e);
	}

	edtInformation.icon(R.drawable.ic_dashclock);
	doUpdate(edtInformation);

}
 
开发者ID:mridang,项目名称:dashclock-hardware,代码行数:36,代码来源:HardwareWidget.java

示例6: onUpdateData

import com.google.android.apps.dashclock.api.ExtensionData; //导入方法依赖的package包/类
@Override
protected void onUpdateData(int intReason) {

	Log.d(getTag(), "Calculating the number of warnings and failures");
	final ExtensionData edtInformation = new ExtensionData();
	setUpdateWhenScreenOn(true);

	try {

		Integer intFailures = getSet("failure", new HashSet<String>()).size();
		Integer intWarnings = getSet("warning", new HashSet<String>()).size();

		if (intFailures + intWarnings > 0) {

			Log.d(getTag(), String.format("Found %d warnings and %d failures", intWarnings, intFailures));
			String strFailures = getQuantityString(R.plurals.failure, intFailures, intFailures);
			String strWarnings = getQuantityString(R.plurals.warning, intWarnings, intWarnings);
			String strBookmark = DateUtils.formatDateTime(this, speSettings.getLong("bookmark", Long.MIN_VALUE), 17);

			edtInformation.clickIntent(new Intent(this, WarningActivity.class).addCategory(Intent.CATEGORY_LAUNCHER));
			edtInformation.expandedBody(getString(R.string.body, strBookmark));
			edtInformation.expandedTitle(getString(R.string.title, strFailures, strWarnings));
			edtInformation.status(String.valueOf(intFailures + intWarnings));
			edtInformation.visible(true);

		} else {

			Log.d(getTag(), "Found no warnings or failures");
			edtInformation.visible(false);

		}

	} catch (Exception e) {
		edtInformation.visible(true);
		Log.e(getTag(), "Encountered an error", e);
		ACRA.getErrorReporter().handleSilentException(e);
	}

	edtInformation.icon(R.drawable.ic_dashclock);
	doUpdate(edtInformation);

}
 
开发者ID:mridang,项目名称:dashclock-warning,代码行数:43,代码来源:WarningWidget.java

示例7: onUpdateData

import com.google.android.apps.dashclock.api.ExtensionData; //导入方法依赖的package包/类
@Override
protected void onUpdateData(int intReason) {

	Log.d(getTag(), "Fetching wireless debugging status");
	ExtensionData edtInformation = new ExtensionData();
	setUpdateWhenScreenOn(false);

	try {

		Integer intPort = Settings.Secure.getInt(getContentResolver(), "adb_port", -1);
		if (intPort > 0) {

			Log.d(getTag(), "Wireless debugging is enabled");
			WifiManager wm = (WifiManager) getSystemService(WIFI_SERVICE);

			Log.d(getTag(), "Checking if wireless connectivity is enabled");
			if (wm.isWifiEnabled()) {

				String strIP = Formatter.formatIpAddress(wm.getConnectionInfo().getIpAddress());

				Log.d(getTag(), "Wireless connectivity is enabled");
				edtInformation.status(getString(R.string.enabled));
				edtInformation.expandedBody(getString(R.string.portno, strIP, intPort));
				edtInformation.visible(true);

			} else {

				Log.d(getTag(), "Wireless connectivity isn't enabled");
				edtInformation.status(getString(R.string.disabled));
				edtInformation.expandedBody(getString(R.string.plugin));
				edtInformation.visible(getBoolean("always", true));

			}

		} else {

			Log.d(getTag(), "Wireless debugging is disabled");
			edtInformation.status(getString(R.string.disabled));
			edtInformation.expandedBody(getString(R.string.plugin));
			edtInformation.visible(getBoolean("always", true));

		}

		edtInformation.clickIntent(new Intent(Settings.ACTION_APPLICATION_DEVELOPMENT_SETTINGS));

	} catch (Exception e) {
		edtInformation.visible(false);
		Log.e(getTag(), "Encountered an error", e);
		ACRA.getErrorReporter().handleSilentException(e);
	}

	edtInformation.icon(R.drawable.ic_dashclock);
	doUpdate(edtInformation);

}
 
开发者ID:mridang,项目名称:dashclock-wifiadb,代码行数:56,代码来源:WifiadbWidget.java

示例8: onReceiveIntent

import com.google.android.apps.dashclock.api.ExtensionData; //导入方法依赖的package包/类
@Override
protected void onReceiveIntent(Context ctxContext, Intent ittIntent) {

	ExtensionData edtInformation = new ExtensionData();
	try {

		Bundle bndBundle = ittIntent.getExtras();
		String strUsername = bndBundle.getString("username").toLowerCase();
		String strMachine = bndBundle.getString("machine");
		notBuilder = notBuilder.setWhen(System.currentTimeMillis());
		notBuilder = notBuilder.setContentTitle(strMachine);
		edtInformation.visible(true);
		edtInformation.expandedBody(strMachine);

		if (bndBundle.getString("event").equalsIgnoreCase("logon")) {

			Log.d(getTag(), strUsername + " logged on at " + strMachine);
			edtInformation.expandedTitle(getString(R.string.logon, strUsername));
			notBuilder = notBuilder.setContentText(edtInformation.expandedTitle());
			mgrNotifications.notify(115, notBuilder.build());

		} else if (bndBundle.getString("event").equalsIgnoreCase("lock")) {

			Log.d(getTag(), strUsername + " locked the computer " + strMachine);
			edtInformation.expandedTitle(getString(R.string.lock, strUsername));
			notBuilder = notBuilder.setContentText(edtInformation.expandedTitle());
			mgrNotifications.notify(115, notBuilder.build());

		} else if (bndBundle.getString("event").equalsIgnoreCase("unlock")) {

			Log.d(getTag(), strUsername + " unlocked the computer " + strMachine);
			edtInformation.expandedTitle(getString(R.string.unlock, strUsername));
			notBuilder = notBuilder.setContentText(edtInformation.expandedTitle());
			mgrNotifications.notify(115, notBuilder.build());

		} else if (bndBundle.getString("event").equalsIgnoreCase("logoff")) {

			Log.d(getTag(), strUsername + " logged off at " + strMachine);
			edtInformation.expandedTitle(getString(R.string.logoff, strUsername));
			notBuilder = notBuilder.setContentText(edtInformation.expandedTitle());
			mgrNotifications.notify(115, notBuilder.build());

		} else {

			Log.v(getTag(), strUsername + " is active on " + strMachine);
			edtInformation.expandedTitle(getString(R.string.active, strUsername));

		}

		hndWaiter.removeMessages(1);
		hndWaiter.sendEmptyMessageDelayed(1, 120000);

	} catch (Exception e) {
		edtInformation.visible(false);
		Log.e(getTag(), "Encountered an error", e);
		ACRA.getErrorReporter().handleSilentException(e);
	}

	edtInformation.icon(R.drawable.ic_dashclock);
	doUpdate(edtInformation);

}
 
开发者ID:mridang,项目名称:dashclock-computer,代码行数:63,代码来源:ComputerWidget.java

示例9: onUpdateData

import com.google.android.apps.dashclock.api.ExtensionData; //导入方法依赖的package包/类
@SuppressLint("SimpleDateFormat")
@Override
protected void onUpdateData(int intReason) {

	Log.d(getTag(), "Checking nightly commits");
	ExtensionData edtInformation = new ExtensionData();
	setUpdateWhenScreenOn(false);

	try {

		Log.d(getTag(), "Checking if it is a nightly build");
		if (HelperFunctions.getType().equalsIgnoreCase("NIGHTLY")) {

			Date datBuild = new SimpleDateFormat("yyyyMMdd").parse(HelperFunctions.getDate());
			Integer intDays = Days.daysBetween(new DateTime(datBuild), new DateTime(new Date())).getDays();

			Log.d(getTag(), "Checking if it is older than zero days");
			if (intDays > 0) {

				ComponentName cmpActivity = new ComponentName("com.cyanogenmod.updater", "com.cyanogenmod.updater.UpdatesSettings");

				edtInformation.clickIntent(new Intent().setComponent(cmpActivity));
				edtInformation.visible(true);
				edtInformation.expandedTitle(getQuantityString(R.plurals.changes, intDays, intDays));
				edtInformation.expandedBody(HelperFunctions.getBuildString());
				edtInformation.status(intDays.toString());

			} else {
				Log.d(getTag(), "It isn't older than zero days");
			}

		} else {
			Log.d(getTag(), "Not a nightly build");
		}

	} catch (Exception e) {
		edtInformation.visible(false);
		Log.e(getTag(), "Encountered an error", e);
		ACRA.getErrorReporter().handleSilentException(e);
	}

	edtInformation.icon(R.drawable.ic_dashclock);
	doUpdate(edtInformation);

}
 
开发者ID:mridang,项目名称:dashclock-cyanight,代码行数:46,代码来源:CyanightWidget.java

示例10: onUpdateData

import com.google.android.apps.dashclock.api.ExtensionData; //导入方法依赖的package包/类
@Override
protected void onUpdateData(int intReason) {

	Log.d(getTag(), "Fetching near-field communication information");
	ExtensionData edtInformation = new ExtensionData();
	setUpdateWhenScreenOn(true);

	try {

		BluetoothAdapter bluAdapter = BluetoothAdapter.getDefaultAdapter();
		if (bluAdapter != null) {

			Log.d(getTag(), "Checking if the bluetooth radio is enabled");
			edtInformation.clickIntent(new Intent(Settings.ACTION_BLUETOOTH_SETTINGS));
			if (bluAdapter.isEnabled()) {

				Log.d(getTag(), "Bluetooth radio is enabled");
				if (booConnected) {
					edtInformation.expandedTitle(getString(R.string.device_connected));
				} else {
					edtInformation.expandedTitle(getString(R.string.not_connected));
				}

				edtInformation.visible(true);
				edtInformation.status(getString(R.string.enabled));
				edtInformation.expandedBody(getString(R.string.visible_as, bluAdapter.getName()));

			} else {

				Log.d(getTag(), "Bluetooth radio is disabled");
				edtInformation.visible(getBoolean("always", true));
				edtInformation.status(getString(R.string.disabled));
				edtInformation.expandedTitle(getString(R.string.not_enabled));
				edtInformation.expandedBody(getString(R.string.tap_enable, bluAdapter.getName()));

			}

		} else {
			Log.d(getTag(), "Device doesn't have a bluetooth radio");
		}

	} catch (Exception e) {
		edtInformation.visible(false);
		Log.e(getTag(), "Encountered an error", e);
		ACRA.getErrorReporter().handleSilentException(e);
	}

	edtInformation.icon(R.drawable.ic_dashclock);
	doUpdate(edtInformation);

}
 
开发者ID:mridang,项目名称:dashclock-bluetooth,代码行数:52,代码来源:BluetoothWidget.java

示例11: onUpdateData

import com.google.android.apps.dashclock.api.ExtensionData; //导入方法依赖的package包/类
@Override
protected void onUpdateData(int intReason) {

	Log.d(getTag(), "Fetching near-field communication information");
	ExtensionData edtInformation = new ExtensionData();
	setUpdateWhenScreenOn(false);

	try {

		NfcManager nfcManager = (NfcManager) getSystemService(Context.NFC_SERVICE);
		if (nfcManager != null && nfcManager.getDefaultAdapter() != null) {

			Log.d(getTag(), "Checking if near-field communication is enabled");
			if (nfcManager.getDefaultAdapter().isEnabled()) {

				Log.d(getTag(), "Near-field communication is enabled");
				edtInformation.visible(true);
				edtInformation.status(getString(R.string.title));
				edtInformation.clickIntent(new Intent("android.settings.NFC_SETTINGS"));

				if (nfcManager.getDefaultAdapter().isNdefPushEnabled()) {
					edtInformation.expandedBody(getString(R.string.beam_enabled));
				} else {
					edtInformation.expandedBody(getString(R.string.beam_disabled));
				}

			} else {
				Log.d(getTag(), "Near-field communication is disabled");
			}

		} else {
			Log.d(getTag(), "Device doesn't support near-field communication");
		}

	} catch (Exception e) {
		edtInformation.visible(false);
		Log.e(getTag(), "Encountered an error", e);
		ACRA.getErrorReporter().handleSilentException(e);
	}

	edtInformation.icon(R.drawable.ic_dashclock);
	doUpdate(edtInformation);

}
 
开发者ID:mridang,项目名称:dashclock-fielder,代码行数:45,代码来源:FielderWidget.java

示例12: onUpdateData

import com.google.android.apps.dashclock.api.ExtensionData; //导入方法依赖的package包/类
@Override
protected void onUpdateData(int arg0) {

	Log.d(getTag(), "Calculating the amount of available storage on device");
	ExtensionData edtInformation = new ExtensionData();
	setUpdateWhenScreenOn(false);

	try {

		File filExternal = Environment.getExternalStorageDirectory();
		StatFs sfsExternal = new StatFs(filExternal.getAbsolutePath());
		Long lngBlize = (long) sfsExternal.getBlockSize();
		Long lngAblock = (long) sfsExternal.getAvailableBlocks();
		Long lngTblock = (long) sfsExternal.getBlockCount();
		Long lngTotal = lngTblock * lngBlize;
		Long lngFree = lngAblock * lngBlize;

		if (lngTotal > 0L) {

			String strTotal = Formatter.formatFileSize(getApplicationContext(), lngTotal);
			String strFree = Formatter.formatFileSize(getApplicationContext(), lngFree);
			Integer intPercent = (int) (0.5d + (double) lngFree * 100 / (double) lngTotal);
			Log.v(getTag(), String.format("%s of %s free on the storage", strFree, strTotal));

			if (Environment.isExternalStorageEmulated()) {
				edtInformation.expandedBody(getString(R.string.internal, strFree, strTotal));
			} else {
				edtInformation.expandedBody(getString(R.string.external, strFree, strTotal));
			}

			edtInformation.visible(true);
			edtInformation.expandedTitle(getString(R.string.available_space, intPercent));
			edtInformation.status(intPercent.toString());
			edtInformation.clickIntent(new Intent(Settings.ACTION_INTERNAL_STORAGE_SETTINGS));

		}

	} catch (Exception e) {
		edtInformation.visible(false);
		Log.e(getTag(), "Encountered an error", e);
		ACRA.getErrorReporter().handleSilentException(e);
	}

	edtInformation.icon(R.drawable.ic_dashclock);
	doUpdate(edtInformation);

}
 
开发者ID:mridang,项目名称:dashclock-storage,代码行数:48,代码来源:StorageWidget.java

示例13: onUpdateData

import com.google.android.apps.dashclock.api.ExtensionData; //导入方法依赖的package包/类
@Override
protected void onUpdateData(int intReason) {

	Log.d(getTag(), "Fetching wireless network information");
	ExtensionData edtInformation = new ExtensionData();
	setUpdateWhenScreenOn(true);

	try {

		Log.d(getTag(), "Checking if connected to a wifi network");
		ConnectivityManager mgrConnect = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
		if (mgrConnect != null) {

			NetworkInfo nifWifi = mgrConnect.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
			if (nifWifi != null && nifWifi.isConnected()) {

				Log.d(getTag(), "Connected to a wireless network");
				WifiManager wifManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
				WifiInfo wifInfo = wifManager.getConnectionInfo();
				List<ScanResult> networks = wifManager.getScanResults();
				String security = null;
				if (networks != null) {
					for (ScanResult network : networks) {
						if (network.BSSID.equalsIgnoreCase(wifInfo.getBSSID())) {
							String capabilities = network.capabilities;
							Log.d(getTag(), "Current network security is " + capabilities);
							if (capabilities.contains("WEP")) {
								security = "WEP";
							} else if (capabilities.contains("WPA2-PSK")) {
								security = "WPA2-PSK";
							} else if (capabilities.contains("WPA2")) {
								security = "WPA2";
							} else if (capabilities.contains("WPA")) {
								security = "WPA";
							} else {
								security = null;
							}
						}
					}
				}

				if (wifInfo != null && !wifInfo.getSSID().trim().isEmpty()) {

					Log.d(getTag(), wifInfo.getSSID().replaceAll("^\"|\"$", ""));
					edtInformation.visible(true);
					edtInformation.status(wifInfo.getLinkSpeed() + WifiInfo.LINK_SPEED_UNITS);
					edtInformation.expandedTitle(wifInfo.getSSID().replaceAll("^\"|\"$", ""));
					if (security == null) {
						edtInformation.expandedBody(getString(R.string.unsecured_network, wifInfo.getLinkSpeed(), WifiInfo.LINK_SPEED_UNITS));
					} else {
						edtInformation.expandedBody(getString(R.string.secured_network, security, wifInfo.getLinkSpeed(), WifiInfo.LINK_SPEED_UNITS));
					}
					edtInformation.clickIntent(new Intent(Settings.ACTION_WIFI_SETTINGS));

				}

			} else {
				Log.d(getTag(), "Not connected to a wireless network");
			}

		} else {
			Log.d(getTag(), "No wireless connection available");
		}

	} catch (Exception e) {
		edtInformation.visible(false);
		Log.e(getTag(), "Encountered an error", e);
		ACRA.getErrorReporter().handleSilentException(e);
	}

	edtInformation.icon(R.drawable.ic_dashclock);
	doUpdate(edtInformation);

}
 
开发者ID:mridang,项目名称:dashclock-wifiinfo,代码行数:75,代码来源:WifiinfoWidget.java

示例14: onUpdateData

import com.google.android.apps.dashclock.api.ExtensionData; //导入方法依赖的package包/类
@Override
protected void onUpdateData(int intReason) {

    Log.d(getTag(), "Fetching phone owner information");
    ExtensionData edtInformation = new ExtensionData();
    setUpdateWhenScreenOn(false);

    try {

        Log.d(getTag(), "Get the phone owner from the Me contact");
        Uri uriProfile = Uri.withAppendedPath(Profile.CONTENT_URI, Contacts.Data.CONTENT_DIRECTORY);
        Cursor curOwner = getContentResolver().query(uriProfile,
                new String[]{Email.ADDRESS, Email.IS_PRIMARY, Profile.DISPLAY_NAME,},
                ContactsContract.Contacts.Data.MIMETYPE + " = ?",
                new String[]{Email.CONTENT_ITEM_TYPE},
                ContactsContract.Contacts.Data.IS_PRIMARY + " DESC");

        if (!getString("heading", "").isEmpty()) {
            edtInformation.expandedTitle(getString("heading", ""));
        }

        if (!getString("message", "").isEmpty()) {
            edtInformation.expandedBody(getString("message", ""));
        }

        while (curOwner.moveToNext()) {

            Integer intName = curOwner.getColumnIndex(ContactsContract.Profile.DISPLAY_NAME);
            if (!curOwner.getString(intName).isEmpty() && edtInformation.expandedTitle() == null) {
                edtInformation.expandedTitle(curOwner.getString(intName));
            }

            Integer intAddress = curOwner.getColumnIndex(ContactsContract.CommonDataKinds.Email.ADDRESS);
            if (!curOwner.getString(intAddress).isEmpty() && edtInformation.expandedBody() == null) {
                edtInformation.expandedBody(curOwner.getString(intAddress));
            }

        }

        edtInformation.clickIntent(new Intent(Intent.ACTION_VIEW).setData(Profile.CONTENT_URI));
        edtInformation.visible(true);
        curOwner.close();

    } catch (Exception e) {
        edtInformation.visible(false);
        Log.e(getTag(), "Encountered an error", e);
        ACRA.getErrorReporter().handleSilentException(e);
    }

    edtInformation.icon(R.drawable.ic_dashclock);
    doUpdate(edtInformation);

}
 
开发者ID:mridang,项目名称:dashclock-owninfo,代码行数:54,代码来源:OwninfoWidget.java


注:本文中的com.google.android.apps.dashclock.api.ExtensionData.icon方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。