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
add more APIs needed for NewPipe
This commit is contained in:
@@ -87,6 +87,7 @@ libtranslationlayer_so = shared_library('translation_layer_main', [
|
|||||||
'src/api-impl-jni/app/android_app_Dialog.c',
|
'src/api-impl-jni/app/android_app_Dialog.c',
|
||||||
'src/api-impl-jni/audio/android_media_AudioTrack.c',
|
'src/api-impl-jni/audio/android_media_AudioTrack.c',
|
||||||
'src/api-impl-jni/audio/android_media_SoundPool.c',
|
'src/api-impl-jni/audio/android_media_SoundPool.c',
|
||||||
|
'src/api-impl-jni/content/android_content_ClipboardManager.c',
|
||||||
'src/api-impl-jni/content/android_content_Context.c',
|
'src/api-impl-jni/content/android_content_Context.c',
|
||||||
'src/api-impl-jni/database/android_database_SQLiteCommon.c',
|
'src/api-impl-jni/database/android_database_SQLiteCommon.c',
|
||||||
'src/api-impl-jni/database/android_database_SQLiteConnection.c',
|
'src/api-impl-jni/database/android_database_SQLiteConnection.c',
|
||||||
|
|||||||
@@ -177,11 +177,3 @@ JNIEXPORT void JNICALL Java_android_app_Activity_nativeOpenURI(JNIEnv *env, jcla
|
|||||||
}
|
}
|
||||||
|
|
||||||
extern GtkWindow *window; // TODO: get this in a better way
|
extern GtkWindow *window; // TODO: get this in a better way
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_android_app_Activity_nativeShare(JNIEnv *env, jclass class, jstring text_jstring)
|
|
||||||
{
|
|
||||||
const char *text = (*env)->GetStringUTFChars(env, text_jstring, NULL);
|
|
||||||
GdkClipboard *clipboard = gdk_display_get_clipboard(gtk_root_get_display(GTK_ROOT(window)));
|
|
||||||
gdk_clipboard_set_text(clipboard, text);
|
|
||||||
(*env)->ReleaseStringUTFChars(env, text_jstring, text);
|
|
||||||
}
|
|
||||||
|
|||||||
16
src/api-impl-jni/content/android_content_ClipboardManager.c
Normal file
16
src/api-impl-jni/content/android_content_ClipboardManager.c
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
|
#include "../defines.h"
|
||||||
|
#include "../util.h"
|
||||||
|
|
||||||
|
#include "../generated_headers/android_content_ClipboardManager.h"
|
||||||
|
|
||||||
|
extern GtkWindow *window; // TODO: get this in a better way
|
||||||
|
|
||||||
|
JNIEXPORT void JNICALL Java_android_content_ClipboardManager_native_1set_1clipboard(JNIEnv *env, jclass class, jstring text_jstring)
|
||||||
|
{
|
||||||
|
const char *text = (*env)->GetStringUTFChars(env, text_jstring, NULL);
|
||||||
|
GdkClipboard *clipboard = gdk_display_get_clipboard(gtk_root_get_display(GTK_ROOT(window)));
|
||||||
|
gdk_clipboard_set_text(clipboard, text);
|
||||||
|
(*env)->ReleaseStringUTFChars(env, text_jstring, text);
|
||||||
|
}
|
||||||
@@ -41,14 +41,6 @@ JNIEXPORT void JNICALL Java_android_app_Activity_nativeStartActivity
|
|||||||
JNIEXPORT void JNICALL Java_android_app_Activity_nativeOpenURI
|
JNIEXPORT void JNICALL Java_android_app_Activity_nativeOpenURI
|
||||||
(JNIEnv *, jclass, jstring);
|
(JNIEnv *, jclass, jstring);
|
||||||
|
|
||||||
/*
|
|
||||||
* Class: android_app_Activity
|
|
||||||
* Method: nativeShare
|
|
||||||
* Signature: (Ljava/lang/String;)V
|
|
||||||
*/
|
|
||||||
JNIEXPORT void JNICALL Java_android_app_Activity_nativeShare
|
|
||||||
(JNIEnv *, jclass, jstring);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||||
|
#include <jni.h>
|
||||||
|
/* Header for class android_content_ClipboardManager */
|
||||||
|
|
||||||
|
#ifndef _Included_android_content_ClipboardManager
|
||||||
|
#define _Included_android_content_ClipboardManager
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
#undef android_content_ClipboardManager_MSG_REPORT_PRIMARY_CLIP_CHANGED
|
||||||
|
#define android_content_ClipboardManager_MSG_REPORT_PRIMARY_CLIP_CHANGED 1L
|
||||||
|
/*
|
||||||
|
* Class: android_content_ClipboardManager
|
||||||
|
* Method: native_set_clipboard
|
||||||
|
* Signature: (Ljava/lang/String;)V
|
||||||
|
*/
|
||||||
|
JNIEXPORT void JNICALL Java_android_content_ClipboardManager_native_1set_1clipboard
|
||||||
|
(JNIEnv *, jclass, jstring);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
@@ -239,6 +239,14 @@ JNIEXPORT void JNICALL Java_android_widget_TextView_setTextSize
|
|||||||
JNIEXPORT void JNICALL Java_android_widget_TextView_native_1setTextColor
|
JNIEXPORT void JNICALL Java_android_widget_TextView_native_1setTextColor
|
||||||
(JNIEnv *, jobject, jint);
|
(JNIEnv *, jobject, jint);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: android_widget_TextView
|
||||||
|
* Method: getText
|
||||||
|
* Signature: ()Ljava/lang/CharSequence;
|
||||||
|
*/
|
||||||
|
JNIEXPORT jobject JNICALL Java_android_widget_TextView_getText
|
||||||
|
(JNIEnv *, jobject);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -79,3 +79,8 @@ JNIEXPORT void JNICALL Java_android_widget_TextView_native_1set_1markup(JNIEnv *
|
|||||||
|
|
||||||
gtk_label_set_use_markup(label, value);
|
gtk_label_set_use_markup(label, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JNIEXPORT jobject JNICALL Java_android_widget_TextView_getText(JNIEnv *env, jobject this)
|
||||||
|
{
|
||||||
|
return _JSTRING(gtk_label_get_text(GTK_LABEL(_PTR(_GET_LONG_FIELD(this, "widget")))));
|
||||||
|
}
|
||||||
|
|||||||
@@ -2,4 +2,19 @@ package android.animation;
|
|||||||
|
|
||||||
public class AnimatorSet extends Animator {
|
public class AnimatorSet extends Animator {
|
||||||
|
|
||||||
|
public class Builder {
|
||||||
|
|
||||||
|
public Builder with(Animator animator) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder play(Animator animator) {
|
||||||
|
return new Builder();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInterpolator(TimeInterpolator value) {}
|
||||||
|
|
||||||
|
public void playSequentially(Animator[] animators) {}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -254,7 +254,7 @@ public class Activity extends ContextWrapper implements Window.Callback {
|
|||||||
|
|
||||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {}
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {}
|
||||||
|
|
||||||
public void startActivityForResult(Intent intent, int requestCode) {
|
public void startActivityForResult(Intent intent, int requestCode, Bundle options) {
|
||||||
System.out.println("startActivityForResult(" + intent + ", " + requestCode + ") called, but we don't currently support multiple activities");
|
System.out.println("startActivityForResult(" + intent + ", " + requestCode + ") called, but we don't currently support multiple activities");
|
||||||
if (intent.getComponent() != null) {
|
if (intent.getComponent() != null) {
|
||||||
try {
|
try {
|
||||||
@@ -276,9 +276,13 @@ public class Activity extends ContextWrapper implements Window.Callback {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
System.out.println("startActivityForResult: intent was not handled. Calling onActivityResult(RESULT_CANCELED).");
|
||||||
onActivityResult(requestCode, 0 /*RESULT_CANCELED*/, new Intent()); // RESULT_CANCELED is the only pre-defined return value, so hopefully it works out for us
|
onActivityResult(requestCode, 0 /*RESULT_CANCELED*/, new Intent()); // RESULT_CANCELED is the only pre-defined return value, so hopefully it works out for us
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public void startActivityForResult(Intent intent, int requestCode) {
|
||||||
|
startActivityForResult(intent, requestCode, null);
|
||||||
|
}
|
||||||
|
|
||||||
public void setResult(int resultCode, Intent data) {
|
public void setResult(int resultCode, Intent data) {
|
||||||
if (resultActivity != null) {
|
if (resultActivity != null) {
|
||||||
@@ -422,5 +426,4 @@ public class Activity extends ContextWrapper implements Window.Callback {
|
|||||||
public static native void nativeRecreateActivity(Activity activity);
|
public static native void nativeRecreateActivity(Activity activity);
|
||||||
public static native void nativeStartActivity(Activity activity);
|
public static native void nativeStartActivity(Activity activity);
|
||||||
public static native void nativeOpenURI(String uri);
|
public static native void nativeOpenURI(String uri);
|
||||||
public static native void nativeShare(String text);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -143,4 +143,13 @@ public class Notification {
|
|||||||
|
|
||||||
public MediaStyle setMediaSession(MediaSession.Token token) {return this;}
|
public MediaStyle setMediaSession(MediaSession.Token token) {return this;}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class BigTextStyle extends Style {
|
||||||
|
|
||||||
|
public BigTextStyle(Notification.Builder builder) {}
|
||||||
|
|
||||||
|
public BigTextStyle setBigContentTitle(CharSequence title) {return this;}
|
||||||
|
|
||||||
|
public BigTextStyle bigText(CharSequence text) {return this;}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,4 +6,8 @@ public class NotificationManager {
|
|||||||
public void notify(String tag, int id, Notification notification) {
|
public void notify(String tag, int id, Notification notification) {
|
||||||
System.out.println("notify(" + tag + ", " + id + ", " + notification + ") called");
|
System.out.println("notify(" + tag + ", " + id + ", " + notification + ") called");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void notify(int id, Notification notification) {
|
||||||
|
System.out.println("notify(" + id + ", " + notification + ") called");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,10 @@ public class PendingIntent {
|
|||||||
return new PendingIntent();
|
return new PendingIntent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static PendingIntent getService(Context context, int requestCode, Intent intent, int flags) {
|
||||||
|
return new PendingIntent();
|
||||||
|
}
|
||||||
|
|
||||||
public class CanceledException extends Exception {
|
public class CanceledException extends Exception {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,9 @@ import android.os.IBinder;
|
|||||||
|
|
||||||
public abstract class Service extends Context {
|
public abstract class Service extends Context {
|
||||||
|
|
||||||
public abstract void onCreate();
|
public void onCreate() {
|
||||||
|
System.out.println("Service.onCreate() called");
|
||||||
|
}
|
||||||
|
|
||||||
public abstract IBinder onBind(Intent intent);
|
public abstract IBinder onBind(Intent intent);
|
||||||
|
|
||||||
@@ -16,4 +18,8 @@ public abstract class Service extends Context {
|
|||||||
System.out.println("startForeground(" + id + ", " + notification + ") called");
|
System.out.println("startForeground(" + id + ", " + notification + ") called");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void stopForeground(boolean remove) {
|
||||||
|
System.out.println("stopForeground(" + remove + ") called");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
12
src/api-impl/android/content/ClipData.java
Normal file
12
src/api-impl/android/content/ClipData.java
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
package android.content;
|
||||||
|
|
||||||
|
public class ClipData {
|
||||||
|
|
||||||
|
String text;
|
||||||
|
|
||||||
|
public static ClipData newPlainText(CharSequence label, CharSequence text) {
|
||||||
|
ClipData clip = new ClipData();
|
||||||
|
clip.text = text.toString();
|
||||||
|
return clip;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -14,6 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package android.content;
|
package android.content;
|
||||||
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
@@ -22,7 +23,6 @@ import android.os.RemoteException;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
class ClipData {}
|
|
||||||
class ClipDescription {}
|
class ClipDescription {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -79,6 +79,8 @@ public class ClipboardManager extends android.text.ClipboardManager {
|
|||||||
* @param clip The clipped data item to set.
|
* @param clip The clipped data item to set.
|
||||||
*/
|
*/
|
||||||
public void setPrimaryClip(ClipData clip) {
|
public void setPrimaryClip(ClipData clip) {
|
||||||
|
// this is not the primary clipboard in UNIX sense (not middle click paste)
|
||||||
|
native_set_clipboard(clip.text);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Returns the current primary clip on the clipboard.
|
* Returns the current primary clip on the clipboard.
|
||||||
@@ -125,4 +127,6 @@ public class ClipboardManager extends android.text.ClipboardManager {
|
|||||||
}
|
}
|
||||||
void reportPrimaryClipChanged() {
|
void reportPrimaryClipChanged() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static native void native_set_clipboard(String text);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,10 @@ import android.location.LocationManager;
|
|||||||
import android.media.AudioManager;
|
import android.media.AudioManager;
|
||||||
import android.media.MediaRouter;
|
import android.media.MediaRouter;
|
||||||
import android.net.ConnectivityManager;
|
import android.net.ConnectivityManager;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.net.wifi.WifiManager;
|
||||||
|
import android.os.Environment;
|
||||||
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.os.PowerManager;
|
import android.os.PowerManager;
|
||||||
import android.os.Vibrator;
|
import android.os.Vibrator;
|
||||||
@@ -86,6 +90,7 @@ public class Context extends Object {
|
|||||||
r = new Resources(assets, dm, config);
|
r = new Resources(assets, dm, config);
|
||||||
theme = r.newTheme();
|
theme = r.newTheme();
|
||||||
application_info = new ApplicationInfo();
|
application_info = new ApplicationInfo();
|
||||||
|
application_info.dataDir = Environment.getExternalStorageDirectory().getAbsolutePath();
|
||||||
InputStream inStream = ClassLoader.getSystemClassLoader().getResourceAsStream("AndroidManifest.xml");
|
InputStream inStream = ClassLoader.getSystemClassLoader().getResourceAsStream("AndroidManifest.xml");
|
||||||
try {
|
try {
|
||||||
manifest = AndroidManifestBlock.load(inStream);
|
manifest = AndroidManifestBlock.load(inStream);
|
||||||
@@ -188,6 +193,8 @@ public class Context extends Object {
|
|||||||
return new AccessibilityManager();
|
return new AccessibilityManager();
|
||||||
case "layout_inflater":
|
case "layout_inflater":
|
||||||
return new LayoutInflater();
|
return new LayoutInflater();
|
||||||
|
case "wifi":
|
||||||
|
return new WifiManager();
|
||||||
default:
|
default:
|
||||||
Slog.e(TAG, "!!!!!!! getSystemService: case >" + name + "< is not implemented yet");
|
Slog.e(TAG, "!!!!!!! getSystemService: case >" + name + "< is not implemented yet");
|
||||||
return null;
|
return null;
|
||||||
@@ -374,24 +381,29 @@ public class Context extends Object {
|
|||||||
|
|
||||||
public void registerComponentCallbacks(ComponentCallbacks callbacks) {}
|
public void registerComponentCallbacks(ComponentCallbacks callbacks) {}
|
||||||
|
|
||||||
public boolean bindService(Intent intent, ServiceConnection serviceConnection, int dummy3) {
|
public boolean bindService(final Intent intent, final ServiceConnection serviceConnection, int dummy3) {
|
||||||
try {
|
if(intent.getComponent() == null) {
|
||||||
if(intent.getComponent() == null) {
|
Slog.w(TAG, "Context.bindService: intent.getComponent() is null");
|
||||||
Slog.w(TAG, "Context.bindService: intent.getComponent() is null");
|
return false;
|
||||||
return false; // maybe?
|
|
||||||
}
|
|
||||||
|
|
||||||
Class<? extends Service> cls = Class.forName(intent.getComponent().getClassName()).asSubclass(Service.class);
|
|
||||||
if (!runningServices.containsKey(cls)) {
|
|
||||||
Service service = cls.getConstructor().newInstance();
|
|
||||||
service.onCreate();
|
|
||||||
runningServices.put(cls, service);
|
|
||||||
}
|
|
||||||
serviceConnection.onServiceConnected(intent.getComponent(), runningServices.get(cls).onBind(intent));
|
|
||||||
} catch (ReflectiveOperationException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
return false; // maybe?
|
|
||||||
|
new Handler().post(new Runnable() { // run this asynchron so the caller can finish its setup before onServiceConnected is called
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
try {
|
||||||
|
Class<? extends Service> cls = Class.forName(intent.getComponent().getClassName()).asSubclass(Service.class);
|
||||||
|
if (!runningServices.containsKey(cls)) {
|
||||||
|
Service service = cls.getConstructor().newInstance();
|
||||||
|
service.onCreate();
|
||||||
|
runningServices.put(cls, service);
|
||||||
|
}
|
||||||
|
serviceConnection.onServiceConnected(intent.getComponent(), runningServices.get(cls).onBind(intent));
|
||||||
|
} catch (ReflectiveOperationException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startActivity(Intent intent) {
|
public void startActivity(Intent intent) {
|
||||||
@@ -402,7 +414,7 @@ public class Context extends Object {
|
|||||||
if (intent.getComponent() == null) {
|
if (intent.getComponent() == null) {
|
||||||
if(intent.getAction() != null && intent.getAction().equals("android.intent.action.SEND")) {
|
if(intent.getAction() != null && intent.getAction().equals("android.intent.action.SEND")) {
|
||||||
Slog.i(TAG, "starting extern activity with intent: " + intent);
|
Slog.i(TAG, "starting extern activity with intent: " + intent);
|
||||||
Activity.nativeShare((String) intent.getExtras().get("android.intent.extra.TEXT"));
|
ClipboardManager.native_set_clipboard(intent.getStringExtra("android.intent.extra.TEXT"));
|
||||||
} else if (intent.getData() != null) {
|
} else if (intent.getData() != null) {
|
||||||
Slog.i(TAG, "starting extern activity with intent: " + intent);
|
Slog.i(TAG, "starting extern activity with intent: " + intent);
|
||||||
Activity.nativeOpenURI(String.valueOf(intent.getData()));
|
Activity.nativeOpenURI(String.valueOf(intent.getData()));
|
||||||
@@ -466,4 +478,8 @@ public class Context extends Object {
|
|||||||
public Context createPackageContext(String dummy, int dummy2) {
|
public Context createPackageContext(String dummy, int dummy2) {
|
||||||
return this; // FIXME?
|
return this; // FIXME?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void grantUriPermission(String dummy, Uri dummy2, int dummy3) {
|
||||||
|
System.out.println("grantUriPermission(" + dummy + ", " + dummy2 + ", " + dummy3 + ") called");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -278,4 +278,16 @@ public class Intent {
|
|||||||
this.type = type;
|
this.type = type;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public long getLongExtra(String name, long def) {
|
||||||
|
return extras.getLong(name, def);
|
||||||
|
}
|
||||||
|
|
||||||
|
public char getCharExtra(String name, char def) {
|
||||||
|
return extras.getChar(name, def);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Parcelable[] getParcelableArrayExtra(String name) {
|
||||||
|
return extras.getParcelableArray(name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -127,4 +127,31 @@ public class Color {
|
|||||||
sColorNameMap.put("silver", 0xC0C0C0);
|
sColorNameMap.put("silver", 0xC0C0C0);
|
||||||
sColorNameMap.put("teal", 0x008080);
|
sColorNameMap.put("teal", 0x008080);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void colorToHSV(int color, float[] hsv) {
|
||||||
|
float red = ((color >> 16) & 0xFF) / 255.0f;
|
||||||
|
float green = ((color >> 8) & 0xFF) / 255.0f;
|
||||||
|
float blue = (color & 0xFF) / 255.0f;
|
||||||
|
float min = Math.min(red, Math.min(green, blue));
|
||||||
|
float max = Math.max(red, Math.max(green, blue));
|
||||||
|
float delta = max - min;
|
||||||
|
|
||||||
|
if (delta == 0) {
|
||||||
|
hsv[0] = 6;
|
||||||
|
} else if (max == red) {
|
||||||
|
hsv[0] = (green - blue) / delta % 6;
|
||||||
|
} else if (max == green) {
|
||||||
|
hsv[0] = 2 + (blue - red) / delta + 2;
|
||||||
|
} else {
|
||||||
|
hsv[0] = 4 + (red - green) / delta + 4;
|
||||||
|
}
|
||||||
|
hsv[0] *= 60;
|
||||||
|
|
||||||
|
if (max == 0) {
|
||||||
|
hsv[1] = 0;
|
||||||
|
} else {
|
||||||
|
hsv[1] = delta / max;
|
||||||
|
}
|
||||||
|
hsv[2] = max;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,12 @@ public class ConnectivityManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public NetworkInfo getActiveNetworkInfo() {
|
public NetworkInfo getActiveNetworkInfo() {
|
||||||
return null; // there is no active network, because there isn't any network at all
|
return new NetworkInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void registerNetworkCallback(NetworkRequest request, NetworkCallback callback) {}
|
||||||
|
|
||||||
|
public boolean isActiveNetworkMetered() {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,4 +17,8 @@ public class NetworkInfo {
|
|||||||
public int getType() {
|
public int getType() {
|
||||||
return 0x8; // where did you even get a NetworkInfo object... there is no network
|
return 0x8; // where did you even get a NetworkInfo object... there is no network
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isConnected() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user