Commit 2e1a8cca authored by Administrator's avatar Administrator

增加 floatingactionbutton 的使用方法

parent 02cfc979
Pipeline #1684 canceled with stages
[submodule "base-lib-ratel-extension/ratelextension"]
path = base-lib-ratel-extension/ratelextension
url = git@git.virjar.com:ratel/ratelextension.git
[submodule "base-lib-ratel-api/ratel-api"]
path = base-lib-ratel-api/ratel-api
url = git@git.virjar.com:ratel/ratelapi.git
apply plugin: 'java-library'
sourceSets {
main {
resources {
srcDir 'ratel-api/src/main/resources'
}
java {
srcDir 'ratel-api/src/main/java'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
compileOnly 'com.google.android:android:4.1.1.4'
compileOnly 'com.google.code.findbugs:jsr305:3.0.2'
compileOnly 'com.android.support:support-annotations:28.0.0'
}
Subproject commit 10509498043ff1583a3b5fa61a0ea3840d9415a7
......@@ -16,6 +16,9 @@ dependencies {
compileOnly 'com.google.android:android:4.1.1.4'
compileOnly 'com.google.code.findbugs:jsr305:3.0.2'
compileOnly 'com.android.support:support-annotations:28.0.0'
compileOnly 'com.virjar:ratel-api:1.3.2'
//compileOnly 'com.virjar:ratel-api:1.3.2'
// 如果如果你仅仅为了测试extension,那么使用标准方式依赖ratel-api,如果需要访问RatelApi开发版本代码,
// 那么通过compileOnly project(':base-lib-ratel-api')的方式进行依赖
compileOnly project(':base-lib-ratel-api')
compileOnly 'com.virjar:sekiro-api:1.0.1'
}
Subproject commit 14f13766ab184cb9a6efeee8a84c079216341ba6
Subproject commit 4732c15a3d180d3f9075e34d34e2f493b7960a36
......@@ -54,7 +54,9 @@ dependencies {
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
compileOnly 'com.virjar:ratel-api:1.3.2'
// compileOnly 'com.virjar:ratel-api:1.3.2'
compileOnly project(':base-lib-ratel-api')
api project(':base-lib-ratel-extension')
api 'com.virjar:sekiro-api:1.0.1'
implementation 'com.getbase:floatingactionbutton:1.10.1'
}
package com.virjar.ratel.demoapp.crack;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import android.view.LayoutInflater;
import android.widget.FrameLayout;
import com.virjar.ratel.api.RatelToolKit;
import com.virjar.ratel.api.rposed.IRposedHookLoadPackage;
import com.virjar.ratel.api.rposed.RC_MethodHook;
import com.virjar.ratel.api.rposed.RposedHelpers;
import com.virjar.ratel.api.rposed.callbacks.RC_LoadPackage;
/**
......@@ -16,8 +26,32 @@ public class HookEntry implements IRposedHookLoadPackage {
@Override
public void handleLoadPackage(final RC_LoadPackage.LoadPackageParam lpparam) {
addFloatingButtonForActivity(lpparam);
Log.i(tag, "hook end");
}
private static void addFloatingButtonForActivity(final RC_LoadPackage.LoadPackageParam lpparam) {
RposedHelpers.findAndHookMethod(Activity.class, "onCreate", Bundle.class, new RC_MethodHook() {
@Override
protected void afterHookedMethod(final MethodHookParam param) throws Throwable {
new Handler(Looper.getMainLooper())
.postDelayed(new Runnable() {
@Override
public void run() {
createAndAttachFloatingButtonOnActivity((Activity) param.thisObject);
}
}, 1000);
}
private void createAndAttachFloatingButtonOnActivity(Activity activity) {
Context context = RatelToolKit.ratelResourceInterface.createContext(lpparam.modulePath, HookEntry.class.getClassLoader(), RatelToolKit.sContext);
FrameLayout frameLayout = (FrameLayout) activity.getWindow().getDecorView();
LayoutInflater.from(context).cloneInContext(context)
.inflate(R.layout.float_button, frameLayout);
}
});
}
}
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/black_semi_transparent"/>
<padding
android:left="16dp"
android:top="4dp"
android:right="16dp"
android:bottom="4dp"/>
<corners
android:radius="2dp"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<com.getbase.floatingactionbutton.FloatingActionsMenu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:fab="http://schemas.android.com/apk/com.getbase.floatingactionbutton"
android:id="@+id/multiple_actions"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:layout_marginBottom="16dp"
fab:fab_addButtonColorNormal="@color/white"
fab:fab_addButtonColorPressed="@color/white_pressed"
fab:fab_addButtonPlusIconColor="@color/half_black"
fab:fab_labelStyle="@style/menu_labels_style">
<com.getbase.floatingactionbutton.FloatingActionButton
android:id="@+id/action_a"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
fab:fab_colorNormal="@color/white"
fab:fab_colorPressed="@color/white_pressed"
fab:fab_title="Action A" />
<com.getbase.floatingactionbutton.FloatingActionButton
android:id="@+id/action_b"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
fab:fab_colorNormal="@color/white"
fab:fab_colorPressed="@color/white_pressed"
fab:fab_title="Action with a very long name that won\'t fit on the screen" />
</com.getbase.floatingactionbutton.FloatingActionsMenu>
......@@ -3,4 +3,13 @@
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
<color name="black_semi_transparent">#B2000000</color>
<color name="background">#e5e5e5</color>
<color name="half_black">#808080</color>
<color name="white">#fafafa</color>
<color name="white_pressed">#f1f1f1</color>
<color name="pink">#e91e63</color>
<color name="pink_pressed">#ec407a</color>
<color name="blue_semi_transparent">#805677fc</color>
<color name="blue_semi_transparent_pressed">#80738ffe</color>
</resources>
......@@ -7,5 +7,8 @@
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="menu_labels_style">
<item name="android:background">@drawable/fab_label_background</item>
<item name="android:textColor">@color/white</item>
</style>
</resources>
include ':base-lib-ratel-extension',
':base-lib-ratel-api',
':demoapp',
':crack-snkrs',
':createhelper',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment