You should have received a copy of the GNU 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"
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="0dp"
android:layout_height="match_parent"
- android:layout_weight="1"
- android:orientation="vertical" >
+ android:layout_weight="1" >
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/swipe_refresh_files"
<com.owncloud.android.ui.ExtendedListView
android:id="@+id/list_root"
android:layout_width="match_parent"
- android:layout_height="0dip"
- android:layout_weight="1" />
+ android:layout_height="match_parent" />
</android.support.v4.widget.SwipeRefreshLayout>
- <TextView
- android:id="@+id/empty_list_view"
+ <android.support.v4.widget.SwipeRefreshLayout
+ android:id="@+id/swipe_refresh_files_emptyView"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:gravity="center_vertical|center_horizontal"
- android:text="@string/file_list_empty"
- android:visibility="gone"
- />
+ android:visibility="gone" >
-</LinearLayout>
+ <ScrollView
+ android:layout_width="match_parent"
+ android:layout_height="match_parent" >
+
+ <TextView
+ android:id="@+id/empty_list_view"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center_vertical|center_horizontal"
+ android:text="@string/empty"
+ android:layout_gravity="center"
+ android:visibility="visible" />
+
+ </ScrollView>
+ </android.support.v4.widget.SwipeRefreshLayout>
+</FrameLayout>
<string name="uploader_wrn_no_content_text">No content was received. Nothing to upload.</string>
<string name="uploader_error_forbidden_content">%1$s is not allowed to access the shared content</string>
<string name="uploader_info_uploading">Uploading</string>
- <string name="file_list_empty">There are no files in this folder.\nNew files can be added with the \"Upload\" menu option.</string>
+ <string name="file_list_empty">Nothing in here. Upload something!</string>
+ <string name="file_list_loading">Loading...</string>
+ <string name="local_file_list_empty">There are no files in this folder.</string>
<string name="filedetails_select_file">Tap on a file to display additional information.</string>
<string name="filedetails_size">Size:</string>
<string name="filedetails_type">Type:</string>
<string name="network_error_socket_timeout_exception">An error occurred while waiting for the server, the operation couldn\'t have been done</string>
<string name="network_error_connect_timeout_exception">An error occurred while waiting for the server, the operation couldn\'t have been done</string>
<string name="network_host_not_available">The operation couldn\'t be completed, server is unavailable</string>
+ <string name="empty"></string>
<string name="forbidden_permissions">You do not have permission %s</string>
<string name="forbidden_permissions_rename">to rename this file</string>
getSupportActionBar().setHomeButtonEnabled(true); // mandatory since Android ICS, according to the official documentation
setSupportProgressBarIndeterminateVisibility(mSyncInProgress /*|| mRefreshSharesInProgress*/); // always AFTER setContentView(...) ; to work around bug in its implementation
+ setBackgroundText();
+
Log_OC.d(TAG, "onCreate() end");
}
removeStickyBroadcast(intent);
Log_OC.d(TAG, "Setting progress visibility to " + mSyncInProgress);
setSupportProgressBarIndeterminateVisibility(mSyncInProgress /*|| mRefreshSharesInProgress*/);
+
+ setBackgroundText();
}
}
}
+ /**
+ * Show a text message on screen view for notifying user if content is
+ * loading or folder is empty
+ */
+ 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.setMessageForEmptyList(getString(message));
+ } else {
+ Log.e(TAG, "OCFileListFragment is null");
+ }
+ }
/**
* Once the file upload has finished -> update view
synchFolderOp.execute(getAccount(), this, null, null);
setSupportProgressBarIndeterminateVisibility(true);
+
+ setBackgroundText();
}
/**
}
onTransferStateChanged(file, false, false);
}
-
+
}
package com.owncloud.android.ui.fragment;
-import com.actionbarsherlock.app.SherlockFragment;
-import com.owncloud.android.R;
-import com.owncloud.android.ui.ExtendedListView;
-import com.owncloud.android.utils.Log_OC;
-
-
import android.os.Bundle;
import android.support.v4.widget.SwipeRefreshLayout;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
-import android.widget.ListAdapter;
import android.widget.AdapterView.OnItemClickListener;
+import android.widget.ListAdapter;
import android.widget.ListView;
+import android.widget.TextView;
+
+import com.actionbarsherlock.app.SherlockFragment;
+import com.owncloud.android.R;
+import com.owncloud.android.ui.ExtendedListView;
+import com.owncloud.android.utils.Log_OC;
/**
* TODO extending SherlockListFragment instead of SherlockFragment
protected ExtendedListView mList;
private SwipeRefreshLayout mRefreshLayout;
+ private SwipeRefreshLayout mRefreshEmptyLayout;
+ private TextView mEmptyListMessage;
public void setListAdapter(ListAdapter listAdapter) {
mList.setAdapter(listAdapter);
//mList = new ExtendedListView(getActivity());
View v = inflater.inflate(R.layout.list_fragment, null);
+ mEmptyListMessage = (TextView) v.findViewById(R.id.empty_list_view);
mList = (ExtendedListView)(v.findViewById(R.id.list_root));
mList.setOnItemClickListener(this);
- //mList.setEmptyView(v.findViewById(R.id.empty_list_view)); // looks like it's not a cool idea
+
mList.setDivider(getResources().getDrawable(R.drawable.uploader_list_separator));
mList.setDividerHeight(1);
// Pull down refresh
mRefreshLayout = (SwipeRefreshLayout) v.findViewById(R.id.swipe_refresh_files);
- // Colors in animations: background
- mRefreshLayout.setColorScheme(R.color.background_color, R.color.background_color,
- R.color.background_color, R.color.background_color);
+ mRefreshEmptyLayout = (SwipeRefreshLayout) v.findViewById(R.id.swipe_refresh_files_emptyView);
- mRefreshLayout.setOnRefreshListener(this);
+ onCreateSwipeToRefresh(mRefreshLayout);
+ onCreateSwipeToRefresh(mRefreshEmptyLayout);
+ mList.setEmptyView(mRefreshEmptyLayout);
+
return v;
}
@Override
public void onRefresh() {
- // to be @overriden
+ // to be @overriden
mRefreshLayout.setRefreshing(false);
+ mRefreshEmptyLayout.setRefreshing(false);
}
/**
public void hideSwipeProgress() {
mRefreshLayout.setRefreshing(false);
}
-
-
+
+ /**
+ * Set message for empty list view
+ */
+ public void setMessageForEmptyList(String message) {
+ if (mEmptyListMessage != null) {
+ mEmptyListMessage.setText(message);
+ }
+ }
+
+ /**
+ * Get the text of EmptyListMessage TextView
+ *
+ * @return String
+ */
+ public String getEmptyViewText() {
+ return (mEmptyListMessage != null) ? mEmptyListMessage.getText().toString() : "";
+ }
+
+ private void onCreateSwipeToRefresh(SwipeRefreshLayout refreshLayout) {
+ // Colors in animations: background
+ refreshLayout.setColorScheme(R.color.background_color, R.color.background_color, R.color.background_color,
+ R.color.background_color);
+
+ refreshLayout.setOnRefreshListener(this);
+ }
+
}
import java.io.File;
-import com.owncloud.android.R;
-import com.owncloud.android.ui.adapter.LocalFileListAdapter;
-import com.owncloud.android.utils.Log_OC;
-
-
import android.app.Activity;
import android.os.Bundle;
import android.os.Environment;
import android.widget.ImageView;
import android.widget.ListView;
+import com.owncloud.android.R;
+import com.owncloud.android.ui.adapter.LocalFileListAdapter;
+import com.owncloud.android.utils.Log_OC;
+
/**
* A Fragment that lists all files and folders in a given LOCAL path.
View v = super.onCreateView(inflater, container, savedInstanceState);
getListView().setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
disableSwipe(); // Disable pull refresh
+ setMessageForEmptyList(getString(R.string.local_file_list_empty));
Log_OC.i(TAG, "onCreateView() end");
return v;
}
import java.io.File;
import java.util.ArrayList;
+import android.app.Activity;
+import android.os.Bundle;
+import android.view.ContextMenu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.AdapterView;
+import android.widget.AdapterView.AdapterContextMenuInfo;
+
import com.owncloud.android.R;
import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.files.FileMenuFilter;
-import com.owncloud.android.ui.adapter.FileListListAdapter;
import com.owncloud.android.ui.activity.FileDisplayActivity;
+import com.owncloud.android.ui.adapter.FileListListAdapter;
import com.owncloud.android.ui.dialog.ConfirmationDialogFragment;
import com.owncloud.android.ui.dialog.RemoveFileDialogFragment;
import com.owncloud.android.ui.dialog.RenameFileDialogFragment;
import com.owncloud.android.ui.preview.PreviewMediaFragment;
import com.owncloud.android.utils.Log_OC;
-import android.app.Activity;
-import android.os.Bundle;
-import android.view.ContextMenu;
-import android.view.MenuInflater;
-import android.view.MenuItem;
-import android.view.View;
-import android.widget.AdapterView;
-import android.widget.AdapterView.AdapterContextMenuInfo;
-
/**
* A Fragment that lists all files and folders in a given path.
*
private static final String KEY_FIRST_POSITIONS= "FIRST_POSITIONS";
private static final String KEY_TOPS = "TOPS";
private static final String KEY_HEIGHT_CELL = "HEIGHT_CELL";
+ private static final String KEY_EMPTY_LIST_MESSAGE = "EMPTY_LIST_MESSAGE";
private FileFragment.ContainerActivity mContainerActivity;
mFirstPositions = savedInstanceState.getIntegerArrayList(KEY_FIRST_POSITIONS);
mTops = savedInstanceState.getIntegerArrayList(KEY_TOPS);
mHeightCell = savedInstanceState.getInt(KEY_HEIGHT_CELL);
+ setMessageForEmptyList(savedInstanceState.getString(KEY_EMPTY_LIST_MESSAGE));
} else {
mIndexes = new ArrayList<Integer>();
setListAdapter(mAdapter);
registerForContextMenu(getListView());
- getListView().setOnCreateContextMenuListener(this);
-
+ getListView().setOnCreateContextMenuListener(this);
}
/**
outState.putIntegerArrayList(KEY_FIRST_POSITIONS, mFirstPositions);
outState.putIntegerArrayList(KEY_TOPS, mTops);
outState.putInt(KEY_HEIGHT_CELL, mHeightCell);
+ outState.putString(KEY_EMPTY_LIST_MESSAGE, getEmptyViewText());
}
/**