private void init2cu() { DataManager.findAlarmMaskByActiveUser(PreMainActivity.this, ""); NpcCommon.verifyNetwork(PreMainActivity.this); regFilter(); if (!verifyLogin()) { String accountstr = SharepreferenceUtil.readString( PreMainActivity.this, SharepreferenceUtil.fileName, "account"); String pwd2cu = SharepreferenceUtil.readString( PreMainActivity.this, SharepreferenceUtil.fileName, "pwd2cu"); loginVideo("newyywapp" + accountstr + "@yywapp.com", pwd2cu); } else { FList.getInstance(); P2PHandler.getInstance().p2pInit(this, new P2PListener(), new SettingListener()); connect(); getAccountInfo(); } }
private void initData() { // TODO Auto-generated method stub uid = SharepreferenceUtil.readString(PreMainActivity.this, SharepreferenceUtil.fileName, "uid"); finalBitmap = FinalBitmap.create(PreMainActivity.this); if (ContextUtil.getHeith(PreMainActivity.this) <= 480) { // RelativeLayout.LayoutParams linearParams = (RelativeLayout.LayoutParams) fl_ad // .getLayoutParams(); // linearParams.height = ContextUtil.dip2px(PreMainActivity.this, 60); // fl_ad.setLayoutParams(linearParams); dpitype = "l"; } else if (ContextUtil.getHeith(PreMainActivity.this) <= 800) { // if(ContextUtil.getWidth(this)<=480) // RelativeLayout.LayoutParams linearParams = (RelativeLayout.LayoutParams) fl_ad // .getLayoutParams(); // linearParams.height = ContextUtil.dip2px(PreMainActivity.this, 140); // fl_ad.setLayoutParams(linearParams); dpitype = "l"; } else if (ContextUtil.getHeith(PreMainActivity.this) <= 860) { // if(ContextUtil.getWidth(this)<=480) // RelativeLayout.LayoutParams linearParams = (RelativeLayout.LayoutParams) fl_ad // .getLayoutParams(); // linearParams.height = ContextUtil.dip2px(PreMainActivity.this, 150); // fl_ad.setLayoutParams(linearParams); dpitype = "l"; } else if (ContextUtil.getHeith(PreMainActivity.this) <= 960) { // if(ContextUtil.getWidth(this)<=480) // RelativeLayout.LayoutParams linearParams = (RelativeLayout.LayoutParams) fl_ad // .getLayoutParams(); // linearParams.height = ContextUtil.dip2px(PreMainActivity.this, 180); // fl_ad.setLayoutParams(linearParams); dpitype = "m"; } else if (ContextUtil.getHeith(PreMainActivity.this) <= 1280) { // RelativeLayout.LayoutParams linearParams = (RelativeLayout.LayoutParams) fl_ad // .getLayoutParams(); // linearParams.height = ContextUtil.dip2px(PreMainActivity.this, 200); // fl_ad.setLayoutParams(linearParams); dpitype = "m"; } else { // RelativeLayout.LayoutParams linearParams = (RelativeLayout.LayoutParams) fl_ad // .getLayoutParams(); // linearParams.height = ContextUtil.dip2px(PreMainActivity.this, 210); // fl_ad.setLayoutParams(linearParams); dpitype = "h"; } RelativeLayout.LayoutParams linearParams = (RelativeLayout.LayoutParams) fl_ad.getLayoutParams(); linearParams.width = ContextUtil.getWidth(PreMainActivity.this); linearParams.height = linearParams.width / 2; fl_ad.setLayoutParams(linearParams); BitMapUtil.getImgOpt(PreMainActivity.this, finalBitmap, mJazzy, R.drawable.os_login_topicon); }
// 获取个人资料 protected void getGrzl() { final String uid = SharepreferenceUtil.readString(MainActivity.this, SharepreferenceUtil.fileName, "uid"); CellComAjaxParams cellComAjaxParams = new CellComAjaxParams(); cellComAjaxParams.put("uid", uid); HttpHelper.getInstances(MainActivity.this) .send( FlowConsts.YYW_USERINFO, cellComAjaxParams, CellComAjaxHttp.HttpWayMode.POST, new CellComHttpInterface.NetCallBack<CellComAjaxResult>() { @Override public void onStart() { // TODO Auto-generated method stub super.onStart(); } @Override public void onFailure(Throwable t, String strMsg) { // TODO Auto-generated method stub super.onFailure(t, strMsg); } @Override public void onSuccess(CellComAjaxResult arg0) { // TODO Auto-generated method stub UserInfoComm userInfoComm = arg0.read(UserInfoComm.class, CellComAjaxResult.ParseType.GSON); String state = userInfoComm.getReturnCode(); String msg = userInfoComm.getReturnMessage(); if (!FlowConsts.STATUE_1.equals(state)) { ShowMsg(msg); return; } initValue(userInfoComm.getBody(), uid); if (SharepreferenceUtil.readString( MainActivity.this, SharepreferenceUtil.fileName, "huafei", "") .equals("")) { tv_kyhf.setText("¥0"); } else { tv_kyhf.setText( "¥" + SharepreferenceUtil.readString( MainActivity.this, SharepreferenceUtil.fileName, "huafei", "")); } } }); }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View inflate = inflater.inflate(R.layout.os_dhb_syzx_bs_fragment, container, false); final GridView gv = (GridView) inflate.findViewById(R.id.gv_bs_os_dhb_syzx_fragment); String u_id = SharepreferenceUtil.readString( DhbSyzxBsFragment.this.getActivity(), SharepreferenceUtil.fileName, "uid", ""); // uid:app用户编号 // pageid:当前页面,每页2个商品 // area:区域 1 本市 2 全省 3 全国 String path = FlowConsts.DHB_SYZX_TJSP_PATH + "uid=" + u_id + "&pageid=1&area=1"; DhbGetTJSP dgtj = new DhbGetTJSP(); dgtj.getData(path, mHttp, gv, DhbSyzxBsFragment.this.getActivity()); return inflate; // 加载期间,展开的layout是否应当附着到ViewGroup上 }
@Override protected void onResume() { // TODO Auto-generated method stub super.onResume(); DhbFragmentActivity dhbactivit = (DhbFragmentActivity) lam.getActivity("dhb"); JshFragmentActivity jshactivit = (JshFragmentActivity) lam.getActivity("jsh"); CshFragmentActivity cshactivit = (CshFragmentActivity) lam.getActivity("csh"); if (dhbactivit != null) { dhbactivit.reflesh(); } if (jshactivit != null) { jshactivit.reflesh(); } if (cshactivit != null) { cshactivit.reflesh(); } getGrzl(); if (SharepreferenceUtil.readString(this, SharepreferenceUtil.fileName, "huafei", "") .equals("")) { tv_kyhf.setText("¥0"); } else { tv_kyhf.setText( "¥" + SharepreferenceUtil.readString(this, SharepreferenceUtil.fileName, "huafei", "")); } if (SharepreferenceUtil.readString(this, SharepreferenceUtil.fileName, "yinyuan", "") .equals("")) { tv_kyyy.setText("0个"); } else { tv_kyyy.setText( SharepreferenceUtil.readString(this, SharepreferenceUtil.fileName, "yinyuan", "") + "个"); } if (SharepreferenceUtil.readString(this, SharepreferenceUtil.fileName, "jifen", "") .equals("")) { tv_kyjf.setText("0分"); } else { tv_kyjf.setText( SharepreferenceUtil.readString(this, SharepreferenceUtil.fileName, "jifen", "") + "分"); } }
@Override public void onReceive(Context arg0, Intent intent) { // TODO Auto-generated method stub if (intent.getAction().equals(Constants.Action.ACTION_NETWORK_CHANGE)) { boolean isNetConnect = false; ConnectivityManager connectivityManager = (ConnectivityManager) PreMainActivity.this.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo activeNetInfo = connectivityManager.getActiveNetworkInfo(); if (activeNetInfo != null) { if (activeNetInfo.isConnected()) { isNetConnect = true; LogMgr.showLog( "mReceiver==>" + getResources().getString(R.string.os_message_net_connect)); } else { LogMgr.showLog( "mReceiver==>" + getResources().getString(R.string.os_network_error)); } if (activeNetInfo.getType() == ConnectivityManager.TYPE_WIFI) { NpcCommon.mNetWorkType = NETWORK_TYPE.NETWORK_WIFI; } else { NpcCommon.mNetWorkType = NETWORK_TYPE.NETWORK_2GOR3G; } } else { LogMgr.showLog("mReceiver==>" + getResources().getString(R.string.os_network_error)); } NpcCommon.setNetWorkState(isNetConnect); Intent intentNew = new Intent(); intentNew.setAction(Constants.Action.NET_WORK_TYPE_CHANGE); PreMainActivity.this.sendBroadcast(intentNew); } else if (intent.getAction().equals(Constants.Action.ACTION_SWITCH_USER)) { Account account = AccountPersist.getInstance().getActiveAccountInfo(PreMainActivity.this); exitConn(account); AccountPersist.getInstance().setActiveAccount(PreMainActivity.this, new Account()); NpcCommon.mThreeNum = ""; Intent i = new Intent(MyApp.MAIN_SERVICE_START); stopService(i); String accountstr = SharepreferenceUtil.readString( PreMainActivity.this, SharepreferenceUtil.fileName, "account"); String pwd2cu = SharepreferenceUtil.readString( PreMainActivity.this, SharepreferenceUtil.fileName, "pwd2cu"); loginVideo("newyywapp" + accountstr + "@yywapp.com", pwd2cu); } else if (intent.getAction().equals(Constants.Action.SESSION_ID_ERROR)) { Account account = AccountPersist.getInstance().getActiveAccountInfo(PreMainActivity.this); exitConn(account); AccountPersist.getInstance().setActiveAccount(PreMainActivity.this, new Account()); Intent i = new Intent(MyApp.MAIN_SERVICE_START); stopService(i); String accountstr = SharepreferenceUtil.readString( PreMainActivity.this, SharepreferenceUtil.fileName, "account"); String pwd2cu = SharepreferenceUtil.readString( PreMainActivity.this, SharepreferenceUtil.fileName, "pwd2cu"); loginVideo("newyywapp" + accountstr + "@yywapp.com", pwd2cu); } else if (intent.getAction().equals(Constants.Action.ACTION_EXIT)) { /** 屏蔽退出确认弹出框 */ } else if (intent.getAction().equals(Intent.ACTION_LOCALE_CHANGED)) { } else if (intent.getAction().equals(Constants.Action.RECEIVE_MSG)) { /** 暂时屏蔽接收消息 */ /* * int result = intent.getIntExtra("result", -1); String msgFlag * = intent.getStringExtra("msgFlag"); * if(result==Constants.P2P_SET.ACK_RESULT.ACK_SUCCESS){ * DataManager.updateMessageStateByFlag(MainActivity.this, * msgFlag, Constants.MessageType.SEND_SUCCESS); Intent refresh * = new Intent(); * refresh.setAction(MessageActivity.REFRESH_MESSAGE); * sendBroadcast(refresh); }else{ * DataManager.updateMessageStateByFlag(MainActivity.this, * msgFlag, Constants.MessageType.SEND_FAULT); Intent refresh = * new Intent(); * refresh.setAction(MessageActivity.REFRESH_MESSAGE); * sendBroadcast(refresh); } */ } else if (intent.getAction().equals(Constants.Action.RECEIVE_SYS_MSG)) { } else if (intent.getAction().equals(Constants.Action.ACTION_UPDATE)) { /** 检测更新屏蔽 */ } }