Search in sources :

Example 21 with Bundle

use of android.os.Bundle in project cw-omnibus by commonsguy.

the class EditorFragment method newInstance.

static EditorFragment newInstance(int position) {
    EditorFragment frag = new EditorFragment();
    Bundle args = new Bundle();
    args.putInt(KEY_POSITION, position);
    frag.setArguments(args);
    return (frag);
}
Also used : Bundle(android.os.Bundle)

Example 22 with Bundle

use of android.os.Bundle in project cw-omnibus by commonsguy.

the class LoremViewsFactory method getViewAt.

@Override
public RemoteViews getViewAt(int position) {
    RemoteViews row = new RemoteViews(ctxt.getPackageName(), R.layout.row);
    row.setTextViewText(android.R.id.text1, items[position]);
    Intent i = new Intent();
    Bundle extras = new Bundle();
    extras.putString(WidgetProvider.EXTRA_WORD, items[position]);
    extras.putInt(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
    i.putExtras(extras);
    row.setOnClickFillInIntent(android.R.id.text1, i);
    return (row);
}
Also used : RemoteViews(android.widget.RemoteViews) Bundle(android.os.Bundle) Intent(android.content.Intent)

Example 23 with Bundle

use of android.os.Bundle in project cw-omnibus by commonsguy.

the class AppWidget method onUpdate.

// based on http://stackoverflow.com/a/18552461/115145
@Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
    super.onUpdate(context, appWidgetManager, appWidgetIds);
    for (int appWidgetId : appWidgetIds) {
        Bundle options = appWidgetManager.getAppWidgetOptions(appWidgetId);
        onAppWidgetOptionsChanged(context, appWidgetManager, appWidgetId, options);
    }
}
Also used : Bundle(android.os.Bundle)

Example 24 with Bundle

use of android.os.Bundle in project cw-omnibus by commonsguy.

the class SearchView method createVoiceAppSearchIntent.

/**
     * Create and return an Intent that can launch the voice search activity, perform a specific
     * voice transcription, and forward the results to the searchable activity.
     *
     * @param baseIntent The voice app search intent to start from
     * @return A completely-configured intent ready to send to the voice search activity
     */
private Intent createVoiceAppSearchIntent(Intent baseIntent, SearchableInfo searchable) {
    ComponentName searchActivity = searchable.getSearchActivity();
    // create the necessary intent to set up a search-and-forward operation
    // in the voice search system.   We have to keep the bundle separate,
    // because it becomes immutable once it enters the PendingIntent
    Intent queryIntent = new Intent(Intent.ACTION_SEARCH);
    queryIntent.setComponent(searchActivity);
    PendingIntent pending = PendingIntent.getActivity(getContext(), 0, queryIntent, PendingIntent.FLAG_ONE_SHOT);
    // Now set up the bundle that will be inserted into the pending intent
    // when it's time to do the search.  We always build it here (even if empty)
    // because the voice search activity will always need to insert "QUERY" into
    // it anyway.
    Bundle queryExtras = new Bundle();
    // Now build the intent to launch the voice search.  Add all necessary
    // extras to launch the voice recognizer, and then all the necessary extras
    // to forward the results to the searchable activity
    Intent voiceIntent = new Intent(baseIntent);
    // Add all of the configuration options supplied by the searchable's metadata
    String languageModel = RecognizerIntent.LANGUAGE_MODEL_FREE_FORM;
    String prompt = null;
    String language = null;
    int maxResults = 1;
    Resources resources = getResources();
    if (searchable.getVoiceLanguageModeId() != 0) {
        languageModel = resources.getString(searchable.getVoiceLanguageModeId());
    }
    if (searchable.getVoicePromptTextId() != 0) {
        prompt = resources.getString(searchable.getVoicePromptTextId());
    }
    if (searchable.getVoiceLanguageId() != 0) {
        language = resources.getString(searchable.getVoiceLanguageId());
    }
    if (searchable.getVoiceMaxResults() != 0) {
        maxResults = searchable.getVoiceMaxResults();
    }
    voiceIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, languageModel);
    voiceIntent.putExtra(RecognizerIntent.EXTRA_PROMPT, prompt);
    voiceIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, language);
    voiceIntent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, maxResults);
    voiceIntent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE, searchActivity == null ? null : searchActivity.flattenToShortString());
    // Add the values that configure forwarding the results
    voiceIntent.putExtra(RecognizerIntent.EXTRA_RESULTS_PENDINGINTENT, pending);
    voiceIntent.putExtra(RecognizerIntent.EXTRA_RESULTS_PENDINGINTENT_BUNDLE, queryExtras);
    return voiceIntent;
}
Also used : Bundle(android.os.Bundle) ComponentName(android.content.ComponentName) PendingIntent(android.app.PendingIntent) Intent(android.content.Intent) RecognizerIntent(android.speech.RecognizerIntent) PendingIntent(android.app.PendingIntent) SuggestionsAdapter.getColumnString(com.actionbarsherlock.widget.SuggestionsAdapter.getColumnString) Resources(android.content.res.Resources)

Example 25 with Bundle

use of android.os.Bundle in project UltimateAndroid by cymcsg.

the class DetailFragment method newInstance.

public static DetailFragment newInstance(int position) {
    DetailFragment fragment = new DetailFragment();
    Bundle args = new Bundle();
    args.putInt(ARRAY_POS, position);
    fragment.setArguments(args);
    return fragment;
}
Also used : Bundle(android.os.Bundle)

Aggregations

Bundle (android.os.Bundle)6155 Intent (android.content.Intent)826 RemoteException (android.os.RemoteException)477 View (android.view.View)342 Test (org.junit.Test)266 ArrayList (java.util.ArrayList)216 TextView (android.widget.TextView)203 PersistableBundle (android.os.PersistableBundle)201 PendingIntent (android.app.PendingIntent)185 IOException (java.io.IOException)176 Uri (android.net.Uri)155 ImageView (android.widget.ImageView)152 ComponentName (android.content.ComponentName)124 Fragment (android.support.v4.app.Fragment)124 Message (android.os.Message)122 JSONObject (org.json.JSONObject)112 Account (android.accounts.Account)108 Context (android.content.Context)102 Parcelable (android.os.Parcelable)99 Bitmap (android.graphics.Bitmap)90