List of usage examples for android.widget CursorAdapter FLAG_AUTO_REQUERY
int FLAG_AUTO_REQUERY
To view the source code for android.widget CursorAdapter FLAG_AUTO_REQUERY.
Click Source Link
From source file:com.skubit.satoshidice.DiceAccountView.java
public void initialize(final Activity activity, DrawerLayout drawerLayout) { mDrawerLayout = drawerLayout;// ww w .ja v a 2s . co m mDropdownList = (ListView) findViewById(R.id.account_dropdown); final Cursor c = activity.getContentResolver().query(AccountsColumns.CONTENT_URI, null, null, null, null); mAdapter = new SimpleCursorAdapter(activity, R.layout.drawer_account_drop_item, c, new String[] { AccountsColumns.NICKNAME }, new int[] { R.id.account_name }, CursorAdapter.FLAG_AUTO_REQUERY); final AccountsCursor ac = new AccountsCursor(c); mSpinner = findViewById(R.id.account_satoshidice); mSpinner.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ImageView expander = (ImageView) mSpinner.findViewById(R.id.expander); if (!mDropdownList.isShown()) { mDropdownList.setVisibility(View.VISIBLE); mDivider.setVisibility(View.VISIBLE); expander.setImageResource(R.drawable.ic_action_collapse); // TODO: close } else { mDropdownList.setVisibility(View.GONE); expander.setImageResource(R.drawable.ic_action_expand); mDivider.setVisibility(View.GONE); } } }); mExpanderIcon = (ImageView) mSpinner.findViewById(R.id.expander); mExpanderIcon.setImageResource(R.drawable.ic_action_expand); mDivider = findViewById(R.id.account_divider_bottom); mDivider.setVisibility(View.GONE); mDropdownList.setAdapter(mAdapter); mDropdownList.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int position, long arg3) { ac.moveToPosition(position); ImageView expander = (ImageView) mSpinner.findViewById(R.id.expander); expander.setImageResource(R.drawable.ic_action_expand); AccountSettings.get(mContext).saveNickName(ac.getNickname()); AccountSettings.get(mContext).saveSecret(ac.getSecret()); AccountSettings.get(mContext).saveDepositAddress(ac.getDepositaddress()); setAccountName(); Intent intent = new Intent("account_change"); LocalBroadcastManager.getInstance(mContext).sendBroadcast(intent); mDivider.setVisibility(View.GONE); mDropdownList.setVisibility(View.GONE); mDrawerLayout.closeDrawers(); } }); setAccountName(); }
From source file:com.skubit.android.BitIdAccountView.java
public void initialize(final Activity activity, DrawerLayout drawerLayout) { mDrawerLayout = drawerLayout;/* w w w.j a v a2 s .c om*/ mDropdownList = (ListView) findViewById(R.id.account_dropdown); final Cursor c = activity.getContentResolver().query(AccountsColumns.CONTENT_URI, null, null, null, null); mAdapter = new SimpleCursorAdapter(activity, R.layout.drawer_account_drop_item, c, new String[] { AccountsColumns.BITID }, new int[] { R.id.account_name }, CursorAdapter.FLAG_AUTO_REQUERY); final AccountsCursor ac = new AccountsCursor(c); mSpinner = findViewById(R.id.account_google);// TODO mSpinner.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ImageView expander = (ImageView) mSpinner.findViewById(R.id.expander); if (!mDropdownList.isShown()) { mDropdownList.setVisibility(View.VISIBLE); mDivider.setVisibility(View.VISIBLE); expander.setImageResource(R.drawable.ic_action_collapse); //TODO: close } else { mDropdownList.setVisibility(View.GONE); expander.setImageResource(R.drawable.ic_action_expand); mDivider.setVisibility(View.GONE); } } }); mExpanderIcon = (ImageView) mSpinner.findViewById(R.id.expander); mExpanderIcon.setImageResource(R.drawable.ic_action_expand); mDivider = findViewById(R.id.account_divider_bottom); mDivider.setVisibility(View.GONE); mDropdownList.setAdapter(mAdapter); mDropdownList.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int position, long arg3) { ac.moveToPosition(position); ImageView expander = (ImageView) mSpinner.findViewById(R.id.expander); expander.setImageResource(R.drawable.ic_action_expand); AccountSettings.get(mContext).saveBitIdAccount(ac.getBitid()); AccountSettings.get(mContext).saveCookie(ac.getCookie()); AccountSettings.get(mContext).saveBitcoinAddress(null); setAccountName(); // Intent data = new Intent("signout"); // data.putExtra(AccountManager.KEY_ACCOUNT_NAME, ac.getBitid()); // LocalBroadcastManager.getInstance(mContext).sendBroadcast(data); mDivider.setVisibility(View.GONE); mDropdownList.setVisibility(View.GONE); mDrawerLayout.closeDrawers(); } }); setAccountName(); }