Loading res/layout-sw600dp/desk_clock.xml +9 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,15 @@ android:layout_width="match_parent" android:layout_height="match_parent" > <View android:id="@+id/window_touch" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#00000000" android:visibility="visible" android:clickable="false" /> <!-- the top padding accounts for the status bar area --> <RelativeLayout android:id="@+id/desk_clock" Loading res/layout-sw600dp/desk_clock_saver.xml +0 −1 Original line number Diff line number Diff line Loading @@ -42,7 +42,6 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginRight="@dimen/time_margin_right" android:layout_below="@id/nightmode_button" android:textSize="@dimen/time_text_size" android:textColor="@color/time_text_color" android:gravity="left" Loading res/layout-sw600dp/desk_clock_time_date.xml +0 −12 Original line number Diff line number Diff line Loading @@ -32,23 +32,11 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginRight="@dimen/time_margin_right" android:layout_below="@id/nightmode_button" android:textSize="@dimen/time_text_size" android:textColor="@color/time_text_color" android:gravity="left" /> <ImageButton android:id="@+id/nightmode_button" style="@style/RoundTouchButton" android:layout_height="wrap_content" android:layout_width="wrap_content" android:src="@drawable/ic_clock_brightness" android:layout_alignRight="@id/timeDisplay" android:layout_marginRight="@dimen/font_margin_adjust" android:contentDescription="@string/nightmode_button_description" android:nextFocusDown="@+id/alarm_button" /> <com.android.deskclock.AndroidClockTextView android:id="@+id/am_pm" android:layout_width="wrap_content" Loading res/layout/desk_clock.xml +9 −11 Original line number Diff line number Diff line Loading @@ -23,6 +23,15 @@ android:layout_width="match_parent" android:layout_height="match_parent" > <View android:id="@+id/window_touch" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#00000000" android:visibility="visible" android:clickable="false" /> <!-- the top padding accounts for the status bar area --> <LinearLayout android:id="@+id/desk_clock" Loading @@ -40,17 +49,6 @@ android:layout_weight="1" android:gravity="center_vertical|right" > <ImageButton android:id="@+id/nightmode_button" style="@style/RoundTouchButton" android:layout_weight="0" android:layout_height="wrap_content" android:layout_width="wrap_content" android:src="@drawable/ic_clock_brightness" android:layout_marginRight="@dimen/time_margin_right" android:paddingRight="@dimen/font_margin_adjust" android:contentDescription="@string/nightmode_button_description" android:nextFocusDown="@+id/alarm_button" /> <include layout="@layout/desk_clock_time_date" android:layout_width="match_parent" android:layout_height="wrap_content" Loading src/com/android/deskclock/DeskClock.java +13 −45 Original line number Diff line number Diff line Loading @@ -44,6 +44,7 @@ import android.text.TextUtils; import android.text.format.DateFormat; import android.util.DisplayMetrics; import android.util.Log; import android.view.GestureDetector; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; Loading Loading @@ -183,7 +184,6 @@ public class DeskClock extends Activity { private View mAlarmButton; private void moveScreenSaver() { moveScreenSaverTo(-1,-1); } Loading Loading @@ -526,16 +526,19 @@ public class DeskClock extends Activity { View alarmControl = mAlarmButton != null ? mAlarmButton : findViewById(R.id.nextAlarm); alarmControl.setOnClickListener(alarmClickListener); final ImageButton nightmodeButton = (ImageButton) findViewById(R.id.nightmode_button); if (nightmodeButton != null) { nightmodeButton.setOnClickListener(new View.OnClickListener() { View touchView = findViewById(R.id.window_touch); touchView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // If the screen saver is on let onUserInteraction handle it if (!mScreenSaverMode) { mDimmed = !mDimmed; doDim(true); } } }); nightmodeButton.setOnLongClickListener(new View.OnLongClickListener() { touchView.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { saveScreen(); return true; Loading @@ -543,41 +546,6 @@ public class DeskClock extends Activity { }); } final View tintView = findViewById(R.id.window_tint); tintView.setOnTouchListener(new View.OnTouchListener() { public boolean onTouch(View v, MotionEvent event) { if (mDimmed && event.getAction() == MotionEvent.ACTION_DOWN) { // We want to un-dim the whole screen on tap. // ...Unless the user is specifically tapping on the dim // widget, in which case let it do the work. Rect r = new Rect(); nightmodeButton.getHitRect(r); int[] gloc = new int[2]; nightmodeButton.getLocationInWindow(gloc); r.offsetTo(gloc[0], gloc[1]); // convert to window coords if (!r.contains((int) event.getX(), (int) event.getY())) { mDimmed = false; doDim(true); } } return false; // always pass the click through } }); // Tidy up awkward focus behavior: the first view to be focused in // trackball mode should be the alarms button final ViewTreeObserver vto = alarmControl.getViewTreeObserver(); final View alarmView = alarmControl; vto.addOnGlobalFocusChangeListener(new ViewTreeObserver.OnGlobalFocusChangeListener() { public void onGlobalFocusChanged(View oldFocus, View newFocus) { if (oldFocus == null && newFocus == nightmodeButton) { alarmView.requestFocus(); } } }); } @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); Loading Loading
res/layout-sw600dp/desk_clock.xml +9 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,15 @@ android:layout_width="match_parent" android:layout_height="match_parent" > <View android:id="@+id/window_touch" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#00000000" android:visibility="visible" android:clickable="false" /> <!-- the top padding accounts for the status bar area --> <RelativeLayout android:id="@+id/desk_clock" Loading
res/layout-sw600dp/desk_clock_saver.xml +0 −1 Original line number Diff line number Diff line Loading @@ -42,7 +42,6 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginRight="@dimen/time_margin_right" android:layout_below="@id/nightmode_button" android:textSize="@dimen/time_text_size" android:textColor="@color/time_text_color" android:gravity="left" Loading
res/layout-sw600dp/desk_clock_time_date.xml +0 −12 Original line number Diff line number Diff line Loading @@ -32,23 +32,11 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginRight="@dimen/time_margin_right" android:layout_below="@id/nightmode_button" android:textSize="@dimen/time_text_size" android:textColor="@color/time_text_color" android:gravity="left" /> <ImageButton android:id="@+id/nightmode_button" style="@style/RoundTouchButton" android:layout_height="wrap_content" android:layout_width="wrap_content" android:src="@drawable/ic_clock_brightness" android:layout_alignRight="@id/timeDisplay" android:layout_marginRight="@dimen/font_margin_adjust" android:contentDescription="@string/nightmode_button_description" android:nextFocusDown="@+id/alarm_button" /> <com.android.deskclock.AndroidClockTextView android:id="@+id/am_pm" android:layout_width="wrap_content" Loading
res/layout/desk_clock.xml +9 −11 Original line number Diff line number Diff line Loading @@ -23,6 +23,15 @@ android:layout_width="match_parent" android:layout_height="match_parent" > <View android:id="@+id/window_touch" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#00000000" android:visibility="visible" android:clickable="false" /> <!-- the top padding accounts for the status bar area --> <LinearLayout android:id="@+id/desk_clock" Loading @@ -40,17 +49,6 @@ android:layout_weight="1" android:gravity="center_vertical|right" > <ImageButton android:id="@+id/nightmode_button" style="@style/RoundTouchButton" android:layout_weight="0" android:layout_height="wrap_content" android:layout_width="wrap_content" android:src="@drawable/ic_clock_brightness" android:layout_marginRight="@dimen/time_margin_right" android:paddingRight="@dimen/font_margin_adjust" android:contentDescription="@string/nightmode_button_description" android:nextFocusDown="@+id/alarm_button" /> <include layout="@layout/desk_clock_time_date" android:layout_width="match_parent" android:layout_height="wrap_content" Loading
src/com/android/deskclock/DeskClock.java +13 −45 Original line number Diff line number Diff line Loading @@ -44,6 +44,7 @@ import android.text.TextUtils; import android.text.format.DateFormat; import android.util.DisplayMetrics; import android.util.Log; import android.view.GestureDetector; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; Loading Loading @@ -183,7 +184,6 @@ public class DeskClock extends Activity { private View mAlarmButton; private void moveScreenSaver() { moveScreenSaverTo(-1,-1); } Loading Loading @@ -526,16 +526,19 @@ public class DeskClock extends Activity { View alarmControl = mAlarmButton != null ? mAlarmButton : findViewById(R.id.nextAlarm); alarmControl.setOnClickListener(alarmClickListener); final ImageButton nightmodeButton = (ImageButton) findViewById(R.id.nightmode_button); if (nightmodeButton != null) { nightmodeButton.setOnClickListener(new View.OnClickListener() { View touchView = findViewById(R.id.window_touch); touchView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // If the screen saver is on let onUserInteraction handle it if (!mScreenSaverMode) { mDimmed = !mDimmed; doDim(true); } } }); nightmodeButton.setOnLongClickListener(new View.OnLongClickListener() { touchView.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { saveScreen(); return true; Loading @@ -543,41 +546,6 @@ public class DeskClock extends Activity { }); } final View tintView = findViewById(R.id.window_tint); tintView.setOnTouchListener(new View.OnTouchListener() { public boolean onTouch(View v, MotionEvent event) { if (mDimmed && event.getAction() == MotionEvent.ACTION_DOWN) { // We want to un-dim the whole screen on tap. // ...Unless the user is specifically tapping on the dim // widget, in which case let it do the work. Rect r = new Rect(); nightmodeButton.getHitRect(r); int[] gloc = new int[2]; nightmodeButton.getLocationInWindow(gloc); r.offsetTo(gloc[0], gloc[1]); // convert to window coords if (!r.contains((int) event.getX(), (int) event.getY())) { mDimmed = false; doDim(true); } } return false; // always pass the click through } }); // Tidy up awkward focus behavior: the first view to be focused in // trackball mode should be the alarms button final ViewTreeObserver vto = alarmControl.getViewTreeObserver(); final View alarmView = alarmControl; vto.addOnGlobalFocusChangeListener(new ViewTreeObserver.OnGlobalFocusChangeListener() { public void onGlobalFocusChanged(View oldFocus, View newFocus) { if (oldFocus == null && newFocus == nightmodeButton) { alarmView.requestFocus(); } } }); } @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); Loading