Android Open Source - OpenGate Open Gate Provider






From Project

Back to project page OpenGate.

License

The source code is released under:

Apache License

If you think the Android project OpenGate 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.arquitetaweb.opengate;
//www.  ja  va  2s  . com
import android.app.PendingIntent;
import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProvider;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.widget.RemoteViews;

public class OpenGateProvider extends AppWidgetProvider {

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

    RemoteViews remoteViews = new RemoteViews(context.getPackageName(),
        R.layout.widget_opengate);
    remoteViews.setOnClickPendingIntent(R.id.widget_image,
        buildButtonPendingIntent(context));
    pushWidgetUpdate(context, remoteViews);
  }

  public static PendingIntent buildButtonPendingIntent(Context context) {
    Intent intent = new Intent();
    intent.setAction("com.arquitetaweb.intent.action.CHANGE_PICTURE");
    return PendingIntent.getBroadcast(context, 0, intent,
        PendingIntent.FLAG_UPDATE_CURRENT);
  }

  public static void pushWidgetUpdate(Context context, RemoteViews remoteViews) {
    ComponentName myWidget = new ComponentName(context,
        OpenGateProvider.class);
    AppWidgetManager manager = AppWidgetManager.getInstance(context);
    manager.updateAppWidget(myWidget, remoteViews);
  }
}




Java Source Code List

com.arquitetaweb.opengate.OpenGateIntentReceiver.java
com.arquitetaweb.opengate.OpenGateProvider.java
com.arquitetaweb.util.ApiController.java
com.arquitetaweb.util.GetApi.java
com.arquitetaweb.util.OpenGateController.java