You've already forked android_translation_layer
mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-10-27 11:48:10 -07:00
implement android.widget.ProgressBar using GtkProgressBar
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user