首页 > 代码库 > 定制自动开关机设置界面

定制自动开关机设置界面

差分包:

--- a/idh.code/packages/apps/Settings/res/layout/alarm_time.xml
+++ b/idh.code/packages/apps/Settings/res/layout/alarm_time.xml
@@ -2,19 +2,35 @@
 <!-- Create by Spreadst  -->
 <LinearLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
+    android:paddingLeft="5dip"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:orientation="horizontal">
-
-    <TextView android:id="@+id/poweronoff"
+    
+    <ImageView android:id="@+id/power_on_off"
         android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_weight="1"
-        android:textColor="?android:attr/textColorPrimary"
-        android:paddingTop="20dip"
-        android:paddingLeft="10dip"
-        android:paddingRight="10dip"
-        android:textAppearance="?android:attr/textAppearanceMedium"/>
+        android:layout_height="match_parent"/>
+        
+       <LinearLayout
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:orientation="vertical"
+            android:paddingTop="10dip"
+            android:paddingLeft="10dip"
+            android:paddingRight="10dip"
+            android:layout_weight="1">
+               <TextView android:id="@+id/time"
+                       android:layout_width="wrap_content"
+                       android:layout_height="wrap_content"
+                       android:textColor="?android:attr/textColorPrimary"
+                       android:textSize="24dip"
+                       android:textAppearance="?android:attr/textAppearanceMedium"/>
+               <TextView android:id="@+id/dayweek"
+                       android:layout_width="wrap_content"
+                       android:layout_height="wrap_content"
+                       android:textSize="14dip"
+                       android:textColor="?android:attr/textColorPrimary"/>
+        </LinearLayout>
        <!-- Modify at 2013-02-01 , for fix bug 123733 start -->
        <!-- android:background="@drawable/clock_selector" -->
        <!-- Modify at 2013-02-01 , for fix bug 123733 end -->
diff --git a/idh.code/packages/apps/Settings/src/com/sprd/settings/timerpower/AlarmClock.java b/idh.code/packages/apps/Settings/src/com
old mode 100644
new mode 100755
index 9c4ddf5..7d16157
--- a/idh.code/packages/apps/Settings/src/com/sprd/settings/timerpower/AlarmClock.java
+++ b/idh.code/packages/apps/Settings/src/com/sprd/settings/timerpower/AlarmClock.java
@@ -23,7 +23,6 @@ import android.widget.AdapterView.OnItemClickListener;
 
 import com.android.settings.R;
 import com.android.settings.Settings;
-
 /**
  * Power ON/OFF application.
  */
@@ -61,7 +60,7 @@ public class AlarmClock extends Activity implements OnItemClickListener {
 
         public void bindView(View view, Context context, Cursor cursor) {
             final Alarm alarm = new Alarm(AlarmClock.this,cursor);
-
+            SetAlarm sAlarm = new SetAlarm();
             View indicator = view.findViewById(R.id.indicator);
 
             // Set the initial state of the clock "checkbox"
@@ -78,15 +77,19 @@ public class AlarmClock extends Activity implements OnItemClickListener {
                     }
             });
             Log.v("timerpower AlarmClock -------------------- >>>>>>>>>>>>>>> "+alarm.label);
-            final TextView powerOnOff = (TextView)view.findViewById(R.id.poweronoff);
+            
+           final ImageView iPowerOnOff = (ImageView)view.findViewById(R.id.power_on_off);
+           final TextView tTime = (TextView)view.findViewById(R.id.time);
+           final TextView tDayWeek = (TextView)view.findViewById(R.id.dayweek);
             if(!alarm.label.equals("") && alarm.label.equals("on"))
             {
-                powerOnOff.setText(R.string.power_on);
+               iPowerOnOff.setImageDrawable(context.getResources().getDrawable(R.drawable.ic_settings_pwron));
             }else
             {
-                powerOnOff.setText(R.string.power_off);
+               iPowerOnOff.setImageDrawable(context.getResources().getDrawable(R.drawable.ic_settings_pwroff));
             }
-
+           tTime.setText(Alarms.formatTime(context, alarm.hour, alarm.minutes,alarm.daysOfWeek));
+           tDayWeek.setText(alarm.daysOfWeek.toString(context, false));
         }
     };


修改后如图:

技术分享


定制自动开关机设置界面