Android Open Source - example-lock-app Lock Widget Provider






From Project

Back to project page example-lock-app.

License

The source code is released under:

Apache License

If you think the Android project example-lock-app 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.lockapp;
//from   ww w  .jav a2 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;

public class LockWidgetProvider extends AppWidgetProvider {

    @Override
  public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
        for (int x = 0; x < appWidgetIds.length; x++) {
            int appWidgetId = appWidgetIds[x];

            Intent i = new Intent(context, LockDeviceReceiver.class);
            PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 0, i, 0);

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

            appWidgetManager.updateAppWidget(appWidgetId, views);
        }
    }
}




Java Source Code List

com.lockapp.AboutActivity.java
com.lockapp.LockDeviceReceiver.java
com.lockapp.LockWidgetProvider.java
com.lockapp.MainActivity.java
com.lockapp.fragments.FragmentUtils.java
com.lockapp.fragments.NotificationStatus.java
com.lockapp.fragments.PromptUtils.java
com.lockapp.fragments.lollipop.ControlsFragment.java
com.lockapp.fragments.lollipop.ControlsUtils.java
com.lockapp.fragments.lollipop.PromptFragment.java
com.lockapp.fragments.others.ControlsFragment.java
com.lockapp.fragments.others.PromptFragment.java