/** @param constantLayoutHeight */ private void configLoginLogout(int constantLayoutHeight) { /* * Login/Logut */ RelativeLayout logOut = (RelativeLayout) rootView.findViewById(R.id.log_out_field); logOut.getLayoutParams().height = constantLayoutHeight; SCUserController userController = SCUserController.getInstance(); if (!userController.isLogin()) { ((TextView) rootView.findViewById(R.id.logout_id)).setText("Log in"); } logOut.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub SCUserController soundCloudUserController = SCUserController.getInstance(); soundCloudUserController.logout(); SCLoginDatabaseTable databaseHandler = SCLoginDatabaseTable.getInstance(getActivity()); databaseHandler.clearTable(); Intent loginAct = new Intent(getActivity(), UserLoginActivity.class); startActivity(loginAct); } }); }
@Override protected String doInBackground(String... params) { // TODO Auto-generated method stub SongController songController = SongController.getInstance(); songController.initialSongCategory(); SCUserController soundCloudUserController = SCUserController.getInstance(); ApiWrapper wrapper = new ApiWrapper(CLIENT_ID, CLIENT_SECRET, null, soundCloudUserController.getToken()); try { HttpResponse resp = wrapper.get(Request.to(ME_FAVORITES)); stringResponse = Http.getString(resp); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return null; }
@Override protected void onPostExecute(String result) { // TODO Auto-generated method stub MusicPlayerMainActivity.type = MusicPlayerMainActivity.SOUNDCLOUD_EXPLORE; Intent i = new Intent(getActivity(), MusicPlayerMainActivity.class); SCUserController soundCloudUserController = SCUserController.getInstance(); soundCloudUserController.setResponseString(stringResponse); Bundle bundle; try { bundle = soundCloudUserController.getBundle(soundCloudUserController.getCurrentUser()); i.putExtra(USER, bundle); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } // i.putExtra(ME_FAVORITES,stringResponse); MusicPlayerMainActivity.getActivity().finish(); startActivity(i); UIController.getInstance().updateUiAppChanged(APP_RUNNING); pDialog.dismiss(); }