Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
171f955526 |
No files matched your search
+9
-1
@@ -23,6 +23,8 @@ public class CustomSeekBarPreference extends SeekBarPreference {
|
||||
private int mMin;
|
||||
/** The textview associated by default to the preference */
|
||||
private TextView mTextView;
|
||||
/** Seekbar increment in case the max gets set */
|
||||
private final int mIncrement;
|
||||
|
||||
|
||||
@SuppressLint("PrivateResource")
|
||||
@@ -31,6 +33,7 @@ public class CustomSeekBarPreference extends SeekBarPreference {
|
||||
try (TypedArray a = context.obtainStyledAttributes(
|
||||
attrs, R.styleable.SeekBarPreference, defStyleAttr, defStyleRes)) {
|
||||
mMin = a.getInt(R.styleable.SeekBarPreference_min, 0);
|
||||
mIncrement = a.getInt(R.styleable.SeekBarPreference_seekBarIncrement, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,7 +114,12 @@ public class CustomSeekBarPreference extends SeekBarPreference {
|
||||
*/
|
||||
public void setRange(int min, int max){
|
||||
setMin(min);
|
||||
setMax(max);
|
||||
setMaxKeepIncrement(max);
|
||||
}
|
||||
|
||||
public void setMaxKeepIncrement(int max) {
|
||||
super.setMax(max);
|
||||
setSeekBarIncrement(mIncrement);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -141,14 +141,14 @@ public class LauncherPreferences {
|
||||
*/
|
||||
private static int findBestRAMAllocation(Context ctx){
|
||||
int deviceRam = Tools.getTotalDeviceMemory(ctx);
|
||||
if (deviceRam < 1024) return 300;
|
||||
if (deviceRam < 1536) return 450;
|
||||
if (deviceRam < 2048) return 600;
|
||||
if (deviceRam < 1024) return 296;
|
||||
if (deviceRam < 1536) return 448;
|
||||
if (deviceRam < 2048) return 656;
|
||||
// Limit the max for 32 bits devices more harshly
|
||||
if (is32BitsDevice()) return 700;
|
||||
if (is32BitsDevice()) return 696;
|
||||
|
||||
if (deviceRam < 3064) return 936;
|
||||
if (deviceRam < 4096) return 1148;
|
||||
if (deviceRam < 4096) return 1144;
|
||||
if (deviceRam < 6144) return 1536;
|
||||
return 2048; //Default RAM allocation for 64 bits
|
||||
}
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ public class LauncherPreferenceJavaFragment extends LauncherPreferenceFragment {
|
||||
if(is32BitsDevice() || deviceRam < 2048) maxRAM = Math.min(1024, deviceRam);
|
||||
else maxRAM = deviceRam - (deviceRam < 3064 ? 800 : 1024); //To have a minimum for the device to breathe
|
||||
|
||||
memorySeekbar.setMax(maxRAM);
|
||||
memorySeekbar.setMaxKeepIncrement(maxRAM);
|
||||
memorySeekbar.setValue(ramAllocation);
|
||||
memorySeekbar.setSuffix(" MB");
|
||||
|
||||
|
||||
Reference in new issue
Block a user