码迷,mamicode.com
首页 > 其他好文 > 详细

定制自动开关机设置界面

时间:2015-01-07 11:04:43      阅读:172      评论:0      收藏:0      [点我收藏+]

标签:定时开关机设置界面   sc7715   

差分包:

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


修改后如图:

技术分享


定制自动开关机设置界面

标签:定时开关机设置界面   sc7715   

原文地址:http://blog.csdn.net/silence_cdsn/article/details/42487689

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!