判斷使用者是不是第一次登陸
阿新 • • 發佈:2019-01-02
SharedPreferences sharedPreferences = this.getSharedPreferences( "share", MODE_PRIVATE); boolean isFirstRun = sharedPreferences.getBoolean("isFirstRun", true); boolean apply = sharedPreferences.getBoolean("apply", true); boolean patch = sharedPreferences.getBoolean("patch", true); Editor editor = sharedPreferences.edit(); Map<String, Object> creditData = MyApplication.getGlobalVar().getCreditData(); if(MyApplication.getGlobalVar().getHomeStatus()!=null){ Map<String, Object> item = MyApplication.getGlobalVar().getHomeStatus().get(1); if (isFirstRun && WelcomeActivity.isLogin&& tsed1.get("showRed").equals("true")) { // 判斷快取 是否是第一次登陸 Log.e("debug", "isFirstRun第一次執行"); editor.putBoolean("isFirstRun", false); editor.commit(); img.setImageResource(R.drawable.a4); // } else if (apply&&(Boolean) item.get("isTip")==true&&WelcomeActivity.isLogin) {// 判斷申請&& rightTxt0.get("rightTxt").equals("已驗證")&& rightTxt2.get("rightTxt").equals("已驗證")&& rightTxt3.get("rightTxt").equals("已驗證") editor.putBoolean("apply", false); editor.commit(); Log.e("debug", "apply第一次執行"); img.setImageResource(R.drawable.apply); } else if (patch && WelcomeActivity.isLogin &&creditData.get("cashadvanceStatus").equals("待補件")) {// 判斷補件 // homeStatus.get("cashadvanceStatus").equals("待補件") editor.putBoolean("patch", false); editor.commit(); Log.e("debug", "patch第一次執行"); Show(); img.setImageResource(R.drawable.patch); } }