Java Code Examples for android.support.v4.app.ShareCompat#IntentReader
The following examples show how to use
android.support.v4.app.ShareCompat#IntentReader .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ShareActivity.java From Shaarlier with GNU General Public License v3.0 | 5 votes |
/** * Load data passed through the intent */ private void readIntent(@NonNull Intent intent) { ShareCompat.IntentReader reader = ShareCompat.IntentReader.from(this); String defaultUrl = extractUrl(reader.getText().toString()); String defaultTitle = extractTitle(reader.getSubject()); String defaultDescription = intent.getStringExtra("description") != null ? intent.getStringExtra("description") : ""; String defaultTags = intent.getStringExtra("tags") != null ? intent.getStringExtra("tags") : ""; if (!userPrefs.isAutoTitle()) { defaultTitle = ""; } if (!userPrefs.isAutoDescription()) { defaultDescription = ""; } defaults = new Link( defaultUrl, defaultTitle, defaultDescription, defaultTags, userPrefs.isPrivateShare(), selectedAccount, userPrefs.isTweet(), userPrefs.isToot(), null, null ); }
Example 2
Source File: PostNewDesignerNewsStory.java From android-proguards with Apache License 2.0 | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_post_new_designer_news_story); ButterKnife.bind(this); if (!FabTransform.setup(this, bottomSheetContent)) { MorphTransform.setup(this, bottomSheetContent, ContextCompat.getColor(this, R.color.background_light), 0); } bottomSheet.registerCallback(new BottomSheet.Callbacks() { @Override public void onSheetDismissed() { // After a drag dismiss, finish without the shared element return transition as // it no longer makes sense. Let the launching window know it's a drag dismiss so // that it can restore any UI used as an entering shared element setResult(RESULT_DRAG_DISMISSED); finish(); } }); scrollContainer.setListener(new ObservableScrollView.OnScrollListener() { @Override public void onScrolled(int scrollY) { if (scrollY != 0 && sheetTitle.getTranslationZ() != appBarElevation) { sheetTitle.animate() .translationZ(appBarElevation) .setStartDelay(0L) .setDuration(80L) .setInterpolator(AnimUtils.getFastOutSlowInInterpolator (PostNewDesignerNewsStory.this)) .start(); } else if (scrollY == 0 && sheetTitle.getTranslationZ() == appBarElevation) { sheetTitle.animate() .translationZ(0f) .setStartDelay(0L) .setDuration(80L) .setInterpolator(AnimUtils.getFastOutSlowInInterpolator (PostNewDesignerNewsStory.this)) .start(); } } }); // check for share intent if (isShareIntent()) { ShareCompat.IntentReader intentReader = ShareCompat.IntentReader.from(this); url.setText(intentReader.getText()); title.setText(intentReader.getSubject()); } if (!hasSharedElementTransition()) { // when launched from share or app shortcut there is no shared element transition so // animate up the bottom sheet to establish the spatial model i.e. that it can be // dismissed downward overridePendingTransition(R.anim.post_story_enter, R.anim.post_story_exit); bottomSheetContent.getViewTreeObserver().addOnPreDrawListener( new ViewTreeObserver.OnPreDrawListener() { @Override public boolean onPreDraw() { bottomSheetContent.getViewTreeObserver().removeOnPreDrawListener(this); bottomSheetContent.setTranslationY(bottomSheetContent.getHeight()); bottomSheetContent.animate() .translationY(0f) .setStartDelay(120L) .setDuration(240L) .setInterpolator(AnimUtils.getLinearOutSlowInInterpolator (PostNewDesignerNewsStory.this)); return false; } }); } ShortcutHelper.reportPostUsed(this); }