public void sendRequest(RequestParams params, Class<? extends Model> modeltype, int requsetType) { if (params != null && modeltype != null) { if (mRequst == null) { mRequst = Request.getSingleRequest(); } if (requsetType == 0) { mRequst.get(mApp.getHostUrl(), params, new MyAsyncHttpResponseHandler(modeltype)); } else { mRequst.post(mApp.getHostUrl(), params, new MyAsyncHttpResponseHandler(modeltype)); } } }
/** * 判断这个用户是否登录过 * * <p>如果个别fragement对用户开发的话,就重新这个方法,然后return true就可以了 * * @return */ public boolean checkTheUser() { ModelUser user = mApp.getUser(); user.toString(); if (user != null && user.getOauth_token() != null) { return true; } ToastUtils.showToast("请先登录"); return false; }
/** 初始化设置 */ public void initSet() { mApp = (MyApplication) getApplication(); mApp.setActivity(this); mInflater = LayoutInflater.from(getApplicationContext()); initTheCommonLayout(); // 把内容和title结合 setContentView(combineTheLayout()); initIntent(); initView(); initData(); initListener(); doRefreshNew(); }