Example usage for android.os Bundle EMPTY

List of usage examples for android.os Bundle EMPTY

Introduction

In this page you can find the example usage for android.os Bundle EMPTY.

Prototype

Bundle EMPTY

To view the source code for android.os Bundle EMPTY.

Click Source Link

Usage

From source file:dev.drsoran.moloko.fragments.TaskEditFragment.java

private void registerForTaskDeletedByBackgroundSync() {
    taskChangesObserver = new ContentObserver(MolokoApp.getHandler()) {
        @Override/*from  w  w w  .  jav a2 s .  c o  m*/
        public void onChange(boolean selfChange) {
            getSherlockActivity().getSupportLoaderManager().initLoader(TaskLoader.ID, Bundle.EMPTY,
                    TaskEditFragment.this.taskLoaderHandler);
        }
    };

    getSherlockActivity().getContentResolver().registerContentObserver(
            Queries.contentUriWithId(RawTasks.CONTENT_URI, getTaskAssertNotNull().getId()), false,
            taskChangesObserver);
}

From source file:dev.drsoran.moloko.util.UIUtils.java

public final static void inflateTags(Context context, ViewGroup container, Collection<String> tags,
        Bundle configuration) {// w ww. ja v  a2  s  .c o  m
    if (configuration == null) {
        configuration = Bundle.EMPTY;
    }

    final int tagPos = getTaggedViewPos(container, "tag_name");

    if (tagPos != -1) {
        container.removeViews(tagPos, container.getChildCount() - tagPos);
    }

    // inflate the stub and add tags
    if (tags.size() > 0 && !configuration.containsKey(REMOVE_ALL_TAGS)) {
        try {
            final String[] tagsToRemove = configuration.getStringArray(REMOVE_TAGS_EQUALS);

            for (String tagText : tags) {
                boolean remove = false;

                if (tagsToRemove != null) {
                    for (int i = 0; i < tagsToRemove.length && !remove; i++) {
                        remove = tagsToRemove[i].equalsIgnoreCase(tagText);
                    }
                }

                if (!remove) {
                    final TextView tagView = (TextView) View.inflate(context, R.layout.tag_button, null);
                    tagView.setText(tagText);
                    container.addView(tagView);
                }
            }
        } catch (Throwable e) {
            throw new InflateException(e);
        }
    }

    if (container.getChildCount() > 0)
        container.setVisibility(View.VISIBLE);
    else
        container.setVisibility(View.GONE);
}

From source file:com.google.android.demos.jamendo.widget.Loadable.java

/** {@inheritDoc} */
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
    Bundle extras = data != null ? data.getExtras() : Bundle.EMPTY;
    mHasError = extras.containsKey(FeedExtras.EXTRA_ERROR);
    mHasMore = extras.getBoolean(FeedExtras.EXTRA_MORE);
    mCount = data != null ? data.getCount() : 0;
    mCallbacks.onLoadFinished(loader, data);
}

From source file:andlabs.lounge.service.LoungeServiceImpl.java

@Override
public void reconnect() {
    Ln.v("reconnect():");
    try {// w ww  .j  a va  2  s .c  om
        Message message = Message.obtain();
        message.what = 1;
        message.setData(Bundle.EMPTY);
        mMessageHandler.send(message);
    } catch (NullPointerException npe) {
        Ln.e(npe, "reconnect(): caught exception while sending message");
    }
}

From source file:dev.drsoran.moloko.activities.TaskListsActivity.java

private void showAddListDialog() {
    createAddRenameListDialogFragment(Bundle.EMPTY);
}

From source file:de.damdi.fitness.activity.settings.sync.OpenTrainingSyncService.java

/**
 * Downloads the JSON-files from wger and parses them.
 * /*  ww w . j a v  a  2 s.  co  m*/
 * @return the {@link WgerJSONParser} 
 * 
 * @throws IOException
 * @throws JSONException
 */
private ArrayList<ExerciseType> downloadAndParseExercises() throws IOException, JSONException {
    Log.d(TAG, "getExercisesAsJSON()");
    IDataProvider dataProvider = new DataProvider(this.getApplicationContext());

    // get exercises from server
    mReceiver.send(STATUS_RUNNING_DOWNLOAD_EXERCISES, Bundle.EMPTY);
    String exercisesAsJSON = mClient.get(EXERCISE_REQUEST_PATH);
    Log.v(TAG, "exercisesAsJSON: " + exercisesAsJSON);

    // get languages from server
    mReceiver.send(STATUS_RUNNING_DOWNLOAD_LANGUAGE_FILES, Bundle.EMPTY);
    String languagesAsJSON = mClient.get(LANGUAGE_REQUEST_PATH);
    Log.v(TAG, "languagesAsJSON: " + languagesAsJSON);

    // get muscles from server
    mReceiver.send(STATUS_RUNNING_DOWNLOAD_MUSCLE_FILES, Bundle.EMPTY);
    String musclesAsJSON = mClient.get(MUSCLE_REQUEST_PATH);
    Log.v(TAG, "musclesAsJSON: " + musclesAsJSON);

    // get equipment from server
    mReceiver.send(STATUS_RUNNING_DOWNLOAD_EQUIPMENT_FILES, Bundle.EMPTY);
    String equipmentAsJSON = mClient.get(EQUIPMENT_REQUEST_PATH);
    Log.v(TAG, "equipmentAsJSON: " + equipmentAsJSON);

    // parse exercises, languages and muscles
    mReceiver.send(STATUS_RUNNING_CHECKING_EXERCISES, Bundle.EMPTY);
    WgerJSONParser wgerParser = new WgerJSONParser(exercisesAsJSON, languagesAsJSON, musclesAsJSON,
            equipmentAsJSON, dataProvider);

    ArrayList<ExerciseType.Builder> exerciseBuilderList = wgerParser.getNewExercisesBuilder();

    // get images from server
    mReceiver.send(STATUS_RUNNING_DOWNLOADING_IMAGES, Bundle.EMPTY);
    WgerImageDownloader imageDownloader = new WgerImageDownloader(getApplicationContext(), mClient);
    ArrayList<ExerciseType> newExerciseList = imageDownloader.downloadImages(exerciseBuilderList);

    return newExerciseList;
}

From source file:com.example.gaurav.calculator.Calculator.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_calculator);

    mDisplayView = (RelativeLayout) findViewById(R.id.display);
    mFormulaEditText = (CalculatorEditText) findViewById(R.id.formula);
    mResultEditText = (CalculatorEditText) findViewById(R.id.result);
    mPadViewPager = (NineOldViewPager) findViewById(R.id.pad_pager);
    mDeleteButton = findViewById(R.id.del);
    mClearButton = findViewById(R.id.clr);

    mEqualButton = findViewById(R.id.pad_numeric).findViewById(R.id.eq);
    if (mEqualButton == null || mEqualButton.getVisibility() != View.VISIBLE) {
        mEqualButton = findViewById(R.id.pad_operator).findViewById(R.id.eq);
    }// w w  w  . ja va 2s.c om

    mTokenizer = new CalculatorExpressionTokenizer(this);
    mEvaluator = new CalculatorExpressionEvaluator(mTokenizer);

    savedInstanceState = savedInstanceState == null ? Bundle.EMPTY : savedInstanceState;
    setState(CalculatorState.values()[savedInstanceState.getInt(KEY_CURRENT_STATE,
            CalculatorState.INPUT.ordinal())]);
    String keyCurrentExpr = savedInstanceState.getString(KEY_CURRENT_EXPRESSION);
    mFormulaEditText.setText(mTokenizer.getLocalizedExpression(keyCurrentExpr == null ? "" : keyCurrentExpr));
    mEvaluator.evaluate(mFormulaEditText.getText(), this);

    mFormulaEditText.setEditableFactory(mFormulaEditableFactory);
    mFormulaEditText.addTextChangedListener(mFormulaTextWatcher);
    mFormulaEditText.setOnKeyListener(mFormulaOnKeyListener);
    mFormulaEditText.setOnTextSizeChangeListener(this);
    mDeleteButton.setOnLongClickListener(this);
}

From source file:com.infine.android.devoxx.service.RestService.java

@Override
protected void onHandleIntent(Intent intent) {

    final ResultReceiver receiver = intent.getParcelableExtra(EXTRA_STATUS_RECEIVER);

    // si passage du numero de version
    // final int latestVersion = intent.getIntExtra(EXTRA_LASTEST_VERSION,
    // 1);//w  w  w  . ja  v  a2s.co  m

    if (receiver != null)
        receiver.send(ServiceStatus.STATUS_RUNNING, Bundle.EMPTY);

    // final Context context = this;
    // final SharedPreferences prefs =
    // getSharedPreferences(Prefs.DEVOXX_SCHEDULE_SYNC,
    // Context.MODE_PRIVATE);
    // final int localVersion = prefs.getInt(Prefs.LOCAL_VERSION,
    // VERSION_NONE);

    try {

        // Bulk of sync work, performed by executing several fetches from
        // local and online sources.
        final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(mApplicationContext);
        int scheduleVersion = prefs.getInt(PREFS_SCHEDULE_VERSION, -1);
        int sessionVersion = prefs.getInt(PREFS_SESSION_VERSION, -1);
        int speakerVersion = prefs.getInt(PREFS_SPEAKER_VERSION, -1);

        if (scheduleVersion + sessionVersion + speakerVersion < 0) {
            // on charge les fichiers statiques que la premiere fois
            // ou quand un jeu de donnes schedule ou session est pourri
            // verion = -1
            loadStaticFiles();
        }
        loadStaticRoom();

        // Always hit remote spreadsheet for any updates
        loadRemoteData();

    } catch (Exception e) {
        Log.e(TAG, "Problem while syncing", e);
        if (receiver != null) {
            // Pass back error to surface listener
            final Bundle bundle = new Bundle();
            bundle.putString(Intent.EXTRA_TEXT, e.toString());
            receiver.send(STATUS_ERROR, bundle);
        }
    }

    // Announce success to any surface listener
    if (receiver != null)
        receiver.send(STATUS_FINISHED, Bundle.EMPTY);
}

From source file:tv.loilo.promise.samples.progress.SampleProgressBarDialogFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    getDialog().setCancelable(false);//from w  ww . ja  v a  2  s  .c om
    getLoaderManager().initLoader(LOADER_ID, Bundle.EMPTY, mLoaderCallbacks);
}

From source file:de.skubware.opentraining.activity.settings.sync.OpenTrainingSyncService.java

/**
 * Downloads the JSON-files from wger and parses them.
 * /*from ww w. j a  v a  2  s . c  om*/
 * @return the {@link WgerJSONParser} 
 * 
 * @throws IOException
 * @throws JSONException
 */
private ArrayList<ExerciseType> downloadAndParseExercises() throws IOException, JSONException {
    Log.d(TAG, "getExercisesAsJSON()");
    IDataProvider dataProvider = new DataProvider(this.getApplicationContext());

    // get exercises from server
    mReceiver.send(STATUS_RUNNING_DOWNLOAD_EXERCISES, Bundle.EMPTY);
    String exercisesAsJSON = mClient.get(EXERCISE_REQUEST_PATH);
    Log.v(TAG, "exercisesAsJSON: " + exercisesAsJSON);

    // get languages from server
    mReceiver.send(STATUS_RUNNING_DOWNLOAD_LANGUAGE_FILES, Bundle.EMPTY);
    String languagesAsJSON = mClient.get(LANGUAGE_REQUEST_PATH);
    Log.v(TAG, "languagesAsJSON: " + languagesAsJSON);

    // get muscles from server
    mReceiver.send(STATUS_RUNNING_DOWNLOAD_MUSCLE_FILES, Bundle.EMPTY);
    String musclesAsJSON = mClient.get(MUSCLE_REQUEST_PATH);
    Log.v(TAG, "musclesAsJSON: " + musclesAsJSON);

    // get licenses from server
    mReceiver.send(STATUS_RUNNING_DOWNLOAD_LICENSE_FILES, Bundle.EMPTY);
    String licenseAsJSON = mClient.get(LICENSE_REQUEST_PATH);
    Log.v(TAG, "licenseAsJSON: " + licenseAsJSON);

    // get equipment from server
    mReceiver.send(STATUS_RUNNING_DOWNLOAD_EQUIPMENT_FILES, Bundle.EMPTY);
    String equipmentAsJSON = mClient.get(EQUIPMENT_REQUEST_PATH);
    Log.v(TAG, "equipmentAsJSON: " + equipmentAsJSON);

    // parse exercises, languages and muscles
    mReceiver.send(STATUS_RUNNING_CHECKING_EXERCISES, Bundle.EMPTY);
    WgerJSONParser wgerParser = new WgerJSONParser(exercisesAsJSON, languagesAsJSON, musclesAsJSON,
            equipmentAsJSON, licenseAsJSON, dataProvider);

    ArrayList<ExerciseType.Builder> exerciseBuilderList = wgerParser.getNewExercisesBuilder();

    // get images from server
    mReceiver.send(STATUS_RUNNING_DOWNLOADING_IMAGES, Bundle.EMPTY);
    WgerImageDownloader imageDownloader = new WgerImageDownloader(licenseAsJSON, getApplicationContext(),
            mClient);
    ArrayList<ExerciseType> newExerciseList = imageDownloader.downloadImages(exerciseBuilderList);

    return newExerciseList;
}