Search in sources :

Example 6 with PageBean

use of vip.kuaifan.weiui.extend.bean.PageBean in project weiui by kuaifan.

the class weiuiPage method getWinInfo.

public static PageBean getWinInfo(String name) {
    if (name == null) {
        return null;
    }
    PageBean mBean = getPageBean(name);
    if (mBean == null) {
        return null;
    }
    Activity activity = mBean.getActivity();
    if (activity == null) {
        return null;
    }
    if (activity instanceof PageActivity) {
        return ((PageActivity) activity).getPageInfo();
    }
    return null;
}
Also used : PageActivity(vip.kuaifan.weiui.PageActivity) PageBean(vip.kuaifan.weiui.extend.bean.PageBean) PageActivity(vip.kuaifan.weiui.PageActivity) Activity(android.app.Activity)

Example 7 with PageBean

use of vip.kuaifan.weiui.extend.bean.PageBean in project weiui by kuaifan.

the class weiuiPage method closeWin.

public static void closeWin(String name) {
    if (name == null) {
        return;
    }
    PageBean mBean = getPageBean(name);
    if (mBean == null) {
        return;
    }
    Activity activity = mBean.getActivity();
    if (activity == null) {
        return;
    }
    activity.finish();
}
Also used : PageBean(vip.kuaifan.weiui.extend.bean.PageBean) PageActivity(vip.kuaifan.weiui.PageActivity) Activity(android.app.Activity)

Example 8 with PageBean

use of vip.kuaifan.weiui.extend.bean.PageBean in project weiui by kuaifan.

the class weiuiPage method reloadWin.

public static void reloadWin(String name) {
    if (name == null) {
        return;
    }
    PageBean mBean = getPageBean(name);
    if (mBean == null) {
        return;
    }
    Activity activity = mBean.getActivity();
    if (activity == null) {
        return;
    }
    if (activity instanceof PageActivity) {
        ((PageActivity) activity).reload();
    }
}
Also used : PageActivity(vip.kuaifan.weiui.PageActivity) PageBean(vip.kuaifan.weiui.extend.bean.PageBean) PageActivity(vip.kuaifan.weiui.PageActivity) Activity(android.app.Activity)

Example 9 with PageBean

use of vip.kuaifan.weiui.extend.bean.PageBean in project weiui by kuaifan.

the class weiuiPage method rewriteUrl.

public static String rewriteUrl(Context context, String url) {
    if (url == null || url.startsWith("http") || url.startsWith("ftp://")) {
        return url;
    }
    if (context instanceof PageActivity) {
        PageBean info = ((PageActivity) context).getPageInfo();
        if (info != null) {
            try {
                URL tmp = new URL(info.getUrl());
                String newUrl = tmp.getProtocol() + "://" + tmp.getHost();
                newUrl += (tmp.getPort() > -1 && tmp.getPort() != 80) ? (":" + tmp.getPort()) : "";
                if (url.startsWith("/")) {
                    return newUrl + url;
                } else {
                    String path = "/";
                    int lastIndex = tmp.getPath().lastIndexOf("/");
                    if (lastIndex > -1) {
                        path = tmp.getPath().substring(0, lastIndex + 1);
                    }
                    return newUrl + path + url;
                }
            } catch (MalformedURLException e) {
                e.printStackTrace();
            }
        }
    }
    return url;
}
Also used : PageActivity(vip.kuaifan.weiui.PageActivity) MalformedURLException(java.net.MalformedURLException) PageBean(vip.kuaifan.weiui.extend.bean.PageBean) URL(java.net.URL)

Example 10 with PageBean

use of vip.kuaifan.weiui.extend.bean.PageBean in project weiui by kuaifan.

the class WelcomeActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_splash);
    View textView = findViewById(R.id.fullscreen_content);
    ScaleAnimation scaleAnimation = new ScaleAnimation(0.0f, 1.0f, 0.0f, 1.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    AnimationSet animationSet = new AnimationSet(false);
    animationSet.addAnimation(scaleAnimation);
    animationSet.setDuration(1500);
    animationSet.setAnimationListener(new Animation.AnimationListener() {

        @Override
        public void onAnimationStart(Animation animation) {
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            PageBean mBean = new PageBean();
            // mBean.setUrl("http://192.168.2.125:8081/dist/index.js");
            // mBean.setUrl("http://192.168.1.6:8081/dist/index.js");
            mBean.setUrl("http://kuaifan.vip/weiui/dist/index.js");
            mBean.setPageType("weex");
            // mBean.setCache(24 * 60 * 60 * 1000);
            weiuiPage.openWin(WelcomeActivity.this, mBean);
            finish();
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        }
    });
    textView.startAnimation(animationSet);
}
Also used : PageBean(vip.kuaifan.weiui.extend.bean.PageBean) ScaleAnimation(android.view.animation.ScaleAnimation) Animation(android.view.animation.Animation) View(android.view.View) AnimationSet(android.view.animation.AnimationSet) ScaleAnimation(android.view.animation.ScaleAnimation)

Aggregations

PageBean (vip.kuaifan.weiui.extend.bean.PageBean)14 PageActivity (vip.kuaifan.weiui.PageActivity)6 JSONObject (com.alibaba.fastjson.JSONObject)5 Activity (android.app.Activity)4 JSMethod (com.taobao.weex.annotation.JSMethod)3 View (android.view.View)2 Animation (android.view.animation.Animation)2 JSCallback (com.taobao.weex.bridge.JSCallback)2 HashMap (java.util.HashMap)2 List (java.util.List)2 Map (java.util.Map)2 Context (android.content.Context)1 Intent (android.content.Intent)1 Bitmap (android.graphics.Bitmap)1 Point (android.graphics.Point)1 RequiresApi (android.support.annotation.RequiresApi)1 ViewGroup (android.view.ViewGroup)1 AnimationSet (android.view.animation.AnimationSet)1 ScaleAnimation (android.view.animation.ScaleAnimation)1 FrameLayout (android.widget.FrameLayout)1