1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-11-14 05:44:55 +00:00

Merge pull request #3698 from B0pol/openWebsite

avoid duplicate: use openUrlInBrowser instead of openWebsite
This commit is contained in:
Tobias Groza 2020-06-06 18:44:24 +02:00 committed by GitHub
commit 1f23c814e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,8 +1,6 @@
package org.schabi.newpipe.about; package org.schabi.newpipe.about;
import android.content.Context; import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.MenuItem; import android.view.MenuItem;
@ -26,6 +24,7 @@ import org.schabi.newpipe.R;
import org.schabi.newpipe.util.ThemeHelper; import org.schabi.newpipe.util.ThemeHelper;
import static org.schabi.newpipe.util.Localization.assureCorrectAppLanguage; import static org.schabi.newpipe.util.Localization.assureCorrectAppLanguage;
import static org.schabi.newpipe.util.ShareUtils.openUrlInBrowser;
public class AboutActivity extends AppCompatActivity { public class AboutActivity extends AppCompatActivity {
/** /**
@ -143,28 +142,23 @@ public class AboutActivity extends AppCompatActivity {
View githubLink = rootView.findViewById(R.id.github_link); View githubLink = rootView.findViewById(R.id.github_link);
githubLink.setOnClickListener(nv -> githubLink.setOnClickListener(nv ->
openWebsite(context.getString(R.string.github_url), context)); openUrlInBrowser(context, context.getString(R.string.github_url)));
View donationLink = rootView.findViewById(R.id.donation_link); View donationLink = rootView.findViewById(R.id.donation_link);
donationLink.setOnClickListener(v -> donationLink.setOnClickListener(v ->
openWebsite(context.getString(R.string.donation_url), context)); openUrlInBrowser(context, context.getString(R.string.donation_url)));
View websiteLink = rootView.findViewById(R.id.website_link); View websiteLink = rootView.findViewById(R.id.website_link);
websiteLink.setOnClickListener(nv -> websiteLink.setOnClickListener(nv ->
openWebsite(context.getString(R.string.website_url), context)); openUrlInBrowser(context, context.getString(R.string.website_url)));
View privacyPolicyLink = rootView.findViewById(R.id.privacy_policy_link); View privacyPolicyLink = rootView.findViewById(R.id.privacy_policy_link);
privacyPolicyLink.setOnClickListener(v -> privacyPolicyLink.setOnClickListener(v ->
openWebsite(context.getString(R.string.privacy_policy_url), context)); openUrlInBrowser(context, context.getString(R.string.privacy_policy_url)));
return rootView; return rootView;
} }
private void openWebsite(final String url, final Context context) {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
context.startActivity(intent);
}
} }
/** /**