private void setContent() { SyncPair syncPair = activity.getSyncPair(); CloudAccount cloudAccount = syncPair.getCloudAccount(); String localPath = syncPair.getLocalPath(); String remotePath = syncPair.getRemotePath(); if (cloudAccount != null) { String userName = cloudAccount.getUserName(); accountText.setText(userName); setSelectedFlag(accountText); int imageResId; switch (cloudAccount.getProviderType()) { case ProviderInfo.DROPBOX: imageResId = R.drawable.icon_dropbox; break; case ProviderInfo.BAIDUCLOUD: imageResId = R.drawable.icon_baidu_cloud; break; case ProviderInfo.GOOGLEDRIVE: imageResId = R.drawable.icon_google_drive; break; case ProviderInfo.KINGSOFT: imageResId = R.drawable.icon_kingsorf_cloud; break; case ProviderInfo.SINACLOUD: imageResId = R.drawable.icon_sina_cloud; break; case ProviderInfo.SUGARSYNC: imageResId = R.drawable.icon_sugar_sync; break; default: imageResId = R.drawable.user_group_new; break; } account_left.setImageResource(imageResId); } if (localPath != null) { localFolderText.setText(localPath); setSelectedFlag(localFolderText); } if (remotePath != null) { String separator = activity.getCloud().getFileSeparator(); if (remotePath.equals(separator)) { remotePath = getResources().getString(R.string.wholeCloud); } cloudFolerText.setText(remotePath); setSelectedFlag(cloudFolerText); } }
@Override public void onClick(View v) { switch (v.getId()) { case R.id.account: activity.loadFragmentById(SyncConfigFragement.FRAGMENT_ACCOUNT_MANAGER); break; case R.id.cloudFolder: if (activity.getCloud() != null) { activity.loadFragmentById(SyncConfigFragement.FRAGMENT_CLOUD_FOLDER); } else { ViewHelper.showToastMessage(mContext, R.string.loginFirst); } break; case R.id.localFolder: activity.loadFragmentById(SyncConfigFragement.FRAGMENT_LOCAL_FOLDER); break; case R.id.advance: activity.loadFragmentById(SyncConfigFragement.FRAGMENT_CONFIGURATION); default: break; } }