Skip to content

Commit ad4efcb

Browse files
committed
Add seekbar to limit size of video
1 parent db23515 commit ad4efcb

File tree

3 files changed

+20
-11
lines changed

3 files changed

+20
-11
lines changed

app/src/main/java/com/wmods/wppenhacer/xposed/features/media/MediaQuality.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.wmods.wppenhacer.xposed.features.media;
22

3-
import android.annotation.SuppressLint;
43
import android.graphics.Bitmap;
54
import android.graphics.RecordingCanvas;
65
import android.os.Build;
@@ -30,12 +29,14 @@ public MediaQuality(ClassLoader loader, XSharedPreferences preferences) {
3029
public void doHook() throws Exception {
3130
var videoQuality = prefs.getBoolean("videoquality", false);
3231
var imageQuality = prefs.getBoolean("imagequality", false);
32+
var maxSize = (int) prefs.getFloat("video_limit_size", 60);
3333

3434
Others.propsBoolean.put(7950, false); // Força o uso do MediaComposer para processar os videos
3535

3636
if (videoQuality) {
3737

3838
Others.propsBoolean.put(5549, true); // Remove o limite de qualidade do video
39+
3940
var jsonProperty = Unobfuscator.loadPropsJsonMethod(classLoader);
4041
XposedBridge.hookMethod(jsonProperty, new XC_MethodHook() {
4142
@Override
@@ -51,7 +52,7 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
5152
var key = (String) json.names().opt(i);
5253
var jSONObject = json.getJSONObject(key);
5354
jSONObject.put("max_bitrate", 16000);
54-
jSONObject.put("max_bandwidth", 90);
55+
jSONObject.put("max_bandwidth", maxSize);
5556
}
5657
}
5758
}
@@ -118,14 +119,14 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
118119
@Override
119120
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
120121
super.beforeHookedMethod(param);
121-
if (prefs.getBoolean("video_size_limit", false)) {
122-
param.args[0] = 90;
123-
}
122+
param.args[0] = maxSize;
124123
param.args[1] = 8000; // 4K Resolution
125124
param.args[2] = 96 * 1000 * 1000; // 96 Mbps
126125
}
127126
});
128127

128+
Others.propsInteger.put(8606, maxSize);
129+
129130
}
130131

131132
if (imageQuality) {

app/src/main/res/values/strings.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@
152152
<string name="default_color">Set color #00000000 to default color</string>
153153
<string name="enable_confirmation_to_send_sticker">Confirmation Before Sending Sticker</string>
154154
<string name="enable_confirmation_to_send_sticker_sum">Show a dialog before sending the sticker</string>
155-
<string name="increase_video_size_limit">Increase Video Size Limit</string>
156-
<string name="increase_video_size_limit_sum">Increase Video size limit to 90MB</string>
155+
<string name="increase_video_size_limit">Increase Video Size Limit (MB)</string>
156+
<string name="increase_video_size_limit_sum">Increase Video size limit to 200MB</string>
157157
<string name="send_video_in_real_resolution">Send Video in Real Resolution</string>
158158
<string name="send_video_in_real_resolution_sum">Send Video in Real Resolution for status, group and chats</string>
159159
<string name="send_video_in_60fps">Send Video in 60fps</string>

app/src/main/res/xml/fragment_media.xml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,18 @@
4444
app:summary="@string/videoquality_sum"
4545
app:title="@string/videoquality" />
4646

47-
<rikka.material.preference.MaterialSwitchPreference
48-
app:dependency="videoquality"
49-
app:key="video_size_limit"
50-
app:summary="@string/increase_video_size_limit_sum"
47+
<!-- <rikka.material.preference.MaterialSwitchPreference-->
48+
<!-- app:dependency="videoquality"-->
49+
<!-- app:key="video_size_limit"-->
50+
<!-- app:summary="@string/increase_video_size_limit_sum"-->
51+
<!-- app:title="@string/increase_video_size_limit" />-->
52+
53+
<com.wmods.wppenhacer.preference.FloatSeekBarPreference
54+
android:defaultValue="60"
55+
app:key="video_limit_size"
56+
app:maxValue="120"
57+
app:minValue="30"
58+
app:valueSpacing="10"
5159
app:title="@string/increase_video_size_limit" />
5260

5361
<!-- <rikka.material.preference.MaterialSwitchPreference-->

0 commit comments

Comments
 (0)