PageRenderTime 257ms CodeModel.GetById 25ms RepoModel.GetById 0ms app.codeStats 0ms

/src/com/sinonetwork/zhonghua/fragment/ZiXunFragment.java

https://gitlab.com/zwp/Zhonghua
Java | 615 lines | 498 code | 71 blank | 46 comment | 46 complexity | 4946ca18489957efad52830a5c9ed033 MD5 | raw file
  1. package com.sinonetwork.zhonghua.fragment;
  2. import java.util.ArrayList;
  3. import java.util.Calendar;
  4. import java.util.List;
  5. import java.util.concurrent.Executors;
  6. import java.util.concurrent.ScheduledExecutorService;
  7. import java.util.concurrent.TimeUnit;
  8. import android.annotation.SuppressLint;
  9. import android.content.Intent;
  10. import android.content.res.AssetManager;
  11. import android.graphics.Typeface;
  12. import android.os.Bundle;
  13. import android.os.Handler;
  14. import android.os.Parcelable;
  15. import android.support.v4.app.Fragment;
  16. import android.support.v4.view.PagerAdapter;
  17. import android.support.v4.view.ViewPager;
  18. import android.support.v4.view.ViewPager.OnPageChangeListener;
  19. import android.util.Log;
  20. import android.view.LayoutInflater;
  21. import android.view.View;
  22. import android.view.View.OnClickListener;
  23. import android.view.ViewGroup;
  24. import android.widget.Button;
  25. import android.widget.ImageView;
  26. import android.widget.ImageView.ScaleType;
  27. import android.widget.LinearLayout;
  28. import android.widget.RelativeLayout;
  29. import android.widget.TextView;
  30. import android.widget.TextView.BufferType;
  31. import com.alibaba.fastjson.JSONArray;
  32. import com.alibaba.fastjson.JSONObject;
  33. import com.lidroid.xutils.BitmapUtils;
  34. import com.lidroid.xutils.HttpUtils;
  35. import com.lidroid.xutils.exception.HttpException;
  36. import com.lidroid.xutils.http.RequestParams;
  37. import com.lidroid.xutils.http.ResponseInfo;
  38. import com.lidroid.xutils.http.callback.RequestCallBack;
  39. import com.lidroid.xutils.http.client.HttpRequest.HttpMethod;
  40. import com.sinonetwork.zhonghua.MyDengLu;
  41. import com.sinonetwork.zhonghua.NewsActivity;
  42. import com.sinonetwork.zhonghua.Price_information;
  43. import com.sinonetwork.zhonghua.Qixiang;
  44. import com.sinonetwork.zhonghua.R;
  45. import com.sinonetwork.zhonghua.SeasonManager;
  46. import com.sinonetwork.zhonghua.event.GetUserNameEvent;
  47. import com.sinonetwork.zhonghua.model.AdvertiseImgInfo;
  48. import com.sinonetwork.zhonghua.model.ZHAccount;
  49. import com.sinonetwork.zhonghua.utils.HttpHelp;
  50. import com.sinonetwork.zhonghua.utils.PrefUtil;
  51. import com.sinonetwork.zhonghua.utils.URLAddress;
  52. import com.sinonetwork.zhonghua.utils.ZhAccountPrefUtil;
  53. import com.sinonetwork.zhonghua.view.CollapsibleTextView;
  54. import de.greenrobot.event.EventBus;
  55. public class ZiXunFragment extends Fragment {
  56. private ImageView imgxinwen, imgqixiang, imghq;
  57. private Bundle bundle;
  58. private Intent intent;
  59. private TextView zixun_bt1;
  60. private ViewPager viewPager; // android-support-v4中的滑动组件
  61. private List<ImageView> imageViews; // 滑动的图片集合
  62. private String[] titles; // 图片标题
  63. private int[] imageResId; // 图片ID
  64. private List<View> dots; // 图片标题正文的那些点
  65. private TextView tv_title;
  66. private int currentItem = 0; // 当前图片的索引号
  67. private ScheduledExecutorService scheduledExecutorService;
  68. private TextView zixun_txt1;
  69. private List<AdvertiseImgInfo> advImgList = new ArrayList<AdvertiseImgInfo>();
  70. private int cropId = -1;
  71. LayoutInflater inflater;
  72. private RelativeLayout LoginLayout;
  73. private RelativeLayout UserLayout;
  74. private TextView zixunuser_name;
  75. private TextView zixunuser_yumi;
  76. private TextView zixunuser_yue;
  77. private TextView zixunuser_hk;
  78. private TextView zixunuser_dz;
  79. private TextView zixunuser_wendu;
  80. private TextView zixunuser_fl;
  81. private TextView zixunuser_wr;
  82. private TextView zixunuser_jg;
  83. private TextView zixunuser_jiage;
  84. private CollapsibleTextView zixunuser_zy1;
  85. private TextView zixunchakan;
  86. private LinearLayout zixun_bottomrl;
  87. private RelativeLayout rel_first;
  88. private Handler handler = new Handler() {
  89. public void handleMessage(android.os.Message msg) {
  90. viewPager.setCurrentItem(currentItem);// 切换当前显示的图片
  91. };
  92. };
  93. public View onCreateView(LayoutInflater inflater, ViewGroup container,
  94. Bundle savedInstanceState) {
  95. View zixunLayout = inflater.inflate(R.layout.activity_zixun, null);
  96. loadAdvertiseImages();// 加载广告条
  97. setFont(zixunLayout);// 提示的字体设置。
  98. rel_first = (RelativeLayout) zixunLayout.findViewById(R.id.rel_first);
  99. if (PrefUtil.getBooleanPref(this.getActivity(), "first_zixun", false)) {
  100. rel_first.setVisibility(View.GONE);
  101. }
  102. // 安装后第一次进入,显示提示界面
  103. ((Button) zixunLayout.findViewById(R.id.btn_know))
  104. .setOnClickListener(new View.OnClickListener() {
  105. @Override
  106. public void onClick(View v) {
  107. PrefUtil.savePref(ZiXunFragment.this.getActivity(),
  108. "first_zixun", true);
  109. rel_first.setVisibility(View.GONE);
  110. }
  111. });
  112. rel_first.setOnClickListener(new View.OnClickListener() {
  113. @Override
  114. public void onClick(View v) {
  115. PrefUtil.savePref(ZiXunFragment.this.getActivity(),
  116. "first_zixun", true);
  117. rel_first.setVisibility(View.GONE);
  118. }
  119. });
  120. initView(zixunLayout);//初始化控件
  121. //登录信息模块信息的展示
  122. if (PrefUtil.getBooleanPref(getActivity().getApplicationContext(),
  123. ZhAccountPrefUtil.IS_LOGINED_ACCOUNT, false)) {
  124. ZHAccount currentAccount = ZhAccountPrefUtil
  125. .getZHAccount(getActivity().getApplicationContext());
  126. LoginLayout.setVisibility(View.GONE);
  127. UserLayout.setVisibility(View.VISIBLE);
  128. zixun_bt1.setVisibility(View.GONE);
  129. String userName = currentAccount.getUserName();
  130. zixunuser_name.setText(userName);
  131. } else {
  132. LoginLayout.setVisibility(View.VISIBLE);
  133. UserLayout.setVisibility(View.GONE);
  134. zixun_bt1.setVisibility(View.VISIBLE);
  135. }
  136. //登录按钮的点击事件
  137. zixun_bt1.setOnClickListener(new OnClickListener() {
  138. @Override
  139. public void onClick(View v) {
  140. Intent intent = new Intent(getActivity(), MyDengLu.class);
  141. startActivity(intent);
  142. }
  143. });
  144. zixunchakan.setOnClickListener(new View.OnClickListener() {
  145. @Override
  146. public void onClick(View v) {
  147. ZHAccount currentAccount = ZhAccountPrefUtil
  148. .getZHAccount(getActivity().getApplicationContext());
  149. Intent intent = new Intent(ZiXunFragment.this.getActivity(),
  150. SeasonManager.class);
  151. Bundle bundle = new Bundle();
  152. bundle.putString("id", currentAccount.getCare() + "");
  153. intent.putExtras(bundle);
  154. startActivity(intent);
  155. }
  156. });
  157. imageResId = new int[] { R.drawable.a, R.drawable.b, R.drawable.c,
  158. R.drawable.d, R.drawable.e };
  159. titles = new String[imageResId.length];
  160. titles[0] = "农垦实现农业现代化";
  161. titles[1] = "农垦实现农业现代化";
  162. titles[2] = "农垦实现农业现代化";
  163. titles[3] = "农垦实现农业现代化";
  164. titles[4] = "农垦实现农业现代化";
  165. imageViews = new ArrayList<ImageView>();
  166. // 初始化图片资源
  167. for (int i = 0; i < imageResId.length; i++) {
  168. ImageView imageView = new ImageView(getActivity());
  169. imageView.setImageResource(imageResId[i]);
  170. imageView.setScaleType(ScaleType.CENTER_CROP);
  171. imageViews.add(imageView);
  172. }
  173. dots = new ArrayList<View>();
  174. dots.add(zixunLayout.findViewById(R.id.zixun_dot0));
  175. dots.add(zixunLayout.findViewById(R.id.zixun_dot1));
  176. dots.add(zixunLayout.findViewById(R.id.zixun_dot2));
  177. dots.add(zixunLayout.findViewById(R.id.zixun_dot3));
  178. dots.add(zixunLayout.findViewById(R.id.zixun_dot4));
  179. tv_title = (TextView) zixunLayout.findViewById(R.id.zixun_title);
  180. tv_title.setText(titles[0]);//
  181. viewPager = (ViewPager) zixunLayout.findViewById(R.id.zixun_viewpager);
  182. viewPager.setAdapter(new ZiXunAdapter());// 设置填充ViewPager页面的适配器
  183. // 设置一个监听器,当ViewPager中的页面改变时调用
  184. viewPager.setOnPageChangeListener(new MyPageChangeListener());
  185. imgxinwen.setOnClickListener(new OnClickListener() {
  186. @Override
  187. public void onClick(View v) {
  188. // TODO Auto-generated method stub
  189. intent = new Intent(getActivity(), NewsActivity.class);
  190. startActivity(intent);
  191. }
  192. });
  193. imghq.setOnClickListener(new OnClickListener() {
  194. @Override
  195. public void onClick(View v) {
  196. // TODO Auto-generated method stub
  197. intent = new Intent(getActivity(), Price_information.class);
  198. startActivity(intent);
  199. }
  200. });
  201. imgqixiang.setOnClickListener(new OnClickListener() {
  202. @Override
  203. public void onClick(View v) {
  204. // TODO Auto-generated method stub
  205. intent = new Intent(getActivity(), Qixiang.class);
  206. startActivity(intent);
  207. }
  208. });
  209. loadData();
  210. return zixunLayout;
  211. }
  212. //初始化控件
  213. private void initView(View zixunLayout) {
  214. imgxinwen = (ImageView) zixunLayout
  215. .findViewById(R.id.zixun_nyzx_icon01);
  216. imghq = (ImageView) zixunLayout.findViewById(R.id.zixun_nyzx_icon02);
  217. imgqixiang = (ImageView) zixunLayout
  218. .findViewById(R.id.zixun_nyzx_icon03);
  219. zixun_txt1 = (TextView) zixunLayout.findViewById(R.id.zixun_txt1);
  220. zixunuser_name = (TextView) zixunLayout
  221. .findViewById(R.id.zixunuser_name);
  222. zixun_bt1 = (TextView) zixunLayout.findViewById(R.id.zixun_bt1);
  223. LoginLayout = (RelativeLayout) zixunLayout
  224. .findViewById(R.id.zixun_centerrl);
  225. UserLayout = (RelativeLayout) zixunLayout
  226. .findViewById(R.id.zixunuser_centerrl);
  227. zixunuser_yumi = (TextView) zixunLayout
  228. .findViewById(R.id.zixunuser_yumi);
  229. zixunuser_yue = (TextView) zixunLayout.findViewById(R.id.zixunuser_yue);
  230. zixunuser_dz = (TextView) zixunLayout.findViewById(R.id.zixunuser_dz);
  231. zixunuser_hk = (TextView) zixunLayout.findViewById(R.id.zixunuser_hk);
  232. zixunuser_wendu = (TextView) zixunLayout
  233. .findViewById(R.id.zixunuser_wendu);
  234. zixunuser_fl = (TextView) zixunLayout.findViewById(R.id.zixunuser_fl);
  235. zixunuser_wr = (TextView) zixunLayout.findViewById(R.id.zixunuser_wr);
  236. zixunuser_jg = (TextView) zixunLayout.findViewById(R.id.zixunuser_jg);
  237. zixunuser_jiage = (TextView) zixunLayout
  238. .findViewById(R.id.zixunuser_jiage);
  239. zixunuser_zy1 = (CollapsibleTextView) zixunLayout
  240. .findViewById(R.id.zixunuser_zy1);
  241. zixunchakan = (TextView) zixunLayout.findViewById(R.id.zixunchakan);
  242. zixun_bottomrl = (LinearLayout) zixunLayout
  243. .findViewById(R.id.zixun_bottomrl);
  244. }
  245. // 设置字体
  246. private void setFont(View zixunLayout) {
  247. AssetManager mgr = getActivity().getAssets();// 得到AssetManager
  248. Typeface tf = Typeface.createFromAsset(mgr, "fonts/mini.ttf");// 根据路径得到Typeface
  249. // Typeface tf2=Typeface.createFromAsset(mgr,
  250. // "fonts/mini.ttf");//根据路径得到Typeface
  251. ((TextView) zixunLayout.findViewById(R.id.tv_introduction_register))
  252. .setTypeface(tf);// 设置字体
  253. }
  254. /**
  255. * 登录成功,返回首页的数据
  256. */
  257. public void loadData() {
  258. if (PrefUtil.getBooleanPref(getActivity().getApplicationContext(),
  259. ZhAccountPrefUtil.IS_LOGINED_ACCOUNT, false)) {// 登录成功
  260. ZHAccount currentAccount = ZhAccountPrefUtil
  261. .getZHAccount(getActivity().getApplicationContext());
  262. GetUserNameEvent event = new GetUserNameEvent();
  263. event.account = currentAccount;
  264. //发送消息
  265. EventBus.getDefault().post(event);
  266. LoginLayout.setVisibility(View.GONE);
  267. UserLayout.setVisibility(View.VISIBLE);// 登录成功后显示的界面
  268. zixun_bt1.setVisibility(View.GONE);
  269. String userName = currentAccount.getUserName();// 用户名
  270. //显示用户名
  271. zixunuser_name.setText(userName);
  272. //显示地区
  273. if (currentAccount.getParent_areaName().equals(
  274. currentAccount.getAreaName())) {
  275. zixunuser_hk.setText(currentAccount.getParent_areaName());
  276. } else {
  277. zixunuser_hk.setText(currentAccount.getParent_areaName()
  278. + currentAccount.getAreaName());
  279. }
  280. //网络Post请求所需要的参数
  281. RequestParams params = new RequestParams();
  282. params.addBodyParameter("method", "searchHomeMessage");
  283. if (currentAccount.getCare() == null
  284. || "".equals(currentAccount.getCare())) {
  285. } else {
  286. params.addBodyParameter("cropId", currentAccount.getCare());
  287. System.out.println("cropId:"+currentAccount.getCare());
  288. }
  289. if (currentAccount.getParent_areaName() == null
  290. || "".equals(currentAccount.getParent_areaName())) {
  291. } else {
  292. params.addBodyParameter("provinceName",
  293. currentAccount.getParent_areaName());
  294. System.out.println("provinceName"+currentAccount.getParent_areaName());
  295. }
  296. if (currentAccount.getAreaName() == null
  297. || "".equals(currentAccount.getAreaName())) {
  298. } else {
  299. params.addBodyParameter("cityName",
  300. currentAccount.getAreaName());
  301. System.out.println("cityName"+currentAccount.getAreaName());
  302. }
  303. // 使用的是第三方xUtils请求数据
  304. HttpHelp.getInstance().send(HttpMethod.POST, URLAddress.URLER,
  305. params, new RequestCallBack<String>() {
  306. @Override
  307. public void onFailure(HttpException arg0, String arg1) {
  308. }
  309. @Override
  310. public void onSuccess(ResponseInfo<String> resultInfo) {
  311. System.out.println("访问网络登录后返回的数据:"
  312. + resultInfo.result);
  313. //设置月份
  314. zixunuser_yue.setText((Calendar.getInstance().get(
  315. Calendar.MONTH) + 1)
  316. + "月");
  317. //设置关注作物
  318. JSONObject json = JSONObject
  319. .parseObject(resultInfo.result);
  320. // Log.v("zhong","json--"+json);
  321. if (json.getString("resultcode").equals("error")) {
  322. } else {
  323. //解析json对象
  324. JSONObject crop = json.getJSONObject("crop");
  325. JSONObject weather = json
  326. .getJSONObject("weather ");
  327. JSONObject quotation = json
  328. .getJSONObject("quotation");
  329. if (json.toString().indexOf("farmingGuide") > -1) {
  330. JSONArray farmGuide = json
  331. .getJSONArray("farmingGuide");
  332. ArrayList<String> guideList = new ArrayList<String>();
  333. if (farmGuide.size() > 0) {
  334. JSONObject jObject = JSONObject
  335. .parseObject(farmGuide.get(0)
  336. .toString());
  337. zixunuser_zy1.setDesc(
  338. "1."
  339. + jObject
  340. .getString("context"),
  341. BufferType.NORMAL);
  342. }
  343. } else {
  344. zixun_bottomrl.setTop(60);
  345. if (crop != null) {
  346. if (!crop.getString("cropDescription")
  347. .equals("")) {
  348. zixunuser_zy1.setDesc(
  349. crop.getString("cropDescription"),
  350. BufferType.NORMAL);
  351. } else {
  352. zixun_bottomrl.setTop(60);
  353. }
  354. }
  355. }
  356. //获取作物相关的信息,并保存
  357. if (crop == null) {
  358. PrefUtil.savePref(getActivity(),
  359. "zhonghua_crop", "");// 把作物保存到本地
  360. } else {
  361. zixunuser_yumi.setText(crop
  362. .getString("cropName"));
  363. zixunuser_jg.setText(crop
  364. .getString("cropName") + "市场价格:");
  365. PrefUtil.savePref(getActivity(),
  366. "zhonghua_crop",
  367. crop.getString("cropName"));// 把作物保存到本地
  368. }
  369. if (weather == null) {
  370. } else {
  371. zixunuser_dz.setText(weather
  372. .getString("districtcn") + ": ");
  373. zixunuser_wendu.setText(weather
  374. .getString("temperature") + "度 ");
  375. zixunuser_fl.setText("风力:"
  376. + weather.getString("windPower")
  377. + "级 ");
  378. zixunuser_wr.setText("污染指数:"
  379. + weather.getString("humidity"));
  380. }
  381. if (quotation == null) {
  382. } else {
  383. // zixunuser_hk.setText(quotation.getString("d1"));
  384. zixunuser_jiage.setText(quotation
  385. .getString("d4") + "元/公斤");
  386. }
  387. }
  388. }
  389. });
  390. }
  391. }
  392. @Override
  393. public void onStart() {
  394. scheduledExecutorService = Executors.newSingleThreadScheduledExecutor();
  395. // 当Activity显示出来后,每两秒钟切换一次图片显示
  396. // scheduledExecutorService.scheduleAtFixedRate(new ScrollTask(), 1, 2,
  397. // TimeUnit.SECONDS);
  398. scheduledExecutorService.scheduleAtFixedRate(new ScrollTask(), 1, 5,
  399. TimeUnit.SECONDS);
  400. if (PrefUtil.getBooleanPref(getActivity().getApplicationContext(),
  401. ZhAccountPrefUtil.IS_LOGINED_ACCOUNT, false)) {
  402. ZHAccount currentAccount = ZhAccountPrefUtil
  403. .getZHAccount(getActivity().getApplicationContext());
  404. LoginLayout.setVisibility(View.GONE);
  405. UserLayout.setVisibility(View.VISIBLE);
  406. zixun_bt1.setVisibility(View.GONE);
  407. String userName = currentAccount.getUserName();
  408. zixunuser_name.setText(userName);
  409. // loadData();
  410. } else {
  411. LoginLayout.setVisibility(View.VISIBLE);
  412. UserLayout.setVisibility(View.GONE);
  413. zixun_bt1.setVisibility(View.VISIBLE);
  414. }
  415. super.onStart();
  416. }
  417. @Override
  418. public void onStop() {
  419. // 当Activity不可见的时候停止切换
  420. scheduledExecutorService.shutdown();
  421. super.onStop();
  422. }
  423. /**
  424. * 网络获取广告的图片,并替换掉默认的图片
  425. */
  426. public void loadAdvertiseImages() {
  427. HttpUtils httpUtils = new HttpUtils();
  428. httpUtils.send(HttpMethod.GET, URLAddress.URLER
  429. + "?method=searchAdvertisements",
  430. new RequestCallBack<String>() {
  431. @Override
  432. public void onFailure(HttpException arg0, String arg1) {
  433. }
  434. @SuppressLint("ShowToast")
  435. @Override
  436. public void onSuccess(ResponseInfo<String> responseInfo) {
  437. JSONObject jsonObject = JSONObject
  438. .parseObject(responseInfo.result);
  439. JSONObject json = JSONObject.parseObject(jsonObject
  440. .toString());
  441. List<AdvertiseImgInfo> advImgList = JSONArray
  442. .parseArray(json.getJSONArray("resultdata")
  443. .toJSONString(), AdvertiseImgInfo.class);
  444. titles = new String[advImgList.size()];
  445. imageViews = new ArrayList<ImageView>();
  446. // 初始化图片资源
  447. for (int i = 0; i < advImgList.size(); i++) {
  448. ImageView imageView = new ImageView(getActivity());
  449. String imageUrl = advImgList.get(i).getPictures();
  450. if (!"".equals(imageUrl) && null != imageUrl) {
  451. new BitmapUtils(getActivity()).display(
  452. imageView, URLAddress.TPURLER
  453. + imageUrl);
  454. }
  455. titles[i] = advImgList.get(i).getTitle();
  456. imageView.setScaleType(ScaleType.CENTER_CROP);
  457. imageViews.add(imageView);
  458. }
  459. }
  460. });
  461. }
  462. private class ScrollTask implements Runnable {
  463. public void run() {
  464. synchronized (viewPager) {
  465. currentItem = (currentItem + 1) % imageViews.size();
  466. handler.obtainMessage().sendToTarget(); // 通过Handler切换图片
  467. }
  468. }
  469. }
  470. private class MyPageChangeListener implements OnPageChangeListener {
  471. private int oldPosition = 0;
  472. /**
  473. * This method will be invoked when a new page becomes selected.
  474. * position: Position index of the new selected page.
  475. */
  476. public void onPageSelected(int position) {
  477. currentItem = position;
  478. tv_title.setText(titles[position]);
  479. dots.get(oldPosition).setBackgroundResource(R.drawable.dot_normal);
  480. dots.get(position).setBackgroundResource(R.drawable.dot_focused);
  481. oldPosition = position;
  482. }
  483. public void onPageScrollStateChanged(int arg0) {
  484. }
  485. public void onPageScrolled(int arg0, float arg1, int arg2) {
  486. }
  487. }
  488. /**
  489. * 填充ViewPager页面的适配器
  490. *
  491. * @author Administrator
  492. *
  493. */
  494. private class ZiXunAdapter extends PagerAdapter {
  495. @Override
  496. public int getCount() {
  497. return imageResId.length;
  498. }
  499. @Override
  500. public Object instantiateItem(View arg0, int arg1) {
  501. ((ViewPager) arg0).addView(imageViews.get(arg1));
  502. return imageViews.get(arg1);
  503. }
  504. @Override
  505. public void destroyItem(View arg0, int arg1, Object arg2) {
  506. ((ViewPager) arg0).removeView((View) arg2);
  507. }
  508. @Override
  509. public boolean isViewFromObject(View arg0, Object arg1) {
  510. return arg0 == arg1;
  511. }
  512. @Override
  513. public void restoreState(Parcelable arg0, ClassLoader arg1) {
  514. }
  515. @Override
  516. public Parcelable saveState() {
  517. return null;
  518. }
  519. @Override
  520. public void startUpdate(View arg0) {
  521. }
  522. @Override
  523. public void finishUpdate(View arg0) {
  524. }
  525. }
  526. // 设置用户信息模块
  527. public void setHomeView() {
  528. if (PrefUtil.getBooleanPref(getActivity().getApplicationContext(),
  529. ZhAccountPrefUtil.IS_LOGINED_ACCOUNT, false)) {// 判断用户是否登陆过
  530. ZHAccount currentAccount = ZhAccountPrefUtil
  531. .getZHAccount(getActivity().getApplicationContext());// 将信息保存到实体bean中
  532. LoginLayout.setVisibility(View.GONE);// 登录按钮
  533. UserLayout.setVisibility(View.VISIBLE);// 用户登陆后信息展示的布局
  534. zixun_bt1.setVisibility(View.GONE);// 用户登录之前信息展示的布局
  535. String userName = currentAccount.getUserName();
  536. zixunuser_name.setText(userName);
  537. loadData();
  538. } else {// 未登陆过
  539. LoginLayout.setVisibility(View.VISIBLE);
  540. UserLayout.setVisibility(View.GONE);
  541. zixun_bt1.setVisibility(View.VISIBLE);
  542. }
  543. }
  544. }