[app] Open module in browser

This commit is contained in:
tehcneko 2021-02-10 15:30:11 +08:00
parent e1c13f3711
commit e4c258ef86
3 changed files with 47 additions and 1 deletions

View File

@ -26,6 +26,8 @@ import android.text.Spannable;
import android.text.SpannableStringBuilder;
import android.text.style.ClickableSpan;
import android.text.util.Linkify;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
@ -117,6 +119,22 @@ public class RepoItemActivity extends BaseActivity {
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_repo_item, menu);
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
int id = item.getItemId();
if (id == R.id.menu_open_in_browser) {
NavUtil.startURL(this, module.getUrl());
// TODO: replace with web version
}
return super.onOptionsItemSelected(item);
}
private class InformationAdapter extends RecyclerView.Adapter<InformationAdapter.ViewHolder> {
private final OnlineModule module;

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ This file is part of LSPosed.
~
~ LSPosed is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ LSPosed is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with LSPosed. If not, see <https://www.gnu.org/licenses/>.
~
~ Copyright (C) 2020 EdXposed Contributors
~ Copyright (C) 2021 LSPosed Contributors
-->
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/menu_open_in_browser"
android:title="@string/menu_open_in_browser"
android:icon="@drawable/ic_open_in_browser"
app:showAsAction="ifRoom" />
</menu>

View File

@ -155,5 +155,5 @@
<string name="module_information_source_url">Source code</string>
<string name="module_information_collaborators">Collaborators</string>
<string name="module_release_view_assets">Assets</string>
<string name="module_release_open_browser">Open in…</string>
<string name="menu_open_in_browser">Open in browser</string>
</resources>