List of usage examples for android.net Uri getAuthority
@Nullable public abstract String getAuthority();
From source file:com.xabber.android.data.account.WLMManager.java
@Override public boolean isValidUri(Uri uri) { return WLM_SCHEME.equals(uri.getScheme()) && WLM_AUTHORITY.equals(uri.getAuthority()) && WLM_REDIRECT_PATH.equals(uri.getPath()); }
From source file:com.owncloud.android.ui.activity.ShareActivity.java
@Override protected void onNewIntent(Intent intent) { // Verify the action and get the query if (Intent.ACTION_SEARCH.equals(intent.getAction())) { String query = intent.getStringExtra(SearchManager.QUERY); Log_OC.w(TAG, "Ignored Intent requesting to query for " + query); } else if (UsersAndGroupsSearchProvider.ACTION_SHARE_WITH.equals(intent.getAction())) { Uri data = intent.getData(); doShareWith(data.getLastPathSegment(), UsersAndGroupsSearchProvider.DATA_GROUP.equals(data.getAuthority())); } else {/*from w ww .ja va 2 s . c o m*/ Log_OC.wtf(TAG, "Unexpected intent " + intent.toString()); } }
From source file:fr.mixit.android.ui.MembersActivity.java
@Override public void startActivityFromFragment(Fragment fragment, Intent intent, int requestCode) { final Uri uri = intent.getData(); if (uri != null && uri.getAuthority().equals(MixItContract.Members.CONTENT_URI.getAuthority())) { final boolean addToBackStack = intent.getBooleanExtra(IntentUtils.EXTRA_FROM_ADD_TO_BACKSTACK, false); final FragmentManager fm = getSupportFragmentManager(); // MEMBER if (uri.getEncodedPath().startsWith(SLASH + MixItContract.PATH_MEMBERS) || uri.getEncodedPath().startsWith(SLASH + MixItContract.PATH_SPEAKERS)) { if (UIUtils.isTablet(this)) { if (addToBackStack) { final MemberDetailsFragment frag = MemberDetailsFragment.newInstance(intent); final FragmentTransaction ft = fm.beginTransaction(); ft.replace(R.id.content_member_details, frag); ft.addToBackStack(null); if (mTopFragCommitId == -1) { mTopFragCommitId = ft.commit(); } else { ft.commit();/* ww w .j a v a 2s . com*/ } return; } else { if (mTopFragCommitId != -1) { fm.popBackStack(mTopFragCommitId, FragmentManager.POP_BACK_STACK_INCLUSIVE); mTopFragCommitId = -1; } if (mMemberDetailsFrag != null) { final int memberId = Integer.parseInt(MixItContract.Members.getMemberId(uri)); mMemberDetailsFrag.setMemberId(memberId); return; } else { Log.e(TAG, "no fragment member details found but device is tablet"); } } } else { super.startActivityFromFragment(fragment, intent, requestCode); return; } } else // SESSIONS if (uri.getEncodedPath().startsWith(SLASH + MixItContract.PATH_SESSIONS) || uri.getEncodedPath().startsWith(SLASH + MixItContract.PATH_LIGHTNINGS)) { if (UIUtils.isTablet(this)) { final SessionDetailsFragment frag = SessionDetailsFragment.newInstance(intent); final FragmentTransaction ft = fm.beginTransaction(); ft.replace(R.id.content_member_details, frag); ft.addToBackStack(null); if (mTopFragCommitId == -1) { mTopFragCommitId = ft.commit(); } else { ft.commit(); } return; } else { super.startActivityFromFragment(fragment, intent, requestCode); return; } } } super.startActivityFromFragment(fragment, intent, requestCode); }
From source file:mobisocial.musubi.objects.WebAppObj.java
String getAppId(Obj obj) { Uri appUri = Uri.parse(obj.getJson().optString(OBJ_URL)); return appUri.getAuthority() + "/" + getAppName(obj); }
From source file:drupalfit.sample.HomeActivity.java
@OnClick(R.id.connect_facebook) public void connectFacebook() { if (TextUtils.isEmpty(endpoint.getText().toString())) { Toast.makeText(HomeActivity.this, "failure", Toast.LENGTH_LONG).show(); return;/*from w w w. j a va 2 s . c o m*/ } progress(); String restEndpoint = endpoint.getText().toString(); Uri uri = Uri.parse(restEndpoint); String oauthEndpoint = uri.getScheme() + "://" + uri.getAuthority() + "/oauth2"; DrupalManager.get().setEndpoint(restEndpoint) .setProvider(this, DrupalManager.FACEBOOK, token.getText().toString()).build(); DrupalManager.get().getProfile(new Callback<User>() { // direct access profile, DrupalManager will try to connect @Override public void success(User user, Response response) { done(); Toast.makeText(HomeActivity.this, "success: " + "uid:" + user.uid + ", name: " + user.name, Toast.LENGTH_LONG).show(); Log8.d(user.name); Log8.d(user.mail); Log8.d(user.uid); } @Override public void failure(RetrofitError error) { done(); Toast.makeText(HomeActivity.this, "failure: " + error, Toast.LENGTH_LONG).show(); Log8.d(error); } }); }
From source file:fr.mixit.android.ui.PlanningActivity.java
@Override public void startActivityFromFragment(Fragment fragment, Intent intent, int requestCode) { final Uri uri = intent.getData(); if (uri != null && uri.getAuthority().equals(MixItContract.Sessions.CONTENT_URI.getAuthority())) { final boolean addToBackStack = intent.getBooleanExtra(IntentUtils.EXTRA_FROM_ADD_TO_BACKSTACK, false); final FragmentManager fm = getSupportFragmentManager(); // SESSION if (uri.getEncodedPath().startsWith(SLASH + MixItContract.PATH_SESSIONS) || uri.getEncodedPath().startsWith(SLASH + MixItContract.PATH_LIGHTNINGS)) { if (UIUtils.isTablet(this)) { if (addToBackStack) { final SessionDetailsFragment frag = SessionDetailsFragment.newInstance(intent); final FragmentTransaction ft = fm.beginTransaction(); ft.replace(R.id.content_session_details, frag); ft.addToBackStack(null); if (mTopFragCommitId == -1) { mTopFragCommitId = ft.commit(); } else { ft.commit();/* w w w . j av a2 s. com*/ } return; } else { if (mTopFragCommitId != -1) { fm.popBackStack(mTopFragCommitId, FragmentManager.POP_BACK_STACK_INCLUSIVE); mTopFragCommitId = -1; } if (mSessionDetailsFrag != null) { final int sessionId = Integer.parseInt(MixItContract.Sessions.getSessionId(uri)); mSessionDetailsFrag.setSessionId(sessionId); return; } else { Log.e(TAG, "no fragment session details found but device is tablet"); } } } else { super.startActivityFromFragment(fragment, intent, requestCode); return; } } else // MEMBERS if (uri.getEncodedPath().startsWith(SLASH + MixItContract.PATH_MEMBERS) || uri.getEncodedPath().startsWith(SLASH + MixItContract.PATH_SPEAKERS)) { if (UIUtils.isTablet(this)) { final MemberDetailsFragment frag = MemberDetailsFragment.newInstance(intent); final FragmentTransaction ft = fm.beginTransaction(); ft.replace(R.id.content_session_details, frag); ft.addToBackStack(null); if (mTopFragCommitId == -1) { mTopFragCommitId = ft.commit(); } else { ft.commit(); } return; } else { super.startActivityFromFragment(fragment, intent, requestCode); return; } } } super.startActivityFromFragment(fragment, intent, requestCode); }
From source file:com.cerema.cloud2.ui.activity.ShareActivity.java
@Override protected void onNewIntent(Intent intent) { // Verify the action and get the query if (Intent.ACTION_SEARCH.equals(intent.getAction())) { String query = intent.getStringExtra(SearchManager.QUERY); Log_OC.w(TAG, "Ignored Intent requesting to query for " + query); } else if (UsersAndGroupsSearchProvider.ACTION_SHARE_WITH.equals(intent.getAction())) { Uri data = intent.getData(); String dataString = intent.getDataString(); String shareWith = dataString.substring(dataString.lastIndexOf('/') + 1); doShareWith(shareWith, data.getAuthority()); } else {/*ww w.j a v a2 s .c o m*/ Log_OC.wtf(TAG, "Unexpected intent " + intent.toString()); } }
From source file:cn.edu.wyu.documentviewer.model.DocumentInfo.java
public void updateFromUri(ContentResolver resolver, Uri uri) throws FileNotFoundException { ContentProviderClient client = null; Cursor cursor = null;/* ww w . j a v a2 s . c om*/ try { client = DocumentsApplication.acquireUnstableProviderOrThrow(resolver, uri.getAuthority()); cursor = client.query(uri, null, null, null, null); if (!cursor.moveToFirst()) { throw new FileNotFoundException("Missing details for " + uri); } updateFromCursor(cursor, uri.getAuthority()); } catch (Throwable t) { throw asFileNotFoundException(t); } finally { IOUtils.closeQuietly(cursor); ContentProviderClient.releaseQuietly(client); } }
From source file:mobisocial.musubi.ui.ViewProfileActivity.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_tabbed); Intent intent = getIntent();//from www .ja v a2 s. c o m Long id = null; // intent from address book Intent is = getIntent(); Uri data = getIntent().getData(); String type = getIntent().getType(); if (data != null) { if (type != null && type.equals(MusubiContentProvider.getType(Provided.IDENTITIES_ID))) { id = ContentUris.parseId(data); } else if (data.getAuthority().equals(ContactsContract.AUTHORITY)) { // intent sent from address book have null type long rawId = ContentUris.parseId(data); id = getMusubiId(rawId); } } if (id == null) { id = intent.getLongExtra(PROFILE_ID, -1); } setTitle("Relationships"); mLabels.add("Profile"); mFragments.add(ViewProfileFragment.newInstance(id)); SQLiteOpenHelper helper = App.getDatabaseSource(this); IdentitiesManager im = new IdentitiesManager(helper); MIdentity identity = im.getIdentityForId(id); if (identity == null) { UsageMetrics.getUsageMetrics(this) .report(new Throwable("Invalid identity " + id + " passed tp ViewProfileActivity")); finish(); return; } FeedManager fm = new FeedManager(helper); mFeedIds = fm.getFeedsForIdentityId(id); setTitle(identity.name_); if (!identity.owned_) { mLabels.add("Conversations"); Bundle args = new Bundle(); args.putLong(ConversationsFragment.ARG_IDENTITY_ID, identity.id_); ConversationsFragment f = new ConversationsFragment(); f.setArguments(args); mFragments.add(f); } else { setTitle("Your profile"); } PagerAdapter adapter = new ViewFragmentAdapter(getSupportFragmentManager(), mFragments, mLabels); mViewPager = (ViewPager) findViewById(R.id.feed_pager); mViewPager.setAdapter(adapter); //Bind the tab indicator to the adapter TabPageIndicator tabIndicator = (TabPageIndicator) findViewById(R.id.feed_titles); tabIndicator.setViewPager(mViewPager); }
From source file:com.android.messaging.datamodel.BugleNotifications.java
/** * Returns the thumbnailUri from the avatar URI, or null if avatar URI does not have thumbnail. *//*from www . j av a 2s . c om*/ private static Uri getThumbnailUri(final Uri avatarUri) { Uri localUri = null; final String avatarType = AvatarUriUtil.getAvatarType(avatarUri); if (TextUtils.equals(avatarType, AvatarUriUtil.TYPE_LOCAL_RESOURCE_URI)) { localUri = AvatarUriUtil.getPrimaryUri(avatarUri); } else if (UriUtil.isLocalResourceUri(avatarUri)) { localUri = avatarUri; } if (localUri != null && localUri.getAuthority().equals(ContactsContract.AUTHORITY)) { // Contact photos are of the form: content://com.android.contacts/contacts/123/photo final List<String> pathParts = localUri.getPathSegments(); if (pathParts.size() == 3 && pathParts.get(2).equals(Contacts.Photo.CONTENT_DIRECTORY)) { return localUri; } } return null; }