Java Code Examples for com.taobao.weex.WXSDKEngine#getActivityNavBarSetter()

The following examples show how to use com.taobao.weex.WXSDKEngine#getActivityNavBarSetter() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UWXNavigatorModule2.java    From ucar-weex-core with Apache License 2.0 6 votes vote down vote up
@JSMethod(uiThread = true)
public void setNavBarRightItem(String param, JSCallback callback) {
    if (!TextUtils.isEmpty(param)) {
        if (WXSDKEngine.getActivityNavBarSetter() != null) {
            if (WXSDKEngine.getActivityNavBarSetter().setNavBarRightItem(param)) {
                if (callback != null) {
                    callback.invoke(MSG_SUCCESS);
                }
                return;
            }
        }
    }

    if (callback != null) {
        callback.invoke(MSG_FAILED);
    }
}
 
Example 2
Source File: WXNavigatorModule.java    From ucar-weex-core with Apache License 2.0 6 votes vote down vote up
@JSMethod(uiThread = true)
public void setNavBarMoreItem(String param, JSCallback callback) {
    if (!TextUtils.isEmpty(param)) {
        if (WXSDKEngine.getActivityNavBarSetter() != null) {
            if (WXSDKEngine.getActivityNavBarSetter().setNavBarMoreItem(param)) {
                if (callback != null) {
                    callback.invoke(MSG_SUCCESS);
                }
                return;
            }
        }
    }

    if (callback != null) {
        callback.invoke(MSG_FAILED);
    }
}
 
Example 3
Source File: WXNavigatorModule.java    From ucar-weex-core with Apache License 2.0 6 votes vote down vote up
@JSMethod(uiThread = true)
public void setNavBarLeftItem(String param, JSCallback callback) {
    if (!TextUtils.isEmpty(param)) {
        if (WXSDKEngine.getActivityNavBarSetter() != null) {
            if (WXSDKEngine.getActivityNavBarSetter().setNavBarLeftItem(param)) {
                if (callback != null) {
                    callback.invoke(MSG_SUCCESS);
                }
                return;
            }
        }
    }

    if (callback != null) {
        callback.invoke(MSG_FAILED);
    }

}
 
Example 4
Source File: WXNavigatorModule.java    From weex with Apache License 2.0 6 votes vote down vote up
@WXModuleAnno
public void setNavBarLeftItem(String param, final String callbackId) {
    if (!TextUtils.isEmpty(param)) {
        if (WXSDKEngine.getActivityNavBarSetter() != null) {
            if (WXSDKEngine.getActivityNavBarSetter().setNavBarLeftItem(param)) {
                WXBridgeManager.getInstance().callback(mWXSDKInstance.getInstanceId(), callbackId,
                        WXConst.MSG_SUCCESS);
                return;
            }
        }
    }

    WXBridgeManager.getInstance().callback(mWXSDKInstance.getInstanceId(), callbackId,
            WXConst.MSG_FAILED);

}
 
Example 5
Source File: WXNavigatorModule.java    From weex-uikit with MIT License 5 votes vote down vote up
@JSMethod(uiThread = true)
public void setNavBarTitle(String param, JSCallback callback) {
    if (!TextUtils.isEmpty(param)) {
        if (WXSDKEngine.getActivityNavBarSetter() != null) {
            if (WXSDKEngine.getActivityNavBarSetter().setNavBarTitle(param)) {
                callback.invoke(MSG_SUCCESS);
                return;
            }
        }
    }

    callback.invoke(MSG_FAILED);
}
 
Example 6
Source File: WXNavigatorModule.java    From weex-uikit with MIT License 5 votes vote down vote up
@JSMethod(uiThread = true)
public void pop(String param, JSCallback callback) {

    if (WXSDKEngine.getActivityNavBarSetter() != null) {
        if (WXSDKEngine.getActivityNavBarSetter().pop(param)) {
            callback.invoke(MSG_SUCCESS);
            return;
        }
    }

    if (mWXSDKInstance.getContext() instanceof Activity) {
        callback.invoke(MSG_SUCCESS);
        ((Activity) mWXSDKInstance.getContext()).finish();
    }
}
 
Example 7
Source File: WXNavigatorModule.java    From weex with Apache License 2.0 5 votes vote down vote up
@WXModuleAnno
public void push(String param, final String callbackId) {

    if (!TextUtils.isEmpty(param)) {
        if (WXSDKEngine.getActivityNavBarSetter() != null) {
            if (WXSDKEngine.getActivityNavBarSetter().push(param)) {
                WXBridgeManager.getInstance().callback(mWXSDKInstance.getInstanceId(), callbackId,
                        WXConst.MSG_SUCCESS);
                return;
            }
        }

        try {
            JSONObject jsonObject = new JSONObject(param);
            String url = jsonObject.optString(URL, "");
            if (!TextUtils.isEmpty(url)) {
                Uri rawUri = Uri.parse(url);
                String scheme = rawUri.getScheme();
                Uri.Builder builder = rawUri.buildUpon();
                if (TextUtils.isEmpty(scheme)) {
                    builder.scheme("http");
                }
                Intent intent = new Intent(Intent.ACTION_VIEW, builder.build());
                intent.addCategory(WEEX);
                intent.putExtra(INSTANCE_ID, mWXSDKInstance.getInstanceId());
                mWXSDKInstance.getContext().startActivity(intent);
                WXBridgeManager.getInstance().callback(mWXSDKInstance.getInstanceId(), callbackId,
                        WXConst.MSG_SUCCESS);
            }
        } catch (Exception e) {
            WXLogUtils.e(TAG, WXLogUtils.getStackTrace(e));
            WXBridgeManager.getInstance().callback(mWXSDKInstance.getInstanceId(), callbackId,
                    WXConst.MSG_FAILED);
        }
    }

    WXBridgeManager.getInstance().callback(mWXSDKInstance.getInstanceId(), callbackId,
            WXConst.MSG_FAILED);
}
 
Example 8
Source File: WXNavigatorModule.java    From weex-uikit with MIT License 5 votes vote down vote up
@JSMethod(uiThread = true)
public void clearNavBarLeftItem(String param, JSCallback callback) {
    if (WXSDKEngine.getActivityNavBarSetter() != null) {
        if (WXSDKEngine.getActivityNavBarSetter().clearNavBarLeftItem(param)) {
            callback.invoke(MSG_SUCCESS);
            return;
        }
    }

    callback.invoke(MSG_FAILED);
}
 
Example 9
Source File: WXNavigatorModule.java    From weex with Apache License 2.0 5 votes vote down vote up
@WXModuleAnno
public void setNavBarTitle(String param, final String callbackId) {
    if (!TextUtils.isEmpty(param)) {
        if (WXSDKEngine.getActivityNavBarSetter() != null) {
            if (WXSDKEngine.getActivityNavBarSetter().setNavBarTitle(param)) {
                WXBridgeManager.getInstance().callback(mWXSDKInstance.getInstanceId(), callbackId,
                        WXConst.MSG_SUCCESS);
                return;
            }
        }
    }

    WXBridgeManager.getInstance().callback(mWXSDKInstance.getInstanceId(), callbackId,
            WXConst.MSG_FAILED);
}
 
Example 10
Source File: WXNavigatorModule.java    From weex-uikit with MIT License 5 votes vote down vote up
@JSMethod(uiThread = true)
public void setNavBarMoreItem(String param, JSCallback callback) {
    if (!TextUtils.isEmpty(param)) {
        if (WXSDKEngine.getActivityNavBarSetter() != null) {
            if (WXSDKEngine.getActivityNavBarSetter().setNavBarMoreItem(param)) {
                callback.invoke(MSG_SUCCESS);
                return;
            }
        }
    }

    callback.invoke(MSG_FAILED);
}
 
Example 11
Source File: WXNavigatorModule.java    From weex-uikit with MIT License 5 votes vote down vote up
@JSMethod(uiThread = true)
public void setNavBarRightItem(String param, JSCallback callback) {
    if (!TextUtils.isEmpty(param)) {
        if (WXSDKEngine.getActivityNavBarSetter() != null) {
            if (WXSDKEngine.getActivityNavBarSetter().setNavBarRightItem(param)) {
                callback.invoke(MSG_SUCCESS);
                return;
            }
        }
    }

    callback.invoke(MSG_FAILED);
}
 
Example 12
Source File: WXNavigatorModule.java    From weex with Apache License 2.0 5 votes vote down vote up
@WXModuleAnno
public void clearNavBarRightItem(String param, final String callbackId) {
    if (WXSDKEngine.getActivityNavBarSetter() != null) {
        if (WXSDKEngine.getActivityNavBarSetter().clearNavBarRightItem(param)) {
            WXBridgeManager.getInstance().callback(mWXSDKInstance.getInstanceId(), callbackId,
                    WXConst.MSG_SUCCESS);
            return;
        }
    }

    WXBridgeManager.getInstance().callback(mWXSDKInstance.getInstanceId(), callbackId,
            WXConst.MSG_FAILED);
}
 
Example 13
Source File: WXNavigatorModule.java    From weex-uikit with MIT License 5 votes vote down vote up
@JSMethod(uiThread = true)
public void clearNavBarMoreItem(String param, JSCallback callback) {
    if (WXSDKEngine.getActivityNavBarSetter() != null) {
        if (WXSDKEngine.getActivityNavBarSetter().clearNavBarMoreItem(param)) {
            callback.invoke(MSG_SUCCESS);
            return;
        }
    }

    callback.invoke(MSG_FAILED);
}
 
Example 14
Source File: WXNavigatorModule.java    From weex-uikit with MIT License 5 votes vote down vote up
@JSMethod(uiThread = true)
public void setNavBarLeftItem(String param, JSCallback callback) {
    if (!TextUtils.isEmpty(param)) {
        if (WXSDKEngine.getActivityNavBarSetter() != null) {
            if (WXSDKEngine.getActivityNavBarSetter().setNavBarLeftItem(param)) {
                callback.invoke(MSG_SUCCESS);
                return;
            }
        }
    }

    callback.invoke(MSG_FAILED);

}
 
Example 15
Source File: UWXNavigatorModule2.java    From ucar-weex-core with Apache License 2.0 5 votes vote down vote up
@JSMethod(uiThread = true)
public void clearNavBarLeftItem(String param, JSCallback callback) {
    if (WXSDKEngine.getActivityNavBarSetter() != null) {
        if (WXSDKEngine.getActivityNavBarSetter().clearNavBarLeftItem(param)) {
            if (callback != null) {
                callback.invoke(MSG_SUCCESS);
            }
            return;
        }
    }

    if (callback != null) {
        callback.invoke(MSG_FAILED);
    }
}
 
Example 16
Source File: WXNavigatorModule.java    From weex-uikit with MIT License 5 votes vote down vote up
@JSMethod(uiThread = true)
public void clearNavBarRightItem(String param, JSCallback callback) {
    if (WXSDKEngine.getActivityNavBarSetter() != null) {
        if (WXSDKEngine.getActivityNavBarSetter().clearNavBarRightItem(param)) {
            callback.invoke(MSG_SUCCESS);
            return;
        }
    }

    callback.invoke(MSG_FAILED);
}
 
Example 17
Source File: WXNavigatorModule.java    From weex with Apache License 2.0 5 votes vote down vote up
@WXModuleAnno
public void setNavBarRightItem(String param, final String callbackId) {
    if (!TextUtils.isEmpty(param)) {
        if (WXSDKEngine.getActivityNavBarSetter() != null) {
            if (WXSDKEngine.getActivityNavBarSetter().setNavBarRightItem(param)) {
                WXBridgeManager.getInstance().callback(mWXSDKInstance.getInstanceId(), callbackId,
                        WXConst.MSG_SUCCESS);
                return;
            }
        }
    }

    WXBridgeManager.getInstance().callback(mWXSDKInstance.getInstanceId(), callbackId,
            WXConst.MSG_FAILED);
}
 
Example 18
Source File: WXNavigatorModule.java    From weex with Apache License 2.0 5 votes vote down vote up
@WXModuleAnno
public void clearNavBarMoreItem(String param, final String callbackId) {
    if (WXSDKEngine.getActivityNavBarSetter() != null) {
        if (WXSDKEngine.getActivityNavBarSetter().clearNavBarMoreItem(param)) {
            WXBridgeManager.getInstance().callback(mWXSDKInstance.getInstanceId(), callbackId,
                    WXConst.MSG_SUCCESS);
            return;
        }
    }

    WXBridgeManager.getInstance().callback(mWXSDKInstance.getInstanceId(), callbackId,
            WXConst.MSG_FAILED);
}
 
Example 19
Source File: UWXNavigatorModule2.java    From ucar-weex-core with Apache License 2.0 4 votes vote down vote up
@JSMethod(uiThread = true)
public void push(String param, JSCallback callback) {

    if (!TextUtils.isEmpty(param)) {
        if (WXSDKEngine.getActivityNavBarSetter() != null) {
            if (WXSDKEngine.getActivityNavBarSetter().push(param)) {
                if (callback != null) {
                    callback.invoke(MSG_SUCCESS);
                }
                return;
            }
        }

        try {
            JSONObject jsonObject = JSON.parseObject(param);
            String url = jsonObject.getString(URL);
            if (!TextUtils.isEmpty(url)) {
                Uri rawUri = Uri.parse(url);
                String scheme = rawUri.getScheme();
                Uri.Builder builder = rawUri.buildUpon();
                if (TextUtils.isEmpty(scheme)) {
                    builder.scheme(Constants.Scheme.HTTP);
                }
                Intent intent = new Intent(Intent.ACTION_VIEW, builder.build());
                intent.addCategory(WEEX);
                intent.putExtra(INSTANCE_ID, mWXSDKInstance.getInstanceId());
                mWXSDKInstance.getContext().startActivity(intent);
                if (callback != null) {
                    callback.invoke(MSG_SUCCESS);
                }
            }
        } catch (Exception e) {
            WXLogUtils.eTag(TAG, e);
            if (callback != null) {
                callback.invoke(MSG_FAILED);
            }
        }
    } else if (callback != null) {
        callback.invoke(MSG_FAILED);
    }
}
 
Example 20
Source File: WXNavigatorModule.java    From ucar-weex-core with Apache License 2.0 4 votes vote down vote up
@JSMethod(uiThread = true)
public void push(String param, JSCallback callback) {

    if (!TextUtils.isEmpty(param)) {
        if (WXSDKEngine.getActivityNavBarSetter() != null) {
            if (WXSDKEngine.getActivityNavBarSetter().push(param)) {
                if (callback != null) {
                    callback.invoke(MSG_SUCCESS);
                }
                return;
            }
        }

        try {
            JSONObject jsonObject = JSON.parseObject(param);
            String url = jsonObject.getString(URL);
            if (!TextUtils.isEmpty(url)) {
                Uri rawUri = Uri.parse(url);
                String scheme = rawUri.getScheme();
                Uri.Builder builder = rawUri.buildUpon();
                if (TextUtils.isEmpty(scheme)) {
                    builder.scheme(Constants.Scheme.HTTP);
                }
                Intent intent = new Intent(Intent.ACTION_VIEW, builder.build());
                intent.addCategory(WEEX);
                intent.putExtra(INSTANCE_ID, mWXSDKInstance.getInstanceId());
                mWXSDKInstance.getContext().startActivity(intent);
                if (callback != null) {
                    callback.invoke(MSG_SUCCESS);
                }
            }
        } catch (Exception e) {
            WXLogUtils.eTag(TAG, e);
            if (callback != null) {
                callback.invoke(MSG_FAILED);
            }
        }
    } else if (callback != null) {
        callback.invoke(MSG_FAILED);
    }
}