app/src/main/java/fr/neamar/kiss/forwarder/Widgets.java
/**
     * Check if widget needs configuration and display configuration view if necessary,
     * otherwise just add the widget
     *
     * @param data Intent holding widget id to configure
     */
Check if widget needs configuration and display configuration view if necessary,
otherwise just add the widget

@param data Intent holding widget id to configure
Check if widget needs configuration and display configuration view if necessary otherwise just add the widget @param data Intent holding widget id to configure
private void configureAppWidget(Intent data) {
        int appWidgetId = data.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, -1);
        AppWidgetProviderInfo appWidgetInfo = mAppWidgetManager.getAppWidgetInfo(appWidgetId);
        addAppWidget(data);
        if (appWidgetInfo.configure != null) {
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
                mAppWidgetHost.startAppWidgetConfigureActivityForResult(mainActivity, appWidgetId, 0, REQUEST_APPWIDGET_CONFIGURED, null);
            }
            else {
                Intent intent = new Intent(AppWidgetManager.ACTION_APPWIDGET_CONFIGURE);
                intent.setComponent(appWidgetInfo.configure);
                intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
                mainActivity.startActivityForResult(intent, REQUEST_APPWIDGET_CONFIGURED);
            }
        }
    }
private void configureAppWidget ( Intent data ) { int appWidgetId = data . getIntExtra ( AppWidgetManager . EXTRA_APPWIDGET_ID , - 1 ) ; AppWidgetProviderInfo appWidgetInfo = mAppWidgetManager . getAppWidgetInfo ( appWidgetId ) ; addAppWidget ( data ) ; if ( appWidgetInfo . configure != null ) { if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . LOLLIPOP ) { mAppWidgetHost . startAppWidgetConfigureActivityForResult ( mainActivity , appWidgetId , 0 , REQUEST_APPWIDGET_CONFIGURED , null ) ; } else { Intent intent = new Intent ( AppWidgetManager . ACTION_APPWIDGET_CONFIGURE ) ; intent . setComponent ( appWidgetInfo . configure ) ; intent . putExtra ( AppWidgetManager . EXTRA_APPWIDGET_ID , appWidgetId ) ; mainActivity . startActivityForResult ( intent , REQUEST_APPWIDGET_CONFIGURED ) ; } } }
Check if widget needs configuration and display configuration view if necessary,
 otherwise just add the widget
Check if widget needs configuration and display configuration view if necessary otherwise just add the widget
// Add the widget // Launch over to configure widget, if needed.