1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-06-25 14:43:20 +00:00

Add subject to shared URL's (fixes #975)

This commit is contained in:
Coffeemakr 2018-01-09 12:41:30 +01:00
parent 33d75fd2fb
commit b93d94b0bd
No known key found for this signature in database
GPG Key ID: 3F35676D8FF6E743
4 changed files with 6 additions and 9 deletions

View File

@ -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)));
}

View File

@ -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

View File

@ -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:

View File

@ -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: