[app] show repo list info dialog in ManageReposActivity

This commit is contained in:
Torsten Grote
2023-12-01 12:12:32 -03:00
parent 349f386d92
commit b45efadc45
4 changed files with 48 additions and 0 deletions

View File

@@ -25,6 +25,9 @@ import android.os.Build;
import android.os.Bundle;
import android.os.UserManager;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@@ -36,6 +39,7 @@ import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.appbar.MaterialToolbar;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.android.material.snackbar.Snackbar;
import org.fdroid.database.Repository;
@@ -198,6 +202,26 @@ public class ManageReposActivity extends AppCompatActivity implements RepoAdapte
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.repo_list, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == R.id.action_info) {
new MaterialAlertDialogBuilder(this)
.setTitle(getString(R.string.repo_list_info_title))
.setMessage(getString(R.string.repo_list_info_text))
.setPositiveButton(getString(R.string.ok), (dialog, which) -> dialog.dismiss())
.show();
return true;
}
return super.onOptionsItemSelected(item);
}
private void disableRepo(Repository repo) {
Utils.runOffUiThread(() -> repoManager.setRepositoryEnabled(repo.getRepoId(), false));
AppUpdateStatusManager.getInstance(this).removeAllByRepo(repo.getRepoId());

View File

@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="?attr/colorControlNormal"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM13,17h-2v-6h2v6zM13,9h-2L11,7h2v2z" />
</vector>

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:fitsSystemWindows="true">
<item
android:id="@+id/action_info"
android:icon="@drawable/ic_info"
android:title="@string/menu_share"
app:showAsAction="ifRoom|withText" />
</menu>

View File

@@ -448,6 +448,8 @@ This often occurs with apps installed via Google Play or other sources, if they
<string name="use_pure_black_dark_theme_summary">Recommended only for OLED screens.</string>
<string name="unsigned">Unsigned</string>
<string name="unverified">Unverified</string>
<string name="repo_list_info_title">Repository List</string>
<string name="repo_list_info_text">A repository is a source of apps. This list shows all currently added repositories. Disabled repositories are not used.\n\nIf an app is in more than one repository, the repository higher in the list is automatically preferred. You can reorder repositories by long pressing and dragging them.</string>
<string name="repo_details">Repository</string>
<string name="repo_url">Address</string>
<string name="repo_num_apps">Number of apps</string>