Example usage for android.support.v4.content Loader getId

List of usage examples for android.support.v4.content Loader getId

Introduction

In this page you can find the example usage for android.support.v4.content Loader getId.

Prototype

public int getId() 

Source Link

Usage

From source file:org.thialfihar.android.apg.ui.CertifyKeyActivity.java

@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
    switch (loader.getId()) {
    case LOADER_ID_KEYRING:
        // the first key here is our master key
        if (data.moveToFirst()) {
            // TODO: put findViewById in onCreate!

            long keyId = data.getLong(INDEX_MASTER_KEY_ID);
            String keyIdStr = PgpKeyHelper.convertKeyIdToHexShort(keyId);
            ((TextView) findViewById(R.id.key_id)).setText(keyIdStr);

            String mainUserId = data.getString(INDEX_USER_ID);
            ((TextView) findViewById(R.id.main_user_id)).setText(mainUserId);

            byte[] fingerprintBlob = data.getBlob(INDEX_FINGERPRINT);
            if (fingerprintBlob == null) {
                // FALLBACK for old database entries
                fingerprintBlob = ProviderHelper.getFingerprint(this, mDataUri);
            }/*from w  ww  .  j  ava  2s  .  co m*/
            String fingerprint = PgpKeyHelper.convertFingerprintToHex(fingerprintBlob);
            ((TextView) findViewById(R.id.fingerprint)).setText(PgpKeyHelper.colorizeFingerprint(fingerprint));
        }
        break;
    case LOADER_ID_USER_IDS:
        mUserIdsAdapter.swapCursor(data);
        break;
    }
}

From source file:org.xbmc.kore.ui.sections.video.TVShowProgressFragment.java

@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
    if (data != null) {
        switch (loader.getId()) {
        case LOADER_NEXT_EPISODES:
            displayNextEpisodeList(data);
            break;
        case LOADER_SEASONS:
            displaySeasonList(data);/*from  ww  w .ja  v  a2  s . c om*/
            break;
        }
    }
}

From source file:com.ultramegasoft.flavordex2.fragment.ViewInfoFragment.java

@Override
public void onLoadFinished(@NonNull Loader<Cursor> loader, Cursor data) {
    final int id = loader.getId();
    switch (id) {
    case LOADER_MAIN:
        if (data.moveToFirst()) {
            mEntryCat = data.getString(data.getColumnIndex(Tables.Entries.CAT));
            mTitle = data.getString(data.getColumnIndex(Tables.Entries.TITLE));
            mRating = data.getFloat(data.getColumnIndex(Tables.Entries.RATING));
            populateViews(data);// w ww.  j  a v a2 s. c  o m
        }
        break;
    case LOADER_EXTRAS:
        data.moveToPosition(-1);
        final LinkedHashMap<String, ExtraFieldHolder> extras = new LinkedHashMap<>();
        String name;
        String value;
        boolean preset;
        while (data.moveToNext()) {
            name = data.getString(data.getColumnIndex(Tables.Extras.NAME));
            value = data.getString(data.getColumnIndex(Tables.EntriesExtras.VALUE));
            preset = data.getInt(data.getColumnIndex(Tables.Extras.PRESET)) == 1;
            extras.put(name, new ExtraFieldHolder(0, name, preset, value));
        }
        populateExtras(extras);
    }
}

From source file:edu.nd.darts.cimon.CimonListView.java

public void onLoaderReset(Loader<Cursor> loader) {
    int id = loader.getId();
    if (DebugLog.DEBUG)
        Log.d(TAG, "CimonListView.onLoaderReset - id: " + id);
    if (id == 0) {
        adapter.swapGroupCursor(null);//w w w  . ja v  a 2 s.com
    } else {
        adapter.swapChildrenCursor(id, null);
    }
}

From source file:nu.firetech.android.pactrack.frontend.ParcelDetailsFragment.java

@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) {
    switch (loader.getId()) {
    case PARCEL_LOADER_ID:
        updateView(cursor);//from w  w  w . j  a v  a 2 s .  c o m
        break;
    case EVENTS_LOADER_ID:
        mEventsAdapter.swapCursor(cursor);
        break;
    case REFRESH_LOADER_ID:
        //TODO This can probably be done better...
        final Cursor fCursor = cursor;
        new Handler(getActivity().getMainLooper()) {
            @Override
            public void handleMessage(Message m) {
                ParcelUpdater.update(ParcelDetailsFragment.this, fCursor);
            }
        }.sendEmptyMessage(0);
        break;
    }
}

From source file:com.money.manager.ex.fragment.HomeFragment.java

@Override
public void onLoaderReset(Loader<Cursor> loader) {
    switch (loader.getId()) {
    case ID_LOADER_ACCOUNT_BILLS:
        txtTotalAccounts.setText(currencyUtils.getBaseCurrencyFormatted(Double.valueOf(0)));
        lstAccountBills.setAdapter(null);
        setListViewAccountBillsVisible(false);
    }//  ww  w . j a  v  a2s  . c o  m
}

From source file:org.mariotaku.twidere.activity.DirectMessagesActivity.java

@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) {
    switch (loader.getId()) {
    case LOADER_ID_ACCOUNTS: {
        mAccountsCursor = cursor;/*from w w w.  j  a  va 2  s  .com*/
        mAccountsAdapter.changeCursor(cursor);
    }
    case LOADER_ID_DIRECT_MESSAGES: {
        mAdapter.changeCursor(cursor);
    }
    }
}

From source file:com.example.mihai.inforoute.app.ForecastFragment.java

@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) {
    if (loader.getId() == 0) {
        if (!cursor.moveToFirst()) {
            return;
        }/*ww  w . j  av a 2 s.c  om*/
        mForecastAdapter.swapCursor(cursor);
    } else {
        if (!cursor.moveToFirst()) {
            return;
        }
        TextView text_dist = (TextView) getView().findViewById(R.id.list_item_distance_textview);

        TextView text_status = (TextView) getView().findViewById(R.id.list_item_status_textview);

        TextView text_speed = (TextView) getView().findViewById(R.id.list_item_speed_textview);

        TextView text_time = (TextView) getView().findViewById(R.id.list_item_time_textview);

        TextView text_cons = (TextView) getView().findViewById(R.id.list_item_consum_textview);

        TextView text_totalCons = (TextView) getView().findViewById(R.id.list_item_consum_total_textview);

        TextView text_cost = (TextView) getView().findViewById(R.id.list_item_cost_textview);

        TextView text_index = (TextView) getView().findViewById(R.id.list_item_index_textview);

        // Extract properties from cursor
        int distance = cursor.getInt(0);
        String status = cursor.getString(1);
        int speed = cursor.getInt(2);
        double time = cursor.getDouble(3);
        int consumption = cursor.getInt(4);
        double tConsumption = cursor.getDouble(5);
        int cost = cursor.getInt(6);
        double indice = cursor.getDouble(7);

        // Populate fields with extracted properties
        text_dist.setText(Integer.toString(distance) + " Km");
        text_status.setText(status);
        //TODO
        //sa utilizez shared preferences pentru a afisa in km/h sau m/s
        text_speed.setText(Integer.toString(speed) + " Km/h");
        text_time.setText(formatTime(Double.toString(time)));
        text_cons.setText(Integer.toString(consumption) + " l/Km");
        text_totalCons.setText(Double.toString(tConsumption) + " l");
        text_cost.setText(Integer.toString(cost) + " RON");
        text_index.setText(Double.toString(indice));
    }
    //mRouteAdapter.swapCursor(data);
}

From source file:com.money.manager.ex.recurring.transactions.RecurringTransactionListFragment.java

@Override
public void onLoaderReset(Loader<Cursor> loader) {
    switch (loader.getId()) {
    case ID_LOADER_REPEATING:
        AllDataAdapter adapter = (AllDataAdapter) getListAdapter();
        if (adapter != null) {
            //                    adapter.swapCursor(null);
            adapter.changeCursor(null);//from  ww w .  j a v a2s .com
        }
    }
}

From source file:com.cattle.fragments.UserPhotosFragment.java

public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
    switch (loader.getId()) {
    case LOADER_USER_PHOTOS_EXTERNAL:
        mPhotoAdapter.swapCursor(data);/*from   w  w w.j a  va 2s .  c  o m*/
        mPhotoGrid.setSelection(0);
        setCountTextView(data.getCount());

        break;
    }
}