|
@@ -1,37 +1,37 @@
|
|
/**
|
|
/**
|
|
- * Nextcloud Android client application
|
|
|
|
|
|
+ * Nextcloud Android client application
|
|
*
|
|
*
|
|
- * @author Andy Scherzinger
|
|
|
|
- * Copyright (C) 2016 Andy Scherzinger
|
|
|
|
- * Copyright (C) 2016 Nextcloud
|
|
|
|
- *
|
|
|
|
- * 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/>.
|
|
|
|
|
|
+ * @author Andy Scherzinger
|
|
|
|
+ * Copyright (C) 2016 Andy Scherzinger
|
|
|
|
+ * Copyright (C) 2016 Nextcloud
|
|
|
|
+ * <p>
|
|
|
|
+ * 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.
|
|
|
|
+ * <p>
|
|
|
|
+ * 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.
|
|
|
|
+ * <p>
|
|
|
|
+ * 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.activity;
|
|
package com.owncloud.android.ui.activity;
|
|
|
|
|
|
-import android.app.Activity;
|
|
|
|
import android.content.Intent;
|
|
import android.content.Intent;
|
|
import android.os.Bundle;
|
|
import android.os.Bundle;
|
|
import android.os.Handler;
|
|
import android.os.Handler;
|
|
import android.support.v7.widget.GridLayoutManager;
|
|
import android.support.v7.widget.GridLayoutManager;
|
|
import android.support.v7.widget.RecyclerView;
|
|
import android.support.v7.widget.RecyclerView;
|
|
import android.util.Log;
|
|
import android.util.Log;
|
|
-import android.support.v7.widget.GridLayoutManager;
|
|
|
|
-import android.support.v7.widget.RecyclerView;
|
|
|
|
import android.view.MenuItem;
|
|
import android.view.MenuItem;
|
|
import android.view.View;
|
|
import android.view.View;
|
|
|
|
+import android.widget.LinearLayout;
|
|
|
|
+import android.widget.TextView;
|
|
|
|
+import android.widget.Toast;
|
|
|
|
|
|
import com.owncloud.android.MainApp;
|
|
import com.owncloud.android.MainApp;
|
|
import com.owncloud.android.R;
|
|
import com.owncloud.android.R;
|
|
@@ -41,15 +41,16 @@ import com.owncloud.android.ui.adapter.FolderSyncAdapter;
|
|
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.TimerTask;
|
|
import java.util.TimerTask;
|
|
-import com.owncloud.android.ui.adapter.FolderSyncAdapter;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
* Activity displaying all auto-synced folders and/or instant upload media folders.
|
|
* Activity displaying all auto-synced folders and/or instant upload media folders.
|
|
*/
|
|
*/
|
|
-public class FolderSyncActivity extends FileActivity {
|
|
|
|
|
|
+public class FolderSyncActivity extends FileActivity implements FolderSyncAdapter.ClickListener {
|
|
private static final String TAG = FolderSyncActivity.class.getSimpleName();
|
|
private static final String TAG = FolderSyncActivity.class.getSimpleName();
|
|
private RecyclerView mRecyclerView;
|
|
private RecyclerView mRecyclerView;
|
|
private FolderSyncAdapter mAdapter;
|
|
private FolderSyncAdapter mAdapter;
|
|
|
|
+ private LinearLayout mProgress;
|
|
|
|
+ private TextView mEmpty;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
@@ -69,16 +70,13 @@ public class FolderSyncActivity extends FileActivity {
|
|
|
|
|
|
|
|
|
|
private void setupContent() {
|
|
private void setupContent() {
|
|
- // TODO setup/initialize UI
|
|
|
|
mRecyclerView = (RecyclerView) findViewById(android.R.id.list);
|
|
mRecyclerView = (RecyclerView) findViewById(android.R.id.list);
|
|
|
|
|
|
|
|
+ mProgress = (LinearLayout) findViewById(android.R.id.progress);
|
|
|
|
+ mEmpty = (TextView) findViewById(android.R.id.empty);
|
|
|
|
+
|
|
final int gridWidth = 4;
|
|
final int gridWidth = 4;
|
|
- mAdapter = new FolderSyncAdapter(this, gridWidth, new FolderSyncAdapter.ClickListener() {
|
|
|
|
- @Override
|
|
|
|
- public void onClick(View view, int section, int relative, int absolute) {
|
|
|
|
- selectItem(FolderSyncActivity.this);
|
|
|
|
- }
|
|
|
|
- }, mRecyclerView);
|
|
|
|
|
|
+ mAdapter = new FolderSyncAdapter(this, gridWidth, this, mRecyclerView);
|
|
|
|
|
|
final GridLayoutManager lm = new GridLayoutManager(this, gridWidth);
|
|
final GridLayoutManager lm = new GridLayoutManager(this, gridWidth);
|
|
mAdapter.setLayoutManager(lm);
|
|
mAdapter.setLayoutManager(lm);
|
|
@@ -88,11 +86,6 @@ public class FolderSyncActivity extends FileActivity {
|
|
load();
|
|
load();
|
|
}
|
|
}
|
|
|
|
|
|
- public static void selectItem(final Activity context) {
|
|
|
|
- // TODO implement selectItem()
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
private void load() {
|
|
private void load() {
|
|
if (mAdapter.getItemCount() > 0) return;
|
|
if (mAdapter.getItemCount() > 0) return;
|
|
setListShown(false);
|
|
setListShown(false);
|
|
@@ -103,7 +96,7 @@ public class FolderSyncActivity extends FileActivity {
|
|
final List<MediaFolder> mediaFolders = MediaProvider.getAllShownImagesPath(FolderSyncActivity.this);
|
|
final List<MediaFolder> mediaFolders = MediaProvider.getAllShownImagesPath(FolderSyncActivity.this);
|
|
|
|
|
|
for (MediaFolder mediaFolder : mediaFolders) {
|
|
for (MediaFolder mediaFolder : mediaFolders) {
|
|
- Log.d(TAG, mediaFolder.path);
|
|
|
|
|
|
+ Log.d(TAG, mediaFolder.absolutePath);
|
|
}
|
|
}
|
|
|
|
|
|
mHandler.post(new TimerTask() {
|
|
mHandler.post(new TimerTask() {
|
|
@@ -119,16 +112,9 @@ public class FolderSyncActivity extends FileActivity {
|
|
|
|
|
|
void setListShown(boolean shown) {
|
|
void setListShown(boolean shown) {
|
|
if (mRecyclerView != null) {
|
|
if (mRecyclerView != null) {
|
|
- mRecyclerView.setVisibility(shown ?
|
|
|
|
- View.VISIBLE : View.GONE);
|
|
|
|
-
|
|
|
|
- // TODO show/hide loading visuals
|
|
|
|
- /**
|
|
|
|
- mProgress.setVisibility(shown ?
|
|
|
|
- View.GONE : View.VISIBLE);
|
|
|
|
- mEmpty.setVisibility(shown && mAdapter.getItemCount() == 0 ?
|
|
|
|
- View.VISIBLE : View.GONE);
|
|
|
|
- **/
|
|
|
|
|
|
+ mRecyclerView.setVisibility(shown ? View.VISIBLE : View.GONE);
|
|
|
|
+ mProgress.setVisibility(shown ? View.GONE : View.VISIBLE);
|
|
|
|
+ mEmpty.setVisibility(shown && mAdapter.getItemCount() == 0 ? View.VISIBLE : View.GONE);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -164,4 +150,14 @@ public class FolderSyncActivity extends FileActivity {
|
|
fileDisplayActivity.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
|
fileDisplayActivity.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
|
startActivity(fileDisplayActivity);
|
|
startActivity(fileDisplayActivity);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void onSyncStatusToggleClick(int section, MediaFolder mediaFolder) {
|
|
|
|
+ Toast.makeText(this,"Sync Status Clicked for " + mediaFolder.absolutePath,Toast.LENGTH_SHORT).show();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void onSyncFolderSettingsClick(int section, MediaFolder mediaFolder) {
|
|
|
|
+ Toast.makeText(this,"Menu Clicked for " + mediaFolder.absolutePath,Toast.LENGTH_SHORT).show();
|
|
|
|
+ }
|
|
}
|
|
}
|