first commit
This commit is contained in:
commit
0b134cf11f
1087 changed files with 16728 additions and 0 deletions
|
|
@ -0,0 +1,6 @@
|
|||
package com.mojang.android;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface StringValue {
|
||||
String getStringValue();
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package com.mojang.android;
|
||||
|
||||
import android.widget.TextView;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class TextViewReader implements StringValue {
|
||||
private TextView _view;
|
||||
|
||||
public TextViewReader(TextView view) {
|
||||
this._view = view;
|
||||
}
|
||||
|
||||
@Override // com.mojang.android.StringValue
|
||||
public String getStringValue() {
|
||||
return this._view.getText().toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
package com.mojang.android.net;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.Socket;
|
||||
import java.net.UnknownHostException;
|
||||
import java.security.KeyManagementException;
|
||||
import java.security.KeyStore;
|
||||
import java.security.KeyStoreException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.UnrecoverableKeyException;
|
||||
import java.security.cert.CertificateException;
|
||||
import java.security.cert.X509Certificate;
|
||||
import javax.net.ssl.SSLContext;
|
||||
import javax.net.ssl.TrustManager;
|
||||
import javax.net.ssl.X509TrustManager;
|
||||
import org.apache.http.conn.ssl.SSLSocketFactory;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class NoCertSSLSocketFactory extends SSLSocketFactory {
|
||||
private SSLContext sslContext;
|
||||
|
||||
public NoCertSSLSocketFactory(KeyStore keyStore) throws NoSuchAlgorithmException, KeyManagementException, KeyStoreException, UnrecoverableKeyException {
|
||||
super(keyStore);
|
||||
this.sslContext = SSLContext.getInstance("TLS");
|
||||
TrustManager tm = new X509TrustManager() { // from class: com.mojang.android.net.NoCertSSLSocketFactory.1
|
||||
@Override // javax.net.ssl.X509TrustManager
|
||||
public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {
|
||||
}
|
||||
|
||||
@Override // javax.net.ssl.X509TrustManager
|
||||
public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {
|
||||
}
|
||||
|
||||
@Override // javax.net.ssl.X509TrustManager
|
||||
public X509Certificate[] getAcceptedIssuers() {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
this.sslContext.init(null, new TrustManager[]{tm}, null);
|
||||
}
|
||||
|
||||
@Override // org.apache.http.conn.ssl.SSLSocketFactory, org.apache.http.conn.scheme.LayeredSocketFactory
|
||||
public Socket createSocket(Socket socket, String host, int port, boolean autoClose) throws IOException, UnknownHostException {
|
||||
return this.sslContext.getSocketFactory().createSocket(socket, host, port, autoClose);
|
||||
}
|
||||
|
||||
@Override // org.apache.http.conn.ssl.SSLSocketFactory, org.apache.http.conn.scheme.SocketFactory
|
||||
public Socket createSocket() throws IOException {
|
||||
return this.sslContext.getSocketFactory().createSocket();
|
||||
}
|
||||
|
||||
public static NoCertSSLSocketFactory createDefault() throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException, KeyManagementException, UnrecoverableKeyException {
|
||||
KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
|
||||
keyStore.load(null, null);
|
||||
NoCertSSLSocketFactory factory = new NoCertSSLSocketFactory(keyStore);
|
||||
factory.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
|
||||
return factory;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,296 @@
|
|||
package com.mojang.android.net;
|
||||
|
||||
import android.util.Log;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.security.InvalidParameterException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import org.apache.http.Header;
|
||||
import org.apache.http.HttpEntity;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.HttpVersion;
|
||||
import org.apache.http.ParseException;
|
||||
import org.apache.http.client.ClientProtocolException;
|
||||
import org.apache.http.client.HttpClient;
|
||||
import org.apache.http.client.methods.HttpDelete;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.client.methods.HttpPut;
|
||||
import org.apache.http.client.methods.HttpRequestBase;
|
||||
import org.apache.http.conn.ClientConnectionManager;
|
||||
import org.apache.http.conn.scheme.PlainSocketFactory;
|
||||
import org.apache.http.conn.scheme.Scheme;
|
||||
import org.apache.http.conn.scheme.SchemeRegistry;
|
||||
import org.apache.http.conn.ssl.SSLSocketFactory;
|
||||
import org.apache.http.entity.StringEntity;
|
||||
import org.apache.http.impl.client.DefaultHttpClient;
|
||||
import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
|
||||
import org.apache.http.params.BasicHttpParams;
|
||||
import org.apache.http.params.HttpConnectionParams;
|
||||
import org.apache.http.params.HttpParams;
|
||||
import org.apache.http.params.HttpProtocolParams;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class WebRequestManager {
|
||||
private IRequestCompleteCallback onRequestCompleteCallback;
|
||||
private HttpClient _httpClient = null;
|
||||
private ArrayList<WebRequestData> _webRequests = new ArrayList<>();
|
||||
private Object _requestlock = new Object();
|
||||
|
||||
public interface IRequestCompleteCallback {
|
||||
void onRequestComplete(int i, long j, int i2, String str);
|
||||
}
|
||||
|
||||
public WebRequestManager(IRequestCompleteCallback onRequestCompleteCallback) {
|
||||
this.onRequestCompleteCallback = onRequestCompleteCallback;
|
||||
}
|
||||
|
||||
private void _init() {
|
||||
HttpParams params = new BasicHttpParams();
|
||||
HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
|
||||
HttpProtocolParams.setContentCharset(params, "utf-8");
|
||||
params.setBooleanParameter("http.protocol.expect-continue", false);
|
||||
SchemeRegistry registry = new SchemeRegistry();
|
||||
registry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
|
||||
try {
|
||||
SSLSocketFactory sslSocketFactory = NoCertSSLSocketFactory.createDefault();
|
||||
registry.register(new Scheme("https", sslSocketFactory, 443));
|
||||
ClientConnectionManager manager = new ThreadSafeClientConnManager(params, registry);
|
||||
this._httpClient = new DefaultHttpClient(manager, params);
|
||||
} catch (Exception e) {
|
||||
Log.e("MCPE_ssl", "Couldn't create SSLSocketFactory");
|
||||
}
|
||||
}
|
||||
|
||||
public void webRequest(int requestId, long voidptr, String uri, String method, String cookieData, String httpBody) {
|
||||
HttpRequestBase httpRequest;
|
||||
if (this._httpClient == null) {
|
||||
_init();
|
||||
}
|
||||
if (method.equals("DELETE")) {
|
||||
httpRequest = new HttpDelete(uri);
|
||||
} else if (method.equals("PUT")) {
|
||||
HttpPut putRequest = new HttpPut(uri);
|
||||
if (httpBody != "") {
|
||||
try {
|
||||
StringEntity se = new StringEntity(httpBody);
|
||||
se.setContentType("application/json");
|
||||
putRequest.setEntity(se);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
httpRequest = putRequest;
|
||||
} else if (method.equals("GET")) {
|
||||
httpRequest = new HttpGet(uri);
|
||||
} else if (method.equals("POST")) {
|
||||
HttpPost postRequest = new HttpPost(uri);
|
||||
if (httpBody != "") {
|
||||
try {
|
||||
StringEntity se2 = new StringEntity(httpBody);
|
||||
se2.setContentType("application/json");
|
||||
postRequest.setEntity(se2);
|
||||
} catch (UnsupportedEncodingException e2) {
|
||||
e2.printStackTrace();
|
||||
}
|
||||
}
|
||||
httpRequest = postRequest;
|
||||
} else {
|
||||
throw new InvalidParameterException("Unknown request method " + method);
|
||||
}
|
||||
httpRequest.addHeader("User-Agent", "MCPE/Curl");
|
||||
HttpParams httpParameters = new BasicHttpParams();
|
||||
HttpConnectionParams.setConnectionTimeout(httpParameters, 30000);
|
||||
httpRequest.setParams(httpParameters);
|
||||
if (cookieData != null && cookieData.length() > 0) {
|
||||
System.out.println("Setting cookie: (" + cookieData.length() + ") " + cookieData);
|
||||
httpRequest.addHeader("Cookie", cookieData);
|
||||
}
|
||||
final WebRequestData request = new WebRequestData(requestId, httpRequest, voidptr);
|
||||
synchronized (this._requestlock) {
|
||||
Iterator i$ = this._webRequests.iterator();
|
||||
while (i$.hasNext()) {
|
||||
WebRequestData w = i$.next();
|
||||
if (w.requestId == request.requestId) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
this._webRequests.add(request);
|
||||
new Thread(new Runnable() { // from class: com.mojang.android.net.WebRequestManager.1
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
do {
|
||||
try {
|
||||
request.execute(WebRequestManager.this._httpClient);
|
||||
if (request.getStatusCode() != 503) {
|
||||
break;
|
||||
} else {
|
||||
request.waitForSeconds(request.retryTimeout);
|
||||
}
|
||||
} catch (Exception e3) {
|
||||
e3.printStackTrace();
|
||||
request.markError(Status.FAIL_TIMEOUT);
|
||||
}
|
||||
} while (!request.aborted);
|
||||
synchronized (WebRequestManager.this._requestlock) {
|
||||
if (!request.aborted) {
|
||||
WebRequestManager.this.onRequestCompleteCallback.onRequestComplete(request.requestId, request.voidptr, request.getStatusCode(), request.content);
|
||||
}
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
}
|
||||
|
||||
public int getWebRequestStatus(int requestId) {
|
||||
return _findWebRequest(requestId).getStatusCode();
|
||||
}
|
||||
|
||||
public String getWebRequestContent(int requestId) {
|
||||
return _findWebRequest(requestId).content;
|
||||
}
|
||||
|
||||
public int abortWebRequest(int requestId) {
|
||||
WebRequestData r = _findWebRequest(requestId);
|
||||
if (r.status != Status.REQUEST_NOT_FOUND) {
|
||||
synchronized (this._requestlock) {
|
||||
r.abort();
|
||||
this._webRequests.remove(r);
|
||||
}
|
||||
System.out.println("Requests left " + this._webRequests.size());
|
||||
}
|
||||
return r.getStatusCode();
|
||||
}
|
||||
|
||||
private WebRequestData _findWebRequest(int requestId) {
|
||||
synchronized (this._requestlock) {
|
||||
Iterator i$ = this._webRequests.iterator();
|
||||
while (i$.hasNext()) {
|
||||
WebRequestData r = i$.next();
|
||||
if (r.requestId == requestId) {
|
||||
return r;
|
||||
}
|
||||
}
|
||||
return new WebRequestData(requestId).markError(Status.REQUEST_NOT_FOUND);
|
||||
}
|
||||
}
|
||||
|
||||
public enum Status {
|
||||
REQUEST_NOT_FOUND,
|
||||
PENDING,
|
||||
FINISHED,
|
||||
FAIL_URLFORMAT,
|
||||
FAIL_PARSE,
|
||||
FAIL_TIMEOUT,
|
||||
FAIL_GENERAL,
|
||||
FAIL_CANCELLED;
|
||||
|
||||
public boolean isError() {
|
||||
return (this == PENDING || this == FINISHED) ? false : true;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return -ordinal();
|
||||
}
|
||||
}
|
||||
|
||||
private static class WebRequestData {
|
||||
static final /* synthetic */ boolean $assertionsDisabled;
|
||||
private HttpRequestBase request;
|
||||
public final int requestId;
|
||||
private HttpResponse response;
|
||||
public long voidptr;
|
||||
public Status status = Status.PENDING;
|
||||
public String content = "";
|
||||
public volatile boolean aborted = false;
|
||||
public int retryTimeout = 5;
|
||||
|
||||
static {
|
||||
$assertionsDisabled = !WebRequestManager.class.desiredAssertionStatus();
|
||||
}
|
||||
|
||||
public WebRequestData(int requestId) {
|
||||
this.requestId = requestId;
|
||||
}
|
||||
|
||||
public WebRequestData(int requestId, HttpRequestBase request, long voidptr) {
|
||||
this.requestId = requestId;
|
||||
this.request = request;
|
||||
this.voidptr = voidptr;
|
||||
}
|
||||
|
||||
public void waitForSeconds(int seconds) {
|
||||
for (int a = 0; a < seconds * 5 && !this.aborted; a++) {
|
||||
try {
|
||||
Thread.sleep(a * 200);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public WebRequestData markError(Status errorCode) {
|
||||
if (!$assertionsDisabled && !errorCode.isError()) {
|
||||
throw new AssertionError();
|
||||
}
|
||||
this.status = errorCode;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void abort() {
|
||||
this.aborted = true;
|
||||
if (this.request != null && !this.request.isAborted()) {
|
||||
this.request.abort();
|
||||
}
|
||||
}
|
||||
|
||||
public void execute(HttpClient httpClient) {
|
||||
if (Status.PENDING == this.status) {
|
||||
try {
|
||||
this.response = httpClient.execute(this.request);
|
||||
} catch (ClientProtocolException e1) {
|
||||
markError(Status.FAIL_URLFORMAT);
|
||||
e1.printStackTrace();
|
||||
} catch (IOException e12) {
|
||||
markError(Status.FAIL_GENERAL);
|
||||
e12.printStackTrace();
|
||||
} catch (Exception e13) {
|
||||
markError(Status.FAIL_GENERAL);
|
||||
e13.printStackTrace();
|
||||
}
|
||||
if (this.response != null) {
|
||||
try {
|
||||
int responseCode = this.response.getStatusLine().getStatusCode();
|
||||
if (responseCode == 204) {
|
||||
this.content = "";
|
||||
} else if (responseCode == 503) {
|
||||
Header h = this.response.getLastHeader("Retry-After");
|
||||
if (h != null) {
|
||||
try {
|
||||
this.retryTimeout = Integer.valueOf(h.getValue()).intValue();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
HttpEntity entity = this.response.getEntity();
|
||||
this.content = EntityUtils.toString(entity);
|
||||
}
|
||||
this.status = Status.FINISHED;
|
||||
} catch (IOException e2) {
|
||||
e2.printStackTrace();
|
||||
this.status = Status.FAIL_GENERAL;
|
||||
} catch (ParseException e3) {
|
||||
e3.printStackTrace();
|
||||
this.status = Status.FAIL_PARSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getStatusCode() {
|
||||
return Status.FINISHED == this.status ? this.response.getStatusLine().getStatusCode() : this.status.getCode();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
package com.mojang.minecraftpe;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class BuildConfig {
|
||||
public static final boolean DEBUG = false;
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
package com.mojang.minecraftpe;
|
||||
|
||||
import android.os.Build;
|
||||
import java.io.File;
|
||||
import java.io.FileFilter;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class HardwareInformation {
|
||||
public static String getDeviceModelName() {
|
||||
String manufacturer = Build.MANUFACTURER;
|
||||
String model = Build.MODEL;
|
||||
if (model.startsWith(manufacturer)) {
|
||||
String returnString = model.toUpperCase();
|
||||
return returnString;
|
||||
}
|
||||
String returnString2 = manufacturer.toUpperCase() + " " + model;
|
||||
return returnString2;
|
||||
}
|
||||
|
||||
public static String getAndroidVersion() {
|
||||
return Build.VERSION.RELEASE;
|
||||
}
|
||||
|
||||
public static String getCPU() {
|
||||
return Build.CPU_ABI;
|
||||
}
|
||||
|
||||
public static int getNumCores() {
|
||||
try {
|
||||
File dir = new File("/sys/devices/system/cpu/");
|
||||
File[] files = dir.listFiles(new FileFilter() { // from class: com.mojang.minecraftpe.HardwareInformation.1CpuFilter
|
||||
@Override // java.io.FileFilter
|
||||
public boolean accept(File pathname) {
|
||||
return Pattern.matches("cpu[0-9]+", pathname.getName());
|
||||
}
|
||||
});
|
||||
return files.length;
|
||||
} catch (Exception e) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,14 @@
|
|||
package com.mojang.minecraftpe;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class Minecraft_Market extends MainActivity {
|
||||
@Override // com.mojang.minecraftpe.MainActivity
|
||||
public void buyGame() {
|
||||
Uri buyLink = Uri.parse("market://details?id=com.mojang.minecraftpe");
|
||||
Intent marketIntent = new Intent("android.intent.action.VIEW", buyLink);
|
||||
startActivity(marketIntent);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
package com.mojang.minecraftpe;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class Minecraft_Market_Demo extends MainActivity {
|
||||
@Override // com.mojang.minecraftpe.MainActivity
|
||||
public void buyGame() {
|
||||
Uri buyLink = Uri.parse("market://details?id=com.mojang.minecraftpe");
|
||||
Intent marketIntent = new Intent("android.intent.action.VIEW", buyLink);
|
||||
startActivity(marketIntent);
|
||||
}
|
||||
|
||||
@Override // com.mojang.minecraftpe.MainActivity
|
||||
protected boolean isDemo() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package com.mojang.minecraftpe;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class R {
|
||||
|
||||
public static final class attr {
|
||||
}
|
||||
|
||||
public static final class drawable {
|
||||
public static final int bg32 = 0x7f020000;
|
||||
public static final int icon = 0x7f020001;
|
||||
public static final int icon_demo = 0x7f020002;
|
||||
public static final int iconx = 0x7f020003;
|
||||
}
|
||||
|
||||
public static final class string {
|
||||
public static final int app_name = 0x7f030000;
|
||||
public static final int app_name_demo = 0x7f030001;
|
||||
public static final int app_name_short = 0x7f030003;
|
||||
public static final int app_name_short_demo = 0x7f030004;
|
||||
public static final int xperiaplayoptimized_content = 0x7f030002;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,97 @@
|
|||
package com.mojang.minecraftpe;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.InputFilter;
|
||||
import android.text.Spanned;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.view.inputmethod.InputConnection;
|
||||
import android.view.inputmethod.InputConnectionWrapper;
|
||||
import android.widget.EditText;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class TextInputProxyEditTextbox extends EditText {
|
||||
private MCPEKeyWatcher _mcpeKeyWatcher;
|
||||
public final int allowedLength;
|
||||
public final boolean limitInput;
|
||||
|
||||
public interface MCPEKeyWatcher {
|
||||
void onBackKeyPressed();
|
||||
|
||||
void onDeleteKeyPressed();
|
||||
}
|
||||
|
||||
public TextInputProxyEditTextbox(Context context, AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
this._mcpeKeyWatcher = null;
|
||||
this.allowedLength = 160;
|
||||
this.limitInput = false;
|
||||
}
|
||||
|
||||
public TextInputProxyEditTextbox(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
this._mcpeKeyWatcher = null;
|
||||
this.allowedLength = 160;
|
||||
this.limitInput = false;
|
||||
}
|
||||
|
||||
public TextInputProxyEditTextbox(Context context, int allowedLength, boolean limitInput) {
|
||||
super(context);
|
||||
InputFilter[] filters;
|
||||
this._mcpeKeyWatcher = null;
|
||||
this.allowedLength = allowedLength;
|
||||
this.limitInput = limitInput;
|
||||
if (limitInput) {
|
||||
filters = new InputFilter[]{new InputFilter.LengthFilter(this.allowedLength), new InputFilter() { // from class: com.mojang.minecraftpe.TextInputProxyEditTextbox.1
|
||||
@Override // android.text.InputFilter
|
||||
public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) {
|
||||
return (source.equals("") || source.toString().matches("^[a-zA-Z0-9_ -^~'.,;!#&()=`{}]*")) ? source : "";
|
||||
}
|
||||
}};
|
||||
} else {
|
||||
filters = new InputFilter[]{new InputFilter.LengthFilter(this.allowedLength)};
|
||||
}
|
||||
setFilters(filters);
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, android.view.View
|
||||
public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
|
||||
return new MCPEInputConnection(super.onCreateInputConnection(outAttrs), true, this);
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, android.view.View
|
||||
public boolean onKeyPreIme(int keyCode, KeyEvent event) {
|
||||
if (keyCode != 4 || event.getAction() != 1) {
|
||||
return super.dispatchKeyEvent(event);
|
||||
}
|
||||
if (this._mcpeKeyWatcher != null) {
|
||||
this._mcpeKeyWatcher.onBackKeyPressed();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setOnMCPEKeyWatcher(MCPEKeyWatcher mcpeKeyWatcher) {
|
||||
this._mcpeKeyWatcher = mcpeKeyWatcher;
|
||||
}
|
||||
|
||||
private class MCPEInputConnection extends InputConnectionWrapper {
|
||||
TextInputProxyEditTextbox textbox;
|
||||
|
||||
public MCPEInputConnection(InputConnection target, boolean mutable, TextInputProxyEditTextbox textbox) {
|
||||
super(target, mutable);
|
||||
this.textbox = textbox;
|
||||
}
|
||||
|
||||
@Override // android.view.inputmethod.InputConnectionWrapper, android.view.inputmethod.InputConnection
|
||||
public boolean sendKeyEvent(KeyEvent event) {
|
||||
if (this.textbox.getText().length() != 0 || event.getAction() != 0 || event.getKeyCode() != 67) {
|
||||
return super.sendKeyEvent(event);
|
||||
}
|
||||
if (TextInputProxyEditTextbox.this._mcpeKeyWatcher != null) {
|
||||
TextInputProxyEditTextbox.this._mcpeKeyWatcher.onDeleteKeyPressed();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue