List of usage examples for android.app Activity getContentResolver
@Override
public ContentResolver getContentResolver()
From source file:de.elanev.studip.android.app.frontend.courses.CoursesFragment.java
@Override public void onAttach(Activity activity) { super.onAttach(activity); activity.getContentResolver().registerContentObserver(CoursesContract.CONTENT_URI, true, mObserver); }
From source file:at.flack.SMSMainActivity.java
public ArrayList<SMSItem> readSMSContacts(Activity activity) { LinkedHashSet<SMSItem> smsList = new LinkedHashSet<SMSItem>(); Cursor cur = activity.getContentResolver().query(Uri.parse("content://sms"), null, null, null, null); if (cur != null && cur.moveToFirst()) { SMSItem.initIdx(cur);/*w w w . ja v a 2 s . c o m*/ do { SMSItem item = new SMSItem(cur); smsList.add(item); } while (cur.moveToNext()); } return new ArrayList<SMSItem>(smsList); }
From source file:org.pixmob.droidlink.ui.AccountInitTask.java
public AccountInitTask(final Fragment fragment) { this.fragment = fragment; final Activity context = fragment.getActivity(); prefs = context.getSharedPreferences(SHARED_PREFERENCES_FILE, Context.MODE_PRIVATE); prefsEditor = prefs.edit();//from w ww . j a v a2 s . co m contentResolver = context.getContentResolver(); accounts = Accounts.list(context); }
From source file:at.flack.activity.NewSMSContactActivity.java
public ArrayList<ContactModel> readSMSContacts(Activity activity) { LinkedHashSet<ContactModel> smsList = new LinkedHashSet<ContactModel>(); Cursor phones = activity.getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, null, null, null);// w w w. ja va2s .c o m while (phones.moveToNext()) { String name = phones .getString(phones.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME)); String phoneNumber = phones.getString(phones .getColumnIndex(PhoneNumberUtils.formatNumber(ContactsContract.CommonDataKinds.Phone.NUMBER))); String photo = phones .getString(phones.getColumnIndex(ContactsContract.CommonDataKinds.Phone.PHOTO_THUMBNAIL_URI)); String primary = name; if (name == null) primary = phoneNumber; smsList.add(new ContactModel(fetchThumbnail(activity, photo != null ? Uri.parse(photo) : null), primary, phoneNumber, "", false)); } phones.close(); ArrayList<ContactModel> unsorted = new ArrayList<ContactModel>(smsList); Collections.sort(unsorted, new Comparator<ContactModel>() { @Override public int compare(ContactModel lhs, ContactModel rhs) { return lhs.getTitle().compareTo(rhs.getTitle()); } }); return unsorted; }
From source file:de.elanev.studip.android.app.frontend.messages.MessageDetailFragment.java
@Override public void onAttach(Activity activity) { super.onAttach(activity); activity.getContentResolver().registerContentObserver(MessagesContract.CONTENT_URI_MESSAGES, true, mObserver);// w w w .jav a 2 s. c o m }
From source file:de.elanev.studip.android.app.frontend.news.NewsListFragment.java
@Override public void onAttach(Activity activity) { super.onAttach(activity); activity.getContentResolver().registerContentObserver(NewsContract.CONTENT_URI, true, mObserver); }
From source file:com.skubit.satoshidice.DiceAccountView.java
public void initialize(final Activity activity, DrawerLayout drawerLayout) { mDrawerLayout = drawerLayout;/*from www .j a va2 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.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.android.settings.profiles.ProfilesSettings.java
private void updateProfilesEnabledState() { Activity activity = getActivity(); mEnabled = Settings.System.getInt(activity.getContentResolver(), Settings.System.SYSTEM_PROFILES_ENABLED, 1) == 1;/*from w w w .j a v a2 s . c o m*/ activity.invalidateOptionsMenu(); mViewPager.setVisibility(mEnabled ? View.VISIBLE : View.GONE); mEmptyText.setVisibility(mEnabled ? View.GONE : View.VISIBLE); }
From source file:com.skubit.android.BitIdAccountView.java
public void initialize(final Activity activity, DrawerLayout drawerLayout) { mDrawerLayout = drawerLayout;/*from w ww . j a v a 2 s. 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.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(); }
From source file:de.elanev.studip.android.app.frontend.messages.MessagesListFragment.java
@Override public void onAttach(Activity activity) { super.onAttach(activity); activity.getContentResolver().registerContentObserver(MessagesContract.CONTENT_URI_MESSAGE_FOLDERS, true, mObserver);//from w ww. j a v a 2 s. com }