本文整理汇总了Java中org.appcelerator.kroll.KrollProxy类的典型用法代码示例。如果您正苦于以下问题:Java KrollProxy类的具体用法?Java KrollProxy怎么用?Java KrollProxy使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
KrollProxy类属于org.appcelerator.kroll包,在下文中一共展示了KrollProxy类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onReceivedSslError
import org.appcelerator.kroll.KrollProxy; //导入依赖的package包/类
@Override
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error)
{
/*
* in theory this should be checked to make sure it's not null but if there is some failure
* in the association then usage of webViewProxy should trigger a NPE to make sure the issue
* is not ignored
*/
KrollProxy webViewProxy = this.webView.getProxy();
KrollDict data = new KrollDict();
data.put(TiC.ERROR_PROPERTY_CODE, error.getPrimaryError());
webView.getProxy().fireSyncEvent(TiC.EVENT_SSL_ERROR, data);
boolean ignoreSslError = false;
try {
ignoreSslError = webViewProxy.getProperties().optBoolean(TiC.PROPERTY_WEBVIEW_IGNORE_SSL_ERROR, false);
} catch(IllegalArgumentException e) {
Log.e(TAG, TiC.PROPERTY_WEBVIEW_IGNORE_SSL_ERROR + " property does not contain a boolean value, ignoring");
}
if (ignoreSslError == true) {
Log.w(TAG, "ran into SSL error but ignoring...");
handler.proceed();
} else {
Log.e(TAG, "SSL error occurred: " + error.toString());
handler.cancel();
}
}
示例2: call
import org.appcelerator.kroll.KrollProxy; //导入依赖的package包/类
public static void call(final KrollProxy proxy) {
// Call the API to invalidate the authToken
final Box box = Box.getInstance(Constants.API_KEY);
box.logout(Constants.getAuthToken(), new LogoutListener() {
@Override
public void onIOException(IOException ex) {
Util.handleIOException(proxy, ex, null);
}
@Override
public void onComplete(String status) {
if (status.equals("logout_ok")) {
Util.i("Logout complete; auth token deauthorized by the server.");
}
else {
Util.handleCommonStatuses(proxy, status, null);
}
}
});
// Nullify the authToken.
Util.saveAuthToken(null);
}
示例3: propertyChanged
import org.appcelerator.kroll.KrollProxy; //导入依赖的package包/类
@Override
public void propertyChanged(String key, Object oldValue, Object newValue,
KrollProxy proxy) {
CompoundButton cb = (CompoundButton) getNativeView();
if (key.equals(TiC.PROPERTY_TITLE_OFF)) {
((Switch) cb).setTextOff((String) newValue);
} else if (key.equals(TiC.PROPERTY_TITLE_ON)) {
((Switch) cb).setTextOff((String) newValue);
} else if (key.equals(TiC.PROPERTY_VALUE)) {
cb.setChecked(TiConvert.toBoolean(newValue));
} else if (key.equals(TiC.PROPERTY_COLOR)) {
cb.setTextColor(TiConvert.toColor(TiConvert.toString(newValue)));
} else if (key.equals(TiC.PROPERTY_FONT)) {
TiUIHelper.styleText(cb, (KrollDict) newValue);
} else if (key.equals(TiC.PROPERTY_TEXT_ALIGN)) {
TiUIHelper.setAlignment(cb, TiConvert.toString(newValue), null);
cb.requestLayout();
} else if (key.equals(TiC.PROPERTY_VERTICAL_ALIGN)) {
TiUIHelper.setAlignment(cb, null, TiConvert.toString(newValue));
cb.requestLayout();
} else {
super.propertyChanged(key, oldValue, newValue, proxy);
}
}
示例4: propertyChanged
import org.appcelerator.kroll.KrollProxy; //导入依赖的package包/类
@Override
public void propertyChanged(String key, Object oldValue, Object newValue, KrollProxy proxy)
{
// If the 'modelListener' property has been set for this proxy then this method is called
// whenever a proxy property value is updated. Note that this method is called whenever the
// setter is called, so it will get called even if the value of the property has not changed.
if ((oldValue == newValue) ||
((oldValue != null) && oldValue.equals(newValue))) {
return;
}
Log.d(TAG, "[FIREBASE] Property " + key + " changed from " + oldValue + " to " + newValue);
// If is a good idea to check if there are listeners for the event that
// is about to fired. There could be zero or multiple listeners for the
// specified event.
if (hasListeners("propertyChange")) {
HashMap<String, Object> event = new HashMap<String, Object>();
event.put("property", key);
event.put("oldValue",oldValue);
event.put("newValue",newValue);
fireEvent("propertyChange", event);
}
}
示例5: propertyChanged
import org.appcelerator.kroll.KrollProxy; //导入依赖的package包/类
@Override
public void propertyChanged(String key, Object oldValue, Object newValue, KrollProxy proxy)
{
if (key.equals("zoom")) {
tiv.setZoom(TiConvert.toFloat(newValue));
}
if (key.equals("image")) {
handleImage(newValue);
}
if (key.equals("maxZoom")) {
tiv.setMaxZoom(TiConvert.toFloat(newValue));
}
if (key.equals("minZoom")) {
tiv.setMinZoom(TiConvert.toFloat(newValue));
}
}
示例6: propertyChanged
import org.appcelerator.kroll.KrollProxy; //导入依赖的package包/类
@Override
public void propertyChanged(String key, Object oldValue, Object newValue, KrollProxy proxy) {
super.propertyChanged(key, oldValue, newValue, proxy);
if (key.equals("indeterminate")) {
boolean indeterminate = TiConvert.toBoolean(newValue, false);
handleSetIndeterminate(indeterminate);
}
else if (key.equals(TiC.PROPERTY_VALUE) || key.equals("min") || key.equals("max") ||
key.equals("secondary")) {
updateProgress();
}
else if (key.equals(TiC.PROPERTY_MESSAGE)) {
String message = TiConvert.toString(newValue);
if (message != null) {
handleSetMessage(message);
}
}
}
示例7: listenerAdded
import org.appcelerator.kroll.KrollProxy; //导入依赖的package包/类
public void listenerAdded(String type, int count, KrollProxy proxy){
super.listenerAdded(type, count, proxy);
Log.i(LCAT, "listenerAdded");
try {
sendQueuedNotification();
} catch (JSONException e) {
Log.d(LCAT, "sendQueuedNotificationError" + e);
}
}
开发者ID:dieskim,项目名称:countly-sdk-appcelerator-titanium-android,代码行数:10,代码来源:TitaniumCountlyAndroidMessagingModule.java
示例8: MediaPlayerWrapper
import org.appcelerator.kroll.KrollProxy; //导入依赖的package包/类
public MediaPlayerWrapper(KrollProxy proxy) throws IOException
{
this.proxy = proxy;
this.playOnResume = false;
this.remote = false;
String url = TiConvert.toString(proxy.getProperty(TiC.PROPERTY_URL));
if (url != null && url.length() > 0)
{
this.initialize();
}
context = proxy.getActivity().getBaseContext();
am = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
}
示例9: propertyChanged
import org.appcelerator.kroll.KrollProxy; //导入依赖的package包/类
@Override
public void propertyChanged(String key, Object oldValue, Object newValue, KrollProxy proxy)
{
if (PROPERTY_VOLUME.equals(key)) {
setVolume(TiConvert.toFloat(newValue));
} else if (TiC.PROPERTY_TIME.equals(key)) {
setTime(TiConvert.toInt(newValue));
}
}
示例10: propertiesChanged
import org.appcelerator.kroll.KrollProxy; //导入依赖的package包/类
@Override
public void propertiesChanged(List<KrollPropertyChange> changes, KrollProxy proxy)
{
for (KrollPropertyChange change : changes) {
propertyChanged(change.getName(), change.getOldValue(), change.getNewValue(), proxy);
}
}
示例11: propertyChanged
import org.appcelerator.kroll.KrollProxy; //导入依赖的package包/类
@Override
public void propertyChanged(String key, Object oldValue, Object newValue, KrollProxy proxy) {
if (TiC.PROPERTY_CURRENT_PAGE.equals(key)) {
setCurrentPage(TiConvert.toInt(newValue));
} else if (key.equals(TiC.PROPERTY_VIEWS)) {
setViews(newValue);
} else if (key.equals(PROPERTY_ORIENTATION)) {
mFlipView.setOrientation((String) newValue);
} else if (key.equals(PROPERTY_OVERFLIPMODE)) {
mFlipView.setOverFlipMode((OverFlipMode) newValue);
} else {
super.propertyChanged(key, oldValue, newValue, proxy);
}
}
示例12: call
import org.appcelerator.kroll.KrollProxy; //导入依赖的package包/类
public static void call(final KrollProxy proxy, HashMap args) {
KrollDict argsDict = new KrollDict(args);
int objectId = argsDict.getInt("objectId");
Boolean isFolder = argsDict.getBoolean("isFolder");
String message = argsDict.getString("message");
final KrollFunction success = (KrollFunction)args.get("success");
final KrollFunction error = (KrollFunction)args.get("error");
final Box box = Box.getInstance(Constants.API_KEY);
box.addComment(Constants.getAuthToken(), isFolder?"folder":"file", objectId, message, new AddCommentListener() {
@Override
public void onIOException(IOException ex) {
Util.handleIOException(proxy, ex, error);
}
@Override
public void onComplete(Comment comment, String status) {
if (status.equals("add_comment_ok")) {
if (success != null)
success.callAsync(proxy.getKrollObject(), new Object[] {});
}
else if (status.equals("add_comment_error")) {
Util.handleError(proxy, "An error happened while we were adding your comment. Try again?", status, error);
}
else {
Util.handleCommonStatuses(proxy, status, error);
}
}
});
}
示例13: call
import org.appcelerator.kroll.KrollProxy; //导入依赖的package包/类
public static void call(final KrollProxy proxy, HashMap args) {
KrollDict argsDict = new KrollDict(args);
int commentId = argsDict.getInt("commentId");
final KrollFunction success = (KrollFunction)args.get("success");
final KrollFunction error = (KrollFunction)args.get("error");
final Box box = Box.getInstance(Constants.API_KEY);
box.deleteComment(Constants.getAuthToken(), commentId, new DeleteCommentListener() {
@Override
public void onIOException(IOException ex) {
Util.handleIOException(proxy, ex, error);
}
@Override
public void onComplete(String status) {
if (status.equals("delete_comment_ok")) {
if (success != null)
success.callAsync(proxy.getKrollObject(), new Object[] {});
}
else if (status.equals("delete_comment_error")) {
Util.handleError(proxy, "An error happened while we were deleting the comment. Try again?", status, error);
}
else {
Util.handleCommonStatuses(proxy, status, error);
}
}
});
}
示例14: call
import org.appcelerator.kroll.KrollProxy; //导入依赖的package包/类
public static void call(final KrollProxy proxy, HashMap args) {
KrollDict argsDict = new KrollDict(args);
int objectId = argsDict.getInt("objectId");
Boolean isFolder = argsDict.getBoolean("isFolder");
String password = argsDict.getString("password");
String[] emailAddresses = argsDict.getStringArray("emailAddresses");
String message = argsDict.getString("message");
final KrollFunction success = (KrollFunction)args.get("success");
final KrollFunction error = (KrollFunction)args.get("error");
final Box box = Box.getInstance(Constants.API_KEY);
box.publicShare(Constants.getAuthToken(), isFolder?"folder":"file", objectId, password, message, emailAddresses, new PublicShareListener() {
@Override
public void onIOException(IOException ex) {
Util.handleIOException(proxy, ex, error);
}
@Override
public void onComplete(String publicName, String status) {
if (status.equals("share_ok")) {
if (success != null)
success.callAsync(proxy.getKrollObject(), new Object[] {});
}
else if (status.equals("wrong_node")) {
Util.handleError(proxy, "We weren't able to find what you tried to share in your account!", status, error);
}
else if (status.equals("share_error")) {
Util.handleError(proxy, "An error happened while we were sharing your file. Try again?", status, error);
}
else {
Util.handleCommonStatuses(proxy, status, error);
}
}
});
}
示例15: call
import org.appcelerator.kroll.KrollProxy; //导入依赖的package包/类
public static void call(final KrollProxy proxy, HashMap args) {
KrollDict argsDict = new KrollDict(args);
int objectId = argsDict.getInt("objectId");
String fileURL = argsDict.getString("fileURL");
TiBaseFile file = TiFileFactory.createTitaniumFile(fileURL, false);
final KrollFunction success = (KrollFunction)args.get("success");
final KrollFunction error = (KrollFunction)args.get("error");
final Box box = Box.getInstance(Constants.API_KEY);
box.download(Constants.getAuthToken(), objectId, file.getNativeFile(), null, new FileDownloadListener() {
@Override
public void onIOException(IOException e) {
Util.handleIOException(proxy, e, error);
}
@Override
public void onProgress(long percent) {
// TODO We won't do anything with this quite yet. We can expose it in the future, though!
}
@Override
public void onComplete(String status) {
if (status.equals("download_ok"))
if (success != null)
success.callAsync(proxy.getKrollObject(), new Object[] {});
if (status.equals("wrong auth token"))
Util.handleError(proxy, "Your token has expired; please login again!", status, error);
else if (status.equals("restricted"))
Util.handleError(proxy, "You cannot access that file!", status, error);
else
Util.handleCommonStatuses(proxy, status, error);
}
});
}