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
api-impl: stubs and fixes for Breezy Weather
This commit is contained in:
@@ -1,9 +1,20 @@
|
||||
package android.animation;
|
||||
|
||||
public class ArgbEvaluator implements TypeEvaluator {
|
||||
import android.graphics.Color;
|
||||
|
||||
public class ArgbEvaluator implements TypeEvaluator<Integer> {
|
||||
|
||||
public static ArgbEvaluator getInstance() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer evaluate(float fraction, Integer startValue, Integer endValue) {
|
||||
return Color.argb(
|
||||
(int)(fraction * Color.alpha(endValue) + (1 - fraction) * Color.alpha(startValue)+.5f),
|
||||
(int)(fraction * Color.red(endValue) + (1 - fraction) * Color.red(startValue)+.5f),
|
||||
(int)(fraction * Color.green(endValue) + (1 - fraction) * Color.green(startValue)+.5f),
|
||||
(int)(fraction * Color.blue(endValue) + (1 - fraction) * Color.blue(startValue)+.5f));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ package android.animation;
|
||||
/**
|
||||
* This evaluator can be used to perform type interpolation between <code>float</code> values.
|
||||
*/
|
||||
public class FloatEvaluator /*implements TypeEvaluator<Number>*/ {
|
||||
public class FloatEvaluator implements TypeEvaluator<Number> {
|
||||
|
||||
/**
|
||||
* This function returns the result of linearly interpolating the start and end values, with
|
||||
|
||||
@@ -13,6 +13,7 @@ public class PropertyValuesHolder {
|
||||
private String property_name;
|
||||
private Method setter;
|
||||
Property property;
|
||||
private TypeEvaluator<Object> evaluator;
|
||||
|
||||
public static PropertyValuesHolder ofFloat(String propertyName, float... values) {
|
||||
PropertyValuesHolder propertyValuesHolder = new PropertyValuesHolder();
|
||||
@@ -27,6 +28,7 @@ public class PropertyValuesHolder {
|
||||
propertyValuesHolder.values_object = values;
|
||||
propertyValuesHolder.property_name = propertyName;
|
||||
propertyValuesHolder.value = values[0];
|
||||
propertyValuesHolder.evaluator = evaluator;
|
||||
return propertyValuesHolder;
|
||||
}
|
||||
|
||||
@@ -53,6 +55,7 @@ public class PropertyValuesHolder {
|
||||
propertyValuesHolder.property_name = property.getName();
|
||||
propertyValuesHolder.property = property;
|
||||
propertyValuesHolder.value = values[0];
|
||||
propertyValuesHolder.evaluator = evaluator;
|
||||
return propertyValuesHolder;
|
||||
}
|
||||
|
||||
@@ -97,14 +100,20 @@ public class PropertyValuesHolder {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setEvaluator(TypeEvaluator value) {}
|
||||
public void setEvaluator(TypeEvaluator<Object> evaluator) {
|
||||
this.evaluator = evaluator;
|
||||
}
|
||||
|
||||
public void calculateValue(float fraction) {
|
||||
if (fraction < 0f)
|
||||
fraction = 0f;
|
||||
if (fraction > 1f)
|
||||
fraction = 1f;
|
||||
if (values_object != null) {
|
||||
if (values_object != null && evaluator != null) {
|
||||
int i = (int) (fraction * (values_object.length - 1));
|
||||
float f = fraction * (values_object.length - 1) - i;
|
||||
value = evaluator.evaluate(f, values_object[i], values_object[i >= values_object.length - 1 ? i : i+1]);
|
||||
} else if (values_object != null) {
|
||||
value = values_object[(int) (fraction * (values_object.length - 1) + 0.5f)];
|
||||
} else if (values_float != null) {
|
||||
int i = (int) (fraction * (values_float.length - 1));
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package android.animation;
|
||||
|
||||
public interface TypeEvaluator {
|
||||
public interface TypeEvaluator<T> {
|
||||
|
||||
public T evaluate(float fraction, T startValue, T endValue);
|
||||
|
||||
}
|
||||
|
||||
@@ -19,4 +19,5 @@ public class NotificationChannel {
|
||||
public int getLightColor() { return 0; }
|
||||
public boolean shouldVibrate() { return false; }
|
||||
public Uri getSound() { return null; }
|
||||
public void setDescription(String description) {}
|
||||
}
|
||||
|
||||
@@ -3,4 +3,6 @@ package android.app;
|
||||
public class NotificationChannelGroup {
|
||||
public NotificationChannelGroup(String a, CharSequence b) {
|
||||
}
|
||||
|
||||
public void setDescription(String description) {}
|
||||
}
|
||||
|
||||
@@ -90,4 +90,10 @@ public class NotificationManager {
|
||||
public boolean areNotificationsEnabled() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void deleteNotificationChannel(String channelId) {}
|
||||
|
||||
public void createNotificationChannelGroups(List<NotificationChannelGroup> groups) {}
|
||||
|
||||
public void createNotificationChannels(List<NotificationChannel> channels) {}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
package android.app;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
|
||||
public class UiModeManager {
|
||||
|
||||
public int getCurrentModeType() {
|
||||
return Configuration.UI_MODE_TYPE_NORMAL;
|
||||
return Context.r.getConfiguration().uiMode & Configuration.UI_MODE_TYPE_MASK;
|
||||
}
|
||||
|
||||
public int getNightMode() {
|
||||
return Context.r.getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1612,7 +1612,12 @@ public class PackageManager {
|
||||
*/
|
||||
public ActivityInfo getActivityInfo(ComponentName component,
|
||||
int flags) throws NameNotFoundException {
|
||||
return new ActivityInfo();
|
||||
ActivityInfo info = new ActivityInfo();
|
||||
/* Breeze Weather tries to override the night mode setting, but we don't implement configuration overriding yet.
|
||||
* AppCompatDelegateImpl.updateAppConfiguration() checks if the setting is correctly overridden and otherwise recreates the activity.
|
||||
* To prevent infinite recreation, we set the CONFIG_UI_MODE flag, indicating that the activity can handle night mode change without recreation. */
|
||||
info.configChanges = ActivityInfo.CONFIG_UI_MODE;
|
||||
return info;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -475,6 +475,10 @@ public class Canvas {
|
||||
return save();
|
||||
}
|
||||
|
||||
public int saveLayer(float left, float top, float right, float bottom, Paint paint) {
|
||||
return save();
|
||||
}
|
||||
|
||||
public void drawOval(RectF oval, Paint paint) {
|
||||
Log.w("Canvas", "STUB: drawOval");
|
||||
}
|
||||
@@ -542,4 +546,8 @@ public class Canvas {
|
||||
}
|
||||
|
||||
public void drawPaint(Paint paint) {}
|
||||
|
||||
public void drawPicture(Picture picture) {
|
||||
Log.w("Canvas", "STUB: drawPicture");
|
||||
}
|
||||
}
|
||||
|
||||
8
src/api-impl/android/location/Geocoder.java
Normal file
8
src/api-impl/android/location/Geocoder.java
Normal file
@@ -0,0 +1,8 @@
|
||||
package android.location;
|
||||
|
||||
public class Geocoder {
|
||||
|
||||
public static boolean isPresent() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -45,6 +45,9 @@ public class StatFs {
|
||||
* @throws IllegalArgumentException if the file system access fails
|
||||
*/
|
||||
private static StructStatVfs doStat(String path) {
|
||||
/* applications use this method to query free space on the data partition. /home should be most equivalent on Linux Desktop */
|
||||
if ("/data".equals(path))
|
||||
path = "/home";
|
||||
try {
|
||||
return Os.statvfs(path);
|
||||
} catch (ErrnoException e) {
|
||||
|
||||
@@ -15,6 +15,8 @@ public final class StrictMode {
|
||||
return new ThreadPolicy();
|
||||
}
|
||||
|
||||
public static void noteSlowCall(String tag) {}
|
||||
|
||||
public interface OnThreadViolationListener {
|
||||
}
|
||||
|
||||
|
||||
14
src/api-impl/android/view/OrientationEventListener.java
Normal file
14
src/api-impl/android/view/OrientationEventListener.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package android.view;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
public class OrientationEventListener {
|
||||
|
||||
public OrientationEventListener(Context context) {}
|
||||
|
||||
public boolean canDetectOrientation() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void disable() {}
|
||||
}
|
||||
@@ -2219,4 +2219,6 @@ public class View implements Drawable.Callback {
|
||||
public void setAccessibilityHeading(boolean heading) {}
|
||||
|
||||
public WindowInsets computeSystemWindowInsets(WindowInsets insets, Rect contentInsets) { return insets; }
|
||||
|
||||
public boolean isDuplicateParentStateEnabled() { return false; }
|
||||
}
|
||||
|
||||
@@ -160,4 +160,6 @@ public class Window {
|
||||
public void setReturnTransition(Transition transition) {}
|
||||
|
||||
public void setEnterTransition(Transition transition) {}
|
||||
|
||||
public void setGravity(int gravity) {}
|
||||
}
|
||||
|
||||
@@ -25,4 +25,12 @@ public class AccessibilityManager {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean removeAccessibilityStateChangeListener(AccessibilityStateChangeListener listener) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean removeTouchExplorationStateChangeListener(TouchExplorationStateChangeListener listener) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package android.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
@@ -75,4 +76,8 @@ public abstract class CompoundButton extends Button implements Checkable {
|
||||
|
||||
@Override
|
||||
public void setCompoundDrawables(Drawable left, Drawable top, Drawable right, Drawable bottom) {}
|
||||
|
||||
public PorterDuff.Mode getButtonTintMode() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,4 +13,7 @@ public class RatingBar extends AbsSeekBar {
|
||||
super(context, attributeSet);
|
||||
}
|
||||
|
||||
public void setRating(float rating) {
|
||||
setProgress((int)rating);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -268,6 +268,7 @@ srcs = [
|
||||
'android/inputmethodservice/InputMethodService.java',
|
||||
'android/inputmethodservice/ATLKeyboardViewer.java',
|
||||
'android/location/Criteria.java',
|
||||
'android/location/Geocoder.java',
|
||||
'android/location/GnssStatus.java',
|
||||
'android/location/Location.java',
|
||||
'android/location/LocationListener.java',
|
||||
@@ -512,6 +513,7 @@ srcs = [
|
||||
'android/view/MenuInflater.java',
|
||||
'android/view/MenuItem.java',
|
||||
'android/view/MotionEvent.java',
|
||||
'android/view/OrientationEventListener.java',
|
||||
'android/view/PointerIcon.java',
|
||||
'android/view/ScaleGestureDetector.java',
|
||||
'android/view/SoundEffectConstants.java',
|
||||
|
||||
Reference in New Issue
Block a user