summaryrefslogtreecommitdiffstats
path: root/src/com/android/deskclock/stopwatch/StopwatchFragment.java
diff options
context:
space:
mode:
authorSam Blitzstein <sblitz@google.com>2012-10-08 17:11:07 -0700
committerItzhak Katzenelson <isaack@android.com>2012-10-09 11:12:09 -0700
commit357497c341662c56945e22e458852f52a977efdf (patch)
tree1722f2c0496525721ca39a1144efbb17863caf80 /src/com/android/deskclock/stopwatch/StopwatchFragment.java
parentda3ef04d2d260e78ccd8848abadbf3a7d4b731c0 (diff)
downloadandroid_packages_apps_DeskClock-357497c341662c56945e22e458852f52a977efdf.tar.gz
android_packages_apps_DeskClock-357497c341662c56945e22e458852f52a977efdf.tar.bz2
android_packages_apps_DeskClock-357497c341662c56945e22e458852f52a977efdf.zip
Implemented lights out and dimming.
Bug: 7234512 Change-Id: I808d992bc58febc0d13d32e95531b6211d598792
Diffstat (limited to 'src/com/android/deskclock/stopwatch/StopwatchFragment.java')
-rw-r--r--src/com/android/deskclock/stopwatch/StopwatchFragment.java11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/com/android/deskclock/stopwatch/StopwatchFragment.java b/src/com/android/deskclock/stopwatch/StopwatchFragment.java
index 5df6d3767..2c54cb5c0 100644
--- a/src/com/android/deskclock/stopwatch/StopwatchFragment.java
+++ b/src/com/android/deskclock/stopwatch/StopwatchFragment.java
@@ -27,6 +27,8 @@ import android.widget.TextView;
import com.android.deskclock.CircleButtonsLinearLayout;
import com.android.deskclock.CircleTimerView;
+import com.android.deskclock.DeskClock;
+import com.android.deskclock.DeskClock.OnTapListener;
import com.android.deskclock.DeskClockFragment;
import com.android.deskclock.Log;
import com.android.deskclock.R;
@@ -75,9 +77,11 @@ public class StopwatchFragment extends DeskClockFragment implements OnSharedPref
ArrayList<Lap> mLaps = new ArrayList<Lap>();
private final LayoutInflater mInflater;
+ private int mBackgroundColor;
public LapsListAdapter(Context context) {
mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+ mBackgroundColor = getResources().getColor(R.color.blackish);
}
@Override
@@ -102,8 +106,9 @@ public class StopwatchFragment extends DeskClockFragment implements OnSharedPref
lapTime.setText(Stopwatches.getTimeText(mLaps.get(position).mLapTime));
toalTime.setText(Stopwatches.getTimeText(mLaps.get(position).mTotalTime));
count.setText(getString(R.string.sw_current_lap_number, mLaps.size() - position));
- return lapInfo;
+ lapInfo.setBackgroundColor(mBackgroundColor);
+ return lapInfo;
}
@Override
@@ -214,6 +219,7 @@ public class StopwatchFragment extends DeskClockFragment implements OnSharedPref
@Override
public void onClick(View v) {
long time = Utils.getTimeNow();
+ ((DeskClock) getActivity()).scheduleLightsOut();
Context context = getActivity().getApplicationContext();
Intent intent = new Intent(context, StopwatchService.class);
intent.putExtra(Stopwatches.MESSAGE_TIME, time);
@@ -248,6 +254,7 @@ public class StopwatchFragment extends DeskClockFragment implements OnSharedPref
mShareButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
+ ((DeskClock) getActivity()).bringLightsUp(false);
showSharePopup();
}
});
@@ -262,12 +269,14 @@ public class StopwatchFragment extends DeskClockFragment implements OnSharedPref
}
});
countingTimerView.registerStopTextView(mCenterButton);
+ countingTimerView.registerActivity((DeskClock) getActivity());
countingTimerView.setVirtualButtonEnabled(true);
mTime = (CircleTimerView)v.findViewById(R.id.stopwatch_time);
mTimeText = (CountingTimerView)v.findViewById(R.id.stopwatch_time_text);
mLapsList = (ListView)v.findViewById(R.id.laps_list);
mLapsList.setDividerHeight(0);
+ mLapsList.setOnTouchListener(new OnTapListener(getActivity()));
mLapsAdapter = new LapsListAdapter(getActivity());
if (mLapsList != null) {
mLapsList.setAdapter(mLapsAdapter);