當前位置: 首頁>>代碼示例>>Java>>正文


Java ExtensionData類代碼示例

本文整理匯總了Java中com.google.android.apps.dashclock.api.ExtensionData的典型用法代碼示例。如果您正苦於以下問題:Java ExtensionData類的具體用法?Java ExtensionData怎麽用?Java ExtensionData使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ExtensionData類屬於com.google.android.apps.dashclock.api包,在下文中一共展示了ExtensionData類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onUpdateData

import com.google.android.apps.dashclock.api.ExtensionData; //導入依賴的package包/類
@Override
protected void onUpdateData(int reason) {
    // Get preference value.
    SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);
    String name = sp.getString(PREF_NAME, getString(R.string.pref_name_default));

    // Publish the extension data update.
    publishUpdate(new ExtensionData()
            .visible(true)
            .icon(R.drawable.ic_extension_example)
            .status("Hello")
            .expandedTitle("Hello, " + name + "!")
            .expandedBody("Thanks for checking out this example extension for DashClock.")
            .contentDescription("Completely different text for accessibility if needed.")
            .clickIntent(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.com"))));
}
 
開發者ID:romannurik,項目名稱:dashclock,代碼行數:17,代碼來源:ExampleExtension.java

示例2: onUpdateData

import com.google.android.apps.dashclock.api.ExtensionData; //導入依賴的package包/類
@Override
protected void onUpdateData(int reason) {
    String nextAlarm = Settings.System.getString(getContentResolver(),
            Settings.System.NEXT_ALARM_FORMATTED);
    if (!TextUtils.isEmpty(nextAlarm)) {
        Matcher m = sDigitPattern.matcher(nextAlarm);
        if (m.find() && m.start() > 0) {
            nextAlarm = nextAlarm.substring(0, m.start()) + "\n"
                    + nextAlarm.substring(m.start() + 1); // +1 to skip whitespace
        }
    }

    SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);
    Intent alarmIntent = AppChooserPreference.getIntentValue(
            sp.getString(PREF_ALARM_SHORTCUT, null), null);
    if (alarmIntent == null) {
        alarmIntent = Utils.getDefaultAlarmsIntent(this);
    }

    publishUpdate(new ExtensionData()
            .visible(!TextUtils.isEmpty(nextAlarm))
            .icon(R.drawable.ic_extension_next_alarm)
            .status(nextAlarm)
            .clickIntent(alarmIntent));
}
 
開發者ID:romannurik,項目名稱:dashclock,代碼行數:26,代碼來源:NextAlarmExtension.java

示例3: 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

示例4: onUpdateData

import com.google.android.apps.dashclock.api.ExtensionData; //導入依賴的package包/類
/**
 * On update, retrieves a line status update, and populates an ExtensionData object
 * ready for publication. The data object my be empty if there are no updates, or may
 * be populated with some error details if we can't get the status for some reason.
 */
@Override
protected void onUpdateData(int reason) {

    ExtensionData data = new ExtensionData();
    if (shouldGetUpdates()) {
        try {
            GenericUrl url = new GenericUrl(getString(R.string.line_status_api_url));

            HttpTransport transport = new NetHttpTransport();
            HttpRequest req = transport.createRequestFactory().buildGetRequest(url);

            HttpResponse rsp = req.execute();
            data = processResponse(rsp);
            rsp.disconnect();
        } catch (IOException ioe) {
            // Some kind of connection issue
            data = populateExtensionData(R.string.error_status,
                    R.string.error_status,
                    getString(R.string.error_request_expanded_body),
                    null);
        }
    }

    publishUpdate(data);
}
 
開發者ID:chriswalker,項目名稱:DashTube,代碼行數:31,代碼來源:DashTubeExtension.java

示例5: onUpdateData

import com.google.android.apps.dashclock.api.ExtensionData; //導入依賴的package包/類
@Override
protected void onUpdateData(int arg0) {
    try {
        Context context = getApplicationContext();
        MmexApplication app = new MmexApplication();
        CurrencyService currencyService = new CurrencyService(context);

        // summary formatted
        String summary = currencyService.getBaseCurrencyFormatted(
                MoneyFactory.fromDouble(app.getSummaryAccounts(context)));

        publishUpdate(new ExtensionData()
                .visible(true)
                .icon(R.drawable.ic_stat_notification)
                .status(summary)
                .expandedTitle(context.getString(R.string.summary) + ": " + summary)
                .expandedBody(app.getUserName())
                .clickIntent(new Intent(this, MainActivity.class)));
    } catch (Exception e) {
        Timber.e(e, "updating summary dash extension");
    }
}
 
開發者ID:moneymanagerex,項目名稱:android-money-manager-ex,代碼行數:23,代碼來源:SummaryDashExtension.java

示例6: createFrom

import com.google.android.apps.dashclock.api.ExtensionData; //導入依賴的package包/類
@Override
public ExtensionData createFrom(Error error) {
    ExtensionData data = new ExtensionData();
    data.status(mContext.getString(R.string.error_status)).icon(R.drawable.ic_skype).visible(true);

    if (error == Error.NOTIFICATION_ACCESS) {
        data.expandedTitle(mContext.getString(R.string.error_notification_access_title))
                .expandedBody(mContext.getString(R.string.error_notification_access_body))
                .clickIntent(new Intent("android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS"));
    } else if (error == Error.EXTENSION_ACCESS) {
        data.expandedTitle(mContext.getString(R.string.error_extension_access_title))
                .expandedBody(mContext.getString(R.string.error_extension_access_body)).clickIntent(new Intent(mContext, SettingsActivity.class));
    }

    return data;
}
 
開發者ID:solmaks,項目名稱:dashclock-skype,代碼行數:17,代碼來源:SkypeExtensionDataFactory.java

示例7: onUpdateData

import com.google.android.apps.dashclock.api.ExtensionData; //導入依賴的package包/類
@Override
protected void onUpdateData(int reason) {
    ContentResolver resolver = getContentResolver();
    boolean autoOrientationEnabled = getAutoOrientationEnabled(resolver);

    if (reason == UPDATE_REASON_MANUAL) {
        setAutoOrientationEnabled(resolver, !autoOrientationEnabled);
        autoOrientationEnabled = getAutoOrientationEnabled(resolver);
    }

    publishUpdate(new ExtensionData()
            .visible(true)
            .icon(autoOrientationEnabled ? R.drawable.ic_auto_rotate_on : R.drawable.ic_auto_rotate_off)
            .status(autoOrientationEnabled ? "ON" : "OFF")
            .expandedTitle("Auto-rotate screen - " + (autoOrientationEnabled ? "On" : "Off")));
}
 
開發者ID:shliama,項目名稱:AutoRotateExtension,代碼行數:17,代碼來源:AutoRotateExtension.java

示例8: onUpdateData

import com.google.android.apps.dashclock.api.ExtensionData; //導入依賴的package包/類
@SuppressLint("DefaultLocale")
@Override
protected void onUpdateData(int reason) {

	DbHelper db = DbHelper.getInstance(this);
	int notes = db.getAllNotes(false).size();
	int remindersTotal = db.getNotesWithReminder(true).size();
	int remindersNotExpired = db.getNotesWithReminder(false).size();
	int today = db.getTodayReminders().size();

	// Publish the extension data update.
	publishUpdate(new ExtensionData()
			.visible(true)
			.icon(R.drawable.ic_stat_notification_icon)
			.status(String.valueOf(notes))
			.expandedTitle(
					notes + " " + getString(R.string.notes).toLowerCase())
			.expandedBody(
					remindersNotExpired + " "
							+ getString(R.string.reminders) + ", "
							+ (remindersTotal - remindersNotExpired) + " "
							+ getString(R.string.expired)
							+ System.getProperty("line.separator") + today
							+ " " + getString(R.string.today))
			.clickIntent(new Intent(this, MainActivity.class)));
}
 
開發者ID:kanpol,項目名稱:omni-note,代碼行數:27,代碼來源:ONDashClockExtension.java

示例9: onUpdateData

import com.google.android.apps.dashclock.api.ExtensionData; //導入依賴的package包/類
@Override
protected void onUpdateData(int reason) {
    String nextAlarm = Settings.System.getString(getContentResolver(),
            Settings.System.NEXT_ALARM_FORMATTED);
    Matcher m = sDigitPattern.matcher(nextAlarm);
    if (m.find() && m.start() > 0) {
        nextAlarm = nextAlarm.substring(0, m.start()) + "\n" + nextAlarm.substring(m.start());
    }
    publishUpdate(new ExtensionData()
            .visible(!TextUtils.isEmpty(nextAlarm))
            .icon(R.drawable.ic_extension_next_alarm)
            .status(nextAlarm)
            .expandedBody(getString(R.string.next_alarm))
            .clickIntent(new Intent(Intent.ACTION_MAIN)
                    .setPackage("com.google.android.deskclock")
                    .addCategory(Intent.CATEGORY_LAUNCHER)));
}
 
開發者ID:JesusM,項目名稱:DashClock,代碼行數:18,代碼來源:NextAlarmExtension.java

示例10: onUpdateData

import com.google.android.apps.dashclock.api.ExtensionData; //導入依賴的package包/類
@Override
protected void onUpdateData(int reason) {
    Cursor cursor = openMissedCallsCursor();

    int missedCalls = 0;
    StringBuilder names = new StringBuilder();
    while (cursor.moveToNext()) {
        ++missedCalls;
        if (names.length() > 0) {
            names.append(", ");
        }
        names.append(cursor.getString(MissedCallsQuery.CACHED_NAME));
    }
    cursor.close();

    publishUpdate(new ExtensionData()
            .visible(missedCalls > 0)
            .icon(R.drawable.ic_extension_missed_calls)
            .status(Integer.toString(missedCalls))
            .expandedTitle(
                    getResources().getQuantityString(
                            R.plurals.missed_calls_title_template, missedCalls, missedCalls))
            .expandedBody(getString(R.string.missed_calls_body_template, names.toString()))
            .clickIntent(new Intent(Intent.ACTION_VIEW, CallLog.Calls.CONTENT_URI)));
}
 
開發者ID:JesusM,項目名稱:DashClock,代碼行數:26,代碼來源:MissedCallsExtension.java

示例11: handleMessage

import com.google.android.apps.dashclock.api.ExtensionData; //導入依賴的package包/類
/**
 * Handler method that that acts an and expiration checker that upon expiry simple hides the
 * dashclock notification.
 */
@Override
public void handleMessage(Message msgMessage) {

	try {

		Log.d(getTag(), "User has been notified of logoff so hide message");
		ExtensionData edtInformation = new ExtensionData();
		edtInformation.visible(false);
		doUpdate(edtInformation);

	} catch (Exception e) {
		Log.e(ComputerWidget.this.getTag(), "Error hiding the notification", e);
	}

}
 
開發者ID:mridang,項目名稱:dashclock-computer,代碼行數:20,代碼來源:ComputerWidget.java

示例12: onStartCommand

import com.google.android.apps.dashclock.api.ExtensionData; //導入依賴的package包/類
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
	String title = intent.getStringExtra(DASH_TITLE);
	String body = intent.getStringExtra(DASH_BODY);
	try {
		publishUpdate(new ExtensionData().visible(true)
				.icon(R.drawable.ic_extension).status(title).expandedTitle(title)
				.expandedBody(body)
				.clickIntent(new Intent(this, ProxyActivity.class)));
	}
	catch (Exception exp) {
		// This can happen if the UpdateService is running, Dashclock is
		// installed, but the widget is not added to Dashclock.
	}
	return START_NOT_STICKY;
}
 
開發者ID:onyxbits,項目名稱:Drudgery,代碼行數:17,代碼來源:DashclockExtensionService.java

示例13: onUpdateData

import com.google.android.apps.dashclock.api.ExtensionData; //導入依賴的package包/類
@Override
protected void onUpdateData(int i) {
    final String ownerInfo = preferences.getString(Constants.PREFS_OWNER_INFO_KEY,
            getString(R.string.default_widget_text));
    final String ownerEmail = preferences.getString(Constants.PREFS_OWNER_EMAIL_KEY,
            getString(R.string.default_email));

    // Publish the extension data update.
    publishUpdate(new ExtensionData()
            .visible(true)
            .icon(R.drawable.app_icon_widget)
            .status(ownerEmail)
            .expandedTitle(getString(R.string.app_name_short))
            .expandedBody(ownerInfo)
    );
}
 
開發者ID:birbeck,項目名稱:dashclock-ownerinfo,代碼行數:17,代碼來源:OwnerInfoWidgetService.java

示例14: onUpdateData

import com.google.android.apps.dashclock.api.ExtensionData; //導入依賴的package包/類
@Override
protected void onUpdateData(int reason) {
	Integer index = wheel.nextInt(quotes.length);
	
	Intent expand = new Intent();
	expand.setClassName(this, "net.logomancy.dashquotes.civ5.ExpandActivity");
	expand.putExtra("net.logomancy.dashquotes.civ5.QuoteString", quotes[index]);
	
	publishUpdate(new ExtensionData()
       .visible(true)
       .icon(R.mipmap.ic_launcher)
       .status(res.getString(R.string.sys_short_title))
       .expandedTitle(res.getString(R.string.app_name))
       .expandedBody(quotes[index])
       .clickIntent(expand));
}
 
開發者ID:logomancer,項目名稱:dashquotes-civ5,代碼行數:17,代碼來源:Civ5QuotesExtension.java

示例15: updateInfo

import com.google.android.apps.dashclock.api.ExtensionData; //導入依賴的package包/類
private void updateInfo() {
	if(dump == null) {
		publishUpdate(null);
		return;
	}
	Context context = DobroApplication.getApplicationStatic();
	Intent notificationIntent = new Intent(context,
			DobroStarredEditor.class);
	notificationIntent.putExtra(GDActivity.GD_ACTION_BAR_TITLE,
			context.getString(R.string.starred));
	notificationIntent.putExtra(DobroConstants.FAVS_DUMP, dump);
	publishUpdate(new ExtensionData()
		.visible(true)
		.icon(R.drawable.dashclock)
		.status("+")
		.expandedTitle("DobroReader")
		.expandedBody("Новые сообщения:\n"+text)
		.clickIntent(notificationIntent));
}
 
開發者ID:rdmwfs,項目名稱:dobroreader-mod,代碼行數:20,代碼來源:DCDashClockExtension.java


注:本文中的com.google.android.apps.dashclock.api.ExtensionData類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。