@Override protected List<CodeRepositories> doInBackground(Void... params) { Log.d("BaseFragment", "Start" + pos); while (AppApplication.Get().repositories.get(pos) == null) { try { synchronized (AppApplication.Get().repositories) { AppApplication.Get().repositories.wait(); } Log.d("BaseFragment", "wait finish" + pos); } catch (InterruptedException e) { Log.d("BaseFragment", "wait interrupted" + pos); } } Log.d("BaseFragment", pos + "End" + AppApplication.Get().repositories.get(pos).size()); return AppApplication.Get().repositories.get(pos); }
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == LOGIN_REQUEST_CODE) { if (resultCode == Activity.RESULT_OK) { Log.d(TAG, "Activity.RESULT_OK"); app.setConnected(true); } else if (resultCode == Activity.RESULT_CANCELED) { Log.d(TAG, "Activity.RESULT_CANCELED"); app.setConnected(false); // Çë¼ì²éÍøÂçÁ´½Ó¡¢appkeyÊÇ·ñÌîдÕýÈ· Toast.makeText(this, "Á´½Ó·þÎñÆ÷ʧ°Ü", Toast.LENGTH_LONG).show(); } } }
@Override protected void onStart() { super.onStart(); Log.d(TAG, "onStart"); if (!app.isConnected()) { Log.d(TAG, "start login"); Intent login = new Intent(this, LoginActivity.class); startActivityForResult(login, LOGIN_REQUEST_CODE); } else { Log.d(TAG, "already logged in"); } }