Example usage for android.os Bundle getLongArray

List of usage examples for android.os Bundle getLongArray

Introduction

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

Prototype

@Nullable
public long[] getLongArray(@Nullable String key) 

Source Link

Document

Returns the value associated with the given key, or null if no mapping of the desired type exists for the given key or a null value is explicitly associated with the key.

Usage

From source file:org.getlantern.firetweet.fragment.support.ActivitiesAboutMeFragment.java

@Override
public Loader<List<ParcelableActivity>> onCreateLoader(final int id, final Bundle args) {
    setProgressBarIndeterminateVisibility(true);
    final long[] accountIds = args.getLongArray(EXTRA_ACCOUNT_IDS);
    final long[] sinceIds = args.getLongArray(EXTRA_SINCE_IDS);
    final long[] maxIds = args.getLongArray(EXTRA_MAX_IDS);
    final long accountId = accountIds != null ? accountIds[0] : -1;
    final long sinceId = sinceIds != null ? sinceIds[0] : -1;
    final long maxId = maxIds != null ? maxIds[0] : -1;
    return new ActivitiesAboutMeLoader(getActivity(), accountId, sinceId, maxId, getAdapterData(),
            getSavedActivitiesFileArgs(), getTabPosition());
}

From source file:org.getlantern.firetweet.fragment.support.ActivitiesByFriendsFragment.java

@Override
public Loader<List<ParcelableActivity>> onCreateLoader(final int id, final Bundle args) {
    setProgressBarIndeterminateVisibility(true);
    final long[] accountIds = args.getLongArray(EXTRA_ACCOUNT_IDS);
    final long[] sinceIds = args.getLongArray(EXTRA_SINCE_IDS);
    final long[] maxIds = args.getLongArray(EXTRA_MAX_IDS);
    final long accountId = accountIds != null ? accountIds[0] : -1;
    final long sinceId = sinceIds != null ? sinceIds[0] : -1;
    final long maxId = maxIds != null ? maxIds[0] : -1;
    return new ActivitiesByFriendsLoader(getActivity(), accountId, sinceId, maxId, getAdapterData(),
            getSavedActivitiesFileArgs(), getTabPosition());
}

From source file:org.gnucash.android.ui.transactions.BulkMoveDialogFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    getDialog().getWindow().setLayout(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);

    Bundle args = getArguments();
    mTransactionIds = args.getLongArray(TransactionsListFragment.SELECTED_TRANSACTION_IDS);
    mOriginAccountId = args.getLong(TransactionsListFragment.ORIGIN_ACCOUNT_ID);

    String title = getActivity().getString(R.string.title_move_transactions, mTransactionIds.length);
    getDialog().setTitle(title);/*  w  w  w  .  ja  v a 2  s  . c  om*/

    mAccountsDbAdapter = new AccountsDbAdapter(getActivity());
    Cursor cursor = mAccountsDbAdapter.fetchAllAccounts();

    String[] from = new String[] { DatabaseHelper.KEY_NAME };
    int[] to = new int[] { android.R.id.text1 };
    SimpleCursorAdapter mCursorAdapter = new SimpleCursorAdapter(getActivity(),
            android.R.layout.simple_spinner_item, cursor, from, to, 0);
    mCursorAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    mDestinationAccountSpinner.setAdapter(mCursorAdapter);
    setListeners();
}

From source file:com.bydavy.card.receipts.ReceiptListAdapter.java

public void load(Bundle savedState) {
    mSelectedSet.clear();/*from   www.  ja v  a  2s  .c  o m*/
    for (final long id : savedState.getLongArray(STATE_SELECTED_IDS)) {
        mSelectedSet.add(id);
        if (mCallback != null) {
            mCallback.onAdapterSelectedChanged(true, getSelectedCount());
        }
    }
    notifyDataSetChanged();
}

From source file:org.gnucash.android.ui.transaction.BulkMoveDialogFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    getDialog().getWindow().setLayout(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);

    Bundle args = getArguments();
    mTransactionIds = args.getLongArray(UxArgument.SELECTED_TRANSACTION_IDS);
    mOriginAccountId = args.getLong(UxArgument.ORIGIN_ACCOUNT_ID);

    String title = getActivity().getString(R.string.title_move_transactions, mTransactionIds.length);
    getDialog().setTitle(title);//  w ww.j ava  2 s  .  com

    mAccountsDbAdapter = new AccountsDbAdapter(getActivity());
    String conditions = "(" + DatabaseHelper.KEY_ROW_ID + " != " + mOriginAccountId + " AND "
            + DatabaseHelper.KEY_CURRENCY_CODE + " = '" + mAccountsDbAdapter.getCurrencyCode(mOriginAccountId)
            + "' AND " + DatabaseHelper.KEY_UID + " != '" + mAccountsDbAdapter.getGnuCashRootAccountUID()
            + "' AND " + DatabaseHelper.KEY_PLACEHOLDER + " = 0" + ")";
    Cursor cursor = mAccountsDbAdapter.fetchAccountsOrderedByFullName(conditions);

    SimpleCursorAdapter mCursorAdapter = new QualifiedAccountNameCursorAdapter(getActivity(),
            android.R.layout.simple_spinner_item, cursor);
    mCursorAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    mDestinationAccountSpinner.setAdapter(mCursorAdapter);
    setListeners();
}

From source file:org.gnucash.android.ui.transaction.dialog.BulkMoveDialogFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    getDialog().getWindow().setLayout(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);

    Bundle args = getArguments();
    mTransactionIds = args.getLongArray(UxArgument.SELECTED_TRANSACTION_IDS);
    mOriginAccountUID = args.getString(UxArgument.ORIGIN_ACCOUNT_UID);

    String title = getActivity().getString(R.string.title_move_transactions, mTransactionIds.length);
    getDialog().setTitle(title);/*from  www .  j  a  va2 s. co  m*/

    mAccountsDbAdapter = new AccountsDbAdapter(getActivity());
    String conditions = "(" + DatabaseSchema.AccountEntry.COLUMN_UID + " != '" + mOriginAccountUID + "' AND "
            + DatabaseSchema.AccountEntry.COLUMN_CURRENCY + " = '"
            + mAccountsDbAdapter.getCurrencyCode(mOriginAccountUID) + "' AND "
            + DatabaseSchema.AccountEntry.COLUMN_UID + " != '" + mAccountsDbAdapter.getGnuCashRootAccountUID()
            + "' AND " + DatabaseSchema.AccountEntry.COLUMN_PLACEHOLDER + " = 0" + ")";
    Cursor cursor = mAccountsDbAdapter.fetchAccountsOrderedByFullName(conditions);

    SimpleCursorAdapter mCursorAdapter = new QualifiedAccountNameCursorAdapter(getActivity(),
            android.R.layout.simple_spinner_item, cursor);
    mCursorAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    mDestinationAccountSpinner.setAdapter(mCursorAdapter);
    setListeners();
}

From source file:ru.mtuci.musicanalyzer.apollo.menu.DeleteDialog.java

/**
 * {@inheritDoc}// www. j  a v a 2s  .com
 */
@Override
public Dialog onCreateDialog(final Bundle savedInstanceState) {
    final String delete = getString(R.string.context_menu_delete);
    final Bundle arguments = getArguments();
    // Get the image cache key
    final String key = arguments.getString("cachekey");
    // Get the track(s) to delete
    mItemList = arguments.getLongArray("items");
    // Get the dialog title
    final String title = arguments.getString(Config.NAME);
    // Initialize the image cache
    mFetcher = ApolloUtils.getImageFetcher(getActivity());
    // Build the dialog
    return new AlertDialog.Builder(getActivity()).setTitle(delete + " " + title)
            .setMessage(R.string.cannot_be_undone).setPositiveButton(delete, new OnClickListener() {

                @Override
                public void onClick(final DialogInterface dialog, final int which) {
                    // Remove the items from the image cache
                    mFetcher.removeFromCache(key);
                    // Delete the selected item(s)
                    MusicUtils.deleteTracks(getActivity(), mItemList);
                    dialog.dismiss();
                }
            }).setNegativeButton(R.string.cancel, new OnClickListener() {

                @Override
                public void onClick(final DialogInterface dialog, final int which) {
                    dialog.dismiss();
                }
            }).create();
}

From source file:com.andrew.apollo.menu.DeleteDialog.java

/**
 * {@inheritDoc}//from w w  w .ja v  a 2  s  .  c om
 */
@Override
public Dialog onCreateDialog(final Bundle savedInstanceState) {
    final String delete = getString(R.string.context_menu_delete);
    final Bundle arguments = getArguments();
    // Get the image cache key
    final String key = arguments.getString("cachekey");
    // Get the track(s) to delete
    mItemList = arguments.getLongArray("items");
    // Get the dialog title
    final String title = arguments.getString(Config.NAME);
    // Initialize the image cache
    mFetcher = ApolloUtils.getImageFetcher(getSherlockActivity());
    // Build the dialog
    return new AlertDialog.Builder(getSherlockActivity()).setTitle(delete + " " + title)
            .setMessage(R.string.cannot_be_undone).setPositiveButton(delete, new OnClickListener() {

                @Override
                public void onClick(final DialogInterface dialog, final int which) {
                    // Remove the items from the image cache
                    mFetcher.removeFromCache(key);
                    // Delete the selected item(s)
                    MusicUtils.deleteTracks(getSherlockActivity(), mItemList);
                    dialog.dismiss();
                }
            }).setNegativeButton(R.string.cancel, new OnClickListener() {

                @Override
                public void onClick(final DialogInterface dialog, final int which) {
                    dialog.dismiss();
                }
            }).create();
}

From source file:com.cyanogenmod.eleven.menu.DeleteDialog.java

/**
 * {@inheritDoc}/*  ww  w  . ja  v  a 2 s.  c o m*/
 */
@Override
public Dialog onCreateDialog(final Bundle savedInstanceState) {
    final String delete = getString(R.string.context_menu_delete);
    final Bundle arguments = getArguments();
    // Get the image cache key
    final String key = arguments.getString("cachekey");
    // Get the track(s) to delete
    mItemList = arguments.getLongArray("items");
    // Get the dialog title
    final String title = arguments.getString(Config.NAME);
    final String dialogTitle = getString(R.string.delete_dialog_title, title);
    // Initialize the image cache
    mFetcher = ApolloUtils.getImageFetcher(getActivity());
    // Build the dialog
    return new AlertDialog.Builder(getActivity()).setTitle(dialogTitle).setMessage(R.string.cannot_be_undone)
            .setPositiveButton(delete, new OnClickListener() {

                @Override
                public void onClick(final DialogInterface dialog, final int which) {
                    // Remove the items from the image cache
                    mFetcher.removeFromCache(key);
                    // Delete the selected item(s)
                    MusicUtils.deleteTracks(getActivity(), mItemList);
                    if (getActivity() instanceof DeleteDialogCallback) {
                        ((DeleteDialogCallback) getActivity()).onDelete(mItemList);
                    }
                    dialog.dismiss();
                }
            }).setNegativeButton(R.string.cancel, new OnClickListener() {

                @Override
                public void onClick(final DialogInterface dialog, final int which) {
                    dialog.dismiss();
                }
            }).create();
}

From source file:com.groupon.sthaleeya.osm.PickFriendsActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.pick_friends);

    FragmentManager fm = getSupportFragmentManager();

    Bundle extras = getIntent().getExtras();
    if (extras != null && extras.containsKey(Constants.FRIENDS_ID_KEY)) {
        long[] friends_ids = extras.getLongArray(Constants.FRIENDS_ID_KEY);
        if (friends_ids != null) {
            friendsMap = new HashMap<Long, Boolean>();
            for (int i = 0; i < friends_ids.length; i++) {
                friendsMap.put(friends_ids[i], true);
            }//w  w w. java  2 s  .  c o m
        }
    }
    if (savedInstanceState == null) {
        // First time through, we create our fragment programmatically.
        final Bundle args = getIntent().getExtras();
        friendPickerFragment = new FriendPickerFragment(args);
        fm.beginTransaction().add(R.id.friend_picker_fragment, friendPickerFragment).commit();
    } else {
        // Subsequent times, our fragment is recreated by the framework and already has saved and
        // restored its state, so we don't need to specify args again. (In fact, this might be
        // incorrect if the fragment was modified programmatically since it was created.)
        friendPickerFragment = (FriendPickerFragment) fm.findFragmentById(R.id.friend_picker_fragment);
    }

    friendPickerFragment.setOnErrorListener(new PickerFragment.OnErrorListener() {
        @Override
        public void onError(PickerFragment<?> fragment, FacebookException error) {
            PickFriendsActivity.this.onError(error);
        }
    });

    friendPickerFragment.setOnDoneButtonClickedListener(new PickerFragment.OnDoneButtonClickedListener() {
        @Override
        public void onDoneButtonClicked(PickerFragment<?> fragment) {
            List<GraphUser> friends = friendPickerFragment.getSelection();
            String[] friends_ids = new String[friends.size()];
            for (int i = 0; i < friends.size(); i++) {
                friends_ids[i] = friends.get(i).getId();
            }
            Intent intent = new Intent();
            intent.putExtra(Constants.FRIENDS_ID_KEY, friends_ids);
            setResult(RESULT_OK, intent);
            finish();
        }
    });
    friendPickerFragment.setFilter(new GraphObjectFilter<GraphUser>() {

        @Override
        public boolean includeItem(GraphUser graphObject) {
            if ((friendsMap != null) && friendsMap.containsKey(Long.parseLong(graphObject.getId())))
                return false;
            return true;
        }
    });
}