Android Open Source - Swipelight_Flashlight Lock Screen 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   ww  w  . ja v  a  2 s  . co  m*/
import android.app.PendingIntent;
import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProvider;
import android.content.Context;
import android.content.Intent;
import android.widget.RemoteViews;

public class LockScreenWidgetProvider extends AppWidgetProvider {

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

        /*Intent receiver = new Intent(context, LockFlashlightWidgetReceiver.class);
        receiver.setAction("COM_FLASHLIGHT");
        receiver.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, appWidgetIds);
        PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 0, receiver, 0);

        RemoteViews views = new RemoteViews(context.getPackageName(),
                R.layout.lockscreen_widget_layout);
        views.setOnClickPendingIntent(R.id.imageView, pendingIntent);

        appWidgetManager.updateAppWidget(appWidgetIds, views);*/

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

        RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.lockscreen_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