mirror of
https://github.com/beemdevelopment/Aegis.git
synced 2025-05-04 20:30:36 +00:00
Improve GroupManagerActivity
This commit is contained in:
parent
c03d00695d
commit
227b5fd87c
5 changed files with 77 additions and 6 deletions
|
@ -3,6 +3,7 @@ package com.beemdevelopment.aegis.ui;
|
|||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
|
||||
import com.beemdevelopment.aegis.R;
|
||||
import com.beemdevelopment.aegis.ui.views.GroupAdapter;
|
||||
|
@ -18,6 +19,8 @@ import androidx.recyclerview.widget.RecyclerView;
|
|||
public class GroupManagerActivity extends AegisActivity implements GroupAdapter.Listener {
|
||||
private GroupAdapter _adapter;
|
||||
private TreeSet<String> _groups;
|
||||
private RecyclerView _slotsView;
|
||||
private View _emptyStateView;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -35,15 +38,28 @@ public class GroupManagerActivity extends AegisActivity implements GroupAdapter.
|
|||
|
||||
// set up the recycler view
|
||||
_adapter = new GroupAdapter(this);
|
||||
RecyclerView slotsView = findViewById(R.id.list_slots);
|
||||
_slotsView= findViewById(R.id.list_slots);
|
||||
LinearLayoutManager layoutManager = new LinearLayoutManager(this);
|
||||
slotsView.setLayoutManager(layoutManager);
|
||||
slotsView.setAdapter(_adapter);
|
||||
slotsView.setNestedScrollingEnabled(false);
|
||||
_slotsView.setLayoutManager(layoutManager);
|
||||
_slotsView.setAdapter(_adapter);
|
||||
_slotsView.setNestedScrollingEnabled(false);
|
||||
|
||||
for (String group : _groups) {
|
||||
_adapter.addGroup(group);
|
||||
}
|
||||
|
||||
_emptyStateView = findViewById(R.id.vEmptyList);
|
||||
updateEmptyState();
|
||||
}
|
||||
|
||||
private void updateEmptyState() {
|
||||
if (_adapter.getItemCount() > 0) {
|
||||
_slotsView.setVisibility(View.VISIBLE);
|
||||
_emptyStateView.setVisibility(View.GONE);
|
||||
} else {
|
||||
_slotsView.setVisibility(View.GONE);
|
||||
_emptyStateView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -54,6 +70,7 @@ public class GroupManagerActivity extends AegisActivity implements GroupAdapter.
|
|||
.setPositiveButton(android.R.string.yes, (dialog, whichButton) -> {
|
||||
_groups.remove(group);
|
||||
_adapter.removeGroup(group);
|
||||
updateEmptyState();
|
||||
})
|
||||
.setNegativeButton(android.R.string.no, null)
|
||||
.create());
|
||||
|
|
|
@ -710,6 +710,8 @@ public class PreferencesFragment extends PreferenceFragmentCompat {
|
|||
entry.setGroup(null);
|
||||
}
|
||||
}
|
||||
|
||||
saveVault();
|
||||
}
|
||||
|
||||
private void onSelectEntriesResult(int resultCode, Intent data) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue