Delete action
This commit is contained in:
parent
80ae3dfad0
commit
6fdb62c538
@ -73,11 +73,11 @@ public class MainActivity extends AppCompatActivity {
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
// Inflate the menu; this adds items to the action bar if it is present.
|
||||
|
||||
if(NavigationUtil.getCurrentFragment(this) instanceof DynamicFragment) {
|
||||
/*if(NavigationUtil.getCurrentFragment(this) instanceof DynamicFragment) { TODO: vs. fabs?
|
||||
//getMenuInflater().inflate(R.menu.menu_dynamic, menu);
|
||||
getMenuInflater().inflate(R.menu.menu_dynamic, menu);
|
||||
return true;
|
||||
}
|
||||
}*/
|
||||
|
||||
getMenuInflater().inflate(R.menu.menu_main, menu);
|
||||
return true;
|
||||
|
@ -11,6 +11,7 @@ import android.widget.Button;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.cringe_studios.cringe_authenticator.R;
|
||||
@ -40,7 +41,18 @@ public class MenuFragment extends Fragment {
|
||||
bundle.putString("tab", item);
|
||||
NavigationUtil.navigate(this, DynamicFragment.class, bundle);
|
||||
});
|
||||
binding.menuItems.addView(itemBinding.getRoot(), 0);
|
||||
itemBinding.button.setOnLongClickListener(view -> {
|
||||
new AlertDialog.Builder(getContext())
|
||||
.setTitle("Delete?")
|
||||
.setMessage("Delete this?")
|
||||
.setPositiveButton("Yes", (dialog, which) -> itemBinding.button.setVisibility(View.GONE))
|
||||
.setNegativeButton("No", (dialog, which) -> {})
|
||||
.show();
|
||||
// TODO: better method?
|
||||
// TODO: actually delete
|
||||
return true;
|
||||
});
|
||||
binding.menuItems.addView(itemBinding.getRoot());
|
||||
}
|
||||
|
||||
binding.editSwitch.setOnCheckedChangeListener((view, checked) -> {
|
||||
|
@ -1,21 +1,29 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/rectangle"
|
||||
android:layout_margin="5dp"
|
||||
android:padding="5dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/displayName"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="My TOTP"
|
||||
android:textAlignment="center" />
|
||||
android:textAlignment="center"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/totpCode"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="000000"
|
||||
android:textAlignment="center" />
|
||||
android:textAlignment="center"
|
||||
android:textSize="20sp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
@ -8,5 +8,5 @@
|
||||
android:id="@+id/button"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Button" />
|
||||
android:text="Button"/>
|
||||
</LinearLayout>
|
Loading…
Reference in New Issue
Block a user