android[unchecked call to as a member as raw type]

之前的HomePageContract

public interface HomeFraPageContract {

    interface View extends BaseView {
        /**
         * 获取首页顶部5个数据成功
         * @param data
         */
        void getTop5Success(T data);
    }

    interface Presenter extends BasePresenter {
        /**
         * 首页顶部5个数据
         * @param activity activity
         */
        void getTop5(BaseActivity activity);
}

之前的Presenter

private IGetDataDelegate mGetDataDelegate = new IGetDataDelegate() {
        @Override
        public void getDataSuccess(EntityForTop5 entity) {
            //studio高亮了下面这个方法 见图1
            mPresenterView.getTop5Success(entity);
        }

        @Override
        public void getDataError(String msg) {
            //mPresenterView.showToast(msg);
        }
    };
图1

高亮的原因大概是泛型使用不规范。为了不让studio再高亮,也为了代码看起来更清爽,直接在方法里面指定了类型,做了如下的修改。
修改后的HomePageContract

public interface HomeFraPageContract {

    interface View extends BaseView {
        /**
         * 获取首页顶部5个数据成功
         * @param data
         */
        void getTop5Success(EntityForTop5 data);
    }

    interface Presenter extends BasePresenter {
        /**
         * 首页顶部5个数据
         * @param activity activity
         */
        void getTop5(BaseActivity activity);
}

Presenter不用改变,高亮已经消失了。见图2

    private IGetDataDelegate mGetDataDelegate = new IGetDataDelegate() {
        @Override
        public void getDataSuccess(EntityForTop5 entity) {
            mPresenterView.getTop5Success(entity);
        }

        @Override
        public void getDataError(String msg) {
            //mPresenterView.showToast(msg);
        }
    };
图2

你可能感兴趣的:(android[unchecked call to as a member as raw type])