PowerAct
v1.7.1
수작업이 아니라 코드로 전원 버튼을 누릅니다.
몇 줄의 코드로 전원 관련 동작을 조작 할 수있는 Android 라이브러리.
repositories {
maven {
url ' https://raw.githubusercontent.com/ryuunoakaihitomi/maven-repository/master '
}
}
dependencies {
// (Required)
implementation ' github.ryuunoakaihitomi.poweract:poweract:latest.release '
// (Optional but recommended) Bring better performance to use root shell.
// -> https://github.com/topjohnwu/libsu
implementation " com.github.topjohnwu.libsu:core:4.0.3 "
// (Optional but recommended) A more elegant and direct way of using privileged system API.
// NOTE: Need more steps to integrate it.
// -> https://github.com/RikkaApps/Shizuku
def shizuku_version = ' 12.1.0 '
implementation " dev.rikka.shizuku:api: $s hizuku_version "
implementation " dev.rikka.shizuku:provider: $s hizuku_version "
// (Optional but recommended) Make Shizuku available in more situations.
// NOTE: Enable it on your own.
// -> https://github.com/LSPosed/AndroidHiddenApiBypass
implementation " org.lsposed.hiddenapibypass:hiddenapibypass:4.3 "
} import github . ryuunoakaihitomi . poweract .*;| 클래스 이름 | 짧은 |
|---|---|
PowerAct | 일반적인 환경. |
PowerActX | 뿌리 환경의 경우. |
Callback | 실행 결과에 알립니다. |
ExternalUtils | 외부 유틸리티 도구. |
PowerButton | 빠른 통합을위한 위젯. |
화면을 끕니다.
PowerAct . lockScreen ( activity );콜백이있는 오픈 시스템 전원 메뉴,
Callback callback = new Callback () {
@ Override
public void done () {}
@ Override
public void failed () {}
};
PowerAct . showPowerDialog ( activity , callback );... 접근성 서비스를 활성화하도록 사용자를 안내하십시오.
//... Continue the above section code.
ExternalUtils . setUserGuideRunnable (() -> Toast . makeText ( this , "Please enable the accessibility service." , Toast . LENGTH_LONG ). show ());복구로 재부팅하십시오.
PowerActX . recovery ();layout.xml에 전원 버튼을 추가하십시오
< github .ryuunoakaihitomi.poweract.PowerButton
android : layout_width = " wrap_content "
android : layout_height = " wrap_content "
/>이론적으로 도서관은 언제든지 예외를 던지지 않아야합니다.
res/values/poweract_config.xml 을 만듭니다
< resources xmlns : tools = " http://schemas.android.com/tools " tools : ignore = " UnusedResources " >
<!-- In order to configure some UI properties you must rewrite the res of the library. -->
< string name = " poweract_accessibility_service_label " >Power Action Service</ string >
< string name = " poweract_accessibility_service_description " >The service is used to perform some power action without reaching the actual power button on the side of the phone. It will never collect any user data.</ string >
< string name = " poweract_accessibility_service_summary " >Virtual power key accessibility service.</ string >
<!-- Optional. -->
< bool name = " poweract_accessibility_service_show_foreground_notification " >true</ bool >
</ resources > Copyright 2020-2022 ZQY
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.