本文整理汇总了Java中android.provider.AlarmClock.ACTION_SHOW_ALARMS属性的典型用法代码示例。如果您正苦于以下问题:Java AlarmClock.ACTION_SHOW_ALARMS属性的具体用法?Java AlarmClock.ACTION_SHOW_ALARMS怎么用?Java AlarmClock.ACTION_SHOW_ALARMS使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.provider.AlarmClock
的用法示例。
在下文中一共展示了AlarmClock.ACTION_SHOW_ALARMS属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onUpdate
@Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.clock_only_widget);
/*Launch system alarm app on clock click*/
Intent openClockIntent = new Intent(AlarmClock.ACTION_SHOW_ALARMS);
openClockIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
PendingIntent clockPendingIntent = PendingIntent.getActivity(context, 0, openClockIntent, 0);
remoteViews.setOnClickPendingIntent(R.id.textClock, clockPendingIntent);
/*Redrawing and updating clock_only_widget*/
appWidgetManager.updateAppWidget(appWidgetIds[0], remoteViews);
}
示例2: onClick
@SuppressLint("InlinedApi")
@Override
public void onClick(View v) {
if (android.os.Build.VERSION.SDK_INT >= 9) {
if (v == mAlarm1View || v == mAlarm2View) {
Animations.click(v, this);
} else {
try {
Intent i = new Intent(
android.os.Build.VERSION.SDK_INT >= 19 ? AlarmClock.ACTION_SHOW_ALARMS
: AlarmClock.ACTION_SET_ALARM);
startActivity(i);
} catch (Exception e) {
Toast.makeText(ClockActivity.this, R.string.alerror,
Toast.LENGTH_SHORT).show();
}
}
} else {
mWheatherFlipListener.onClick(v);
}
}
示例3: setupEditOnClick
private static void setupEditOnClick(Context context, RemoteViews widget) {
String intentAction = Build.VERSION.SDK_INT >= 19 ? AlarmClock.ACTION_SHOW_ALARMS : AlarmClock.ACTION_SET_ALARM;
Intent launchIntent = new Intent(intentAction);
PendingIntent launchPendingIntent = PendingIntent.getActivity(context, r.nextInt(), launchIntent, PendingIntent.FLAG_UPDATE_CURRENT);
widget.setOnClickPendingIntent(R.id.clock_edit_button, launchPendingIntent);
}
示例4: refreshWidgetView
public static void refreshWidgetView(Context context, Location location, Weather weather) {
if (weather == null) {
return;
}
SharedPreferences sharedPreferences = context.getSharedPreferences(
context.getString(R.string.sp_widget_clock_day_vertical_setting),
Context.MODE_PRIVATE);
String viewStyle = sharedPreferences.getString(context.getString(R.string.key_view_type), "rectangle");
boolean showCard = sharedPreferences.getBoolean(context.getString(R.string.key_show_card), false);
boolean blackText = sharedPreferences.getBoolean(context.getString(R.string.key_black_text), false);
boolean hideSubtitle = sharedPreferences.getBoolean(context.getString(R.string.key_hide_subtitle), false);
String subtitleData = sharedPreferences.getString(context.getString(R.string.key_subtitle_data), "time");
boolean dayTime = TimeManager.getInstance(context).getDayTime(context, weather, false).isDayTime();
SharedPreferences defaultSharePreferences = PreferenceManager.getDefaultSharedPreferences(context);
boolean fahrenheit = defaultSharePreferences.getBoolean(
context.getString(R.string.key_fahrenheit),
false);
String iconStyle = defaultSharePreferences.getString(
context.getString(R.string.key_widget_icon_style),
"material");
boolean touchToRefresh = defaultSharePreferences.getBoolean(
context.getString(R.string.key_click_widget_to_refresh),
false);
int textColor;
if (blackText || showCard) {
textColor = ContextCompat.getColor(context, R.color.colorTextDark);
} else {
textColor = ContextCompat.getColor(context, R.color.colorTextLight);
}
RemoteViews views = buildWidgetViewDayPart(
context, weather,
dayTime, textColor, fahrenheit,
iconStyle, blackText,
viewStyle,
hideSubtitle, subtitleData);
views.setViewVisibility(R.id.widget_clock_day_card, showCard ? View.VISIBLE : View.GONE);
Intent intentClock = new Intent(AlarmClock.ACTION_SHOW_ALARMS);
PendingIntent pendingIntentClock = PendingIntent.getActivity(
context, CLOCK_PENDING_INTENT_CODE, intentClock, PendingIntent.FLAG_UPDATE_CURRENT);
views.setOnClickPendingIntent(R.id.widget_clock_day_clockButton, pendingIntentClock);
PendingIntent pendingIntentWeather;
if (touchToRefresh) {
pendingIntentWeather = PendingIntent.getService(
context,
WEATHER_PENDING_INTENT_CODE,
new Intent(context, NormalUpdateService.class),
PendingIntent.FLAG_UPDATE_CURRENT);
} else {
pendingIntentWeather = PendingIntent.getActivity(
context,
WEATHER_PENDING_INTENT_CODE,
IntentHelper.buildMainActivityIntent(context, location),
PendingIntent.FLAG_UPDATE_CURRENT);
}
views.setOnClickPendingIntent(R.id.widget_clock_day_weatherButton, pendingIntentWeather);
// commit.
AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
appWidgetManager.updateAppWidget(
new ComponentName(context, WidgetClockDayVerticalProvider.class),
views);
}
示例5: refreshWidgetView
public static void refreshWidgetView(Context context, Location location, Weather weather) {
if (weather == null) {
return;
}
SharedPreferences sharedPreferences = context.getSharedPreferences(
context.getString(R.string.sp_widget_clock_day_horizontal_setting),
Context.MODE_PRIVATE);
boolean showCard = sharedPreferences.getBoolean(context.getString(R.string.key_show_card), false);
boolean blackText = sharedPreferences.getBoolean(context.getString(R.string.key_black_text), false);
boolean dayTime = TimeManager.getInstance(context).getDayTime(context, weather, false).isDayTime();
SharedPreferences defaultSharePreferences = PreferenceManager.getDefaultSharedPreferences(context);
boolean fahrenheit = defaultSharePreferences.getBoolean(
context.getString(R.string.key_fahrenheit),
false);
String iconStyle = defaultSharePreferences.getString(
context.getString(R.string.key_widget_icon_style),
"material");
boolean touchToRefresh = defaultSharePreferences.getBoolean(
context.getString(R.string.key_click_widget_to_refresh),
false);
int textColor;
if (blackText || showCard) {
textColor = ContextCompat.getColor(context, R.color.colorTextDark);
} else {
textColor = ContextCompat.getColor(context, R.color.colorTextLight);
}
RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget_clock_day_horizontal);
views.setImageViewResource(
R.id.widget_clock_day_icon,
getWeatherIconId(weather, dayTime, iconStyle, blackText));
views.setTextViewText(
R.id.widget_clock_day_lunar,
getLunarText(context));
views.setTextViewText(
R.id.widget_clock_day_subtitle,
getSubtitleText(weather, fahrenheit));
views.setTextColor(R.id.widget_clock_day_clock, textColor);
views.setTextColor(R.id.widget_clock_day_clock_aa, textColor);
views.setTextColor(R.id.widget_clock_day_title, textColor);
views.setTextColor(R.id.widget_clock_day_lunar, textColor);
views.setTextColor(R.id.widget_clock_day_subtitle, textColor);
views.setViewVisibility(R.id.widget_clock_day_card, showCard ? View.VISIBLE : View.GONE);
Intent intentClock = new Intent(AlarmClock.ACTION_SHOW_ALARMS);
PendingIntent pendingIntentClock = PendingIntent.getActivity(
context,
CLOCK_PENDING_INTENT_CODE,
intentClock,
PendingIntent.FLAG_UPDATE_CURRENT);
views.setOnClickPendingIntent(R.id.widget_clock_day_clockButton, pendingIntentClock);
PendingIntent pendingIntentWeather;
if (touchToRefresh) {
pendingIntentWeather = PendingIntent.getService(
context,
WEATHER_PENDING_INTENT_CODE,
new Intent(context, NormalUpdateService.class),
PendingIntent.FLAG_UPDATE_CURRENT);
} else {
pendingIntentWeather = PendingIntent.getActivity(
context,
WEATHER_PENDING_INTENT_CODE,
IntentHelper.buildMainActivityIntent(context, location),
PendingIntent.FLAG_UPDATE_CURRENT);
}
views.setOnClickPendingIntent(R.id.widget_clock_day_weatherButton, pendingIntentWeather);
AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
appWidgetManager.updateAppWidget(
new ComponentName(context, WidgetClockDayHorizontalProvider.class),
views);
}