Android Open Source - Swipelight_Flashlight Widget Provider






From Project

Back to project page Swipelight_Flashlight.

License

The source code is released under:

Apache License

If you think the Android project Swipelight_Flashlight listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.collinguarino.flashlight;
/*from  www  .  j ava  2  s . c  om*/
import android.app.PendingIntent;
import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProvider;
import android.content.Context;
import android.content.Intent;
import android.widget.RemoteViews;

/**
 * Created by Collin on 10/1/13.
 */
public class WidgetProvider extends AppWidgetProvider {

    @Override
    public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
        super.onUpdate(context, appWidgetManager, appWidgetIds);

        Intent intent = new Intent(context, Main.class);
        PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);

        RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget_layout);
        views.setOnClickPendingIntent(R.id.widgetView, pendingIntent);
        appWidgetManager.updateAppWidget(appWidgetIds, views);
    }
}




Java Source Code List

com.collinguarino.flashlight.FlashlightWidgetReceiver.java
com.collinguarino.flashlight.HomeScreenWidgetProvider.java
com.collinguarino.flashlight.LockFlashlightWidgetReceiver.java
com.collinguarino.flashlight.LockScreenWidgetProvider.java
com.collinguarino.flashlight.Main.java
com.collinguarino.flashlight.SwipelightDashClock.java
com.collinguarino.flashlight.WidgetProvider.java