diff --git a/drawable_resources/ic_list_empty_create_folder.svg b/drawable_resources/ic_list_empty_create_folder.svg new file mode 100644 index 0000000000..3d43932ea2 --- /dev/null +++ b/drawable_resources/ic_list_empty_create_folder.svg @@ -0,0 +1,57 @@ + + + + + + image/svg+xml + + + + + + + + + diff --git a/drawable_resources/ic_list_empty_folder.svg b/drawable_resources/ic_list_empty_folder.svg new file mode 100644 index 0000000000..dbeef3d332 --- /dev/null +++ b/drawable_resources/ic_list_empty_folder.svg @@ -0,0 +1,58 @@ + + + + + + image/svg+xml + + + + + + + + diff --git a/drawable_resources/ic_list_empty_upload.svg b/drawable_resources/ic_list_empty_upload.svg new file mode 100644 index 0000000000..02ecad0b38 --- /dev/null +++ b/drawable_resources/ic_list_empty_upload.svg @@ -0,0 +1,57 @@ + + + + + + image/svg+xml + + + + + + + + diff --git a/res/drawable-hdpi/ic_list_empty_create_folder.png b/res/drawable-hdpi/ic_list_empty_create_folder.png new file mode 100644 index 0000000000..d479d048c1 Binary files /dev/null and b/res/drawable-hdpi/ic_list_empty_create_folder.png differ diff --git a/res/drawable-hdpi/ic_list_empty_folder.png b/res/drawable-hdpi/ic_list_empty_folder.png new file mode 100644 index 0000000000..5a1cc5723b Binary files /dev/null and b/res/drawable-hdpi/ic_list_empty_folder.png differ diff --git a/res/drawable-hdpi/ic_list_empty_upload.png b/res/drawable-hdpi/ic_list_empty_upload.png new file mode 100644 index 0000000000..340a6910d3 Binary files /dev/null and b/res/drawable-hdpi/ic_list_empty_upload.png differ diff --git a/res/drawable-mdpi/ic_list_empty_create_folder.png b/res/drawable-mdpi/ic_list_empty_create_folder.png new file mode 100644 index 0000000000..6fcd621bf2 Binary files /dev/null and b/res/drawable-mdpi/ic_list_empty_create_folder.png differ diff --git a/res/drawable-mdpi/ic_list_empty_folder.png b/res/drawable-mdpi/ic_list_empty_folder.png new file mode 100644 index 0000000000..9cc4c98961 Binary files /dev/null and b/res/drawable-mdpi/ic_list_empty_folder.png differ diff --git a/res/drawable-mdpi/ic_list_empty_upload.png b/res/drawable-mdpi/ic_list_empty_upload.png new file mode 100644 index 0000000000..eeb5c36ff4 Binary files /dev/null and b/res/drawable-mdpi/ic_list_empty_upload.png differ diff --git a/res/drawable-xhdpi/ic_list_empty_create_folder.png b/res/drawable-xhdpi/ic_list_empty_create_folder.png new file mode 100644 index 0000000000..5daceeed23 Binary files /dev/null and b/res/drawable-xhdpi/ic_list_empty_create_folder.png differ diff --git a/res/drawable-xhdpi/ic_list_empty_folder.png b/res/drawable-xhdpi/ic_list_empty_folder.png new file mode 100644 index 0000000000..7814a7e5b9 Binary files /dev/null and b/res/drawable-xhdpi/ic_list_empty_folder.png differ diff --git a/res/drawable-xhdpi/ic_list_empty_upload.png b/res/drawable-xhdpi/ic_list_empty_upload.png new file mode 100644 index 0000000000..9404a338a4 Binary files /dev/null and b/res/drawable-xhdpi/ic_list_empty_upload.png differ diff --git a/res/drawable-xxhdpi/ic_list_empty_create_folder.png b/res/drawable-xxhdpi/ic_list_empty_create_folder.png new file mode 100644 index 0000000000..ec355029f7 Binary files /dev/null and b/res/drawable-xxhdpi/ic_list_empty_create_folder.png differ diff --git a/res/drawable-xxhdpi/ic_list_empty_folder.png b/res/drawable-xxhdpi/ic_list_empty_folder.png new file mode 100644 index 0000000000..599901efb6 Binary files /dev/null and b/res/drawable-xxhdpi/ic_list_empty_folder.png differ diff --git a/res/drawable-xxhdpi/ic_list_empty_upload.png b/res/drawable-xxhdpi/ic_list_empty_upload.png new file mode 100644 index 0000000000..d520f1b578 Binary files /dev/null and b/res/drawable-xxhdpi/ic_list_empty_upload.png differ diff --git a/res/drawable-xxxhdpi/ic_list_empty_create_folder.png b/res/drawable-xxxhdpi/ic_list_empty_create_folder.png new file mode 100644 index 0000000000..aeae3497d7 Binary files /dev/null and b/res/drawable-xxxhdpi/ic_list_empty_create_folder.png differ diff --git a/res/drawable-xxxhdpi/ic_list_empty_folder.png b/res/drawable-xxxhdpi/ic_list_empty_folder.png new file mode 100644 index 0000000000..aee2368beb Binary files /dev/null and b/res/drawable-xxxhdpi/ic_list_empty_folder.png differ diff --git a/res/drawable-xxxhdpi/ic_list_empty_upload.png b/res/drawable-xxxhdpi/ic_list_empty_upload.png new file mode 100644 index 0000000000..f04cdb0801 Binary files /dev/null and b/res/drawable-xxxhdpi/ic_list_empty_upload.png differ diff --git a/res/layout/empty_list.xml b/res/layout/empty_list.xml new file mode 100644 index 0000000000..16826b792f --- /dev/null +++ b/res/layout/empty_list.xml @@ -0,0 +1,68 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/res/layout/folder_sync_layout.xml b/res/layout/folder_sync_layout.xml index cfcb67fd67..093ad15af7 100644 --- a/res/layout/folder_sync_layout.xml +++ b/res/layout/folder_sync_layout.xml @@ -60,8 +60,8 @@ + android:textSize="26sp"/> diff --git a/res/layout/list_fragment.xml b/res/layout/list_fragment.xml index fdb8b83c45..1faeb16aef 100644 --- a/res/layout/list_fragment.xml +++ b/res/layout/list_fragment.xml @@ -74,14 +74,9 @@ - + + + diff --git a/res/layout/list_fragment_expandable.xml b/res/layout/list_fragment_expandable.xml index b62da0dda5..d813197235 100755 --- a/res/layout/list_fragment_expandable.xml +++ b/res/layout/list_fragment_expandable.xml @@ -31,14 +31,7 @@ EXCEPT: ExpandableListView must be used for @+id/swipe_refresh_files_emptyView android:layout_width="match_parent" android:layout_height="match_parent" > - + diff --git a/res/values/strings.xml b/res/values/strings.xml index 4554e26668..7e33a656ab 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -78,11 +78,13 @@ Keep file in source folder Delete file from source folder seconds ago - Nothing in here. Upload something! + No files in here + Upload some content or sync with your devices! Loading… No app found for file type! There are no files in this folder. - No uploads available. + No uploads available + Upload some content or activate instant upload! folder folders file diff --git a/src/com/owncloud/android/ui/activity/FileDisplayActivity.java b/src/com/owncloud/android/ui/activity/FileDisplayActivity.java index 9968532545..c1b2e1f34c 100644 --- a/src/com/owncloud/android/ui/activity/FileDisplayActivity.java +++ b/src/com/owncloud/android/ui/activity/FileDisplayActivity.java @@ -1099,12 +1099,11 @@ public class FileDisplayActivity extends HookActivity private void setBackgroundText() { OCFileListFragment ocFileListFragment = getListOfFilesFragment(); if (ocFileListFragment != null) { - int message = R.string.file_list_loading; if (!mSyncInProgress) { - // In case file list is empty - message = R.string.file_list_empty; + ocFileListFragment.setEmptyListMessage(); + } else { + ocFileListFragment.setEmptyListLoadingMessage(); } - ocFileListFragment.setMessageForEmptyList(getString(message)); } else { Log_OC.e(TAG, "OCFileListFragment is null"); } @@ -1117,7 +1116,6 @@ public class FileDisplayActivity extends HookActivity /** * Once the file upload has finished -> update view * - * @author David A. Velasco * {@link BroadcastReceiver} to enable upload feedback in UI */ @Override diff --git a/src/com/owncloud/android/ui/activity/FolderPickerActivity.java b/src/com/owncloud/android/ui/activity/FolderPickerActivity.java index e63481369a..d3de9ade6c 100644 --- a/src/com/owncloud/android/ui/activity/FolderPickerActivity.java +++ b/src/com/owncloud/android/ui/activity/FolderPickerActivity.java @@ -38,7 +38,6 @@ import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; -import android.widget.ProgressBar; import android.widget.Toast; import com.owncloud.android.R; @@ -164,12 +163,15 @@ public class FolderPickerActivity extends FileActivity implements FileFragment.C private void setBackgroundText() { OCFileListFragment listFragment = getListOfFilesFragment(); if (listFragment != null) { - int message = R.string.file_list_loading; if (!mSyncInProgress) { - // In case folder list is empty - message = R.string.file_list_empty_moving; + listFragment.setMessageForEmptyList( + R.string.file_list_empty_headline, + R.string.file_list_empty_moving, + R.drawable.ic_list_empty_create_folder + ); + } else { + listFragment.setEmptyListLoadingMessage(); } - listFragment.setMessageForEmptyList(getString(message)); } else { Log.e(TAG, "OCFileListFragment is null"); } diff --git a/src/com/owncloud/android/ui/fragment/ExpandableListFragment.java b/src/com/owncloud/android/ui/fragment/ExpandableListFragment.java index e2676d1c9a..c7022f29bc 100755 --- a/src/com/owncloud/android/ui/fragment/ExpandableListFragment.java +++ b/src/com/owncloud/android/ui/fragment/ExpandableListFragment.java @@ -28,7 +28,6 @@ import android.view.ViewGroup; import android.widget.ExpandableListAdapter; import android.widget.ExpandableListView; import android.widget.ExpandableListView.OnChildClickListener; -import android.widget.TextView; import com.owncloud.android.R; import com.owncloud.android.lib.common.utils.Log_OC; @@ -56,7 +55,8 @@ public class ExpandableListFragment extends ExtendedListFragment implements OnCh Log_OC.e(TAG, "onCreateView"); View v = inflater.inflate(R.layout.list_fragment_expandable, null); - mEmptyListMessage = (TextView) v.findViewById(R.id.empty_list_view); + setupEmptyList(v); + mList = (ExpandableListView)(v.findViewById(R.id.list_root)); mList.setOnChildClickListener(this); @@ -86,5 +86,4 @@ public class ExpandableListFragment extends ExtendedListFragment implements OnCh Log_OC.e(TAG, "onChildClick(). This method should be overriden!"); return false; } - } diff --git a/src/com/owncloud/android/ui/fragment/ExtendedListFragment.java b/src/com/owncloud/android/ui/fragment/ExtendedListFragment.java index 21737466e3..85a7a80e95 100644 --- a/src/com/owncloud/android/ui/fragment/ExtendedListFragment.java +++ b/src/com/owncloud/android/ui/fragment/ExtendedListFragment.java @@ -21,6 +21,8 @@ package com.owncloud.android.ui.fragment; import android.os.Bundle; +import android.support.annotation.DrawableRes; +import android.support.annotation.StringRes; import android.support.v4.app.Fragment; import android.support.v4.view.MenuItemCompat; import android.support.v4.widget.SwipeRefreshLayout; @@ -35,7 +37,9 @@ import android.widget.AbsListView; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.GridView; -import android.widget.ListAdapter; +import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.ProgressBar; import android.widget.TextView; import com.getbase.floatingactionbutton.FloatingActionButton; @@ -67,7 +71,11 @@ public class ExtendedListFragment extends Fragment protected SwipeRefreshLayout mRefreshListLayout; private SwipeRefreshLayout mRefreshGridLayout; protected SwipeRefreshLayout mRefreshEmptyLayout; + protected LinearLayout mEmptyListContainer; protected TextView mEmptyListMessage; + protected TextView mEmptyListHeadline; + protected ImageView mEmptyListIcon; + protected ProgressBar mEmptyListProgress; private FloatingActionsMenu mFabMain; private FloatingActionButton mFabUpload; @@ -164,10 +172,10 @@ public class ExtendedListFragment extends Fragment Log_OC.d(TAG, "onCreateView"); View v = inflater.inflate(R.layout.list_fragment, null); + setupEmptyList(v); mListView = (ExtendedListView)(v.findViewById(R.id.list_root)); mListView.setOnItemClickListener(this); - //mListView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE_MODAL); mListFooterView = inflater.inflate(R.layout.list_footer, null, false); mGridView = (GridViewWithHeaderAndFooter) (v.findViewById(R.id.grid_root)); @@ -180,7 +188,6 @@ public class ExtendedListFragment extends Fragment mRefreshListLayout = (SwipeRefreshLayout) v.findViewById(R.id.swipe_containing_list); mRefreshGridLayout = (SwipeRefreshLayout) v.findViewById(R.id.swipe_containing_grid); mRefreshEmptyLayout = (SwipeRefreshLayout) v.findViewById(R.id.swipe_containing_empty); - mEmptyListMessage = (TextView) v.findViewById(R.id.empty_list_view); onCreateSwipeToRefresh(mRefreshListLayout); onCreateSwipeToRefresh(mRefreshGridLayout); @@ -212,6 +219,14 @@ public class ExtendedListFragment extends Fragment return v; } + protected void setupEmptyList(View view) { + mEmptyListContainer = (LinearLayout) view.findViewById(R.id.empty_list_view); + mEmptyListMessage = (TextView) view.findViewById(R.id.empty_list_view_text); + mEmptyListHeadline = (TextView) view.findViewById(R.id.empty_list_view_headline); + mEmptyListIcon = (ImageView) view.findViewById(R.id.empty_list_icon); + mEmptyListProgress = (ProgressBar) view.findViewById(R.id.empty_list_progress); + } + /** * {@inheritDoc} */ @@ -227,9 +242,9 @@ public class ExtendedListFragment extends Fragment setMessageForEmptyList(savedInstanceState.getString(KEY_EMPTY_LIST_MESSAGE)); } else { - mIndexes = new ArrayList(); - mFirstPositions = new ArrayList(); - mTops = new ArrayList(); + mIndexes = new ArrayList<>(); + mFirstPositions = new ArrayList<>(); + mTops = new ArrayList<>(); mHeightCell = 0; } } @@ -361,7 +376,7 @@ public class ExtendedListFragment extends Fragment /** * Sets the 'visibility' state of the FAB contained in the fragment. * - * When 'false' is set, FAB visibility is set to View.GONE programatically, + * When 'false' is set, FAB visibility is set to View.GONE programmatically, * * @param enabled Desired visibility for the FAB. */ @@ -374,27 +389,67 @@ public class ExtendedListFragment extends Fragment } /** - * Set message for empty list view + * Set message for empty list view. */ public void setMessageForEmptyList(String message) { - if (mEmptyListMessage != null) { + if (mEmptyListContainer != null && mEmptyListMessage != null) { mEmptyListMessage.setText(message); } } /** - * Get the text of EmptyListMessage TextView + * displays an empty list information with a headline, a message and an icon. + * + * @param headline the headline + * @param message the message + * @param icon the icon to be shown + */ + public void setMessageForEmptyList(@StringRes int headline, @StringRes int message, @DrawableRes int icon) { + if (mEmptyListContainer != null && mEmptyListMessage != null) { + mEmptyListHeadline.setText(headline); + mEmptyListMessage.setText(message); + mEmptyListIcon.setImageResource(icon); + + mEmptyListIcon.setVisibility(View.VISIBLE); + mEmptyListProgress.setVisibility(View.GONE); + } + } + + /** + * Set message for empty list view. + */ + public void setEmptyListMessage() { + setMessageForEmptyList( + R.string.file_list_empty_headline, + R.string.file_list_empty, + R.drawable.ic_list_empty_folder + ); + } + + /** + * Set message for empty list view. + */ + public void setEmptyListLoadingMessage() { + if (mEmptyListContainer != null && mEmptyListMessage != null) { + mEmptyListMessage.setText(R.string.file_list_loading); + + mEmptyListIcon.setVisibility(View.GONE); + mEmptyListProgress.setVisibility(View.VISIBLE); + } + } + + /** + * Get the text of EmptyListMessage TextView. * - * @return String + * @return String empty text view text-value */ public String getEmptyViewText() { - return (mEmptyListMessage != null) ? mEmptyListMessage.getText().toString() : ""; + return (mEmptyListContainer != null && mEmptyListMessage != null) ? mEmptyListMessage.getText().toString() : ""; } protected void onCreateSwipeToRefresh(SwipeRefreshLayout refreshLayout) { // Colors in animations - refreshLayout.setColorSchemeResources(R.color.color_accent, R.color.primary, - R.color.primary_dark); + refreshLayout.setColorSchemeResources(R.color.color_accent, R.color.primary, R.color.primary_dark); refreshLayout.setOnRefreshListener(this); } @@ -424,7 +479,7 @@ public class ExtendedListFragment extends Fragment * TODO doc * To be called before setAdapter, or GridViewWithHeaderAndFooter will throw an exception * - * @param enabled + * @param enabled flag if footer should be shown/calculated */ protected void setFooterEnabled(boolean enabled) { if (enabled) { @@ -451,8 +506,9 @@ public class ExtendedListFragment extends Fragment } /** - * TODO doc - * @param text + * set the list/grid footer text. + * + * @param text the footer text */ protected void setFooterText(String text) { if (text != null && text.length() > 0) { diff --git a/src/com/owncloud/android/ui/fragment/LocalFileListFragment.java b/src/com/owncloud/android/ui/fragment/LocalFileListFragment.java index 4c54342132..baf6bc2af8 100644 --- a/src/com/owncloud/android/ui/fragment/LocalFileListFragment.java +++ b/src/com/owncloud/android/ui/fragment/LocalFileListFragment.java @@ -20,9 +20,6 @@ */ package com.owncloud.android.ui.fragment; -import java.io.File; -import java.util.ArrayList; - import android.app.Activity; import android.os.Bundle; import android.os.Environment; @@ -40,6 +37,9 @@ import com.owncloud.android.lib.common.utils.Log_OC; import com.owncloud.android.ui.adapter.LocalFileListAdapter; import com.owncloud.android.utils.FileStorageUtils; +import java.io.File; +import java.util.ArrayList; + /** * A Fragment that lists all files and folders in a given LOCAL path. @@ -87,7 +87,9 @@ public class LocalFileListFragment extends ExtendedListFragment { setChoiceMode(ListView.CHOICE_MODE_MULTIPLE); setSwipeEnabled(false); // Disable pull-to-refresh setFabEnabled(false); // Disable FAB - setMessageForEmptyList(getString(R.string.local_file_list_empty)); + setMessageForEmptyList( + R.string.file_list_empty_headline, R.string.local_file_list_empty, R.drawable.ic_list_empty_folder + ); Log_OC.i(TAG, "onCreateView() end"); return v; } diff --git a/src/com/owncloud/android/ui/fragment/UploadListFragment.java b/src/com/owncloud/android/ui/fragment/UploadListFragment.java index 9487c5dfde..c86022abd1 100755 --- a/src/com/owncloud/android/ui/fragment/UploadListFragment.java +++ b/src/com/owncloud/android/ui/fragment/UploadListFragment.java @@ -35,14 +35,13 @@ import com.owncloud.android.ui.adapter.ExpandableUploadListAdapter; /** * A Fragment that lists all files and folders in a given LOCAL path. - * */ public class UploadListFragment extends ExpandableListFragment { private static final String TAG = UploadListFragment.class.getSimpleName(); /** - * Reference to the Activity which this fragment is attached to. For - * callbacks + * Reference to the Activity which this fragment is attached to. + * For callbacks. */ private UploadListFragment.ContainerActivity mContainerActivity; @@ -63,7 +62,9 @@ public class UploadListFragment extends ExpandableListFragment { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = super.onCreateView(inflater, container, savedInstanceState); getListView().setChoiceMode(ListView.CHOICE_MODE_MULTIPLE); - setMessageForEmptyList(getString(R.string.upload_list_empty)); + setMessageForEmptyList( + R.string.upload_list_empty_headline, R.string.upload_list_empty_text, R.drawable.ic_list_empty_upload + ); setOnRefreshListener(this); return v; } @@ -127,12 +128,11 @@ public class UploadListFragment extends ExpandableListFragment { /** * Callback method invoked when an upload item is clicked by the user on * the upload list - * - * @param file + * + * @param file the file that has been clicked on. * @return return true if click was handled. */ public boolean onUploadItemClick(OCUpload file); - } public void binderReady(){ @@ -148,5 +148,4 @@ public class UploadListFragment extends ExpandableListFragment { mAdapter.refreshView(); } } - } \ No newline at end of file