implement android.widget.ProgressBar using GtkProgressBar

This commit is contained in:
Julian Winkler
2023-11-12 12:01:02 +01:00
parent 987058f55d
commit b0fdf53f9b
4 changed files with 266 additions and 6 deletions

View File

@@ -7,6 +7,10 @@ import android.util.AttributeSet;
import android.view.View;
public class ProgressBar extends View {
private int max = 100;
private int progress = 0;
public ProgressBar(Context context, AttributeSet attrs) {
super(context, attrs);
}
@@ -15,6 +19,10 @@ public class ProgressBar extends View {
super(context);
}
@Override
protected native long native_constructor(Context context, AttributeSet attrs);
private native void native_setProgress(long widget, float fraction);
public synchronized void setIndeterminate(boolean indeterminate) {}
public Drawable getProgressDrawable() {
@@ -37,17 +45,23 @@ public class ProgressBar extends View {
};
}
public void setMax(int max) {}
public int getMax() {
return 100;
public void setMax(int max) {
this.max = max;
native_setProgress(widget, progress / (float)max);
}
public void setProgress(int progress) {}
public int getMax() {
return max;
}
public void setProgress(int progress) {
this.progress = progress;
native_setProgress(widget, progress / (float)max);
}
public void setSecondaryProgress(int secondaryProgress) {}
public int getProgress() {
return 0;
return progress;
}
}