mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2024-12-23 08:30:44 +00:00
Merge pull request #976 from coffeemakr/feature-share-subject
Add subject to shared URL's (fixes #975)
This commit is contained in:
commit
bb6fa343cf
@ -19,6 +19,7 @@ import org.schabi.newpipe.MainActivity;
|
||||
import org.schabi.newpipe.R;
|
||||
import org.schabi.newpipe.ReCaptchaActivity;
|
||||
import org.schabi.newpipe.extractor.exceptions.ReCaptchaException;
|
||||
import org.schabi.newpipe.extractor.stream.StreamInfo;
|
||||
import org.schabi.newpipe.report.ErrorActivity;
|
||||
import org.schabi.newpipe.report.UserAction;
|
||||
import org.schabi.newpipe.util.ExtractorHelper;
|
||||
@ -252,9 +253,10 @@ public abstract class BaseStateFragment<I> extends BaseFragment implements ViewC
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
protected void shareUrl(String url) {
|
||||
protected void shareUrl(String subject, String url) {
|
||||
Intent intent = new Intent(Intent.ACTION_SEND);
|
||||
intent.setType("text/plain");
|
||||
intent.putExtra(Intent.EXTRA_SUBJECT, subject);
|
||||
intent.putExtra(Intent.EXTRA_TEXT, url);
|
||||
startActivity(Intent.createChooser(intent, getString(R.string.share_dialog_title)));
|
||||
}
|
||||
|
@ -623,12 +623,7 @@ public class VideoDetailFragment extends BaseStateFragment<StreamInfo> implement
|
||||
if (DEBUG) Log.d(TAG, "setupActionBarHandler() called with: info = [" + info + "]");
|
||||
sortedStreamVideosList = new ArrayList<>(ListHelper.getSortedStreamVideosList(activity, info.getVideoStreams(), info.getVideoOnlyStreams(), false));
|
||||
actionBarHandler.setupStreamList(sortedStreamVideosList, spinnerToolbar);
|
||||
actionBarHandler.setOnShareListener(new ActionBarHandler.OnActionListener() {
|
||||
@Override
|
||||
public void onActionSelected(int selectedStreamId) {
|
||||
shareUrl(info.getUrl());
|
||||
}
|
||||
});
|
||||
actionBarHandler.setOnShareListener(selectedStreamId -> shareUrl(info.name, info.url));
|
||||
|
||||
actionBarHandler.setOnOpenInBrowserListener(new ActionBarHandler.OnActionListener() {
|
||||
@Override
|
||||
|
@ -231,7 +231,7 @@ public class ChannelFragment extends BaseListInfoFragment<ChannelInfo> {
|
||||
openUrlInBrowser(url);
|
||||
break;
|
||||
case R.id.menu_item_share: {
|
||||
shareUrl(url);
|
||||
shareUrl(name, url);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -167,7 +167,7 @@ public class PlaylistFragment extends BaseListInfoFragment<PlaylistInfo> {
|
||||
openUrlInBrowser(url);
|
||||
break;
|
||||
case R.id.menu_item_share: {
|
||||
shareUrl(url);
|
||||
shareUrl(name, url);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user