ym6745476 / andbase

andbase快速开发框架@Deprecated
671 stars 423 forks source link

abactivity中一个地方,有点想法 #3

Open lf951515851 opened 9 years ago

lf951515851 commented 9 years ago
public void setContentView(int layoutResID) {
        super.setContentView(layoutResID);
        initIocView();
    }

public void setAbContentView(View contentView) {
        contentLayout.removeAllViews();
        contentLayout.addView(contentView,new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
        //ioc
        initIocView();
    }

中都有initIocView();在实践开发中如果这样:

protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);//父类方法中会调用setContentView
        setAbContentView(R.layout.activity_main);
    }

就会调用两次initIocView();如果界面定义的iocview比较多的话,性能会有较大影响

ym6745476 commented 9 years ago

谢谢反馈 这应该是一个bug,稍后我们会修复这个问题

2015-05-29

zhaoqp2010

发件人:lf951515851 notifications@github.com 发送时间:2015-05-29 09:59 主题:[andbase] abactivity中一个地方,有点想法 (#3) 收件人:"zhaoqp2010/andbase"andbase@noreply.github.com 抄送:

public void setContentView(int layoutResID) { super.setContentView(layoutResID); initIocView(); } 和 public void setAbContentView(View contentView) { contentLayout.removeAllViews(); contentLayout.addView(contentView,new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); //ioc initIocView(); } 中都有initIocView();在实践开发中如果这样: protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);//父类方法中会调用setContentView setAbContentView(R.layout.activity_main); } 就会调用两次initIocView();如果界面定义的iocview比较多的话,性能会有较大影响 — Reply to this email directly or view it on GitHub.

lf951515851 commented 9 years ago
/**
     * 描述:用指定的View填充主界面.
     * @param contentView  指定的View
     */
    public void setAbContentView(View contentView) {
        contentLayout.removeAllViews();
        contentLayout.addView(contentView,new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));

    }

将setAbContentView()中的initIocView();去掉不太好吧.

@AbIocView(id = R.id.mText)TextView mTextView;

protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);//父类方法中会调用setContentView
        setAbContentView(R.layout.activity_main);
    }

这样控件是获取不到的,demo中的ioc实例就出现这样的问题了,感觉还是将setContentView中的initIocView()去掉,只使用setAbContentView

ym6745476 commented 9 years ago

ok 谢谢

2015-06-03

zhaoqp2010

发件人:lf951515851 notifications@github.com 发送时间:2015-06-02 09:10 主题:Re: [andbase] abactivity中一个地方,有点想法 (#3) 收件人:"zhaoqp2010/andbase"andbase@noreply.github.com 抄送:"zhaoqp"zhaoqp2010@163.com

/* * 描述:用指定的View填充主界面. * @param contentView 指定的View / public void setAbContentView(View contentView) { contentLayout.removeAllViews(); contentLayout.addView(contentView,new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));

}

将setAbContentView()中的initIocView();去掉不太好吧. @AbIocView(id = R.id.mText)TextView mTextView;

protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);//父类方法中会调用setContentView setAbContentView(R.layout.activity_main); } 这样控件是获取不到的,demo中的ioc实例就出现这样的问题了,感觉还是将setContentView中的initIocView()去掉,只使用setAbContentView — Reply to this email directly or view it on GitHub.