定制自动开关机设置界面 - 新闻资讯 - 云南小程序开发|云南软件开发|云南网站建设-昆明葵宇信息科技有限公司

159-8711-8523

云南网建设/小程序开发/软件开发

知识

不管是网站,软件还是小程序,都要直接或间接能为您产生价值,我们在追求其视觉表现的同时,更侧重于功能的便捷,营销的便利,运营的高效,让网站成为营销工具,让软件能切实提升企业内部管理水平和效率。优秀的程序为后期升级提供便捷的支持!

您当前位置>首页 » 新闻资讯 » 技术分享 >

定制自动开关机设置界面

发表时间:2021-1-4

发布人:葵宇科技

浏览次数:49


差分包:
--- 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));
         }
     };

修改后如图:
[img]http://img.blog.csdn.net/20150107100217995?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvc2lsZW5jZV9jZHNu/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center

相关案例查看更多