android.appwidget.AppWidgetProvider Java Examples

The following examples show how to use android.appwidget.AppWidgetProvider. 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: Tools.java    From isu with GNU General Public License v3.0 6 votes vote down vote up
public static void updateAllWidgets(boolean SU_SEL, final Context context,
    final int layoutResourceId,
    final Class < ? extends AppWidgetProvider > appWidgetClass) {
    boolean su = SuBinary();
    boolean selinux = isSELinuxActive(context);
    RemoteViews remoteViews = new RemoteViews(context.getPackageName(), layoutResourceId);
    remoteViews.setTextViewText(R.id.iSuMain, "SU" + "\n" + (su ?
        context.getString(R.string.activated) : context.getString(R.string.deactivated)));
    remoteViews.setInt(R.id.iSuMain, "setBackgroundResource", (su ? R.drawable.button :
        R.drawable.buttong));
    if (SU_SEL) {
        remoteViews.setTextViewText(R.id.iSuMonitor, context.getString(R.string.selinux) + "\n" + (selinux ? context.getString(R.string.enforcing) :
            context.getString(R.string.permissive)));
        remoteViews.setInt(R.id.iSuMonitor, "setBackgroundResource", (selinux ? R.drawable.buttong :
            R.drawable.button));
    }
    AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
    final int[] appWidgetIds = appWidgetManager.getAppWidgetIds(new ComponentName(context, appWidgetClass));
    appWidgetManager.partiallyUpdateAppWidget(appWidgetIds, remoteViews);
}
 
Example #2
Source File: ChannelShortcut.java    From CumulusTV with MIT License 5 votes vote down vote up
public static void updateWidgets(Context context, Class<? extends AppWidgetProvider> widgetType) {
    Intent intent = new Intent(context, widgetType);
    intent.setAction("android.appwidget.action.APPWIDGET_UPDATE");
    int ids[] = AppWidgetManager.getInstance(context)
            .getAppWidgetIds(new ComponentName(context, widgetType));
    intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS,ids);
    context.sendBroadcast(intent);
}
 
Example #3
Source File: InjectingAppWidgetProvider.java    From fb-android-dagger with Apache License 2.0 5 votes vote down vote up
/**
 * Provides the Context for the AppWidgetProvider associated with this graph.
 *
 * @return the AppWidgetProvider Context
 */
@Provides
@Singleton
@AppWidgetProvider
public Context provideAppWidgetProviderContext() {
    return mContext;
}
 
Example #4
Source File: InjectingAppWidgetProvider.java    From fb-android-dagger with Apache License 2.0 5 votes vote down vote up
/**
 * Provides the Injector for the AppWidgetProvider-scope graph
 *
 * @return the Injector
 */
@Provides
@Singleton
@AppWidgetProvider
public Injector provideAppWidgetProviderInjector() {
    return mInjector;
}
 
Example #5
Source File: NewsRemoteViews.java    From opencdk-appwidget with Apache License 2.0 4 votes vote down vote up
private Class<? extends AppWidgetProvider> getAppWidgetProvider() {
	return NewsAppWidgetProvider.class;
}
 
Example #6
Source File: InjectingAppWidgetProvider.java    From fb-android-dagger with Apache License 2.0 4 votes vote down vote up
/**
 * Class constructor.
 *
 * @param appWidgetProvider the InjectingAppWidgetProvider with which this module is associated.
 */
public InjectingAppWidgetProviderModule(Context context, android.appwidget.AppWidgetProvider appWidgetProvider, Injector injector) {
    mContext = context;
    mAppWidgetProvider = appWidgetProvider;
    mInjector = injector;
}
 
Example #7
Source File: InjectingAppWidgetProvider.java    From fb-android-dagger with Apache License 2.0 4 votes vote down vote up
/**
 * Provides the AppWidgetProvider
 *
 * @return the AppWidgetProvider
 */
@Provides
@Singleton
public android.appwidget.AppWidgetProvider provideAppWidgetProvider() {
    return mAppWidgetProvider;
}