About menu: Added url method.

This commit is contained in:
FlyingP1g FlyingP1g
2022-07-15 20:25:43 +03:00
parent f3a3fa0ea8
commit 89cce89650

View File

@@ -63,31 +63,20 @@ public class AboutFragment extends Fragment {
briarChangelog = requireActivity().findViewById(R.id.BriarChangelog); briarChangelog = requireActivity().findViewById(R.id.BriarChangelog);
briarWebsite.setOnClickListener(View -> { briarWebsite.setOnClickListener(View -> {
String url = "https://briarproject.org/"; String url = "https://briarproject.org/";
Intent i = new Intent(Intent.ACTION_VIEW); goToUrl(url);
i.setData(Uri.parse(url));
try {
startActivity(i);
} catch (ActivityNotFoundException e) {
logException(LOG, WARNING, e);
Toast.makeText(requireContext(),
R.string.error_start_activity, LENGTH_LONG).show();
}
}); });
briarSourceCode.setOnClickListener(View -> { briarSourceCode.setOnClickListener(View -> {
String url = "https://code.briarproject.org/briar/briar"; String url = "https://code.briarproject.org/briar/briar";
Intent i = new Intent(Intent.ACTION_VIEW); goToUrl(url);
i.setData(Uri.parse(url));
try {
startActivity(i);
} catch (ActivityNotFoundException e) {
logException(LOG, WARNING, e);
Toast.makeText(requireContext(),
R.string.error_start_activity, LENGTH_LONG).show();
}
}); });
briarChangelog.setOnClickListener(View -> { briarChangelog.setOnClickListener(View -> {
String url = String url =
"https://code.briarproject.org/briar/briar/-/wikis/changelog"; "https://code.briarproject.org/briar/briar/-/wikis/changelog";
goToUrl(url);
});
}
private void goToUrl(String url) {
Intent i = new Intent(Intent.ACTION_VIEW); Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url)); i.setData(Uri.parse(url));
try { try {
@@ -97,7 +86,7 @@ public class AboutFragment extends Fragment {
Toast.makeText(requireContext(), Toast.makeText(requireContext(),
R.string.error_start_activity, LENGTH_LONG).show(); R.string.error_start_activity, LENGTH_LONG).show();
} }
});
} }
} }