Java Code Examples for com.taobao.weex.utils.WXSoInstallMgrSdk#isCPUSupport()

The following examples show how to use com.taobao.weex.utils.WXSoInstallMgrSdk#isCPUSupport() . 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: IndexActivity.java    From WeexOne with MIT License 6 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_index);
    setContainer((ViewGroup) findViewById(R.id.index_container));
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    mProgressBar = (ProgressBar) findViewById(R.id.index_progressBar);
    mTipView = (TextView) findViewById(R.id.index_tip);
    mProgressBar.setVisibility(View.VISIBLE);
    mTipView.setVisibility(View.VISIBLE);


    if (!WXSoInstallMgrSdk.isCPUSupport()) {
        mProgressBar.setVisibility(View.INVISIBLE);
        mTipView.setText(R.string.cpu_not_support_tip);
        return;
    }

    loadUrl(isLocalPage() ? AppConfig.getLocalUrl() : AppConfig.getLaunchUrl());
}
 
Example 2
Source File: WXEnvironment.java    From weex-uikit with MIT License 5 votes vote down vote up
/**
 * Tell whether Weex can run on current hardware.
 * @return true if weex can run on current hardware, otherwise false.
 */
public static boolean isHardwareSupport() {
  boolean excludeX86 = "true".equals(options.get(SETTING_EXCLUDE_X86SUPPORT));
  boolean isX86AndExcluded = WXSoInstallMgrSdk.isX86() && excludeX86;
  boolean isCPUSupport = WXSoInstallMgrSdk.isCPUSupport() && !isX86AndExcluded;
  if (WXEnvironment.isApkDebugable()) {
    WXLogUtils.d("WXEnvironment.sSupport:" + isCPUSupport
                 + "isX86AndExclueded: "+ isX86AndExcluded
                 + " !WXUtils.isTabletDevice():" + !WXUtils.isTabletDevice());
  }
  return isCPUSupport && !WXUtils.isTabletDevice();
}
 
Example 3
Source File: WXEnvironment.java    From weex with Apache License 2.0 5 votes vote down vote up
public static boolean isSupport() {
  boolean excludeX86 = "true".equals(options.get(SETTING_EXCLUDE_X86SUPPORT));
  boolean isX86AndExcluded = WXSoInstallMgrSdk.isX86()&&excludeX86;
  boolean isCPUSupport = WXSoInstallMgrSdk.isCPUSupport()&&!isX86AndExcluded;
  if (WXEnvironment.isApkDebugable()) {
    WXLogUtils.d("WXEnvironment.sSupport:" + isCPUSupport
                 + " WXSDKEngine.isInitialized():" + WXSDKEngine.isInitialized()
                 + " !WXUtils.isTabletDevice():" + !WXUtils.isTabletDevice());
  }
  return isCPUSupport && WXSDKEngine.isInitialized() && !WXUtils.isTabletDevice();
}
 
Example 4
Source File: IndexActivity.java    From weex with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_index);
  setContainer((ViewGroup) findViewById(R.id.index_container));
  Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
  toolbar.setTitle("WEEX");
  setSupportActionBar(toolbar);

  mProgressBar = (ProgressBar) findViewById(R.id.index_progressBar);
  mTipView = (TextView) findViewById(R.id.index_tip);
  mProgressBar.setVisibility(View.VISIBLE);
  mTipView.setVisibility(View.VISIBLE);


  if(!WXSoInstallMgrSdk.isCPUSupport()){
    mProgressBar.setVisibility(View.INVISIBLE);
    mTipView.setText(R.string.cpu_not_support_tip);
    return;
  }

  if(TextUtils.equals(CURRENT_IP,DEFAULT_IP)){
    renderPage(WXFileUtils.loadFileContent("index.js", this),WEEX_INDEX_URL);
  }else{
    renderPageByURL(WEEX_INDEX_URL);
  }
}
 
Example 5
Source File: IndexActivity.java    From incubator-weex-playground with Apache License 2.0 4 votes vote down vote up
@Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_index);
    setContainer((ViewGroup) findViewById(R.id.index_container));
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getWindow().setFormat(PixelFormat.TRANSLUCENT);

    mProgressBar = (ProgressBar) findViewById(R.id.index_progressBar);
    mTipView = (TextView) findViewById(R.id.index_tip);
    mProgressBar.setVisibility(View.VISIBLE);
    mTipView.setVisibility(View.VISIBLE);


    if (!WXSoInstallMgrSdk.isCPUSupport()) {
      mProgressBar.setVisibility(View.INVISIBLE);
      mTipView.setText(R.string.cpu_not_support_tip);
      return;
    }

    if (TextUtils.equals(sCurrentIp, DEFAULT_IP)) {
      renderPage(WXFileUtils.loadAsset("landing.weex.js", this), getIndexUrl());
//      renderPageByURL("http://dotwe.org/raw/dist/2bbe1860da4669a68595c1aed01d7fd2.bundle.wx");
    } else {
      renderPageByURL(getIndexUrl());
    }


    mReloadReceiver = new BroadcastReceiver() {
      @Override
      public void onReceive(Context context, Intent intent) {
        createWeexInstance();
        if (TextUtils.equals(sCurrentIp, DEFAULT_IP)) {
          renderPage(WXFileUtils.loadAsset("landing.weex.js", getApplicationContext()), getIndexUrl());
        } else {
          renderPageByURL(getIndexUrl());
        }
        mProgressBar.setVisibility(View.VISIBLE);
      }
    };

    LocalBroadcastManager.getInstance(this).registerReceiver(mReloadReceiver, new IntentFilter(WXSDKEngine.JS_FRAMEWORK_RELOAD));

    CheckForUpdateUtil.checkForUpdate(this);
  }
 
Example 6
Source File: WXPageActivity.java    From yanxuan-weex-demo with MIT License 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_wxpage);
  mContainer = (ViewGroup) findViewById(R.id.container);
  mProgressBar = (ProgressBar) findViewById(R.id.progress);
  mTipView = (TextView) findViewById(R.id.index_tip);

  Intent intent = getIntent();
  Uri uri = intent.getData();
  String from = intent.getStringExtra("from");
  mFromSplash = "splash".equals(from);

  if (uri == null) {
    uri = Uri.parse("{}");
  }
  if (uri != null) {
    try {
      JSONObject initData = new JSONObject(uri.toString());
      String bundleUrl = initData.optString("WeexBundle", null);
      if (bundleUrl != null) {
        mUri = Uri.parse(bundleUrl);
      }

      String ws = initData.optString("Ws", null);
      if (!TextUtils.isEmpty(ws)) {
        mHotReloadManager = new HotReloadManager(ws, new HotReloadManager.ActionListener() {
          @Override
          public void reload() {
            runOnUiThread(new Runnable() {
              @Override
              public void run() {
                Toast.makeText(WXPageActivity.this, "Hot reload", Toast.LENGTH_SHORT).show();
                createWeexInstance();
                renderPage();
              }
            });
          }

          @Override
          public void render(final String bundleUrl) {
            runOnUiThread(new Runnable() {
              @Override
              public void run() {
                Toast.makeText(WXPageActivity.this, "Render: " + bundleUrl, Toast.LENGTH_SHORT).show();
                createWeexInstance();
                loadUrl(bundleUrl);
              }
            });
          }
        });
      } else {
        WXLogUtils.w("Weex", "can not get hot reload config");
      }
    } catch (JSONException e) {
      e.printStackTrace();
    }
  }

  if (mUri == null) {
    mUri = Uri.parse(AppConfig.getLaunchUrl());
  }

  if (!WXSoInstallMgrSdk.isCPUSupport()) {
    mProgressBar.setVisibility(View.INVISIBLE);
    mTipView.setText(R.string.cpu_not_support_tip);
    return;
  }

  String url = getUrl(mUri);
  if (getSupportActionBar() != null) {
    getSupportActionBar().setTitle(url);
    getSupportActionBar().hide();
  }
  loadUrl(url);
}
 
Example 7
Source File: IndexActivity.java    From analyzer-of-android-for-Apache-Weex with Apache License 2.0 4 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_index);
  setContainer((ViewGroup) findViewById(R.id.index_container));
  Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
  toolbar.setTitle("WEEX");
  setSupportActionBar(toolbar);

  mProgressBar = (ProgressBar) findViewById(R.id.index_progressBar);
  mTipView = (TextView) findViewById(R.id.index_tip);
  mProgressBar.setVisibility(View.VISIBLE);
  mTipView.setVisibility(View.VISIBLE);


  if(!WXSoInstallMgrSdk.isCPUSupport()){
    mProgressBar.setVisibility(View.INVISIBLE);
    mTipView.setText(R.string.cpu_not_support_tip);
    return;
  }

  if(TextUtils.equals(CURRENT_IP,DEFAULT_IP)){
    renderPage(WXFileUtils.loadAsset("index.js", this),WEEX_INDEX_URL);
  }else{
    renderPageByURL(WEEX_INDEX_URL);
  }


  mReloadReceiver=new BroadcastReceiver() {
    @Override
    public void onReceive(Context context, Intent intent) {
      createWeexInstance();
      if(TextUtils.equals(CURRENT_IP,DEFAULT_IP)){
        renderPage(WXFileUtils.loadAsset("index.js", IndexActivity.this),WEEX_INDEX_URL);
      }else{
        renderPageByURL(WEEX_INDEX_URL);
      }
      mProgressBar.setVisibility(View.VISIBLE);
    }
  };

  LocalBroadcastManager.getInstance(this).registerReceiver(mReloadReceiver,new IntentFilter(WXSDKEngine.JS_FRAMEWORK_RELOAD));
}