Browse Source

Fix #11, make FAB bigger

feature_fragments
vanitasvitae 5 years ago
parent
commit
74e8e9de1f
Signed by: vanitasvitae
GPG Key ID: 62BEE9264BF17311
  1. 11
      app/src/main/java/de/trac/spherical/MainActivity.java
  2. 2
      app/src/main/res/layout/activity_main.xml
  3. 4
      app/src/main/res/values/dimensions.xml

11
app/src/main/java/de/trac/spherical/MainActivity.java

@ -49,29 +49,28 @@ public class MainActivity extends AppCompatActivity {
@Override
public void onClick(View v) {
SphereSurfaceView.USE_TOUCH = !SphereSurfaceView.USE_TOUCH;
fab.hide();
fab.setVisibility(View.INVISIBLE);
}
});
fab.hide();
// Detect gestures like single taps.
final GestureDetector mGesDetect = new GestureDetector(this, new GestureDetector.SimpleOnGestureListener() {
final GestureDetector gestureDetector = new GestureDetector(this, new GestureDetector.SimpleOnGestureListener() {
@Override
public boolean onSingleTapConfirmed(MotionEvent event) {
if (fab.isShown()) {
fab.hide();
fab.setVisibility(View.INVISIBLE);
} else {
fab.show();
}
return true;
}
});
surfaceView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
return mGesDetect.onTouchEvent(event);
return gestureDetector.onTouchEvent(event);
}
});

2
app/src/main/res/layout/activity_main.xml

@ -18,7 +18,7 @@
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:src="@drawable/ic_explore_white_48px"
app:fabSize="auto"
app:fabSize="mini"
android:layout_gravity="bottom|end"
android:layout_margin="16dp"
android:layout_width="wrap_content"

4
app/src/main/res/values/dimensions.xml

@ -0,0 +1,4 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<dimen name="design_fab_size_mini" tools:override="true">64dp</dimen>
<dimen name="design_fab_image_size" tools:override="true">48dp</dimen>
</resources>
Loading…
Cancel
Save