-/* ownCloud Android client application
- * Copyright (C) 2012-2013 ownCloud Inc.
+/**
+ * ownCloud Android client application
+ *
+ * @author David A. Velasco
+ * Copyright (C) 2015 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
+ * it under the terms of the GNU General Public License version 2,
+ * as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.app.DialogFragment;
+import android.support.v7.app.ActionBarActivity;
import android.text.method.ScrollingMovementMethod;
-import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;
import android.widget.Toast;
-import com.actionbarsherlock.app.SherlockFragmentActivity;
-import com.owncloud.android.Log_OC;
import com.owncloud.android.R;
import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.datamodel.OCFile;
+import com.owncloud.android.lib.common.utils.Log_OC;
+
import com.owncloud.android.ui.dialog.IndeterminateProgressDialog;
import com.owncloud.android.utils.FileStorageUtils;
+
/**
- * Activity reporting errors occurred when local files uploaded to an ownCloud account with an app in
- * version under 1.3.16 where being copied to the ownCloud local folder.
+ * Activity reporting errors occurred when local files uploaded to an ownCloud account with an app
+ * in version under 1.3.16 where being copied to the ownCloud local folder.
*
- * Allows the user move the files to the ownCloud local folder, or let them unlinked to the remote
+ * Allows the user move the files to the ownCloud local folder. let them unlinked to the remote
* files.
*
* Shown when the error notification summarizing the list of errors is clicked by the user.
- *
- * @author David A. Velasco
*/
-public class ErrorsWhileCopyingHandlerActivity extends SherlockFragmentActivity implements OnClickListener {
+public class ErrorsWhileCopyingHandlerActivity extends ActionBarActivity
+ implements OnClickListener {
private static final String TAG = ErrorsWhileCopyingHandlerActivity.class.getSimpleName();
- public static final String EXTRA_ACCOUNT = ErrorsWhileCopyingHandlerActivity.class.getCanonicalName() + ".EXTRA_ACCOUNT";
- public static final String EXTRA_LOCAL_PATHS = ErrorsWhileCopyingHandlerActivity.class.getCanonicalName() + ".EXTRA_LOCAL_PATHS";
- public static final String EXTRA_REMOTE_PATHS = ErrorsWhileCopyingHandlerActivity.class.getCanonicalName() + ".EXTRA_REMOTE_PATHS";
+ public static final String EXTRA_ACCOUNT =
+ ErrorsWhileCopyingHandlerActivity.class.getCanonicalName() + ".EXTRA_ACCOUNT";
+ public static final String EXTRA_LOCAL_PATHS =
+ ErrorsWhileCopyingHandlerActivity.class.getCanonicalName() + ".EXTRA_LOCAL_PATHS";
+ public static final String EXTRA_REMOTE_PATHS =
+ ErrorsWhileCopyingHandlerActivity.class.getCanonicalName() + ".EXTRA_REMOTE_PATHS";
private static final String WAIT_DIALOG_TAG = "WAIT_DIALOG";
/// customize text message
TextView textView = (TextView) findViewById(R.id.message);
String appName = getString(R.string.app_name);
- String message = String.format(getString(R.string.sync_foreign_files_forgotten_explanation), appName, appName, appName, appName, mAccount.name);
+ String message = String.format(getString(R.string.sync_foreign_files_forgotten_explanation),
+ appName, appName, appName, appName, mAccount.name);
textView.setText(message);
textView.setMovementMethod(new ScrollingMovementMethod());
/// customize buttons
Button cancelBtn = (Button) findViewById(R.id.cancel);
Button okBtn = (Button) findViewById(R.id.ok);
+
okBtn.setText(R.string.foreign_files_move);
cancelBtn.setOnClickListener(this);
okBtn.setOnClickListener(this);
/**
- * Customized adapter, showing the local files as main text in two-lines list item and the remote files
- * as the secondary text.
- *
- * @author David A. Velasco
+ * Customized adapter, showing the local files as main text in two-lines list item and the
+ * remote files as the secondary text.
*/
public class ErrorsWhileCopyingListAdapter extends ArrayAdapter<String> {
ErrorsWhileCopyingListAdapter() {
- super(ErrorsWhileCopyingHandlerActivity.this, android.R.layout.two_line_list_item, android.R.id.text1, mLocalPaths);
+ super(ErrorsWhileCopyingHandlerActivity.this, android.R.layout.two_line_list_item,
+ android.R.id.text1, mLocalPaths);
}
@Override
public View getView (int position, View convertView, ViewGroup parent) {
View view = convertView;
if (view == null) {
- LayoutInflater vi = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+ LayoutInflater vi = (LayoutInflater) getSystemService(
+ Context.LAYOUT_INFLATER_SERVICE);
view = vi.inflate(android.R.layout.two_line_list_item, null);
}
if (view != null) {
text1.setText(String.format(getString(R.string.foreign_files_local_text), localPath));
}
}
- if (mRemotePaths != null && mRemotePaths.size() > 0 && position >= 0 && position < mRemotePaths.size()) {
+ if (mRemotePaths != null && mRemotePaths.size() > 0 && position >= 0 &&
+ position < mRemotePaths.size()) {
TextView text2 = (TextView) view.findViewById(android.R.id.text2);
String remotePath = mRemotePaths.get(position);
if (text2 != null && remotePath != null) {
/**
* Asynchronous task performing the move of all the local files to the ownCloud folder.
- *
- * @author David A. Velasco
*/
private class MoveFilesTask extends AsyncTask<Void, Void, Boolean> {
if (result) {
// nothing else to do in this activity
- Toast t = Toast.makeText(ErrorsWhileCopyingHandlerActivity.this, getString(R.string.foreign_files_success), Toast.LENGTH_LONG);
+ Toast t = Toast.makeText(ErrorsWhileCopyingHandlerActivity.this,
+ getString(R.string.foreign_files_success), Toast.LENGTH_LONG);
t.show();
finish();
} else {
- Toast t = Toast.makeText(ErrorsWhileCopyingHandlerActivity.this, getString(R.string.foreign_files_fail), Toast.LENGTH_LONG);
+ Toast t = Toast.makeText(ErrorsWhileCopyingHandlerActivity.this,
+ getString(R.string.foreign_files_fail), Toast.LENGTH_LONG);
t.show();
}
}