定制自动开关机设置界面

差分包:

--- 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));
         }
     };


修改后如图:



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值