mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2024-12-23 16:40:32 +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.R;
|
||||||
import org.schabi.newpipe.ReCaptchaActivity;
|
import org.schabi.newpipe.ReCaptchaActivity;
|
||||||
import org.schabi.newpipe.extractor.exceptions.ReCaptchaException;
|
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.ErrorActivity;
|
||||||
import org.schabi.newpipe.report.UserAction;
|
import org.schabi.newpipe.report.UserAction;
|
||||||
import org.schabi.newpipe.util.ExtractorHelper;
|
import org.schabi.newpipe.util.ExtractorHelper;
|
||||||
@ -252,9 +253,10 @@ public abstract class BaseStateFragment<I> extends BaseFragment implements ViewC
|
|||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void shareUrl(String url) {
|
protected void shareUrl(String subject, String url) {
|
||||||
Intent intent = new Intent(Intent.ACTION_SEND);
|
Intent intent = new Intent(Intent.ACTION_SEND);
|
||||||
intent.setType("text/plain");
|
intent.setType("text/plain");
|
||||||
|
intent.putExtra(Intent.EXTRA_SUBJECT, subject);
|
||||||
intent.putExtra(Intent.EXTRA_TEXT, url);
|
intent.putExtra(Intent.EXTRA_TEXT, url);
|
||||||
startActivity(Intent.createChooser(intent, getString(R.string.share_dialog_title)));
|
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 + "]");
|
if (DEBUG) Log.d(TAG, "setupActionBarHandler() called with: info = [" + info + "]");
|
||||||
sortedStreamVideosList = new ArrayList<>(ListHelper.getSortedStreamVideosList(activity, info.getVideoStreams(), info.getVideoOnlyStreams(), false));
|
sortedStreamVideosList = new ArrayList<>(ListHelper.getSortedStreamVideosList(activity, info.getVideoStreams(), info.getVideoOnlyStreams(), false));
|
||||||
actionBarHandler.setupStreamList(sortedStreamVideosList, spinnerToolbar);
|
actionBarHandler.setupStreamList(sortedStreamVideosList, spinnerToolbar);
|
||||||
actionBarHandler.setOnShareListener(new ActionBarHandler.OnActionListener() {
|
actionBarHandler.setOnShareListener(selectedStreamId -> shareUrl(info.name, info.url));
|
||||||
@Override
|
|
||||||
public void onActionSelected(int selectedStreamId) {
|
|
||||||
shareUrl(info.getUrl());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
actionBarHandler.setOnOpenInBrowserListener(new ActionBarHandler.OnActionListener() {
|
actionBarHandler.setOnOpenInBrowserListener(new ActionBarHandler.OnActionListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -231,7 +231,7 @@ public class ChannelFragment extends BaseListInfoFragment<ChannelInfo> {
|
|||||||
openUrlInBrowser(url);
|
openUrlInBrowser(url);
|
||||||
break;
|
break;
|
||||||
case R.id.menu_item_share: {
|
case R.id.menu_item_share: {
|
||||||
shareUrl(url);
|
shareUrl(name, url);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -167,7 +167,7 @@ public class PlaylistFragment extends BaseListInfoFragment<PlaylistInfo> {
|
|||||||
openUrlInBrowser(url);
|
openUrlInBrowser(url);
|
||||||
break;
|
break;
|
||||||
case R.id.menu_item_share: {
|
case R.id.menu_item_share: {
|
||||||
shareUrl(url);
|
shareUrl(name, url);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
Loading…
Reference in New Issue
Block a user