New colors for dark theme palette. Toggle between start/pause icons for timer item.

This commit is contained in:
Phillip Hsu 2016-08-31 22:06:28 -07:00
parent c21cbc1124
commit 2d6b21a3c9
4 changed files with 14 additions and 10 deletions

View File

@ -1,6 +1,8 @@
package com.philliphsu.clock2.timers;
import android.animation.ObjectAnimator;
import android.graphics.drawable.Drawable;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
@ -29,6 +31,8 @@ public class TimerViewHolder extends BaseViewHolder<Timer> {
private final AsyncTimersTableUpdateHandler mAsyncTimersTableUpdateHandler;
private TimerController mController;
private ObjectAnimator mProgressAnimator;
private final Drawable mStartIcon;
private final Drawable mPauseIcon;
@Bind(R.id.label) TextView mLabel;
@Bind(R.id.duration) CountdownChronometer mChronometer;
@ -42,6 +46,8 @@ public class TimerViewHolder extends BaseViewHolder<Timer> {
super(parent, R.layout.item_timer, listener);
Log.d(TAG, "New TimerViewHolder");
mAsyncTimersTableUpdateHandler = asyncTimersTableUpdateHandler;
mStartIcon = ContextCompat.getDrawable(getContext(), R.drawable.ic_start_24dp);
mPauseIcon = ContextCompat.getDrawable(getContext(), R.drawable.ic_pause_24dp);
}
@Override
@ -127,8 +133,7 @@ public class TimerViewHolder extends BaseViewHolder<Timer> {
}
private void bindButtonControls(Timer timer) {
// TODO: Pause and start icons, resp.
// mStartPause.setImageResource(timer.isRunning() ? 0 : 0);
mStartPause.setImageDrawable(timer.isRunning() ? mPauseIcon : mStartIcon);
int visibility = timer.hasStarted() ? View.VISIBLE : View.INVISIBLE;
mAddOneMinute.setVisibility(visibility);
mStop.setVisibility(visibility);

View File

@ -4,6 +4,6 @@
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:fillColor="#FFFFFF"
android:pathData="M6,19h4V5H6v14zm8,-14v14h4V5h-4z"/>
</vector>

View File

@ -4,5 +4,7 @@
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color> <!--Alternatives: Red 700 #D32F2F-->
<color name="black_overlay">#66000000</color>
<color name="colorPrimaryInverse">@color/dark_gray</color> <!--TODO-->
<color name="colorPrimaryDarkInverse">@color/dark_gray</color> <!--TODO-->
<color name="colorAccentInverse">@color/colorAccent</color> <!--TODO-->
</resources>

View File

@ -14,12 +14,9 @@
</style>
<style name="AppTheme.Dark" parent="Theme.AppCompat.NoActionBar">
<!--TODO: Define colorPrimaryInverse in colors.xml-->
<item name="colorPrimary">@color/dark_gray</item>
<!-- TODO: Define colorPrimaryDarkInverse in colors.xml -->
<item name="colorPrimaryDark">@color/dark_gray</item>
<!-- TODO: Define colorAccentInverse in colors.xml -->
<item name="colorAccent">@color/colorAccent</item>
<item name="colorPrimary">@color/colorPrimaryInverse</item>
<item name="colorPrimaryDark">@color/colorPrimaryDarkInverse</item>
<item name="colorAccent">@color/colorAccentInverse</item>
<!-- TODO: This doesn't work for BottomSheetDialogs. Verify this works for other types of dialogs. -->
<!--<item name="dialogTheme">@style/AppCompatDialogTheme.Dark</item>-->
<item name="alertDialogTheme">@style/AppCompatAlertDialogStyle.Dark</item>