Android Open Source - UANET_Android Widget Activity






From Project

Back to project page UANET_Android.

License

The source code is released under:

GNU General Public License

If you think the Android project UANET_Android 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.voidcode.diasporawebclient;
/*from  www .  ja  v  a2 s .  c om*/
import android.app.PendingIntent;
import android.appwidget.AppWidgetProvider;
import com.voidcode.diasporawebclient.R;

import android.appwidget.AppWidgetManager;
import android.content.Context;
import android.content.Intent;
import android.widget.RemoteViews;

public class WidgetActivity extends AppWidgetProvider {
  public static String MAIN_ACTION;
  
  @Override
  public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
        final int N = appWidgetIds.length;

        // Perform this loop procedure for each App Widget that belongs to this provider
        for (int i=0; i<N; i++) {
            int appWidgetId = appWidgetIds[i];

            // Create an Intent to launch ShareActivity
            Intent share_intent = new Intent(context, ShareActivity.class);
            PendingIntent share_pendingIntent = PendingIntent.getActivity(context, 0, share_intent, 0);
            
            
            
            // Create an Intent to launch MainActivity
            Intent main_intent = new Intent(context, MainActivity.class);
            PendingIntent main_pendingIntent = PendingIntent.getActivity(context, 0, main_intent, 0);
            
            // Get the layout for the App Widget and attach an on-click listener
            // to the button
            RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget);
            views.setOnClickPendingIntent(R.id.widget_button_stream, main_pendingIntent);
            views.setOnClickPendingIntent(R.id.widget_button_share, share_pendingIntent);          
            
            // Tell the AppWidgetManager to perform an update on the current app widget
            appWidgetManager.updateAppWidget(appWidgetId, views);
        }
    }
}




Java Source Code List

com.voidcode.diasporawebclient.JSInterface.java
com.voidcode.diasporawebclient.Language.java
com.voidcode.diasporawebclient.MainActivity.java
com.voidcode.diasporawebclient.PodSettingsActivity.java
com.voidcode.diasporawebclient.SetupInternetActivity.java
com.voidcode.diasporawebclient.ShareActivity.java
com.voidcode.diasporawebclient.TranslateActivity.java
com.voidcode.diasporawebclient.WidgetActivity.java
com.voidcode.diasporawebclient.getPodlistTask.java