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


Java AlarmClock.ACTION_SHOW_ALARMS属性代码示例

本文整理汇总了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);
}
 
开发者ID:YanDoroshenko,项目名称:Klok,代码行数:13,代码来源:ClockOnlyWidget.java

示例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);
    }
}
 
开发者ID:Nikolay-Kha,项目名称:TabletClock,代码行数:21,代码来源:ClockActivity.java

示例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);
}
 
开发者ID:WeAreFairphone,项目名称:android_packages_apps_ClockWidget,代码行数:6,代码来源:ClockWidget.java

示例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);
}
 
开发者ID:WangDaYeeeeee,项目名称:GeometricWeather,代码行数:69,代码来源:WidgetClockDayVerticalUtils.java

示例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);
}
 
开发者ID:WangDaYeeeeee,项目名称:GeometricWeather,代码行数:81,代码来源:WidgetClockDayHorizontalUtils.java


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