@Override public void onClick(View v) { if (dropboxConnect.isLinked()) { dropboxConnect.unLink(); dropboxConnect.clearAccessToken(); btnLinkToDropbox.setText("Link to DropBox"); } else dropboxConnect.getSession().startOAuth2Authentication(getActivity()); }
@Override public void onResume() { super.onResume(); dropboxConnect.saveAccessToken(); setLinked(dropboxConnect.isLinked()); Control.sendRefreshDropbox(); Log.d(">>>> THAI <<<<", "onResume() Fragment_Dropbox"); }
@Override public void onClick(View v) { if (dropboxConnect.isLinked()) { DropboxLoadFileList loadFileList = new DropboxLoadFileList( Fragment_Dropbox.this, dropboxConnect.getDropboxAPI(), DropboxConnect.MUSIC_DIR); loadFileList.execute(); } else { dropboxConnect.getSession().startOAuth2Authentication(getActivity()); } Log.d(">>>> THAI <<<<", "DropboxLoadFileList()"); }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_dropbox, container, false); btnLinkToDropbox = (Button) rootView.findViewById(R.id.btnLinkToDropbox); btnLoadList = (Button) rootView.findViewById(R.id.btnLoadDropboxList); listDropbox = (ListView) rootView.findViewById(R.id.ListDropbox); adapter = new ArrayAdapter<SongItem>(getActivity(), android.R.layout.simple_list_item_1, songList); listDropbox.setAdapter(adapter); listDropbox.setOnItemClickListener(onDroptItempClick); btnLinkToDropbox.setOnClickListener(onClickLinktoDropbox); btnLoadList.setOnClickListener(onClickLoadListFile); setLinked(dropboxConnect.isLinked()); Log.d(">>>> THAI <<<<", "onCreateView() Fragment_Dropbox"); return rootView; }