Exploit databaseDownload repository ZIP
GH-15c5bc82a645186235e570cbaed15511
rxinnotrstar/cve-2019-2215-formipad4-new-gui
Sources for CVE-2019-2215
37 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files10
rxinnotrstar/cve-2019-2215-formipad4-new-guiRevision d67138a7574d
- ↑..Parent directory
- core/
- Copy.java
- LockScrollView.java
- MainActivity.java
- ManagerPage.java
- PrivilegePage.java
- SliderSwitch.java
- SuPage.java
- Ui.java
- UiState.java
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
app/src/main/java/rxi/root/the/mipad4/cve20192215/SliderSwitch.java
Java · 2,536 bytespackage rxi.root.the.mipad4.cve20192215;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.RectF;
import android.util.TypedValue;
import android.view.View;
/**
* 0.95b:一个真正的滑块开关。
*
* 之前用的是「一个方块换颜色」,看着像个色块而不是开关。这里按系统 Switch 的比例画:
* 轨道 46x26dp、圆角半径等于高度一半,滑钮是白圆、直径 22dp,左右各留 2dp 边距。
* 不做动画:状态切换本来就是瞬时的,动画只在手感上有差别,不值得引入一整条插值链。
*/
public class SliderSwitch extends View {
public interface OnChange {
void onChanged(boolean on);
}
private boolean on;
private OnChange listener;
private final Paint trackPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
private final Paint thumbPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
private final RectF track = new RectF();
private final float widthDp = 46f;
private final float heightDp = 26f;
private final float padDp = 2f;
public SliderSwitch(Context c) {
super(c);
thumbPaint.setColor(0xFFFFFFFF);
setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
setOn(!on, true);
}
});
}
public boolean isOn() {
return on;
}
public void setOn(boolean v, boolean notify) {
if (on == v) {
invalidate();
return;
}
on = v;
invalidate();
if (notify && listener != null) listener.onChanged(on);
}
public void setOnChange(OnChange l) {
listener = l;
}
private float dp(float v) {
return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, v,
getResources().getDisplayMetrics());
}
@Override
protected void onMeasure(int wSpec, int hSpec) {
setMeasuredDimension((int) dp(widthDp), (int) dp(heightDp));
}
@Override
protected void onDraw(Canvas canvas) {
float w = getWidth();
float h = getHeight();
float r = h / 2f;
trackPaint.setColor(on ? Ui.ACCENT : Ui.DIVIDER);
track.set(0, 0, w, h);
canvas.drawRoundRect(track, r, r, trackPaint);
float pad = dp(padDp);
float tr = h / 2f - pad;
float cx = on ? (w - tr - pad) : (tr + pad);
canvas.drawCircle(cx, h / 2f, tr, thumbPaint);
}
}