app/src/main/java/org/andstatus/app/appwidget/AppWidgets.java
/**  Construct the RemoteViews object. It takes the package name (in our case, it's our
     *   package, but it needs this because on the other side it's the widget
     *   host inflating the layout from our package).  */
Construct the RemoteViews object. It takes the package name (in our case, it's our
package, but it needs this because on the other side it's the widget
host inflating the layout from our package).
Construct the RemoteViews object . It takes the package name ( in our case it ' s our package but it needs this because on the other side it ' s the widget host inflating the layout from our package ) .
private RemoteViews constructRemoteViews(Context context, MyRemoteViewData viewData) {
        RemoteViews views = new RemoteViews(context.getPackageName(),
                R.layout.appwidget);
        if (StringUtil.isEmpty(viewData.widgetText)) {
            views.setViewVisibility(R.id.appwidget_text, android.view.View.GONE);
        }
        if (StringUtil.isEmpty(viewData.widgetComment)) {
            views.setViewVisibility(R.id.appwidget_comment, android.view.View.GONE);
        }
        if (!StringUtil.isEmpty(viewData.widgetText)) {
            views.setViewVisibility(R.id.appwidget_text, android.view.View.VISIBLE);
            views.setTextViewText(R.id.appwidget_text, viewData.widgetText);
        }
        if (!StringUtil.isEmpty(viewData.widgetComment)) {
            views.setViewVisibility(R.id.appwidget_comment,
                    android.view.View.VISIBLE);
            views.setTextViewText(R.id.appwidget_comment, viewData.widgetComment);
        }
        views.setTextViewText(R.id.appwidget_time, viewData.widgetTime);
        views.setOnClickPendingIntent(R.id.widget, viewData.onClickIntent);
        return views;
    }
private RemoteViews constructRemoteViews ( Context context , MyRemoteViewData viewData ) { RemoteViews views = new RemoteViews ( context . getPackageName ( ) , R . layout . appwidget ) ; if ( StringUtil . isEmpty ( viewData . widgetText ) ) { views . setViewVisibility ( R . id . appwidget_text , android . view . View . GONE ) ; } if ( StringUtil . isEmpty ( viewData . widgetComment ) ) { views . setViewVisibility ( R . id . appwidget_comment , android . view . View . GONE ) ; } if ( ! StringUtil . isEmpty ( viewData . widgetText ) ) { views . setViewVisibility ( R . id . appwidget_text , android . view . View . VISIBLE ) ; views . setTextViewText ( R . id . appwidget_text , viewData . widgetText ) ; } if ( ! StringUtil . isEmpty ( viewData . widgetComment ) ) { views . setViewVisibility ( R . id . appwidget_comment , android . view . View . VISIBLE ) ; views . setTextViewText ( R . id . appwidget_comment , viewData . widgetComment ) ; } views . setTextViewText ( R . id . appwidget_time , viewData . widgetTime ) ; views . setOnClickPendingIntent ( R . id . widget , viewData . onClickIntent ) ; return views ; }
Construct the RemoteViews object.
Construct the RemoteViews object .