Android->setting:add SchedulePowerOnOff function

This commit is contained in:
cjp
2016-03-25 15:20:59 +08:00
committed by Guanzl
parent e0b865f2fb
commit a3ff837be0
11 changed files with 69 additions and 4 deletions

View File

@ -2254,9 +2254,7 @@
<category android:name="android.intent.category.VOICE_LAUNCH" />
</intent-filter>
</activity>
<receiver
android:name=".BootReceiver"
<receiver android:name=".BootReceiver"
>
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
@ -2264,6 +2262,11 @@
</intent-filter>
</receiver>
<receiver android:name="ScheduleOnOffReceiver" android:process=":remote">
<intent-filter>
<action android:name="android.timerswitch.run_power_off"/>
</intent-filter>
</receiver>
<!--$_rbox_$_modify_$_end-->
</application>
</manifest>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<!-- schedule power on off start -->
<string name="schedule_power_on_off_settings_title">"定时开关机"</string>
</resources>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<!-- Schedule power on/off settings -->
<!-- Main Settings screen setting option name to go into the power on/off settings-->
<string name="schedule_power_on_off_settings_title">定時開/關機</string>
</resources>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<!-- Schedule power on/off settings -->
<!-- Main Settings screen setting option name to go into the power on/off settings-->
<string name="schedule_power_on_off_settings_title">定時開/關機</string>
</resources>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Main Settings screen setting option name to go into the power on&amp;off settings-->
<string name="schedule_power_on_off_settings_title">Scheduled power on &amp; off</string>
</resources>

View File

@ -234,7 +234,14 @@
android:fragment="com.android.settings.DateTimeSettings"
android:icon="@drawable/ic_settings_date_time"
/>
<!--Scheduled power on&off-->
<dashboard-tile
android:id="@+id/power_settings"
android:icon="@drawable/ic_settings_schpwronoff"
android:title="@string/schedule_power_on_off_settings_title">
<intent android:action="com.android.settings.SCHEDULE_POWER_ON_OFF_SETTING" />
</dashboard-tile>
<!-- Accessibility feedback -->
<dashboard-tile
android:id="@+id/accessibility_settings"

View File

@ -0,0 +1,29 @@
package com.android.settings;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import android.widget.Toast;
/**
* @author lql
*
*/
public class ScheduleOnOffReceiver extends BroadcastReceiver {
/* (non-Javadoc)
* @see android.content.BroadcastReceiver#onReceive(android.content.Context, android.content.Intent)
*/
@Override
public void onReceive(Context arg0, Intent data) {
Log.v("sjf",data.getAction());
if(data.getAction().equals("android.timerswitch.run_power_off"))
{
// Toast.makeText(arg0, "will power_off", Toast.LENGTH_SHORT).show();
Intent newIntent = new Intent(Intent.ACTION_REQUEST_SHUTDOWN);
newIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
arg0.startActivity(newIntent);
}
}
}