AndyScherzinger 7 жил өмнө
parent
commit
254ac96795

+ 1 - 0
drawable_resources/ic_star.svg

@@ -0,0 +1 @@
+<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24"><path d="M12,17.27L18.18,21L16.54,13.97L22,9.24L14.81,8.62L12,2L9.19,8.62L2,9.24L7.45,13.97L5.82,21L12,17.27Z" /></svg>

+ 1 - 0
drawable_resources/ic_star_outline.svg

@@ -0,0 +1 @@
+<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24"><path d="M12,15.39L8.24,17.66L9.23,13.38L5.91,10.5L10.29,10.13L12,6.09L13.71,10.13L18.09,10.5L14.77,13.38L15.76,17.66M22,9.24L14.81,8.63L12,2L9.19,8.63L2,9.24L7.45,13.97L5.82,21L12,17.27L18.18,21L16.54,13.97L22,9.24Z" /></svg>

+ 1 - 0
drawable_resources/ic_tag.svg

@@ -0,0 +1 @@
+<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24"><path d="M5.5,7A1.5,1.5 0 0,1 4,5.5A1.5,1.5 0 0,1 5.5,4A1.5,1.5 0 0,1 7,5.5A1.5,1.5 0 0,1 5.5,7M21.41,11.58L12.41,2.58C12.05,2.22 11.55,2 11,2H4C2.89,2 2,2.89 2,4V11C2,11.55 2.22,12.05 2.59,12.41L11.58,21.41C11.95,21.77 12.45,22 13,22C13.55,22 14.05,21.77 14.41,21.41L21.41,14.41C21.78,14.05 22,13.55 22,13C22,12.44 21.77,11.94 21.41,11.58Z" /></svg>

+ 62 - 0
src/main/java/com/owncloud/android/ui/adapter/FileDetailTabAdapter.java

@@ -0,0 +1,62 @@
+/*
+ * Nextcloud Android client application
+ *
+ * @author Andy Scherzinger
+ * Copyright (C) 2018 Andy Scherzinger
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public
+ * License along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package com.owncloud.android.ui.adapter;
+
+import android.accounts.Account;
+import android.support.v4.app.Fragment;
+import android.support.v4.app.FragmentManager;
+import android.support.v4.app.FragmentStatePagerAdapter;
+
+import com.owncloud.android.datamodel.OCFile;
+import com.owncloud.android.ui.fragment.FileDetailActivitiesFragment;
+import com.owncloud.android.ui.fragment.FileDetailSharingFragment;
+
+/**
+ * File details pager adapter.
+ */
+public class FileDetailTabAdapter extends FragmentStatePagerAdapter {
+    private OCFile file;
+    private Account account;
+
+    public FileDetailTabAdapter(FragmentManager fm, OCFile file, Account account) {
+        super(fm);
+
+        this.file = file;
+        this.account = account;
+    }
+
+    @Override
+    public Fragment getItem(int position) {
+        switch (position) {
+            case 0:
+                return FileDetailActivitiesFragment.newInstance(file, account);
+            case 1:
+                return FileDetailSharingFragment.newInstance(file, account);
+            default:
+                return null;
+        }
+    }
+
+    @Override
+    public int getCount() {
+        return 2;
+    }
+}

+ 76 - 0
src/main/java/com/owncloud/android/ui/fragment/FileDetailActivitiesFragment.java

@@ -0,0 +1,76 @@
+/*
+ * Nextcloud Android client application
+ *
+ * @author Andy Scherzinger
+ * Copyright (C) 2018 Andy Scherzinger
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public
+ * License along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package com.owncloud.android.ui.fragment;
+
+import android.accounts.Account;
+import android.os.Bundle;
+import android.support.annotation.NonNull;
+import android.support.v4.app.Fragment;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+
+import com.owncloud.android.R;
+import com.owncloud.android.datamodel.OCFile;
+import com.owncloud.android.ui.activity.FileActivity;
+
+public class FileDetailActivitiesFragment extends Fragment {
+
+    private static final String ARG_FILE = "FILE";
+    private static final String ARG_ACCOUNT = "ACCOUNT";
+
+    private OCFile file;
+    private Account account;
+
+    public static FileDetailActivitiesFragment newInstance(OCFile file, Account account) {
+        FileDetailActivitiesFragment fragment = new FileDetailActivitiesFragment();
+        Bundle args = new Bundle();
+        args.putParcelable(ARG_FILE, file);
+        args.putParcelable(ARG_ACCOUNT, account);
+        fragment.setArguments(args);
+        return fragment;
+    }
+
+    @Override
+    public View onCreateView(@NonNull LayoutInflater inflater,
+                             ViewGroup container,
+                             Bundle savedInstanceState) {
+
+        file = getArguments().getParcelable(ARG_FILE);
+        account = getArguments().getParcelable(ARG_ACCOUNT);
+
+        if (savedInstanceState != null) {
+            file = savedInstanceState.getParcelable(FileActivity.EXTRA_FILE);
+            account = savedInstanceState.getParcelable(FileActivity.EXTRA_ACCOUNT);
+        }
+
+        View view = inflater.inflate(R.layout.file_details_activities_fragment, container, false);
+
+        setupView(view);
+
+        return view;
+    }
+
+    private void setupView(View view) {
+        // TODO populate activities list
+    }
+}

+ 59 - 25
src/main/java/com/owncloud/android/ui/fragment/FileDetailFragment.java

@@ -25,6 +25,8 @@ import android.accounts.Account;
 import android.graphics.Bitmap;
 import android.os.Bundle;
 import android.support.design.widget.Snackbar;
+import android.support.design.widget.TabLayout;
+import android.support.v4.view.ViewPager;
 import android.support.v7.widget.SwitchCompat;
 import android.view.LayoutInflater;
 import android.view.Menu;
@@ -53,6 +55,7 @@ import com.owncloud.android.lib.common.utils.Log_OC;
 import com.owncloud.android.lib.resources.shares.OCShare;
 import com.owncloud.android.ui.activity.FileActivity;
 import com.owncloud.android.ui.activity.FileDisplayActivity;
+import com.owncloud.android.ui.adapter.FileDetailTabAdapter;
 import com.owncloud.android.ui.adapter.UserListAdapter;
 import com.owncloud.android.ui.dialog.RemoveFilesDialogFragment;
 import com.owncloud.android.ui.dialog.RenameFileDialogFragment;
@@ -68,8 +71,7 @@ import java.util.ArrayList;
 /**
  * This Fragment is used to display the details about a file.
  */
-public class FileDetailFragment extends FileFragment implements OnClickListener,
-        CompoundButton.OnCheckedChangeListener {
+public class FileDetailFragment extends FileFragment implements OnClickListener {
 
     private int mLayout;
     private View mView;
@@ -154,13 +156,11 @@ public class FileDetailFragment extends FileFragment implements OnClickListener,
         
         if (mLayout == R.layout.file_details_fragment) {
             int accentColor = ThemeUtils.primaryAccentColor(getContext());
-            SwitchCompat favoriteToggle = mView.findViewById(R.id.fdFavorite);
-            favoriteToggle.setOnCheckedChangeListener(this);
-            ThemeUtils.tintSwitch(favoriteToggle, accentColor, false);
             ProgressBar progressBar = mView.findViewById(R.id.fdProgressBar);
             ThemeUtils.colorHorizontalProgressBar(progressBar, ThemeUtils.primaryAccentColor(getContext()));
             mProgressListener = new ProgressListener(progressBar);
             mView.findViewById(R.id.fdCancelBtn).setOnClickListener(this);
+            mView.findViewById(R.id.fdFavorite).setOnClickListener(this);
             ((TextView)mView.findViewById(R.id.fdShareTitle)).setTextColor(accentColor);
             ((TextView)mView.findViewById(R.id.fdShareWithUsersTitle)).setTextColor(accentColor);
         }
@@ -169,6 +169,38 @@ public class FileDetailFragment extends FileFragment implements OnClickListener,
         return mView;
     }
 
+    private void setupViewPager(View view) {
+        TabLayout tabLayout = view.findViewById(R.id.tab_layout);
+        tabLayout.removeAllTabs();
+
+        tabLayout.addTab(tabLayout.newTab().setText(R.string.drawer_item_activities));
+        tabLayout.addTab(tabLayout.newTab().setText(R.string.share_dialog_title));
+
+        tabLayout.setTabGravity(TabLayout.GRAVITY_FILL);
+
+        final ViewPager viewPager = view.findViewById(R.id.pager);
+        final FileDetailTabAdapter adapter = new FileDetailTabAdapter
+                (getFragmentManager(), getFile(),mAccount);
+        viewPager.setAdapter(adapter);
+        viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
+        tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
+            @Override
+            public void onTabSelected(TabLayout.Tab tab) {
+                viewPager.setCurrentItem(tab.getPosition());
+            }
+
+            @Override
+            public void onTabUnselected(TabLayout.Tab tab) {
+
+            }
+
+            @Override
+            public void onTabReselected(TabLayout.Tab tab) {
+
+            }
+        });
+    }
+
     @Override
     public void onSaveInstanceState(Bundle outState) {
         super.onSaveInstanceState(outState);
@@ -359,18 +391,26 @@ public class FileDetailFragment extends FileFragment implements OnClickListener,
                 ((FileDisplayActivity) mContainerActivity).cancelTransference(getFile());
                 break;
             }
+            case R.id.fdFavorite: {
+                if (getFile().isAvailableOffline()) {
+                    ((ImageView)getView().findViewById(R.id.fdFavorite)).
+                            setImageDrawable(getResources()
+                                    .getDrawable(R.drawable.ic_star_outline));
+                } else {
+                    ((ImageView)getView().findViewById(R.id.fdFavorite))
+                            .setImageDrawable(getResources()
+                                    .getDrawable(R.drawable.ic_star));
+                }
+                mContainerActivity.getFileOperationsHelper()
+                        .toggleOfflineFile(getFile(), !getFile().isAvailableOffline());
+                break;
+            }
             default:
                 Log_OC.e(TAG, "Incorrect view clicked!");
                 break;
         }
     }
 
-    @Override
-    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
-        SwitchCompat favSwitch = getView().findViewById(R.id.fdFavorite);
-        mContainerActivity.getFileOperationsHelper().toggleOfflineFile(getFile(), favSwitch.isChecked());
-    }
-
     /**
      * Check if the fragment was created with an empty layout. An empty fragment can't show file details, must be replaced.
      *
@@ -419,15 +459,13 @@ public class FileDetailFragment extends FileFragment implements OnClickListener,
             setFilename(file.getFileName());
             setFiletype(file);
             setFilesize(file.getFileLength());
-
             setTimeModified(file.getModificationTimestamp());
 
-            SwitchCompat favSwitch = getView().findViewById(R.id.fdFavorite);
-            favSwitch.setChecked(file.isAvailableOffline());
-
-            setShareByLinkInfo(file.isSharedViaLink());
-
-            setShareWithUserInfo();
+            if (file.isAvailableOffline()) {
+                ((ImageView)getView().findViewById(R.id.fdFavorite)).setImageDrawable(getResources().getDrawable(R.drawable.ic_star));
+            } else {
+                ((ImageView)getView().findViewById(R.id.fdFavorite)).setImageDrawable(getResources().getDrawable(R.drawable.ic_star_outline));
+            }
 
             // configure UI for depending upon local state of the file
             FileDownloaderBinder downloaderBinder = mContainerActivity.getFileDownloaderBinder();
@@ -448,6 +486,9 @@ public class FileDetailFragment extends FileFragment implements OnClickListener,
                 setButtonsForRemote();
             }
         }
+
+        setupViewPager(getView());
+
         getView().invalidate();
     }
 
@@ -634,9 +675,6 @@ public class FileDetailFragment extends FileFragment implements OnClickListener,
      */
     private void setButtonsForTransferring() {
         if (!isEmpty()) {
-            // let's protect the user from himself ;)
-            getView().findViewById(R.id.fdFavorite).setEnabled(false);
-            
             // show the progress bar for the transfer
             getView().findViewById(R.id.fdProgressBlock).setVisibility(View.VISIBLE);
             TextView progressText = getView().findViewById(R.id.fdProgressText);
@@ -660,8 +698,6 @@ public class FileDetailFragment extends FileFragment implements OnClickListener,
      */
     private void setButtonsForDown() {
         if (!isEmpty()) {
-            getView().findViewById(R.id.fdFavorite).setEnabled(true);
-            
             // hides the progress bar
             getView().findViewById(R.id.fdProgressBlock).setVisibility(View.GONE);
             TextView progressText = getView().findViewById(R.id.fdProgressText);
@@ -674,8 +710,6 @@ public class FileDetailFragment extends FileFragment implements OnClickListener,
      */
     private void setButtonsForRemote() {
         if (!isEmpty()) {
-            getView().findViewById(R.id.fdFavorite).setEnabled(true);
-            
             // hides the progress bar
             getView().findViewById(R.id.fdProgressBlock).setVisibility(View.GONE);
             TextView progressText = getView().findViewById(R.id.fdProgressText);

+ 175 - 0
src/main/java/com/owncloud/android/ui/fragment/FileDetailSharingFragment.java

@@ -0,0 +1,175 @@
+/*
+ * Nextcloud Android client application
+ *
+ * @author Andy Scherzinger
+ * Copyright (C) 2018 Andy Scherzinger
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public
+ * License along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package com.owncloud.android.ui.fragment;
+
+import android.accounts.Account;
+import android.os.Bundle;
+import android.support.annotation.NonNull;
+import android.support.v4.app.Fragment;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ImageView;
+import android.widget.ListAdapter;
+import android.widget.ListView;
+import android.widget.TextView;
+
+import com.owncloud.android.R;
+import com.owncloud.android.datamodel.FileDataStorageManager;
+import com.owncloud.android.datamodel.OCFile;
+import com.owncloud.android.lib.resources.shares.OCShare;
+import com.owncloud.android.ui.activity.FileActivity;
+import com.owncloud.android.ui.adapter.UserListAdapter;
+
+import java.util.ArrayList;
+
+public class FileDetailSharingFragment  extends Fragment {
+
+    private static final String ARG_FILE = "FILE";
+    private static final String ARG_ACCOUNT = "ACCOUNT";
+
+    // to show share with users/groups info
+    private ArrayList<OCShare> mShares;
+
+    private OCFile file;
+    private Account account;
+
+    public static FileDetailSharingFragment newInstance(OCFile file, Account account) {
+        FileDetailSharingFragment fragment = new FileDetailSharingFragment();
+        Bundle args = new Bundle();
+        args.putParcelable(ARG_FILE, file);
+        args.putParcelable(ARG_ACCOUNT, account);
+        fragment.setArguments(args);
+        return fragment;
+    }
+
+    @Override
+    public View onCreateView(@NonNull LayoutInflater inflater,
+                             ViewGroup container,
+                             Bundle savedInstanceState) {
+
+        file = getArguments().getParcelable(ARG_FILE);
+        account = getArguments().getParcelable(ARG_ACCOUNT);
+
+        if (savedInstanceState != null) {
+            file = savedInstanceState.getParcelable(FileActivity.EXTRA_FILE);
+            account = savedInstanceState.getParcelable(FileActivity.EXTRA_ACCOUNT);
+        }
+
+        View view = inflater.inflate(R.layout.file_details_sharing_fragment, container, false);
+
+        setupView(view);
+
+        return view;
+    }
+
+    private void setupView(View view) {
+        // TODO populate sharing UI
+
+        setShareByLinkInfo(file.isSharedViaLink(), view);
+
+        setShareWithUserInfo(view);
+    }
+
+    /**
+     * Updates Share by link data
+     *
+     * @param isShareByLink flag is share by link is enable
+     */
+    private void setShareByLinkInfo(boolean isShareByLink, View view) {
+        TextView tv = view.findViewById(R.id.fdSharebyLink);
+        if (tv != null) {
+            tv.setText(isShareByLink ? R.string.filedetails_share_link_enable :
+                    R.string.filedetails_share_link_disable);
+        }
+        ImageView linkIcon = view.findViewById(R.id.fdShareLinkIcon);
+        if (linkIcon != null) {
+            linkIcon.setVisibility(isShareByLink ? View.VISIBLE : View.GONE);
+        }
+    }
+
+    /**
+     * Update Share With data
+     */
+    private void setShareWithUserInfo(View view){
+        // Get Users and Groups
+        if (((FileActivity) getActivity()).getStorageManager() != null) {
+            FileDataStorageManager fileDataStorageManager = ((FileActivity) getActivity()).getStorageManager();
+            mShares = fileDataStorageManager.getSharesWithForAFile(
+                    file.getRemotePath(),account.name
+            );
+
+            // Update list of users/groups
+            updateListOfUserGroups(view);
+        }
+    }
+
+    private void updateListOfUserGroups(View view) {
+        // Update list of users/groups
+        // TODO Refactoring: create a new {@link ShareUserListAdapter} instance with every call should not be needed
+        UserListAdapter mUserGroupsAdapter = new UserListAdapter(
+                getActivity().getApplicationContext(),
+                R.layout.share_user_item, mShares
+        );
+
+        // Show data
+        ListView usersList = view.findViewById(R.id.fdshareUsersList);
+
+        // No data
+        TextView noList = view.findViewById(R.id.fdShareNoUsers);
+
+        if (mShares.size() > 0) {
+            usersList.setVisibility(View.VISIBLE);
+            usersList.setAdapter(mUserGroupsAdapter);
+            noList.setVisibility(View.GONE);
+            setListViewHeightBasedOnChildren(usersList);
+
+        } else {
+            usersList.setVisibility(View.GONE);
+            noList.setVisibility(View.VISIBLE);
+        }
+    }
+
+    /**
+     * Fix scroll in listview when the parent is a ScrollView
+     */
+    private static void setListViewHeightBasedOnChildren(ListView listView) {
+        ListAdapter listAdapter = listView.getAdapter();
+        if (listAdapter == null) {
+            return;
+        }
+        int desiredWidth = View.MeasureSpec.makeMeasureSpec(listView.getWidth(), View.MeasureSpec.AT_MOST);
+        int totalHeight = 0;
+        View view = null;
+        for (int i = 0; i < listAdapter.getCount(); i++) {
+            view = listAdapter.getView(i, view, listView);
+            if (i == 0) {
+                view.setLayoutParams(new ViewGroup.LayoutParams(desiredWidth, ViewGroup.LayoutParams.WRAP_CONTENT));
+            }
+            view.measure(desiredWidth, View.MeasureSpec.UNSPECIFIED);
+            totalHeight += view.getMeasuredHeight();
+        }
+        ViewGroup.LayoutParams params = listView.getLayoutParams();
+        params.height = totalHeight + (listView.getDividerHeight() * (listAdapter.getCount() - 1));
+        listView.setLayoutParams(params);
+        listView.requestLayout();
+    }
+}

+ 8 - 0
src/main/res/drawable/ic_star.xml

@@ -0,0 +1,8 @@
+<!-- drawable/star.xml -->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:height="24dp"
+    android:width="24dp"
+    android:viewportWidth="24"
+    android:viewportHeight="24">
+    <path android:fillColor="#757575" android:pathData="M12,17.27L18.18,21L16.54,13.97L22,9.24L14.81,8.62L12,2L9.19,8.62L2,9.24L7.45,13.97L5.82,21L12,17.27Z" />
+</vector>

+ 8 - 0
src/main/res/drawable/ic_star_outline.xml

@@ -0,0 +1,8 @@
+<!-- drawable/star_outline.xml -->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:height="24dp"
+    android:width="24dp"
+    android:viewportWidth="24"
+    android:viewportHeight="24">
+    <path android:fillColor="#757575" android:pathData="M12,15.39L8.24,17.66L9.23,13.38L5.91,10.5L10.29,10.13L12,6.09L13.71,10.13L18.09,10.5L14.77,13.38L15.76,17.66M22,9.24L14.81,8.63L12,2L9.19,8.63L2,9.24L7.45,13.97L5.82,21L12,17.27L18.18,21L16.54,13.97L22,9.24Z" />
+</vector>

+ 8 - 0
src/main/res/drawable/ic_tag.xml

@@ -0,0 +1,8 @@
+<!-- drawable/tag.xml -->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:height="24dp"
+    android:width="24dp"
+    android:viewportWidth="24"
+    android:viewportHeight="24">
+    <path android:fillColor="#757575" android:pathData="M5.5,7A1.5,1.5 0 0,1 4,5.5A1.5,1.5 0 0,1 5.5,4A1.5,1.5 0 0,1 7,5.5A1.5,1.5 0 0,1 5.5,7M21.41,11.58L12.41,2.58C12.05,2.22 11.55,2 11,2H4C2.89,2 2,2.89 2,4V11C2,11.55 2.22,12.05 2.59,12.41L11.58,21.41C11.95,21.77 12.45,22 13,22C13.55,22 14.05,21.77 14.41,21.41L21.41,14.41C21.78,14.05 22,13.55 22,13C22,12.44 21.77,11.94 21.41,11.58Z" />
+</vector>

+ 53 - 0
src/main/res/layout/file_details_activities_fragment.xml

@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  Nextcloud Android client application
+
+  Copyright (C) 2018 Andy Scherzinger
+
+  This program is free software; you can redistribute it and/or
+  modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+  License as published by the Free Software Foundation; either
+  version 3 of the License, or any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+
+  You should have received a copy of the GNU Affero General Public
+  License along with this program.  If not, see <http://www.gnu.org/licenses/>.
+-->
+
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_height="match_parent"
+    android:layout_width="match_parent">
+
+    <android.support.v4.widget.SwipeRefreshLayout
+        android:footerDividersEnabled="false"
+        android:id="@+id/swipe_containing_list"
+        android:layout_height="match_parent"
+        android:layout_width="match_parent"
+        android:visibility="visible">
+
+        <android.support.v7.widget.RecyclerView
+            android:clipToPadding="false"
+            android:id="@android:id/list"
+            android:layout_height="match_parent"
+            android:layout_width="match_parent"
+            android:scrollbarStyle="outsideOverlay"
+            android:scrollbars="vertical"
+            android:visibility="visible" />
+
+    </android.support.v4.widget.SwipeRefreshLayout>
+
+    <android.support.v4.widget.SwipeRefreshLayout
+        android:footerDividersEnabled="false"
+        android:id="@+id/swipe_containing_empty"
+        android:layout_height="match_parent"
+        android:layout_width="match_parent"
+        android:visibility="visible">
+
+        <include layout="@layout/empty_list" />
+    </android.support.v4.widget.SwipeRefreshLayout>
+
+</FrameLayout>

+ 93 - 92
src/main/res/layout/file_details_fragment.xml

@@ -29,110 +29,99 @@
         android:layout_height="wrap_content"
         android:orientation="vertical">
 
-        <RelativeLayout
-            android:id="@+id/fdFileHeaderContainer"
+        <ImageView
+            android:id="@+id/fdIcon"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_margin="@dimen/standard_margin"
+            android:contentDescription="@string/file_icon"
+            android:src="@drawable/file" />
+
+        <View
+            android:layout_width="match_parent"
+            android:layout_height="1dp"
+            android:background="@color/list_divider_background" />
+
+        <LinearLayout
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:layout_margin="@dimen/standard_margin">
+            android:layout_margin="@dimen/standard_margin"
+            android:orientation="vertical">
 
-            <ImageView
-                android:id="@+id/fdIcon"
+            <TextView
+                android:id="@+id/fdFilename"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
-                android:contentDescription="@string/file_icon"
-                android:src="@drawable/file"/>
+                android:text="@string/placeholder_filename"
+                android:textSize="16sp"
+                android:textColor="@color/black"/>
 
             <LinearLayout
+                android:id="@+id/fdFiledetails"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
-                android:layout_centerVertical="true"
-                android:layout_toEndOf="@+id/fdIcon"
-                android:layout_toRightOf="@+id/fdIcon"
-                android:paddingLeft="@dimen/standard_padding"
-                android:paddingStart="@dimen/standard_padding"
-                android:paddingEnd="@dimen/zero"
-                android:paddingRight="@dimen/zero"
-                android:orientation="vertical">
+                android:gravity="center"
+                android:orientation="horizontal">
+
+                <ImageView
+                    android:id="@+id/fdFavorite"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_marginEnd="@dimen/standard_eighth_margin"
+                    android:layout_marginLeft="@dimen/zero"
+                    android:layout_marginRight="@dimen/standard_eighth_margin"
+                    android:layout_marginStart="@dimen/zero"
+                    android:contentDescription="@null"
+                    android:src="@drawable/ic_star_outline" />
 
                 <TextView
-                    android:id="@+id/fdFilename"
+                    android:id="@+id/fdSize"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
-                    android:text="@string/placeholder_filename"
-                    android:textAppearance="?android:attr/textAppearanceLarge"/>
+                    android:text="@string/placeholder_fileSize"
+                    android:textSize="16sp" />
 
-                <LinearLayout
-                    android:id="@+id/fdFiledetails"
+                <TextView
+                    android:id="@+id/file_separator"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
-                    android:orientation="horizontal">
+                    android:gravity="end"
+                    android:paddingEnd="@dimen/standard_quarter_padding"
+                    android:paddingLeft="@dimen/zero"
+                    android:paddingRight="@dimen/standard_quarter_padding"
+                    android:paddingStart="@dimen/zero"
+                    android:text="@string/info_separator"
+                    android:textColor="@color/list_item_lastmod_and_filesize_text"
+                    android:textSize="@dimen/two_line_secondary_text_size" />
 
-                    <TextView
-                        android:id="@+id/fdSize"
-                        android:layout_width="wrap_content"
-                        android:layout_height="wrap_content"
-                        android:text="@string/placeholder_fileSize"
-                        android:textColor="@color/list_item_lastmod_and_filesize_text"
-                        android:textSize="@dimen/two_line_secondary_text_size"/>
+                <TextView
+                    android:id="@+id/fdModified"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:gravity="end"
+                    android:text="@string/placeholder_media_time"
+                    android:textSize="16sp" />
 
-                    <TextView
-                        android:id="@+id/file_separator"
-                        android:layout_width="wrap_content"
-                        android:layout_height="wrap_content"
-                        android:paddingRight="@dimen/standard_quarter_padding"
-                        android:paddingEnd="@dimen/standard_quarter_padding"
-                        android:paddingStart="@dimen/zero"
-                        android:paddingLeft="@dimen/zero"
-                        android:gravity="end"
-                        android:text="@string/info_separator"
-                        android:textColor="@color/list_item_lastmod_and_filesize_text"
-                        android:textSize="@dimen/two_line_secondary_text_size"/>
-
-                    <TextView
-                        android:id="@+id/fdModified"
-                        android:layout_width="wrap_content"
-                        android:layout_height="wrap_content"
-                        android:gravity="end"
-                        android:text="@string/placeholder_media_time"
-                        android:textColor="@color/list_item_lastmod_and_filesize_text"
-                        android:textSize="@dimen/two_line_secondary_text_size"/>
+                <ImageView
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_marginEnd="@dimen/standard_eighth_margin"
+                    android:layout_marginLeft="@dimen/standard_margin"
+                    android:layout_marginRight="@dimen/standard_eighth_margin"
+                    android:layout_marginStart="@dimen/standard_margin"
+                    android:contentDescription="@null"
+                    android:src="@drawable/ic_tag" />
 
-                </LinearLayout>
+                <TextView
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="@string/tags" />
 
             </LinearLayout>
 
-        </RelativeLayout>
-
-        <View
-            android:layout_width="match_parent"
-            android:layout_height="1dp"
-            android:background="@color/list_divider_background"/>
-
-        <RelativeLayout
-            android:id="@+id/fdProgressAndControl"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:layout_marginBottom="@dimen/standard_half_margin"
-            android:layout_marginLeft="@dimen/standard_margin"
-            android:layout_marginRight="@dimen/standard_margin"
-            android:layout_marginTop="@dimen/standard_half_margin"
-            android:gravity="center_horizontal">
-
-            <android.support.v7.widget.SwitchCompat
-                android:id="@+id/fdFavorite"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:layout_alignParentLeft="true"
-                android:layout_alignParentStart="true"
-                android:layout_alignParentTop="true"
-                android:layout_gravity="start"
-                android:text="@string/favorite_switch"
-                android:textSize="16sp"/>
-
             <LinearLayout
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
-                android:layout_below="@id/fdFavorite"
                 android:orientation="vertical">
 
                 <TextView
@@ -140,7 +129,7 @@
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
                     android:layout_marginTop="@dimen/standard_half_margin"
-                    android:text="@string/downloader_download_in_progress_ticker"/>
+                    android:text="@string/downloader_download_in_progress_ticker" />
 
                 <LinearLayout
                     android:id="@+id/fdProgressBlock"
@@ -158,7 +147,7 @@
                         android:layout_height="wrap_content"
                         android:layout_weight="1"
                         android:indeterminate="false"
-                        android:indeterminateOnly="false"/>
+                        android:indeterminateOnly="false" />
 
                     <ImageButton
                         android:id="@+id/fdCancelBtn"
@@ -168,18 +157,29 @@
                         android:layout_marginStart="@dimen/standard_half_margin"
                         android:background="@android:color/transparent"
                         android:contentDescription="@string/common_cancel"
-                        android:src="@drawable/ic_cancel"/>
+                        android:src="@drawable/ic_cancel" />
 
                 </LinearLayout>
 
             </LinearLayout>
 
-        </RelativeLayout>
+        </LinearLayout>
 
         <View
             android:layout_width="match_parent"
             android:layout_height="1dp"
-            android:background="@color/list_divider_background"/>
+            android:background="@color/list_divider_background" />
+
+        <android.support.design.widget.TabLayout
+            android:id="@+id/tab_layout"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:background="@color/white" />
+
+        <android.support.v4.view.ViewPager
+            android:id="@+id/pager"
+            android:layout_width="match_parent"
+            android:layout_height="fill_parent"/>
 
         <LinearLayout
             android:id="@+id/fdShareContainer"
@@ -189,7 +189,8 @@
             android:layout_marginLeft="@dimen/standard_margin"
             android:layout_marginRight="@dimen/standard_margin"
             android:layout_marginTop="@dimen/standard_half_margin"
-            android:orientation="vertical">
+            android:orientation="vertical"
+            android:visibility="gone">
 
             <TextView
                 android:id="@+id/fdShareTitle"
@@ -198,7 +199,7 @@
                 android:layout_height="wrap_content"
                 android:layout_marginBottom="@dimen/standard_half_margin"
                 android:text="@string/action_send_share"
-                android:textColor="@color/color_accent"/>
+                android:textColor="@color/color_accent" />
 
             <LinearLayout
                 android:layout_width="match_parent"
@@ -207,22 +208,22 @@
                 tools:ignore="UseCompoundDrawables">
 
                 <ImageView
-                    android:contentDescription="@string/shared_icon"
                     android:id="@+id/fdShareLinkIcon"
                     android:layout_width="@dimen/shared_list_icon_width"
                     android:layout_height="@dimen/shared_list_icon_height"
                     android:layout_gravity="center_vertical"
                     android:layout_marginEnd="@dimen/standard_half_margin"
                     android:layout_marginRight="@dimen/standard_half_margin"
+                    android:contentDescription="@string/shared_icon"
                     android:src="@drawable/shared_via_link"
-                    android:visibility="gone"/>
+                    android:visibility="gone" />
 
                 <TextView
                     android:id="@+id/fdSharebyLink"
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
                     android:layout_gravity="start"
-                    android:text="@string/filedetails_share_link_disable"/>
+                    android:text="@string/filedetails_share_link_disable" />
             </LinearLayout>
 
             <TextView
@@ -234,21 +235,21 @@
                 android:layout_marginBottom="@dimen/standard_half_margin"
                 android:layout_marginTop="@dimen/standard_half_margin"
                 android:text="@string/filedetails_share_users_with_access"
-                android:textColor="@color/color_accent"/>
+                android:textColor="@color/color_accent" />
 
             <ListView
                 android:id="@+id/fdshareUsersList"
                 android:layout_width="match_parent"
                 android:layout_height="0dip"
                 android:layout_weight="1"
-                android:visibility="gone"/>
+                android:visibility="gone" />
 
             <TextView
                 android:id="@+id/fdShareNoUsers"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 android:text="@string/share_no_users"
-                android:textSize="@dimen/share_no_users_text_size"/>
+                android:textSize="@dimen/share_no_users_text_size" />
 
         </LinearLayout>
 

+ 105 - 0
src/main/res/layout/file_details_sharing_fragment.xml

@@ -0,0 +1,105 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  Nextcloud Android client application
+
+  Copyright (C) 2018 Andy Scherzinger
+
+  This program is free software; you can redistribute it and/or
+  modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+  License as published by the Free Software Foundation; either
+  version 3 of the License, or any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+
+  You should have received a copy of the GNU Affero General Public
+  License along with this program.  If not, see <http://www.gnu.org/licenses/>.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="vertical">
+
+    <ScrollView
+        android:layout_width="match_parent"
+        android:layout_height="0dp"
+        android:layout_weight="1">
+
+        <LinearLayout
+            android:id="@+id/fdShareContainer"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:layout_marginBottom="@dimen/standard_half_margin"
+            android:layout_marginLeft="@dimen/standard_margin"
+            android:layout_marginRight="@dimen/standard_margin"
+            android:layout_marginTop="@dimen/standard_half_margin"
+            android:orientation="vertical">
+
+            <TextView
+                android:id="@+id/fdShareTitle"
+                style="@style/TextAppearance.AppCompat.Body2"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_marginBottom="@dimen/standard_half_margin"
+                android:text="@string/action_send_share"
+                android:textColor="@color/color_accent" />
+
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:orientation="horizontal"
+                tools:ignore="UseCompoundDrawables">
+
+                <ImageView
+                    android:id="@+id/fdShareLinkIcon"
+                    android:layout_width="@dimen/shared_list_icon_width"
+                    android:layout_height="@dimen/shared_list_icon_height"
+                    android:layout_gravity="center_vertical"
+                    android:layout_marginEnd="@dimen/standard_half_margin"
+                    android:layout_marginRight="@dimen/standard_half_margin"
+                    android:contentDescription="@string/shared_icon"
+                    android:src="@drawable/shared_via_link"
+                    android:visibility="gone" />
+
+                <TextView
+                    android:id="@+id/fdSharebyLink"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:layout_gravity="start"
+                    android:text="@string/filedetails_share_link_disable" />
+            </LinearLayout>
+
+            <TextView
+                android:id="@+id/fdShareWithUsersTitle"
+                style="@style/TextAppearance.AppCompat.Body2"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_gravity="start"
+                android:layout_marginBottom="@dimen/standard_half_margin"
+                android:layout_marginTop="@dimen/standard_half_margin"
+                android:text="@string/filedetails_share_users_with_access"
+                android:textColor="@color/color_accent" />
+
+            <ListView
+                android:id="@+id/fdshareUsersList"
+                android:layout_width="match_parent"
+                android:layout_height="0dip"
+                android:layout_weight="1"
+                android:visibility="gone" />
+
+            <TextView
+                android:id="@+id/fdShareNoUsers"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:text="@string/share_no_users"
+                android:textSize="@dimen/share_no_users_text_size" />
+
+        </LinearLayout>
+
+    </ScrollView>
+
+</LinearLayout>

+ 1 - 0
src/main/res/values/strings.xml

@@ -784,4 +784,5 @@
     <string name="upload_content_from_other_apps">Upload content from other apps</string>
     <string name="create_new_folder">Create new folder</string>
     <string name="uploads_view_upload_status_virus_detected">Virus detected. Upload cannot be completed!</string>
+    <string name="tags">Tags</string>
 </resources>