import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
-import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
* create an instance of this fragment.
*/
public class ShareFileFragment extends Fragment
- implements GetShareWithUserAsyncTask.OnGetSharesWithUserTaskListener, View.OnTouchListener {
+ implements GetShareWithUserAsyncTask.OnGetSharesWithUserTaskListener {
+
private static final String TAG = ShareFileFragment.class.getSimpleName();
// the fragment initialization parameters
/**
* Public factory method to create new ShareFileFragment instances.
*
- * @param fileToShare An {@link OCFile} to show in the fragment
- * @param account An ownCloud account
+ * @param fileToShare An {@link OCFile} to show in the fragment
+ * @param account An ownCloud account
* @return A new instance of fragment ShareFileFragment.
*/
- public static ShareFileFragment newInstance(OCFile fileToShare, Account account) {
+ public static ShareFileFragment newInstance(OCFile fileToShare, Account account) {
ShareFileFragment fragment = new ShareFileFragment();
Bundle args = new Bundle();
args.putParcelable(ARG_FILE, fileToShare);
if (mFile.isImage()) {
String remoteId = String.valueOf(mFile.getRemoteId());
Bitmap thumbnail = ThumbnailsCacheManager.getBitmapFromDiskCache(remoteId);
- if (thumbnail != null){
+ if (thumbnail != null) {
icon.setImageBitmap(thumbnail);
}
}
filename.setText(mFile.getFileName());
// Size
TextView size = (TextView) view.findViewById(R.id.shareFileSize);
- if (mFile.isFolder()){
+ if (mFile.isFolder()) {
size.setVisibility(View.GONE);
} else {
size.setText(DisplayUtils.bytesToHumanReadable(mFile.getFileLength()));
}
// Get users and groups to fill the "share with" list
- private void getShares(){
+ private void getShares() {
mShares = new ArrayList<>();
// Get Users and Groups
((ShareActivity) getActivity()).dismissWaitingLoadDialog();
if (result != null && result.isSuccess()) {
// update local database
- for(Object obj: result.getData()) {
- if ( ((OCShare) obj).getShareType() == ShareType.USER ||
- ((OCShare) obj).getShareType() == ShareType.GROUP ){
+ for (Object obj : result.getData()) {
+ if (((OCShare) obj).getShareType() == ShareType.USER ||
+ ((OCShare) obj).getShareType() == ShareType.GROUP) {
mShares.add((OCShare) obj);
}
}
// Update list of users/groups
- updateListOfUserGroups();
+ updateListOfUserGroups();
} else {
Toast.makeText(getActivity(), result.getLogMessage(), Toast.LENGTH_SHORT).show();
}
- private void updateListOfUserGroups(){
+ private void updateListOfUserGroups() {
// Update list of users/groups
mUserGroupsAdapter = new ShareUserListAdapter(getActivity().getApplicationContext(),
R.layout.share_user_item, mShares);
} else {
unshareButton.setVisibility(View.GONE);
}
+ view.setAlpha(0);
+ view.animate().alpha(1).setDuration(500).start();
return false;
}
});
}
- @Override
- public boolean onTouch(View v, MotionEvent event) {
- return false;
- }
-
-
// TODO: review if it is necessary
/**
* This interface must be implemented by activities that contain this