avoid duplicate: use openUrlInBrowser instead of openWebsite

This commit is contained in:
bopol 2020-05-31 12:17:54 +02:00
parent 049c8f70cd
commit 6b0381b903
1 changed files with 5 additions and 11 deletions

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);
}
} }
/** /**