Replace mini FABs with ImageButtons
This commit is contained in:
parent
012c8fb425
commit
7248f8a8ae
@ -17,6 +17,7 @@ import android.util.Log;
|
|||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ImageButton;
|
||||||
import android.widget.SeekBar;
|
import android.widget.SeekBar;
|
||||||
|
|
||||||
import com.philliphsu.clock2.R;
|
import com.philliphsu.clock2.R;
|
||||||
@ -43,20 +44,20 @@ public class StopwatchFragment extends RecyclerViewFragment<
|
|||||||
private static final String TAG = "StopwatchFragment";
|
private static final String TAG = "StopwatchFragment";
|
||||||
|
|
||||||
// Exposed for StopwatchNotificationService
|
// Exposed for StopwatchNotificationService
|
||||||
public static final String KEY_START_TIME = "start_time";
|
public static final String KEY_START_TIME = "start_time";
|
||||||
public static final String KEY_PAUSE_TIME = "pause_time";
|
public static final String KEY_PAUSE_TIME = "pause_time";
|
||||||
public static final String KEY_CHRONOMETER_RUNNING = "chronometer_running";
|
public static final String KEY_CHRONOMETER_RUNNING = "chronometer_running";
|
||||||
|
|
||||||
private ObjectAnimator mProgressAnimator;
|
private ObjectAnimator mProgressAnimator;
|
||||||
private SharedPreferences mPrefs;
|
private SharedPreferences mPrefs;
|
||||||
private WeakReference<FloatingActionButton> mActivityFab;
|
private WeakReference<FloatingActionButton> mActivityFab;
|
||||||
private Drawable mStartDrawable;
|
private Drawable mStartDrawable;
|
||||||
private Drawable mPauseDrawable;
|
private Drawable mPauseDrawable;
|
||||||
|
|
||||||
@Bind(R.id.chronometer) ChronometerWithMillis mChronometer;
|
@Bind(R.id.chronometer) ChronometerWithMillis mChronometer;
|
||||||
@Bind(R.id.new_lap) FloatingActionButton mNewLapButton;
|
@Bind(R.id.new_lap) ImageButton mNewLapButton;
|
||||||
@Bind(R.id.stop) FloatingActionButton mStopButton;
|
@Bind(R.id.stop) ImageButton mStopButton;
|
||||||
@Bind(R.id.seek_bar) SeekBar mSeekBar;
|
@Bind(R.id.seek_bar) SeekBar mSeekBar;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is called only when a new instance of this Fragment is being created,
|
* This is called only when a new instance of this Fragment is being created,
|
||||||
@ -142,7 +143,7 @@ public class StopwatchFragment extends RecyclerViewFragment<
|
|||||||
* this Fragment gets to. Here, the view hierarchy returned from onCreateView()
|
* this Fragment gets to. Here, the view hierarchy returned from onCreateView()
|
||||||
* is destroyed--the Fragment itself is NOT destroyed. If the user navigates back
|
* is destroyed--the Fragment itself is NOT destroyed. If the user navigates back
|
||||||
* to this tab, this Fragment goes through its lifecycle beginning from onCreateView().
|
* to this tab, this Fragment goes through its lifecycle beginning from onCreateView().
|
||||||
*
|
* <p/>
|
||||||
* TODO: Verify that members are not reset.
|
* TODO: Verify that members are not reset.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
10
app/src/main/res/drawable/ic_add_lap_40dp.xml
Normal file
10
app/src/main/res/drawable/ic_add_lap_40dp.xml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="40dp"
|
||||||
|
android:height="40dp"
|
||||||
|
android:viewportHeight="24"
|
||||||
|
android:viewportWidth="24">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FFFFFF"
|
||||||
|
android:pathData="M6,3A1,1 0 0,1 7,4V4.88C8.06,4.44 9.5,4 11,4C14,4 14,6 16,6C19,6 20,4 20,4V12C20,12 19,14 16,14C13,14 13,12 11,12C8,12 7,14 7,14V21H5V4A1,1 0 0,1 6,3Z"/>
|
||||||
|
</vector>
|
||||||
9
app/src/main/res/drawable/ic_stop_40dp.xml
Normal file
9
app/src/main/res/drawable/ic_stop_40dp.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="40dp"
|
||||||
|
android:height="40dp"
|
||||||
|
android:viewportWidth="24.0"
|
||||||
|
android:viewportHeight="24.0">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FFFFFF"
|
||||||
|
android:pathData="M6,6h12v12H6z"/>
|
||||||
|
</vector>
|
||||||
@ -36,8 +36,6 @@
|
|||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<!--TODO: If we are changing the style of the mini FABS often,
|
|
||||||
then create a style resource for them. -->
|
|
||||||
<android.support.v7.widget.GridLayout
|
<android.support.v7.widget.GridLayout
|
||||||
android:id="@id/mini_fab_layout"
|
android:id="@id/mini_fab_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@ -45,29 +43,13 @@
|
|||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
app:columnCount="2">
|
app:columnCount="2">
|
||||||
|
|
||||||
<android.support.design.widget.FloatingActionButton
|
<ImageButton
|
||||||
android:id="@+id/new_lap"
|
android:id="@+id/new_lap"
|
||||||
android:layout_width="wrap_content"
|
style="@style/AddLapButton"/>
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:src="@drawable/ic_add_lap_24dp"
|
|
||||||
android:tint="@android:color/white"
|
|
||||||
android:visibility="invisible"
|
|
||||||
app:layout_columnWeight="1"
|
|
||||||
app:layout_gravity="center"
|
|
||||||
app:fabSize="mini"
|
|
||||||
app:backgroundTint="?attr/colorPrimary"/>
|
|
||||||
|
|
||||||
<android.support.design.widget.FloatingActionButton
|
<ImageButton
|
||||||
android:id="@+id/stop"
|
android:id="@+id/stop"
|
||||||
android:layout_width="wrap_content"
|
style="@style/StopButton"/>
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:src="@drawable/ic_stop_24dp"
|
|
||||||
android:tint="@android:color/white"
|
|
||||||
android:visibility="invisible"
|
|
||||||
app:layout_columnWeight="1"
|
|
||||||
app:layout_gravity="center"
|
|
||||||
app:fabSize="mini"
|
|
||||||
app:backgroundTint="?attr/colorPrimary"/>
|
|
||||||
|
|
||||||
</android.support.v7.widget.GridLayout>
|
</android.support.v7.widget.GridLayout>
|
||||||
|
|
||||||
|
|||||||
@ -30,37 +30,19 @@
|
|||||||
app:layout_anchorGravity="bottom"
|
app:layout_anchorGravity="bottom"
|
||||||
style="@style/BaseSeekBar"/>
|
style="@style/BaseSeekBar"/>
|
||||||
|
|
||||||
<!--TODO: If we are changing the style of the mini FABS often,
|
|
||||||
then create a style resource for them. -->
|
|
||||||
<android.support.v7.widget.GridLayout
|
<android.support.v7.widget.GridLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="@dimen/fab_total_height"
|
android:layout_height="@dimen/fab_total_height"
|
||||||
android:layout_gravity="bottom"
|
android:layout_gravity="bottom"
|
||||||
app:columnCount="2">
|
app:columnCount="2">
|
||||||
|
|
||||||
<android.support.design.widget.FloatingActionButton
|
<ImageButton
|
||||||
android:id="@+id/new_lap"
|
android:id="@+id/new_lap"
|
||||||
android:layout_width="wrap_content"
|
style="@style/AddLapButton"/>
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:src="@drawable/ic_add_lap_24dp"
|
|
||||||
android:tint="@android:color/white"
|
|
||||||
android:visibility="invisible"
|
|
||||||
app:layout_columnWeight="1"
|
|
||||||
app:layout_gravity="center"
|
|
||||||
app:fabSize="mini"
|
|
||||||
app:backgroundTint="?attr/colorPrimary"/>
|
|
||||||
|
|
||||||
<android.support.design.widget.FloatingActionButton
|
<ImageButton
|
||||||
android:id="@+id/stop"
|
android:id="@+id/stop"
|
||||||
android:layout_width="wrap_content"
|
style="@style/StopButton"/>
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:src="@drawable/ic_stop_24dp"
|
|
||||||
android:tint="@android:color/white"
|
|
||||||
android:visibility="invisible"
|
|
||||||
app:layout_columnWeight="1"
|
|
||||||
app:layout_gravity="center"
|
|
||||||
app:fabSize="mini"
|
|
||||||
app:backgroundTint="?attr/colorPrimary"/>
|
|
||||||
|
|
||||||
</android.support.v7.widget.GridLayout>
|
</android.support.v7.widget.GridLayout>
|
||||||
|
|
||||||
|
|||||||
@ -36,4 +36,8 @@
|
|||||||
<item name="android:background">@color/alert_dialog_background_color_black</item>
|
<item name="android:background">@color/alert_dialog_background_color_black</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style name="SelectableButton">
|
||||||
|
<item name="android:background">?selectableItemBackgroundBorderless</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
<style name="BaseAlarmToggleButton">
|
|
||||||
<item name="android:background">?selectableItemBackgroundBorderless</item>
|
|
||||||
</style>
|
|
||||||
</resources>
|
|
||||||
@ -188,4 +188,8 @@
|
|||||||
<item name="android:maxLines">1</item>
|
<item name="android:maxLines">1</item>
|
||||||
<item name="android:textSize">@dimen/text_size_subhead</item>
|
<item name="android:textSize">@dimen/text_size_subhead</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style name="SelectableButton">
|
||||||
|
<item name="android:background">?selectableItemBackground</item>
|
||||||
|
</style>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@ -1,15 +1,12 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<style name="BaseAlarmToggleButton">
|
<style name="AlarmDayToggle" parent="SelectableButton">
|
||||||
<item name="android:background">?selectableItemBackground</item>
|
|
||||||
</style>
|
|
||||||
<style name="AlarmDayToggle" parent="BaseAlarmToggleButton">
|
|
||||||
<item name="android:layout_width">0dp</item>
|
<item name="android:layout_width">0dp</item>
|
||||||
<item name="android:layout_height">match_parent</item>
|
<item name="android:layout_height">match_parent</item>
|
||||||
<item name="android:layout_weight">1</item>
|
<item name="android:layout_weight">1</item>
|
||||||
<item name="android:textAllCaps">true</item>
|
<item name="android:textAllCaps">true</item>
|
||||||
</style>
|
</style>
|
||||||
<style name="AlarmVibrateToggle" parent="BaseAlarmToggleButton">
|
<style name="AlarmVibrateToggle" parent="SelectableButton">
|
||||||
<item name="android:layout_width">@dimen/vibrate_toggle_size</item>
|
<item name="android:layout_width">@dimen/vibrate_toggle_size</item>
|
||||||
<item name="android:layout_height">match_parent</item>
|
<item name="android:layout_height">match_parent</item>
|
||||||
<item name="srcCompat">@drawable/ic_vibrate_24dp</item>
|
<item name="srcCompat">@drawable/ic_vibrate_24dp</item>
|
||||||
|
|||||||
@ -5,4 +5,17 @@
|
|||||||
<item name="android:fontFamily">sans-serif-light</item>
|
<item name="android:fontFamily">sans-serif-light</item>
|
||||||
<item name="android:textSize">@dimen/text_size_display_3</item>
|
<item name="android:textSize">@dimen/text_size_display_3</item>
|
||||||
</style>
|
</style>
|
||||||
|
<style name="SideButton" parent="SelectableButton">
|
||||||
|
<item name="android:layout_width">wrap_content</item>
|
||||||
|
<item name="android:layout_height">wrap_content</item>
|
||||||
|
<item name="android:visibility">invisible</item>
|
||||||
|
<item name="layout_columnWeight">1</item>
|
||||||
|
<item name="layout_gravity">center</item>
|
||||||
|
</style>
|
||||||
|
<style name="AddLapButton" parent="SideButton">
|
||||||
|
<item name="android:src">@drawable/ic_add_lap_40dp</item>
|
||||||
|
</style>
|
||||||
|
<style name="StopButton" parent="SideButton">
|
||||||
|
<item name="android:src">@drawable/ic_stop_40dp</item>
|
||||||
|
</style>
|
||||||
</resources>
|
</resources>
|
||||||
Loading…
Reference in New Issue
Block a user