mirror of
https://github.com/beemdevelopment/Aegis.git
synced 2025-05-14 14:02:49 +00:00
Collapse the FAB menu on touch
This commit is contained in:
parent
88670dfa96
commit
22861548c9
2 changed files with 31 additions and 3 deletions
|
@ -6,12 +6,14 @@ import android.content.ClipboardManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.graphics.Rect;
|
||||||
import android.media.MediaScannerConnection;
|
import android.media.MediaScannerConnection;
|
||||||
import android.support.design.widget.BottomSheetDialog;
|
import android.support.design.widget.BottomSheetDialog;
|
||||||
import android.support.v7.app.AlertDialog;
|
import android.support.v7.app.AlertDialog;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
@ -52,6 +54,7 @@ public class MainActivity extends AegisActivity implements KeyProfileView.Listen
|
||||||
|
|
||||||
private boolean _nightMode = false;
|
private boolean _nightMode = false;
|
||||||
private Menu _menu;
|
private Menu _menu;
|
||||||
|
private FloatingActionsMenu _fabMenu;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
@ -69,13 +72,13 @@ public class MainActivity extends AegisActivity implements KeyProfileView.Listen
|
||||||
_keyProfileView.setShowIssuer(_app.getPreferences().getBoolean("pref_issuer", false));
|
_keyProfileView.setShowIssuer(_app.getPreferences().getBoolean("pref_issuer", false));
|
||||||
|
|
||||||
// set up the floating action button
|
// set up the floating action button
|
||||||
FloatingActionsMenu fabMenu = findViewById(R.id.fab);
|
_fabMenu = findViewById(R.id.fab);
|
||||||
findViewById(R.id.fab_enter).setOnClickListener(view -> {
|
findViewById(R.id.fab_enter).setOnClickListener(view -> {
|
||||||
fabMenu.collapse();
|
_fabMenu.collapse();
|
||||||
onEnterKeyInfo();
|
onEnterKeyInfo();
|
||||||
});
|
});
|
||||||
findViewById(R.id.fab_scan).setOnClickListener(view -> {
|
findViewById(R.id.fab_scan).setOnClickListener(view -> {
|
||||||
fabMenu.collapse();
|
_fabMenu.collapse();
|
||||||
onScanKeyInfo();
|
onScanKeyInfo();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -112,6 +115,23 @@ public class MainActivity extends AegisActivity implements KeyProfileView.Listen
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean dispatchTouchEvent(MotionEvent event) {
|
||||||
|
// collapse the fab menu on touch
|
||||||
|
if (event.getAction() == MotionEvent.ACTION_DOWN) {
|
||||||
|
if (_fabMenu.isExpanded()) {
|
||||||
|
Rect rect = new Rect();
|
||||||
|
_fabMenu.getGlobalVisibleRect(rect);
|
||||||
|
|
||||||
|
if (!rect.contains((int) event.getRawX(), (int) event.getRawY())) {
|
||||||
|
_fabMenu.collapse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.dispatchTouchEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onNewIntent(Intent intent) {
|
protected void onNewIntent(Intent intent) {
|
||||||
super.onNewIntent(intent);
|
super.onNewIntent(intent);
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
package me.impy.aegis.encoding;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by alex on 1/1/18.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class Base32Exception {
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue