Rework group editing (WIP)
This commit is contained in:
parent
e210095716
commit
e3698fd044
@ -10,8 +10,8 @@
|
|||||||
<option name="gradleJvm" value="jbr-17" />
|
<option name="gradleJvm" value="jbr-17" />
|
||||||
<option name="modules">
|
<option name="modules">
|
||||||
<set>
|
<set>
|
||||||
<option value="$PROJECT_DIR$" />
|
<option value="/mnt/sshd/Files/Desktop/testing/android/Cringe-Authenticator" />
|
||||||
<option value="$PROJECT_DIR$/app" />
|
<option value="/mnt/sshd/Files/Desktop/testing/android/Cringe-Authenticator/app" />
|
||||||
</set>
|
</set>
|
||||||
</option>
|
</option>
|
||||||
</GradleProjectSettings>
|
</GradleProjectSettings>
|
||||||
|
@ -19,6 +19,7 @@ import androidx.annotation.NonNull;
|
|||||||
import androidx.appcompat.app.ActionBar;
|
import androidx.appcompat.app.ActionBar;
|
||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.appcompat.app.AppCompatDelegate;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
import com.cringe_studios.cringe_authenticator.databinding.ActivityMainBinding;
|
import com.cringe_studios.cringe_authenticator.databinding.ActivityMainBinding;
|
||||||
@ -158,8 +159,11 @@ public class MainActivity extends BaseActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
if(NavigationUtil.getCurrentFragment(this) instanceof MenuFragment) {
|
Fragment fragment = NavigationUtil.getCurrentFragment(this);
|
||||||
getMenuInflater().inflate(R.menu.menu_groups, menu);
|
if(fragment instanceof MenuFragment) {
|
||||||
|
MenuFragment frag = (MenuFragment) fragment;
|
||||||
|
getMenuInflater().inflate(frag.isEditing() ? R.menu.menu_groups_edit : R.menu.menu_groups, menu);
|
||||||
|
if(frag.isEditing() && frag.hasSelectedMultipleItems()) menu.removeItem(R.id.action_edit_group);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -184,7 +188,16 @@ public class MainActivity extends BaseActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBackPressed() {
|
public void onBackPressed() {
|
||||||
if(!(NavigationUtil.getCurrentFragment(this) instanceof HomeFragment)) {
|
Fragment fragment = NavigationUtil.getCurrentFragment(this);
|
||||||
|
if(fragment instanceof MenuFragment) {
|
||||||
|
MenuFragment menuFragment = (MenuFragment) fragment;
|
||||||
|
if(menuFragment.isEditing()) {
|
||||||
|
menuFragment.finishEditing();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!(fragment instanceof HomeFragment)) {
|
||||||
NavigationUtil.navigate(this, HomeFragment.class, null);
|
NavigationUtil.navigate(this, HomeFragment.class, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -256,12 +269,24 @@ public class MainActivity extends BaseActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void addGroup(MenuItem item) {
|
public void addGroup(MenuItem item) {
|
||||||
DialogUtil.showCreateGroupDialog(getLayoutInflater(), null, group -> {
|
|
||||||
Fragment frag = NavigationUtil.getCurrentFragment(this);
|
Fragment frag = NavigationUtil.getCurrentFragment(this);
|
||||||
if(frag instanceof MenuFragment) {
|
if(frag instanceof MenuFragment) {
|
||||||
((MenuFragment) frag).addGroup(group);
|
((MenuFragment) frag).addGroup();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void editGroup(MenuItem item) {
|
||||||
|
Fragment frag = NavigationUtil.getCurrentFragment(this);
|
||||||
|
if(frag instanceof MenuFragment) {
|
||||||
|
((MenuFragment) frag).editGroup();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deleteGroup(MenuItem item) {
|
||||||
|
Fragment frag = NavigationUtil.getCurrentFragment(this);
|
||||||
|
if(frag instanceof MenuFragment) {
|
||||||
|
((MenuFragment) frag).removeSelectedGroups();
|
||||||
}
|
}
|
||||||
}, null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.cringe_studios.cringe_authenticator.fragment;
|
package com.cringe_studios.cringe_authenticator.fragment;
|
||||||
|
|
||||||
|
import android.content.ClipData;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
@ -9,6 +10,8 @@ import android.view.ViewGroup;
|
|||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.recyclerview.widget.ItemTouchHelper;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import com.cringe_studios.cringe_authenticator.R;
|
import com.cringe_studios.cringe_authenticator.R;
|
||||||
import com.cringe_studios.cringe_authenticator.crypto.CryptoException;
|
import com.cringe_studios.cringe_authenticator.crypto.CryptoException;
|
||||||
|
@ -7,10 +7,14 @@ import android.view.ViewGroup;
|
|||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.recyclerview.widget.ItemTouchHelper;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import com.cringe_studios.cringe_authenticator.R;
|
import com.cringe_studios.cringe_authenticator.R;
|
||||||
import com.cringe_studios.cringe_authenticator.databinding.FragmentMenuBinding;
|
import com.cringe_studios.cringe_authenticator.databinding.FragmentMenuBinding;
|
||||||
import com.cringe_studios.cringe_authenticator.grouplist.GroupListAdapter;
|
import com.cringe_studios.cringe_authenticator.grouplist.GroupListAdapter;
|
||||||
|
import com.cringe_studios.cringe_authenticator.grouplist.GroupListItem;
|
||||||
import com.cringe_studios.cringe_authenticator.util.DialogUtil;
|
import com.cringe_studios.cringe_authenticator.util.DialogUtil;
|
||||||
import com.cringe_studios.cringe_authenticator.util.FabUtil;
|
import com.cringe_studios.cringe_authenticator.util.FabUtil;
|
||||||
import com.cringe_studios.cringe_authenticator.util.NavigationUtil;
|
import com.cringe_studios.cringe_authenticator.util.NavigationUtil;
|
||||||
@ -36,12 +40,11 @@ public class MenuFragment extends NamedFragment {
|
|||||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
binding = FragmentMenuBinding.inflate(inflater);
|
binding = FragmentMenuBinding.inflate(inflater);
|
||||||
|
|
||||||
groupListAdapter = new GroupListAdapter(requireContext(), group -> {
|
groupListAdapter = new GroupListAdapter(requireContext(), binding.menuItems, group -> {
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putString(GroupFragment.BUNDLE_GROUP, group);
|
bundle.putString(GroupFragment.BUNDLE_GROUP, group);
|
||||||
NavigationUtil.navigate(this, GroupFragment.class, bundle);
|
NavigationUtil.navigate(this, GroupFragment.class, bundle);
|
||||||
}, this::showGroupDialog);
|
}, () -> SettingsUtil.setGroups(requireContext(), groupListAdapter.getItems()));
|
||||||
|
|
||||||
binding.menuItems.setAdapter(groupListAdapter);
|
binding.menuItems.setAdapter(groupListAdapter);
|
||||||
|
|
||||||
loadGroups();
|
loadGroups();
|
||||||
@ -84,10 +87,43 @@ public class MenuFragment extends NamedFragment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addGroup(String groupName) {
|
public void addGroup() {
|
||||||
|
DialogUtil.showCreateGroupDialog(getLayoutInflater(), null, groupName -> {
|
||||||
String id = UUID.randomUUID().toString();
|
String id = UUID.randomUUID().toString();
|
||||||
SettingsUtil.addGroup(requireContext(), id, groupName);
|
SettingsUtil.addGroup(requireContext(), id, groupName);
|
||||||
groupListAdapter.add(id);
|
groupListAdapter.add(id);
|
||||||
|
}, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void editGroup() {
|
||||||
|
if(!groupListAdapter.isEditing()) return;
|
||||||
|
|
||||||
|
List<GroupListItem> items = groupListAdapter.getSelectedGroups();
|
||||||
|
if(items.size() != 1) return;
|
||||||
|
|
||||||
|
String group = items.get(0).getGroupId();
|
||||||
|
|
||||||
|
DialogUtil.showCreateGroupDialog(getLayoutInflater(), SettingsUtil.getGroupName(requireContext(), group), newName -> { // TODO: edit group dialog (with "Edit Group" title)
|
||||||
|
renameGroup(group, newName);
|
||||||
|
groupListAdapter.finishEditing();
|
||||||
|
}, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeSelectedGroups() {
|
||||||
|
if(!groupListAdapter.isEditing()) return;
|
||||||
|
|
||||||
|
new StyledDialogBuilder(requireContext())
|
||||||
|
.setTitle(R.string.group_delete_title)
|
||||||
|
.setMessage("Delete selected groups?")
|
||||||
|
.setPositiveButton(R.string.yes, (d, w) -> {
|
||||||
|
for(GroupListItem item : groupListAdapter.getSelectedGroups()) {
|
||||||
|
removeGroup(item.getGroupId());
|
||||||
|
}
|
||||||
|
|
||||||
|
groupListAdapter.finishEditing();
|
||||||
|
})
|
||||||
|
.setNegativeButton(R.string.no, (d, w) -> {})
|
||||||
|
.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeGroup(String group) {
|
public void removeGroup(String group) {
|
||||||
@ -100,6 +136,18 @@ public class MenuFragment extends NamedFragment {
|
|||||||
groupListAdapter.update(group);
|
groupListAdapter.update(group);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isEditing() {
|
||||||
|
return groupListAdapter.isEditing();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void finishEditing() {
|
||||||
|
groupListAdapter.finishEditing();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasSelectedMultipleItems() {
|
||||||
|
return groupListAdapter.getSelectedGroups().size() > 1;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroyView() {
|
public void onDestroyView() {
|
||||||
super.onDestroyView();
|
super.onDestroyView();
|
||||||
|
@ -77,10 +77,6 @@ public class SettingsFragment extends NamedFragment {
|
|||||||
|
|
||||||
binding.settingsEnableEncryption.setChecked(SettingsUtil.isDatabaseEncrypted(requireContext()));
|
binding.settingsEnableEncryption.setChecked(SettingsUtil.isDatabaseEncrypted(requireContext()));
|
||||||
binding.settingsEnableEncryption.setOnCheckedChangeListener((view, checked) -> {
|
binding.settingsEnableEncryption.setOnCheckedChangeListener((view, checked) -> {
|
||||||
if(!OTPDatabase.isDatabaseLoaded()) {
|
|
||||||
// TODO: prompt user
|
|
||||||
}
|
|
||||||
|
|
||||||
if(checked) {
|
if(checked) {
|
||||||
DialogUtil.showInputPasswordDialog(requireContext(), password -> {
|
DialogUtil.showInputPasswordDialog(requireContext(), password -> {
|
||||||
CryptoParameters params = CryptoParameters.createNew();
|
CryptoParameters params = CryptoParameters.createNew();
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package com.cringe_studios.cringe_authenticator.grouplist;
|
package com.cringe_studios.cringe_authenticator.grouplist;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.app.Application;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
@ -7,19 +9,29 @@ import android.view.LayoutInflater;
|
|||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.core.util.Consumer;
|
import androidx.core.util.Consumer;
|
||||||
|
import androidx.recyclerview.widget.ItemTouchHelper;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.cringe_studios.cringe_authenticator.BaseActivity;
|
||||||
|
import com.cringe_studios.cringe_authenticator.MainActivity;
|
||||||
import com.cringe_studios.cringe_authenticator.databinding.MenuItemBinding;
|
import com.cringe_studios.cringe_authenticator.databinding.MenuItemBinding;
|
||||||
|
import com.cringe_studios.cringe_authenticator.otplist.OTPListItem;
|
||||||
import com.cringe_studios.cringe_authenticator.util.SettingsUtil;
|
import com.cringe_studios.cringe_authenticator.util.SettingsUtil;
|
||||||
|
|
||||||
|
import org.bouncycastle.jcajce.provider.symmetric.ARC4;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class GroupListAdapter extends RecyclerView.Adapter<GroupListItem> {
|
public class GroupListAdapter extends RecyclerView.Adapter<GroupListItem> {
|
||||||
|
|
||||||
private Context context;
|
private Context context;
|
||||||
|
|
||||||
|
private RecyclerView recyclerView;
|
||||||
|
|
||||||
private LayoutInflater inflater;
|
private LayoutInflater inflater;
|
||||||
|
|
||||||
private List<String> items;
|
private List<String> items;
|
||||||
@ -28,15 +40,20 @@ public class GroupListAdapter extends RecyclerView.Adapter<GroupListItem> {
|
|||||||
|
|
||||||
private Consumer<String> navigateToGroup;
|
private Consumer<String> navigateToGroup;
|
||||||
|
|
||||||
private Consumer<String> showMenuCallback;
|
private Runnable saveGroups;
|
||||||
|
|
||||||
public GroupListAdapter(Context context, Consumer<String> navigateToGroup, Consumer<String> showMenuCallback) {
|
private boolean editing;
|
||||||
|
|
||||||
|
public GroupListAdapter(Context context, RecyclerView recyclerView, Consumer<String> navigateToGroup, Runnable saveGroups) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
|
this.recyclerView = recyclerView;
|
||||||
this.navigateToGroup = navigateToGroup;
|
this.navigateToGroup = navigateToGroup;
|
||||||
this.showMenuCallback = showMenuCallback;
|
this.saveGroups = saveGroups;
|
||||||
this.inflater = LayoutInflater.from(context);
|
this.inflater = LayoutInflater.from(context);
|
||||||
this.items = new ArrayList<>();
|
this.items = new ArrayList<>();
|
||||||
this.handler = new Handler(Looper.getMainLooper());
|
this.handler = new Handler(Looper.getMainLooper());
|
||||||
|
|
||||||
|
attachTouchHelper(recyclerView);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@ -50,12 +67,31 @@ public class GroupListAdapter extends RecyclerView.Adapter<GroupListItem> {
|
|||||||
public void onBindViewHolder(@NonNull GroupListItem holder, int position) {
|
public void onBindViewHolder(@NonNull GroupListItem holder, int position) {
|
||||||
String group = items.get(position);
|
String group = items.get(position);
|
||||||
|
|
||||||
|
holder.setGroupId(group);
|
||||||
|
|
||||||
holder.getBinding().button.setText(SettingsUtil.getGroupName(context, group));
|
holder.getBinding().button.setText(SettingsUtil.getGroupName(context, group));
|
||||||
|
|
||||||
holder.getBinding().button.setOnClickListener(view -> navigateToGroup.accept(group));
|
holder.getBinding().button.setOnClickListener(view -> {
|
||||||
holder.getBinding().button.setOnLongClickListener(view -> {
|
if(!editing) {
|
||||||
|
navigateToGroup.accept(group);
|
||||||
|
}else {
|
||||||
|
holder.setSelected(!holder.isSelected());
|
||||||
|
if(getSelectedGroups().isEmpty()) editing = false;
|
||||||
|
((BaseActivity) context).invalidateMenu();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
/*holder.getBinding().button.setOnLongClickListener(view -> {
|
||||||
showMenuCallback.accept(group);
|
showMenuCallback.accept(group);
|
||||||
return true;
|
return true;
|
||||||
|
});*/
|
||||||
|
|
||||||
|
holder.getBinding().button.setOnLongClickListener(view -> {
|
||||||
|
if(editing) return true;
|
||||||
|
|
||||||
|
holder.setSelected(true);
|
||||||
|
editing = true;
|
||||||
|
((BaseActivity) context).invalidateMenu();
|
||||||
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,6 +100,10 @@ public class GroupListAdapter extends RecyclerView.Adapter<GroupListItem> {
|
|||||||
return items.size();
|
return items.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<String> getItems() {
|
||||||
|
return items;
|
||||||
|
}
|
||||||
|
|
||||||
public void add(String group) {
|
public void add(String group) {
|
||||||
items.add(group);
|
items.add(group);
|
||||||
notifyItemInserted(items.size() - 1);
|
notifyItemInserted(items.size() - 1);
|
||||||
@ -82,4 +122,57 @@ public class GroupListAdapter extends RecyclerView.Adapter<GroupListItem> {
|
|||||||
notifyItemChanged(index);
|
notifyItemChanged(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isEditing() {
|
||||||
|
return editing;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void finishEditing() {
|
||||||
|
if(!editing) return;
|
||||||
|
|
||||||
|
editing = false;
|
||||||
|
for(GroupListItem item : getSelectedGroups()) {
|
||||||
|
item.setSelected(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
((BaseActivity) context).invalidateMenu();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<GroupListItem> getSelectedGroups() {
|
||||||
|
List<GroupListItem> selected = new ArrayList<>();
|
||||||
|
for(int i = 0; i < items.size(); i++) {
|
||||||
|
GroupListItem vh = (GroupListItem) recyclerView.findViewHolderForAdapterPosition(i);
|
||||||
|
if(vh == null) continue;
|
||||||
|
if(vh.isSelected()) selected.add(vh);
|
||||||
|
}
|
||||||
|
return selected;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void attachTouchHelper(RecyclerView view) {
|
||||||
|
new ItemTouchHelper(new TouchHelperCallback()).attachToRecyclerView(view);
|
||||||
|
}
|
||||||
|
|
||||||
|
private class TouchHelperCallback extends ItemTouchHelper.Callback {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMovementFlags(@NonNull RecyclerView recyclerView, @NonNull RecyclerView.ViewHolder viewHolder) {
|
||||||
|
return makeMovementFlags(ItemTouchHelper.UP | ItemTouchHelper.DOWN, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onMove(@NonNull RecyclerView recyclerView, @NonNull RecyclerView.ViewHolder viewHolder, @NonNull RecyclerView.ViewHolder target) {
|
||||||
|
Collections.swap(items, viewHolder.getAdapterPosition(), target.getAdapterPosition());
|
||||||
|
notifyItemMoved(viewHolder.getAdapterPosition(), target.getAdapterPosition());
|
||||||
|
saveGroups.run();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSwiped(@NonNull RecyclerView.ViewHolder viewHolder, int direction) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isLongPressDragEnabled() {
|
||||||
|
return editing;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,24 @@
|
|||||||
package com.cringe_studios.cringe_authenticator.grouplist;
|
package com.cringe_studios.cringe_authenticator.grouplist;
|
||||||
|
|
||||||
|
import android.content.res.ColorStateList;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.graphics.drawable.ColorDrawable;
|
||||||
|
import android.os.Build;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.cringe_studios.cringe_authenticator.R;
|
||||||
import com.cringe_studios.cringe_authenticator.databinding.MenuItemBinding;
|
import com.cringe_studios.cringe_authenticator.databinding.MenuItemBinding;
|
||||||
|
|
||||||
public class GroupListItem extends RecyclerView.ViewHolder {
|
public class GroupListItem extends RecyclerView.ViewHolder {
|
||||||
|
|
||||||
private MenuItemBinding binding;
|
private MenuItemBinding binding;
|
||||||
|
|
||||||
|
private String groupId;
|
||||||
|
|
||||||
|
private boolean selected;
|
||||||
|
|
||||||
public GroupListItem(@NonNull MenuItemBinding binding) {
|
public GroupListItem(@NonNull MenuItemBinding binding) {
|
||||||
super(binding.getRoot());
|
super(binding.getRoot());
|
||||||
this.binding = binding;
|
this.binding = binding;
|
||||||
@ -17,4 +27,27 @@ public class GroupListItem extends RecyclerView.ViewHolder {
|
|||||||
public MenuItemBinding getBinding() {
|
public MenuItemBinding getBinding() {
|
||||||
return binding;
|
return binding;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setGroupId(String groupId) {
|
||||||
|
this.groupId = groupId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGroupId() {
|
||||||
|
return groupId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSelected(boolean selected) {
|
||||||
|
this.selected = selected;
|
||||||
|
|
||||||
|
if(selected) {
|
||||||
|
binding.menuItemBackground.setBackground(new ColorDrawable(0xFFFF00FF));
|
||||||
|
}else {
|
||||||
|
binding.menuItemBackground.setBackground(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSelected() {
|
||||||
|
return selected;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@ public class NavigationUtil {
|
|||||||
ActionBar bar = activity.getSupportActionBar();
|
ActionBar bar = activity.getSupportActionBar();
|
||||||
navigate(manager, fragment, () -> {
|
navigate(manager, fragment, () -> {
|
||||||
if(bar != null) bar.setTitle(fragment.getName());
|
if(bar != null) bar.setTitle(fragment.getName());
|
||||||
|
activity.invalidateMenu();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,10 +48,6 @@ public class NavigationUtil {
|
|||||||
return getCurrentFragment(activity.getSupportFragmentManager());
|
return getCurrentFragment(activity.getSupportFragmentManager());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Fragment getCurrentFragment(Fragment currentFragment) {
|
|
||||||
return getCurrentFragment(currentFragment.getParentFragment().getChildFragmentManager());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Fragment getCurrentFragment(FragmentManager manager) {
|
public static Fragment getCurrentFragment(FragmentManager manager) {
|
||||||
return manager.findFragmentById(R.id.nav_host_fragment_content_main);
|
return manager.findFragmentById(R.id.nav_host_fragment_content_main);
|
||||||
}
|
}
|
||||||
|
@ -47,6 +47,15 @@ public class SettingsUtil {
|
|||||||
return Arrays.asList(GSON.fromJson(prefs.getString("groups", "[]"), String[].class));
|
return Arrays.asList(GSON.fromJson(prefs.getString("groups", "[]"), String[].class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Only for reordering groups. Don't add/delete groups with this!
|
||||||
|
* @param groups Groups
|
||||||
|
*/
|
||||||
|
public static void setGroups(Context ctx, List<String> groups) {
|
||||||
|
SharedPreferences prefs = ctx.getSharedPreferences(GROUPS_PREFS_NAME, Context.MODE_PRIVATE);
|
||||||
|
prefs.edit().putString("groups", GSON.toJson(groups)).apply();
|
||||||
|
}
|
||||||
|
|
||||||
public static void addGroup(Context ctx, String group, String groupName) {
|
public static void addGroup(Context ctx, String group, String groupName) {
|
||||||
List<String> groups = new ArrayList<>(getGroups(ctx));
|
List<String> groups = new ArrayList<>(getGroups(ctx));
|
||||||
groups.add(group);
|
groups.add(group);
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.cringe_studios.cringe_authenticator.util;
|
package com.cringe_studios.cringe_authenticator.util;
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.appcompat.app.AppCompatDelegate;
|
||||||
|
|
||||||
import com.cringe_studios.cringe_authenticator.R;
|
import com.cringe_studios.cringe_authenticator.R;
|
||||||
|
|
||||||
@ -13,6 +14,9 @@ public class ThemeUtil {
|
|||||||
}else {
|
}else {
|
||||||
activity.setTheme(R.style.Theme_CringeAuthenticator_Blue_Green);
|
activity.setTheme(R.style.Theme_CringeAuthenticator_Blue_Green);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: use settings
|
||||||
|
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<vector android:height="24dp" android:tint="#000000"
|
<vector android:height="24dp" android:tint="?android:attr/textColor"
|
||||||
android:viewportHeight="24" android:viewportWidth="24"
|
android:viewportHeight="24" android:viewportWidth="24"
|
||||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<path android:fillColor="@android:color/white" android:pathData="M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/>
|
<path android:fillColor="@android:color/white" android:pathData="M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<vector android:height="24dp" android:tint="#000000"
|
<vector android:height="24dp" android:tint="?android:attr/textColor"
|
||||||
android:viewportHeight="24" android:viewportWidth="24"
|
android:viewportHeight="24" android:viewportWidth="24"
|
||||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<path android:fillColor="@android:color/white" android:pathData="M19,6.41L17.59,5 12,10.59 6.41,5 5,6.41 10.59,12 5,17.59 6.41,19 12,13.41 17.59,19 19,17.59 13.41,12z"/>
|
<path android:fillColor="@android:color/white" android:pathData="M19,6.41L17.59,5 12,10.59 6.41,5 5,6.41 10.59,12 5,17.59 6.41,19 12,13.41 17.59,19 19,17.59 13.41,12z"/>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<vector android:height="24dp" android:tint="#000000"
|
<vector android:height="24dp" android:tint="?android:attr/textColor"
|
||||||
android:viewportHeight="24" android:viewportWidth="24"
|
android:viewportHeight="24" android:viewportWidth="24"
|
||||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<path android:fillColor="@android:color/white" android:pathData="M6,19c0,1.1 0.9,2 2,2h8c1.1,0 2,-0.9 2,-2V7H6v12zM19,4h-3.5l-1,-1h-5l-1,1H5v2h14V4z"/>
|
<path android:fillColor="@android:color/white" android:pathData="M6,19c0,1.1 0.9,2 2,2h8c1.1,0 2,-0.9 2,-2V7H6v12zM19,4h-3.5l-1,-1h-5l-1,1H5v2h14V4z"/>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<vector android:height="24dp" android:tint="#000000"
|
<vector android:height="24dp" android:tint="?android:attr/textColor"
|
||||||
android:viewportHeight="24" android:viewportWidth="24"
|
android:viewportHeight="24" android:viewportWidth="24"
|
||||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<path android:fillColor="@android:color/white" android:pathData="M3,17.25V21h3.75L17.81,9.94l-3.75,-3.75L3,17.25zM20.71,7.04c0.39,-0.39 0.39,-1.02 0,-1.41l-2.34,-2.34c-0.39,-0.39 -1.02,-0.39 -1.41,0l-1.83,1.83 3.75,3.75 1.83,-1.83z"/>
|
<path android:fillColor="@android:color/white" android:pathData="M3,17.25V21h3.75L17.81,9.94l-3.75,-3.75L3,17.25zM20.71,7.04c0.39,-0.39 0.39,-1.02 0,-1.41l-2.34,-2.34c-0.39,-0.39 -1.02,-0.39 -1.41,0l-1.83,1.83 3.75,3.75 1.83,-1.83z"/>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<vector android:height="24dp" android:tint="#000000"
|
<vector android:height="24dp" android:tint="?android:attr/textColor"
|
||||||
android:viewportHeight="24" android:viewportWidth="24"
|
android:viewportHeight="24" android:viewportWidth="24"
|
||||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<path android:fillColor="@android:color/white" android:pathData="M10,20v-6h4v6h5v-8h3L12,3 2,12h3v8z"/>
|
<path android:fillColor="@android:color/white" android:pathData="M10,20v-6h4v6h5v-8h3L12,3 2,12h3v8z"/>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<vector android:height="24dp" android:tint="#000000"
|
<vector android:height="24dp" android:tint="?android:attr/textColor"
|
||||||
android:viewportHeight="24" android:viewportWidth="24"
|
android:viewportHeight="24" android:viewportWidth="24"
|
||||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<path android:fillColor="@android:color/white" android:pathData="M3,18h18v-2L3,16v2zM3,13h18v-2L3,11v2zM3,6v2h18L21,6L3,6z"/>
|
<path android:fillColor="@android:color/white" android:pathData="M3,18h18v-2L3,16v2zM3,13h18v-2L3,11v2zM3,6v2h18L21,6L3,6z"/>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<vector android:height="24dp" android:tint="#000000"
|
<vector android:height="24dp" android:tint="?android:attr/textColor"
|
||||||
android:viewportHeight="24" android:viewportWidth="24"
|
android:viewportHeight="24" android:viewportWidth="24"
|
||||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<path android:fillColor="@android:color/white" android:pathData="M9.5,6.5v3h-3v-3H9.5M11,5H5v6h6V5L11,5zM9.5,14.5v3h-3v-3H9.5M11,13H5v6h6V13L11,13zM17.5,6.5v3h-3v-3H17.5M19,5h-6v6h6V5L19,5zM13,13h1.5v1.5H13V13zM14.5,14.5H16V16h-1.5V14.5zM16,13h1.5v1.5H16V13zM13,16h1.5v1.5H13V16zM14.5,17.5H16V19h-1.5V17.5zM16,16h1.5v1.5H16V16zM17.5,14.5H19V16h-1.5V14.5zM17.5,17.5H19V19h-1.5V17.5zM22,7h-2V4h-3V2h5V7zM22,22v-5h-2v3h-3v2H22zM2,22h5v-2H4v-3H2V22zM2,2v5h2V4h3V2H2z"/>
|
<path android:fillColor="@android:color/white" android:pathData="M9.5,6.5v3h-3v-3H9.5M11,5H5v6h6V5L11,5zM9.5,14.5v3h-3v-3H9.5M11,13H5v6h6V13L11,13zM17.5,6.5v3h-3v-3H17.5M19,5h-6v6h6V5L19,5zM13,13h1.5v1.5H13V13zM14.5,14.5H16V16h-1.5V14.5zM16,13h1.5v1.5H16V13zM13,16h1.5v1.5H13V16zM14.5,17.5H16V19h-1.5V17.5zM16,16h1.5v1.5H16V16zM17.5,14.5H19V16h-1.5V14.5zM17.5,17.5H19V19h-1.5V17.5zM22,7h-2V4h-3V2h5V7zM22,22v-5h-2v3h-3v2H22zM2,22h5v-2H4v-3H2V22zM2,2v5h2V4h3V2H2z"/>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<vector android:height="24dp" android:tint="#000000"
|
<vector android:height="24dp" android:tint="?android:attr/textColor"
|
||||||
android:viewportHeight="24" android:viewportWidth="24"
|
android:viewportHeight="24" android:viewportWidth="24"
|
||||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<path android:fillColor="@android:color/white" android:pathData="M19.14,12.94c0.04,-0.3 0.06,-0.61 0.06,-0.94c0,-0.32 -0.02,-0.64 -0.07,-0.94l2.03,-1.58c0.18,-0.14 0.23,-0.41 0.12,-0.61l-1.92,-3.32c-0.12,-0.22 -0.37,-0.29 -0.59,-0.22l-2.39,0.96c-0.5,-0.38 -1.03,-0.7 -1.62,-0.94L14.4,2.81c-0.04,-0.24 -0.24,-0.41 -0.48,-0.41h-3.84c-0.24,0 -0.43,0.17 -0.47,0.41L9.25,5.35C8.66,5.59 8.12,5.92 7.63,6.29L5.24,5.33c-0.22,-0.08 -0.47,0 -0.59,0.22L2.74,8.87C2.62,9.08 2.66,9.34 2.86,9.48l2.03,1.58C4.84,11.36 4.8,11.69 4.8,12s0.02,0.64 0.07,0.94l-2.03,1.58c-0.18,0.14 -0.23,0.41 -0.12,0.61l1.92,3.32c0.12,0.22 0.37,0.29 0.59,0.22l2.39,-0.96c0.5,0.38 1.03,0.7 1.62,0.94l0.36,2.54c0.05,0.24 0.24,0.41 0.48,0.41h3.84c0.24,0 0.44,-0.17 0.47,-0.41l0.36,-2.54c0.59,-0.24 1.13,-0.56 1.62,-0.94l2.39,0.96c0.22,0.08 0.47,0 0.59,-0.22l1.92,-3.32c0.12,-0.22 0.07,-0.47 -0.12,-0.61L19.14,12.94zM12,15.6c-1.98,0 -3.6,-1.62 -3.6,-3.6s1.62,-3.6 3.6,-3.6s3.6,1.62 3.6,3.6S13.98,15.6 12,15.6z"/>
|
<path android:fillColor="@android:color/white" android:pathData="M19.14,12.94c0.04,-0.3 0.06,-0.61 0.06,-0.94c0,-0.32 -0.02,-0.64 -0.07,-0.94l2.03,-1.58c0.18,-0.14 0.23,-0.41 0.12,-0.61l-1.92,-3.32c-0.12,-0.22 -0.37,-0.29 -0.59,-0.22l-2.39,0.96c-0.5,-0.38 -1.03,-0.7 -1.62,-0.94L14.4,2.81c-0.04,-0.24 -0.24,-0.41 -0.48,-0.41h-3.84c-0.24,0 -0.43,0.17 -0.47,0.41L9.25,5.35C8.66,5.59 8.12,5.92 7.63,6.29L5.24,5.33c-0.22,-0.08 -0.47,0 -0.59,0.22L2.74,8.87C2.62,9.08 2.66,9.34 2.86,9.48l2.03,1.58C4.84,11.36 4.8,11.69 4.8,12s0.02,0.64 0.07,0.94l-2.03,1.58c-0.18,0.14 -0.23,0.41 -0.12,0.61l1.92,3.32c0.12,0.22 0.37,0.29 0.59,0.22l2.39,-0.96c0.5,0.38 1.03,0.7 1.62,0.94l0.36,2.54c0.05,0.24 0.24,0.41 0.48,0.41h3.84c0.24,0 0.44,-0.17 0.47,-0.41l0.36,-2.54c0.59,-0.24 1.13,-0.56 1.62,-0.94l2.39,0.96c0.22,0.08 0.47,0 0.59,-0.22l1.92,-3.32c0.12,-0.22 0.07,-0.47 -0.12,-0.61L19.14,12.94zM12,15.6c-1.98,0 -3.6,-1.62 -3.6,-3.6s1.62,-3.6 3.6,-3.6s3.6,1.62 3.6,3.6S13.98,15.6 12,15.6z"/>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<vector android:height="24dp" android:tint="#000000"
|
<vector android:height="24dp" android:tint="?android:attr/textColor"
|
||||||
android:viewportHeight="24" android:viewportWidth="24"
|
android:viewportHeight="24" android:viewportWidth="24"
|
||||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<path android:fillColor="@android:color/white" android:pathData="M12,4.5C7,4.5 2.73,7.61 1,12c1.73,4.39 6,7.5 11,7.5s9.27,-3.11 11,-7.5c-1.73,-4.39 -6,-7.5 -11,-7.5zM12,17c-2.76,0 -5,-2.24 -5,-5s2.24,-5 5,-5 5,2.24 5,5 -2.24,5 -5,5zM12,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3 3,-1.34 3,-3 -1.34,-3 -3,-3z"/>
|
<path android:fillColor="@android:color/white" android:pathData="M12,4.5C7,4.5 2.73,7.61 1,12c1.73,4.39 6,7.5 11,7.5s9.27,-3.11 11,-7.5c-1.73,-4.39 -6,-7.5 -11,-7.5zM12,17c-2.76,0 -5,-2.24 -5,-5s2.24,-5 5,-5 5,2.24 5,5 -2.24,5 -5,5zM12,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3 3,-1.34 3,-3 -1.34,-3 -3,-3z"/>
|
||||||
|
@ -29,7 +29,6 @@
|
|||||||
android:layout_marginEnd="@dimen/fab_margin"
|
android:layout_marginEnd="@dimen/fab_margin"
|
||||||
android:layout_marginBottom="16dp"
|
android:layout_marginBottom="16dp"
|
||||||
app:srcCompat="@drawable/baseline_edit_24"
|
app:srcCompat="@drawable/baseline_edit_24"
|
||||||
app:tint="@color/white"
|
|
||||||
android:backgroundTint="?attr/colorTheme1"
|
android:backgroundTint="?attr/colorTheme1"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
|
|
||||||
@ -41,7 +40,6 @@
|
|||||||
android:layout_marginEnd="@dimen/fab_margin"
|
android:layout_marginEnd="@dimen/fab_margin"
|
||||||
android:layout_marginBottom="16dp"
|
android:layout_marginBottom="16dp"
|
||||||
app:srcCompat="@drawable/baseline_qr_code_scanner_24"
|
app:srcCompat="@drawable/baseline_qr_code_scanner_24"
|
||||||
app:tint="@color/white"
|
|
||||||
android:backgroundTint="?attr/colorTheme1"
|
android:backgroundTint="?attr/colorTheme1"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
|
|
||||||
@ -54,8 +52,7 @@
|
|||||||
android:layout_marginBottom="16dp"
|
android:layout_marginBottom="16dp"
|
||||||
android:backgroundTint="?attr/colorTheme1"
|
android:backgroundTint="?attr/colorTheme1"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
app:srcCompat="@drawable/baseline_compare_24"
|
app:srcCompat="@drawable/baseline_compare_24" />
|
||||||
app:tint="@color/white" />
|
|
||||||
|
|
||||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||||
android:id="@+id/fab_menu"
|
android:id="@+id/fab_menu"
|
||||||
@ -65,7 +62,6 @@
|
|||||||
android:layout_marginEnd="@dimen/fab_margin"
|
android:layout_marginEnd="@dimen/fab_margin"
|
||||||
android:layout_marginBottom="16dp"
|
android:layout_marginBottom="16dp"
|
||||||
app:srcCompat="@drawable/baseline_menu_24"
|
app:srcCompat="@drawable/baseline_menu_24"
|
||||||
app:tint="@color/white"
|
|
||||||
android:backgroundTint="?attr/colorTheme1"/>
|
android:backgroundTint="?attr/colorTheme1"/>
|
||||||
|
|
||||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
@ -17,6 +17,7 @@
|
|||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:srcCompat="@drawable/cringeauth_white" />
|
app:srcCompat="@drawable/cringeauth_white"
|
||||||
|
app:tint="?android:attr/textColor" />
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -8,8 +8,7 @@
|
|||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent">
|
||||||
android:padding="16dp">
|
|
||||||
|
|
||||||
<!--<LinearLayout
|
<!--<LinearLayout
|
||||||
android:id="@+id/menuItems"
|
android:id="@+id/menuItems"
|
||||||
|
@ -1,10 +1,15 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:id="@+id/menu_item_background"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:layout_margin="5dp"
|
android:padding="5dp"
|
||||||
android:background="@drawable/button_themed" >
|
android:paddingStart="16dp"
|
||||||
|
android:paddingEnd="16dp"
|
||||||
|
android:clickable="true"
|
||||||
|
android:focusable="true" >
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatButton
|
<androidx.appcompat.widget.AppCompatButton
|
||||||
android:id="@+id/button"
|
android:id="@+id/button"
|
||||||
@ -13,8 +18,8 @@
|
|||||||
android:background="@drawable/button_themed"
|
android:background="@drawable/button_themed"
|
||||||
android:paddingTop="20dp"
|
android:paddingTop="20dp"
|
||||||
android:paddingBottom="20dp"
|
android:paddingBottom="20dp"
|
||||||
android:text="Button"
|
|
||||||
android:textAllCaps="false"
|
android:textAllCaps="false"
|
||||||
android:textSize="20sp" />
|
android:textSize="20sp"
|
||||||
|
tools:text="Menu Item" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
@ -5,9 +5,10 @@
|
|||||||
<item
|
<item
|
||||||
android:id="@+id/action_new_group"
|
android:id="@+id/action_new_group"
|
||||||
android:orderInCategory="100"
|
android:orderInCategory="100"
|
||||||
|
android:icon="@drawable/baseline_add_24"
|
||||||
android:title="@string/action_new_group"
|
android:title="@string/action_new_group"
|
||||||
app:showAsAction="never"
|
android:onClick="addGroup"
|
||||||
android:onClick="addGroup" />
|
app:showAsAction="ifRoom" />
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_settings"
|
android:id="@+id/action_settings"
|
||||||
android:orderInCategory="100"
|
android:orderInCategory="100"
|
||||||
|
38
app/src/main/res/menu/menu_groups_edit.xml
Normal file
38
app/src/main/res/menu/menu_groups_edit.xml
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<menu xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_new_group"
|
||||||
|
android:orderInCategory="100"
|
||||||
|
android:icon="@drawable/baseline_add_24"
|
||||||
|
android:title="@string/action_new_group"
|
||||||
|
android:onClick="addGroup"
|
||||||
|
app:showAsAction="always" />
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_edit_group"
|
||||||
|
android:orderInCategory="100"
|
||||||
|
android:icon="@drawable/baseline_edit_24"
|
||||||
|
android:title="Edit Group"
|
||||||
|
android:onClick="editGroup"
|
||||||
|
app:showAsAction="always" />
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_delete_group"
|
||||||
|
android:orderInCategory="100"
|
||||||
|
android:icon="@drawable/baseline_delete_24"
|
||||||
|
android:title="Delete Group"
|
||||||
|
android:onClick="deleteGroup"
|
||||||
|
app:showAsAction="always" />
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_settings"
|
||||||
|
android:orderInCategory="100"
|
||||||
|
android:title="@string/action_settings"
|
||||||
|
app:showAsAction="never"
|
||||||
|
android:onClick="openSettings" />
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_about"
|
||||||
|
android:orderInCategory="100"
|
||||||
|
android:title="@string/action_about"
|
||||||
|
app:showAsAction="never"
|
||||||
|
android:onClick="openAbout" />
|
||||||
|
</menu>
|
@ -21,8 +21,8 @@
|
|||||||
<string name="qr_scanner_failed">Scannen fehlgeschlagen: %s</string>
|
<string name="qr_scanner_failed">Scannen fehlgeschlagen: %s</string>
|
||||||
<string name="intro_video_failed">Abspielen des Videos fehlgeschlagen</string>
|
<string name="intro_video_failed">Abspielen des Videos fehlgeschlagen</string>
|
||||||
<string name="edit_otp_title">OTP bearbeiten</string>
|
<string name="edit_otp_title">OTP bearbeiten</string>
|
||||||
<string name="group_delete_title">Gruppe löschen</string>
|
<string name="group_delete_title">Gruppe(n) löschen</string>
|
||||||
<string name="group_delete_message">Willst du die Gruppe löschen\n\nHinweis: Dadurch werden alle OTPs in der Gruppe gelöscht!</string>
|
<string name="group_delete_message">Willst du die ausgewählte(n) Gruppe(n) löschen?\n\nHinweis: Dadurch werden alle darin enthaltenen OTPs gelöscht!</string>
|
||||||
<string name="hotp_generated_new_code">Neuen Code generiert</string>
|
<string name="hotp_generated_new_code">Neuen Code generiert</string>
|
||||||
<string name="uri_handler_failed_title">Hinzufügen des Codes fehlgeschlagen</string>
|
<string name="uri_handler_failed_title">Hinzufügen des Codes fehlgeschlagen</string>
|
||||||
<string name="code_input_title">Code eingeben</string>
|
<string name="code_input_title">Code eingeben</string>
|
||||||
|
@ -21,8 +21,8 @@
|
|||||||
<string name="qr_scanner_failed">Scan failed: %s</string>
|
<string name="qr_scanner_failed">Scan failed: %s</string>
|
||||||
<string name="intro_video_failed">Failed to play video</string>
|
<string name="intro_video_failed">Failed to play video</string>
|
||||||
<string name="edit_otp_title">Edit OTP</string>
|
<string name="edit_otp_title">Edit OTP</string>
|
||||||
<string name="group_delete_title">Delete Group</string>
|
<string name="group_delete_title">Delete Group(s)</string>
|
||||||
<string name="group_delete_message">Do you want to delete the group?\n\nNote: This will delete all of the OTPs in the group!</string>
|
<string name="group_delete_message">Do you want to delete the group(s)?\n\nNote: This will delete all of the contained OTPs!</string>
|
||||||
<string name="hotp_generated_new_code">Generated new code</string>
|
<string name="hotp_generated_new_code">Generated new code</string>
|
||||||
<string name="uri_handler_failed_title">Failed to add code</string>
|
<string name="uri_handler_failed_title">Failed to add code</string>
|
||||||
<string name="code_input_title">Input Code</string>
|
<string name="code_input_title">Input Code</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user