|
|
|
@ -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());
|
|
|
|
|