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

The following examples show how to use com.taobao.weex.WXSDKEngine#setActivityNavBarSetter() . 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: WXPageActivity.java    From incubator-weex-playground with Apache License 2.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_wxpage);
  setCurrentWxPageActivity(this);


  WXSDKEngine.setActivityNavBarSetter(new NavigatorAdapter());
  getWindow().setFormat(PixelFormat.TRANSLUCENT);
  mUri = getIntent().getData();
  Bundle bundle = getIntent().getExtras();
  if (mUri == null && bundle == null) {
    mUri = Uri.parse(Constants.BUNDLE_URL + Constants.WEEX_SAMPLES_KEY);
  }
  if (bundle != null) {
    String bundleUrl = bundle.getString("bundleUrl");
    Log.i(TAG, "bundleUrl==" + bundleUrl);

    if (bundleUrl != null) {
      mConfigMap.put("bundleUrl", bundleUrl + Constants.WEEX_SAMPLES_KEY);
      mUri = Uri.parse(bundleUrl + Constants.WEEX_SAMPLES_KEY);

    }
  } else {
    mConfigMap.put("bundleUrl", mUri.toString() + Constants.WEEX_SAMPLES_KEY);
    // mUri = Uri.parse(mUri.toString() + Constants.WEEX_SAMPLES_KEY)
  }

  if (mUri == null) {
    Toast.makeText(this, "the uri is empty!", Toast.LENGTH_SHORT).show();
    finish();
    return;
  }

  Log.e("TestScript_Guide mUri==", mUri.toString());
  initUIAndData();

  if(WXPAGE.equals(mUri.getScheme())||
     TextUtils.equals("true",mUri.getQueryParameter("_wxpage"))) {
    mUri = mUri.buildUpon().scheme("http").build();
    loadWXfromService(mUri.toString());
    startHotRefresh();
    mWXHandler.removeCallbacks(mCollectIDMap);
    mWXHandler.postDelayed(mCollectIDMap,2000);
  }else if (TextUtils.equals("http", mUri.getScheme()) || TextUtils.equals("https", mUri.getScheme())) {
    // if url has key "_wx_tpl" then get weex bundle js
    String weexTpl = mUri.getQueryParameter(Constants.WEEX_TPL_KEY);
    String url = TextUtils.isEmpty(weexTpl) ? mUri.toString() : weexTpl;
    loadWXfromService(url);
    startHotRefresh();
  } else {
    loadWXfromLocal(false);
  }
  mInstance.onActivityCreate();
  registerBroadcastReceiver();

  mWxAnalyzerDelegate = new WXAnalyzerDelegate(this);
  mWxAnalyzerDelegate.onCreate();

  //if (mInstance.isPreDownLoad() || mInstance.isPreInitMode()){
    mInstance.onInstanceReady();
  //}
}
 
Example 2
Source File: WXPageActivity.java    From analyzer-of-android-for-Apache-Weex with Apache License 2.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_wxpage);
  setCurrentWxPageActivity(this);
  WXSDKEngine.setActivityNavBarSetter(new NavigatorAdapter());

  mUri = getIntent().getData();
  Bundle bundle = getIntent().getExtras();
  if (mUri == null && bundle == null) {
    mUri = Uri.parse(Constants.BUNDLE_URL + Constants.WEEX_SAMPLES_KEY);
  }
  if (bundle != null) {
    String bundleUrl = bundle.getString("bundleUrl");
    Log.e(TAG, "bundleUrl==" + bundleUrl);

    if (bundleUrl != null) {
      mConfigMap.put("bundleUrl", bundleUrl + Constants.WEEX_SAMPLES_KEY);
      mUri = Uri.parse(bundleUrl + Constants.WEEX_SAMPLES_KEY);

    }
  } else {
    mConfigMap.put("bundleUrl", mUri.toString() + Constants.WEEX_SAMPLES_KEY);
    // mUri = Uri.parse(mUri.toString() + Constants.WEEX_SAMPLES_KEY)
  }

  if (mUri == null) {
    Toast.makeText(this, "the uri is empty!", Toast.LENGTH_SHORT).show();
    finish();
    return;
  }

  Log.e("TestScript_Guide mUri==", mUri.toString());
  initUIAndData();

  if (TextUtils.equals("http", mUri.getScheme()) || TextUtils.equals("https", mUri.getScheme())) {
    //      if url has key "_wx_tpl" then get weex bundle js
    String weexTpl = mUri.getQueryParameter(Constants.WEEX_TPL_KEY);
    String url = TextUtils.isEmpty(weexTpl) ? mUri.toString() : weexTpl;
    loadWXfromService(url);
    startHotRefresh();
  } else {
    loadWXfromLocal(false);
  }
  mInstance.onActivityCreate();
  registerBroadcastReceiver();
}