Merge pull request #627 from owncloud/better_loggin_system

Improved logging system
This commit is contained in:
David A. Velasco 2014-09-18 09:38:27 +02:00
commit 60d26d53f6
63 changed files with 331 additions and 332 deletions

@ -1 +1 @@
Subproject commit 79d586637ee306fdbefbbc4439eb3b058f6877c9
Subproject commit ff0de72ea5352ba22a21cdac289e9314706cdb2e

View file

@ -1,35 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="8dp"
android:paddingRight="8dp">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="10dp"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:weightSum="1" >
<ListView android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
<ScrollView
android:id="@+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginBottom="15dp"
android:layout_weight="1" >
<TextView android:id="@android:id/empty"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#FF0000"
android:text="No data"/>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="bottom">
<Button
android:id="@+id/deleteLogHistoryButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/prefs_log_delete_history_button"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="@+id/logTV"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/empty" />
</LinearLayout>
</ScrollView>
<Button
android:id="@+id/deleteLogHistoryButton"
android:layout_width="match_parent"
android:layout_height="50dp"
android:text="@string/prefs_log_delete_history_button" />
<Button
android:id="@+id/sendLogHistoryButton"
android:layout_width="match_parent"
android:layout_height="50dp"
android:text="@string/log_send_history_button" />
</LinearLayout>

View file

@ -43,6 +43,12 @@
android:orderInCategory="2"
android:showAsAction="never"
android:title="@string/actionbar_settings"/>
<item
android:id="@+id/action_logger"
android:icon="@drawable/ic_action_settings"
android:orderInCategory="2"
android:showAsAction="never"
android:title="@string/actionbar_logger"/>
<!-- <item android:id="@+id/search" android:title="@string/actionbar_search" android:icon="@drawable/ic_action_search"></item> -->

View file

@ -49,6 +49,9 @@
<string name="mail_feedback">"mailto:apps@owncloud.com"</string>
<string name="url_app_download">"https://play.google.com/store/apps/details?id=com.owncloud.android"</string>
<!--Destination mail for sending log files -->
<string name="mail_logger"></string>
</resources>

View file

@ -285,6 +285,11 @@
<string name="prefs_add_account">Add account</string>
<string name="auth_redirect_non_secure_connection_title">Secure connection is redirected through an unsecured route.</string>
<string name="actionbar_logger">Logs</string>
<string name="log_send_history_button">Send History</string>
<string name="log_mail_subject">Owncloud Android app logs</string>
<string name="log_progress_dialog_text">Loading data...</string>
<string name="saml_authentication_required_text">Authentication required</string>
<string name="saml_authentication_wrong_pass">Wrong password</string>
<string name="actionbar_move">Move</string>

View file

@ -16,11 +16,12 @@
*/
package com.owncloud.android;
import com.owncloud.android.lib.common.OwnCloudClientManagerFactory;
import com.owncloud.android.lib.common.OwnCloudClientManagerFactory.Policy;
import android.app.Application;
import android.content.Context;
import com.owncloud.android.lib.common.OwnCloudClientManagerFactory;
import com.owncloud.android.lib.common.OwnCloudClientManagerFactory.Policy;
import com.owncloud.android.lib.common.utils.Log_OC;
/**
* Main Application of the project
*
@ -54,6 +55,16 @@ public class MainApp extends Application {
OwnCloudClientManagerFactory.setDefaultPolicy(Policy.ALWAYS_NEW_CLIENT);
}
if (BuildConfig.DEBUG) {
String dataFolder = getDataFolder();
// Set folder for store logs
Log_OC.setLogDataFolder(dataFolder);
Log_OC.startLogging();
Log_OC.d("Debug", "start logging");
}
}
public static Context getAppContext() {
@ -66,7 +77,7 @@ public class MainApp extends Application {
public static String getAccountType() {
return getAppContext().getResources().getString(R.string.account_type);
}
// From AccountAuthenticator
// public static final String AUTHORITY = "org.owncloud";
public static String getAuthority() {

View file

@ -29,7 +29,7 @@ import android.os.Handler;
import android.widget.Toast;
import com.owncloud.android.lib.common.accounts.AccountTypeUtils;
import com.owncloud.android.utils.Log_OC;
import com.owncloud.android.lib.common.utils.Log_OC;
/**

View file

@ -71,6 +71,7 @@ import com.owncloud.android.lib.common.operations.OnRemoteOperationListener;
import com.owncloud.android.lib.common.operations.RemoteOperation;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.lib.resources.files.ExistenceCheckRemoteOperation;
import com.owncloud.android.lib.resources.status.OwnCloudVersion;
import com.owncloud.android.lib.resources.users.GetRemoteUserNameOperation;
@ -84,7 +85,6 @@ import com.owncloud.android.ui.dialog.IndeterminateProgressDialog;
import com.owncloud.android.ui.dialog.SamlWebViewDialog;
import com.owncloud.android.ui.dialog.SslUntrustedCertDialog;
import com.owncloud.android.ui.dialog.SslUntrustedCertDialog.OnSslUntrustedCertListener;
import com.owncloud.android.utils.Log_OC;
/**
* This Activity is used to add an ownCloud account to the App

View file

@ -24,6 +24,9 @@ import java.security.cert.CertificateException;
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
import com.owncloud.android.lib.common.network.NetworkUtils;
import com.owncloud.android.lib.common.utils.Log_OC;
import android.content.Context;
import android.graphics.Bitmap;
import android.net.http.SslCertificate;
@ -40,9 +43,6 @@ import android.webkit.WebResourceResponse;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import com.owncloud.android.lib.common.network.NetworkUtils;
import com.owncloud.android.utils.Log_OC;
/**
* Custom {@link WebViewClient} client aimed to catch the end of a single-sign-on process

View file

@ -27,11 +27,11 @@ import java.util.Vector;
import com.owncloud.android.MainApp;
import com.owncloud.android.db.ProviderMeta.ProviderTableMeta;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.lib.resources.shares.OCShare;
import com.owncloud.android.lib.resources.shares.ShareType;
import com.owncloud.android.lib.resources.files.FileUtils;
import com.owncloud.android.utils.FileStorageUtils;
import com.owncloud.android.utils.Log_OC;
import android.accounts.Account;

View file

@ -20,7 +20,7 @@ package com.owncloud.android.datamodel;
import java.io.File;
import com.owncloud.android.utils.Log_OC;
import com.owncloud.android.lib.common.utils.Log_OC;
import android.os.Parcel;

View file

@ -18,7 +18,7 @@
package com.owncloud.android.db;
import com.owncloud.android.MainApp;
import com.owncloud.android.utils.Log_OC;
import com.owncloud.android.lib.common.utils.Log_OC;
import android.content.ContentValues;
import android.content.Context;

View file

@ -18,8 +18,8 @@
package com.owncloud.android.files;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.services.observer.FileObserverService;
import com.owncloud.android.utils.Log_OC;
import android.content.BroadcastReceiver;
import android.content.Context;

View file

@ -34,11 +34,11 @@ import com.owncloud.android.files.services.FileUploader.FileUploaderBinder;
import com.owncloud.android.lib.common.accounts.AccountUtils.Constants;
import com.owncloud.android.lib.common.network.WebdavUtils;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.lib.resources.status.OwnCloudVersion;
import com.owncloud.android.services.OperationsService;
import com.owncloud.android.ui.activity.FileActivity;
import com.owncloud.android.ui.dialog.ShareLinkToDialog;
import com.owncloud.android.utils.Log_OC;
/**
*

View file

@ -24,8 +24,8 @@ import com.owncloud.android.MainApp;
import com.owncloud.android.authentication.AccountUtils;
import com.owncloud.android.db.DbHandler;
import com.owncloud.android.files.services.FileUploader;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.utils.FileStorageUtils;
import com.owncloud.android.utils.Log_OC;
import android.accounts.Account;

View file

@ -41,6 +41,7 @@ import com.owncloud.android.notifications.NotificationBuilderWithProgressBar;
import com.owncloud.android.notifications.NotificationDelayer;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.lib.resources.files.FileUtils;
import com.owncloud.android.operations.DownloadFileOperation;
import com.owncloud.android.ui.activity.FileActivity;
@ -48,7 +49,6 @@ import com.owncloud.android.ui.activity.FileDisplayActivity;
import com.owncloud.android.ui.preview.PreviewImageActivity;
import com.owncloud.android.ui.preview.PreviewImageFragment;
import com.owncloud.android.utils.ErrorMessageAdapter;
import com.owncloud.android.utils.Log_OC;
import android.accounts.Account;
import android.accounts.AccountsException;

View file

@ -59,6 +59,7 @@ import com.owncloud.android.lib.common.network.OnDatatransferProgressListener;
import com.owncloud.android.lib.common.operations.RemoteOperation;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.lib.resources.files.ExistenceCheckRemoteOperation;
import com.owncloud.android.lib.resources.files.FileUtils;
import com.owncloud.android.lib.resources.files.ReadRemoteFileOperation;
@ -72,7 +73,6 @@ import com.owncloud.android.operations.common.SyncOperation;
import com.owncloud.android.ui.activity.FileActivity;
import com.owncloud.android.ui.activity.FileDisplayActivity;
import com.owncloud.android.utils.ErrorMessageAdapter;
import com.owncloud.android.utils.Log_OC;

View file

@ -39,9 +39,9 @@ import java.io.IOException;
import com.owncloud.android.R;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.ui.activity.FileActivity;
import com.owncloud.android.ui.activity.FileDisplayActivity;
import com.owncloud.android.utils.Log_OC;
/**

View file

@ -19,8 +19,8 @@ package com.owncloud.android.media;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.media.MediaService.State;
import com.owncloud.android.utils.Log_OC;
import android.accounts.Account;
import android.content.Intent;

View file

@ -23,9 +23,9 @@ import com.owncloud.android.lib.resources.files.CreateRemoteFolderOperation;
import com.owncloud.android.lib.common.operations.OnRemoteOperationListener;
import com.owncloud.android.lib.common.operations.RemoteOperation;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.operations.common.SyncOperation;
import com.owncloud.android.utils.FileStorageUtils;
import com.owncloud.android.utils.Log_OC;
/**

View file

@ -32,12 +32,12 @@ import com.owncloud.android.lib.common.OwnCloudClient;
import com.owncloud.android.lib.resources.shares.OCShare;
import com.owncloud.android.lib.common.operations.RemoteOperation;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.lib.resources.shares.GetRemoteSharesForFileOperation;
import com.owncloud.android.lib.resources.shares.ShareType;
import com.owncloud.android.lib.resources.shares.CreateRemoteShareOperation;
import com.owncloud.android.lib.resources.files.FileUtils;
import com.owncloud.android.operations.common.SyncOperation;
import com.owncloud.android.utils.Log_OC;
public class CreateShareOperation extends SyncOperation {

View file

@ -31,6 +31,7 @@ import com.owncloud.android.lib.common.operations.OnRemoteOperationListener;
import com.owncloud.android.lib.common.operations.RemoteOperation;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.lib.resources.files.ExistenceCheckRemoteOperation;
import android.content.Context;
@ -122,7 +123,7 @@ public class DetectAuthenticationMethodOperation extends RemoteOperation {
authMethod = AuthenticationMethod.SAML_WEB_SSO;
}
// else - fall back to UNKNOWN
Log.d(TAG, "Authentication method found: " + authenticationMethodToString(authMethod));
Log_OC.d(TAG, "Authentication method found: " + authenticationMethodToString(authMethod));
if (!authMethod.equals(AuthenticationMethod.UNKNOWN)) {
result = new RemoteOperationResult(true, result.getHttpCode(), null);

View file

@ -29,9 +29,9 @@ import com.owncloud.android.lib.common.OwnCloudClient;
import com.owncloud.android.lib.common.operations.OperationCancelledException;
import com.owncloud.android.lib.common.operations.RemoteOperation;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.lib.resources.files.DownloadRemoteFileOperation;
import com.owncloud.android.utils.FileStorageUtils;
import com.owncloud.android.utils.Log_OC;
import android.accounts.Account;
import android.webkit.MimeTypeMap;

View file

@ -31,10 +31,10 @@ import com.owncloud.android.lib.common.OwnCloudClient;
import com.owncloud.android.lib.common.operations.RemoteOperation;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.lib.resources.status.GetRemoteStatusOperation;
import com.owncloud.android.lib.resources.status.OwnCloudVersion;
import com.owncloud.android.operations.DetectAuthenticationMethodOperation.AuthenticationMethod;
import com.owncloud.android.utils.Log_OC;
import android.content.Context;

View file

@ -23,9 +23,9 @@ import java.util.ArrayList;
import com.owncloud.android.lib.common.OwnCloudClient;
import com.owncloud.android.lib.resources.shares.OCShare;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.lib.resources.shares.GetRemoteSharesForFileOperation;
import com.owncloud.android.operations.common.SyncOperation;
import com.owncloud.android.utils.Log_OC;
/**
* Provide a list shares for a specific file.

View file

@ -21,10 +21,10 @@ import java.util.ArrayList;
import com.owncloud.android.lib.common.OwnCloudClient;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.lib.resources.shares.OCShare;
import com.owncloud.android.lib.resources.shares.GetRemoteSharesOperation;
import com.owncloud.android.operations.common.SyncOperation;
import com.owncloud.android.utils.Log_OC;
/**
* Access to remote operation to get the share files/folders

View file

@ -14,7 +14,7 @@ import com.owncloud.android.lib.common.OwnCloudClient;
import com.owncloud.android.lib.common.operations.RemoteOperation;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
import com.owncloud.android.utils.Log_OC;
import com.owncloud.android.lib.common.utils.Log_OC;
public class OAuth2GetAccessToken extends RemoteOperation {

View file

@ -24,10 +24,10 @@ import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.lib.common.OwnCloudClient;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.lib.resources.files.RenameRemoteFileOperation;
import com.owncloud.android.operations.common.SyncOperation;
import com.owncloud.android.utils.FileStorageUtils;
import com.owncloud.android.utils.Log_OC;
import android.accounts.Account;

View file

@ -25,10 +25,10 @@ import com.owncloud.android.lib.common.OwnCloudClient;
import com.owncloud.android.lib.resources.files.RemoteFile;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.lib.resources.files.ReadRemoteFileOperation;
import com.owncloud.android.operations.common.SyncOperation;
import com.owncloud.android.utils.FileStorageUtils;
import com.owncloud.android.utils.Log_OC;
import android.accounts.Account;
import android.content.Context;

View file

@ -43,6 +43,7 @@ import com.owncloud.android.lib.resources.shares.OCShare;
import com.owncloud.android.lib.common.operations.RemoteOperation;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.lib.resources.shares.GetRemoteSharesForFileOperation;
import com.owncloud.android.lib.resources.files.FileUtils;
import com.owncloud.android.lib.resources.files.ReadRemoteFileOperation;
@ -51,7 +52,6 @@ import com.owncloud.android.lib.resources.files.RemoteFile;
import com.owncloud.android.syncadapter.FileSyncAdapter;
import com.owncloud.android.utils.FileStorageUtils;
import com.owncloud.android.utils.Log_OC;

View file

@ -24,13 +24,13 @@ import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.lib.common.OwnCloudClient;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.lib.resources.files.ExistenceCheckRemoteOperation;
import com.owncloud.android.lib.resources.shares.OCShare;
import com.owncloud.android.lib.resources.shares.RemoveRemoteShareOperation;
import com.owncloud.android.lib.resources.shares.ShareType;
import com.owncloud.android.operations.common.SyncOperation;
import com.owncloud.android.utils.Log_OC;
/**
* Unshare file/folder

View file

@ -28,8 +28,8 @@ import com.owncloud.android.lib.common.accounts.AccountUtils.Constants;
import com.owncloud.android.lib.common.operations.RemoteOperation;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.lib.resources.status.OwnCloudVersion;
import com.owncloud.android.utils.Log_OC;
import android.accounts.Account;
import android.accounts.AccountManager;

View file

@ -40,11 +40,11 @@ import com.owncloud.android.lib.common.operations.OperationCancelledException;
import com.owncloud.android.lib.common.operations.RemoteOperation;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.lib.resources.files.ChunkedUploadRemoteFileOperation;
import com.owncloud.android.lib.resources.files.ExistenceCheckRemoteOperation;
import com.owncloud.android.lib.resources.files.UploadRemoteFileOperation;
import com.owncloud.android.utils.FileStorageUtils;
import com.owncloud.android.utils.Log_OC;
import android.accounts.Account;
import android.content.Context;

View file

@ -24,8 +24,8 @@ import java.util.HashMap;
import com.owncloud.android.R;
import com.owncloud.android.db.ProviderMeta;
import com.owncloud.android.db.ProviderMeta.ProviderTableMeta;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.lib.resources.shares.ShareType;
import com.owncloud.android.utils.Log_OC;

View file

@ -35,6 +35,7 @@ import com.owncloud.android.lib.common.accounts.AccountUtils.AccountNotFoundExce
import com.owncloud.android.lib.common.operations.OnRemoteOperationListener;
import com.owncloud.android.lib.common.operations.RemoteOperation;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.lib.resources.files.ExistenceCheckRemoteOperation;
import com.owncloud.android.lib.resources.shares.ShareType;
import com.owncloud.android.lib.resources.users.GetRemoteUserNameOperation;
@ -48,7 +49,6 @@ import com.owncloud.android.operations.RemoveFileOperation;
import com.owncloud.android.operations.RenameFileOperation;
import com.owncloud.android.operations.SynchronizeFileOperation;
import com.owncloud.android.operations.UnshareLinkOperation;
import com.owncloud.android.utils.Log_OC;
import android.accounts.Account;
import android.accounts.AccountsException;

View file

@ -37,9 +37,9 @@ import com.owncloud.android.authentication.AccountUtils;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.db.ProviderMeta.ProviderTableMeta;
import com.owncloud.android.files.services.FileDownloader;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.operations.SynchronizeFileOperation;
import com.owncloud.android.utils.FileStorageUtils;
import com.owncloud.android.utils.Log_OC;
/**

View file

@ -30,9 +30,9 @@ import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.operations.SynchronizeFileOperation;
import com.owncloud.android.ui.activity.ConflictsResolveActivity;
import com.owncloud.android.utils.Log_OC;
/**
* Observer watching a folder to request the synchronization of kept-in-sync files

View file

@ -34,8 +34,8 @@ import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.operations.SynchronizeFolderOperation;
import com.owncloud.android.operations.UpdateOCVersionOperation;
import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.ui.activity.ErrorsWhileCopyingHandlerActivity;
import com.owncloud.android.utils.Log_OC;
import android.accounts.Account;
import android.accounts.AccountsException;

View file

@ -21,11 +21,11 @@ package com.owncloud.android.ui.activity;
import com.actionbarsherlock.app.ActionBar;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.files.services.FileUploader;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.ui.dialog.ConflictsResolveDialog;
import com.owncloud.android.ui.dialog.ConflictsResolveDialog.Decision;
import com.owncloud.android.ui.dialog.ConflictsResolveDialog.OnConflictDecisionMadeListener;
import com.owncloud.android.utils.DisplayUtils;
import com.owncloud.android.utils.Log_OC;
import android.content.Intent;
import android.os.Bundle;

View file

@ -42,10 +42,10 @@ import com.actionbarsherlock.app.SherlockFragmentActivity;
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;
import com.owncloud.android.utils.Log_OC;

View file

@ -52,6 +52,7 @@ import com.owncloud.android.lib.common.operations.OnRemoteOperationListener;
import com.owncloud.android.lib.common.operations.RemoteOperation;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.operations.CreateShareOperation;
import com.owncloud.android.operations.UnshareLinkOperation;
@ -59,7 +60,6 @@ import com.owncloud.android.services.OperationsService;
import com.owncloud.android.services.OperationsService.OperationsServiceBinder;
import com.owncloud.android.ui.dialog.LoadingDialog;
import com.owncloud.android.utils.ErrorMessageAdapter;
import com.owncloud.android.utils.Log_OC;
/**

View file

@ -61,6 +61,7 @@ import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuInflater;
import com.actionbarsherlock.view.MenuItem;
import com.actionbarsherlock.view.Window;
import com.owncloud.android.BuildConfig;
import com.owncloud.android.MainApp;
import com.owncloud.android.R;
import com.owncloud.android.datamodel.OCFile;
@ -77,6 +78,7 @@ import com.owncloud.android.lib.common.network.CertificateCombinedException;
import com.owncloud.android.lib.common.operations.RemoteOperation;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.operations.CreateFolderOperation;
import com.owncloud.android.operations.CreateShareOperation;
import com.owncloud.android.operations.MoveFileOperation;
@ -99,7 +101,6 @@ import com.owncloud.android.ui.preview.PreviewMediaFragment;
import com.owncloud.android.ui.preview.PreviewVideoActivity;
import com.owncloud.android.utils.DisplayUtils;
import com.owncloud.android.utils.ErrorMessageAdapter;
import com.owncloud.android.utils.Log_OC;
/**
@ -289,7 +290,7 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
if (listOfFiles != null) {
listOfFiles.listDirectory(getCurrentDir());
} else {
Log.e(TAG, "Still have a chance to lose the initializacion of list fragment >(");
Log_OC.e(TAG, "Still have a chance to lose the initializacion of list fragment >(");
}
/// Second fragment
@ -305,12 +306,12 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
}
} else {
Log.wtf(TAG, "initFragments() called with invalid NULLs!");
Log_OC.wtf(TAG, "initFragments() called with invalid NULLs!");
if (getAccount() == null) {
Log.wtf(TAG, "\t account is NULL");
Log_OC.wtf(TAG, "\t account is NULL");
}
if (getFile() == null) {
Log.wtf(TAG, "\t file is NULL");
Log_OC.wtf(TAG, "\t file is NULL");
}
}
}
@ -448,6 +449,16 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
}
}
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
if (BuildConfig.DEBUG) {
menu.findItem(R.id.action_logger).setVisible(true);
} else {
menu.findItem(R.id.action_logger).setVisible(false);
}
return super.onPrepareOptionsMenu(menu);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getSherlock().getMenuInflater();
@ -478,6 +489,11 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
startActivity(settingsIntent);
break;
}
case R.id.action_logger: {
Intent loggerIntent = new Intent(getApplicationContext(),LogHistoryActivity.class);
startActivity(loggerIntent);
break;
}
case android.R.id.home: {
FileFragment second = getSecondFragment();
OCFile currentDir = getCurrentDir();
@ -1023,7 +1039,7 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
}
ocFileListFragment.setMessageForEmptyList(getString(message));
} else {
Log.e(TAG, "OCFileListFragment is null");
Log_OC.e(TAG, "OCFileListFragment is null");
}
}

View file

@ -17,106 +17,224 @@
package com.owncloud.android.ui.activity;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import android.content.Intent;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceChangeListener;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;
import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.app.SherlockPreferenceActivity;
import com.actionbarsherlock.app.SherlockFragmentActivity;
import com.actionbarsherlock.view.MenuItem;
import com.owncloud.android.R;
import com.owncloud.android.ui.adapter.LogListAdapter;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.ui.dialog.LoadingDialog;
import com.owncloud.android.utils.DisplayUtils;
import com.owncloud.android.utils.FileStorageUtils;
public class LogHistoryActivity extends SherlockFragmentActivity {
private static final String MAIL_ATTACHMENT_TYPE = "text/plain";
private static final String TAG = LogHistoryActivity.class.getSimpleName();
private static final String DIALOG_WAIT_TAG = "DIALOG_WAIT";
private String mLogPath = FileStorageUtils.getLogPath();
private File logDIR = null;
public class LogHistoryActivity extends SherlockPreferenceActivity implements OnPreferenceChangeListener {
String logpath = FileStorageUtils.getLogPath();
File logDIR = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.log_send_file);
setTitle("Log History");
setTitle(getText(R.string.actionbar_logger));
ActionBar actionBar = getSherlock().getActionBar();
actionBar.setIcon(DisplayUtils.getSeasonalIconId());
actionBar.setDisplayHomeAsUpEnabled(true);
ListView listView = (ListView) findViewById(android.R.id.list);
Button deleteHistoryButton = (Button) findViewById(R.id.deleteLogHistoryButton);
Button sendHistoryButton = (Button) findViewById(R.id.sendLogHistoryButton);
deleteHistoryButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
File dir = new File(logpath);
if (dir != null) {
File[] files = dir.listFiles();
if(files!=null) {
for(File f: files) {
f.delete();
}
}
dir.delete();
}
Intent intent = new Intent(getBaseContext(), Preferences.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
Log_OC.deleteHistoryLogging();
finish();
}
});
if(logpath != null){
logDIR = new File(logpath);
}
if(logDIR != null && logDIR.isDirectory()) {
File[] files = logDIR.listFiles();
if (files != null && files.length != 0) {
ArrayList<String> logfiles_name = new ArrayList<String>();
for (File file : files) {
logfiles_name.add(file.getName());
}
String[] logFiles2Array = logfiles_name.toArray(new String[logfiles_name.size()]);
LogListAdapter listadapter = new LogListAdapter(this,logFiles2Array);
listView.setAdapter(listadapter);
sendHistoryButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
sendMail();
}
});
if (mLogPath != null) {
logDIR = new File(mLogPath);
}
if (logDIR != null && logDIR.isDirectory()) {
// Show a dialog while log data is being loaded
showLoadingDialog();
TextView logTV = (TextView) findViewById(R.id.logTV);
// Start a new thread that will load all the log data
LoadingLogTask task = new LoadingLogTask(logTV);
task.execute();
}
}
@Override
public boolean onMenuItemSelected(int featureId, MenuItem item) {
super.onMenuItemSelected(featureId, item);
Intent intent;
switch (item.getItemId()) {
case android.R.id.home:
intent = new Intent(getBaseContext(), Preferences.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
finish();
break;
default:
return false;
}
return true;
}
@Override
public boolean onPreferenceChange(Preference arg0, Object arg1) {
return false;
/**
* Start activity for sending email with logs attached
*/
private void sendMail() {
String emailAddresses[] = { getText(R.string.mail_logger).toString() };
ArrayList<Uri> uris = new ArrayList<Uri>();
// Convert from paths to Android friendly Parcelable Uri's
for (String file : Log_OC.getLogFileNames())
{
if (new File(mLogPath + File.separator, file).exists()) {
Uri u = Uri.parse("file://" + mLogPath + File.separator + file);
uris.add(u);
}
}
Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE);
// Explicitly only use Gmail to send
intent.setClassName("com.google.android.gm","com.google.android.gm.ComposeActivityGmail");
intent.putExtra(Intent.EXTRA_EMAIL, emailAddresses);
intent.putExtra(Intent.EXTRA_SUBJECT, getText(R.string.log_mail_subject));
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setType(MAIL_ATTACHMENT_TYPE);
intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);
if (intent.resolveActivity(getPackageManager()) != null) {
startActivity(intent);
}
}
/**
*
* Class for loading the log data async
*
*/
private class LoadingLogTask extends AsyncTask<String, Void, String> {
private final WeakReference<TextView> textViewReference;
public LoadingLogTask(TextView logTV){
// Use of a WeakReference to ensure the TextView can be garbage collected
textViewReference = new WeakReference<TextView>(logTV);
}
protected String doInBackground(String... args) {
return readLogFile();
}
protected void onPostExecute(String result) {
if (textViewReference != null && result != null) {
final TextView logTV = textViewReference.get();
if (logTV != null) {
logTV.setText(result);
dismissLoadingDialog();
}
}
}
/**
* Read and show log file info
*/
private String readLogFile() {
String[] logFileName = Log_OC.getLogFileNames();
//Read text from files
StringBuilder text = new StringBuilder();
try {
String line;
for (int i = logFileName.length-1; i >= 0; i--) {
File file = new File(mLogPath,logFileName[i]);
if (file.exists()) {
// Check if FileReader is ready
if (new FileReader(file).ready()) {
BufferedReader br = new BufferedReader(new FileReader(file));
while ((line = br.readLine()) != null) {
// Append the log info
text.append(line);
text.append('\n');
}
}
}
}
}
catch (IOException e) {
Log_OC.d(TAG, e.getMessage().toString());
}
return text.toString();
}
}
/**
* Show loading dialog
*/
public void showLoadingDialog() {
// Construct dialog
LoadingDialog loading = new LoadingDialog(getResources().getString(R.string.log_progress_dialog_text));
FragmentManager fm = getSupportFragmentManager();
FragmentTransaction ft = fm.beginTransaction();
loading.show(ft, DIALOG_WAIT_TAG);
}
/**
* Dismiss loading dialog
*/
public void dismissLoadingDialog(){
Fragment frag = getSupportFragmentManager().findFragmentByTag(DIALOG_WAIT_TAG);
if (frag != null) {
LoadingDialog loading = (LoadingDialog) frag;
loading.dismiss();
}
}
}

View file

@ -61,7 +61,7 @@ import com.owncloud.android.ui.fragment.FileFragment;
import com.owncloud.android.ui.fragment.OCFileListFragment;
import com.owncloud.android.utils.DisplayUtils;
import com.owncloud.android.utils.ErrorMessageAdapter;
import com.owncloud.android.utils.Log_OC;
import com.owncloud.android.lib.common.utils.Log_OC;
public class MoveActivity extends HookActivity implements FileFragment.ContainerActivity,
OnClickListener, SwipeRefreshLayout.OnRefreshListener {

View file

@ -51,9 +51,9 @@ import com.owncloud.android.R;
import com.owncloud.android.authentication.AccountUtils;
import com.owncloud.android.authentication.AuthenticatorActivity;
import com.owncloud.android.db.DbHandler;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.ui.LongClickableCheckBoxPreference;
import com.owncloud.android.utils.DisplayUtils;
import com.owncloud.android.utils.Log_OC;
/**
@ -68,8 +68,6 @@ public class Preferences extends SherlockPreferenceActivity implements AccountMa
private DbHandler mDbHandler;
private CheckBoxPreference pCode;
//private CheckBoxPreference pLogging;
//private Preference pLoggingHistory;
private Preference pAboutApp;
private PreferenceCategory mAccountsPrefCategory = null;
@ -254,44 +252,6 @@ public class Preferences extends SherlockPreferenceActivity implements AccountMa
Log_OC.e(TAG, "Error while showing about dialog", e);
}
}
/* DISABLED FOR RELEASE UNTIL FIXED
pLogging = (CheckBoxPreference) findPreference("log_to_file");
if (pLogging != null) {
pLogging.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
String logpath = Environment.getExternalStorageDirectory()+File.separator+"owncloud"+File.separator+"log";
if(!pLogging.isChecked()) {
Log_OC.d("Debug", "start logging");
Log_OC.v("PATH", logpath);
Log_OC.startLogging(logpath);
}
else {
Log_OC.d("Debug", "stop logging");
Log_OC.stopLogging();
}
return true;
}
});
}
pLoggingHistory = (Preference) findPreference("log_history");
if (pLoggingHistory != null) {
pLoggingHistory.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
Intent intent = new Intent(getApplicationContext(),LogHistoryActivity.class);
startActivity(intent);
return true;
}
});
}
*/
}
@Override

View file

@ -36,13 +36,13 @@ import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.app.ActionBar.OnNavigationListener;
import com.actionbarsherlock.view.MenuItem;
import com.owncloud.android.R;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.ui.dialog.ConfirmationDialogFragment;
import com.owncloud.android.ui.dialog.IndeterminateProgressDialog;
import com.owncloud.android.ui.dialog.ConfirmationDialogFragment.ConfirmationDialogFragmentListener;
import com.owncloud.android.ui.fragment.LocalFileListFragment;
import com.owncloud.android.utils.DisplayUtils;
import com.owncloud.android.utils.FileStorageUtils;
import com.owncloud.android.utils.Log_OC;
/**

View file

@ -32,7 +32,7 @@ import com.owncloud.android.authentication.AccountAuthenticator;
import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.files.services.FileUploader;
import com.owncloud.android.utils.Log_OC;
import com.owncloud.android.lib.common.utils.Log_OC;
import android.accounts.Account;
import android.accounts.AccountManager;

View file

@ -24,7 +24,7 @@ import android.content.DialogInterface;
import android.os.Bundle;
import com.actionbarsherlock.app.SherlockDialogFragment;
import com.owncloud.android.utils.Log_OC;
import com.owncloud.android.lib.common.utils.Log_OC;
public class ConfirmationDialogFragment extends SherlockDialogFragment {

View file

@ -39,7 +39,7 @@ import com.owncloud.android.R;
import com.owncloud.android.authentication.SsoWebViewClient;
import com.owncloud.android.authentication.SsoWebViewClient.SsoWebViewClientListener;
import com.owncloud.android.lib.common.OwnCloudClient;
import com.owncloud.android.utils.Log_OC;
import com.owncloud.android.lib.common.utils.Log_OC;
/**

View file

@ -42,10 +42,10 @@ import android.widget.TextView;
import com.actionbarsherlock.app.SherlockDialogFragment;
import com.owncloud.android.R;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.ui.activity.ComponentsGetter;
import com.owncloud.android.ui.activity.CopyToClipboardActivity;
import com.owncloud.android.ui.activity.FileActivity;
import com.owncloud.android.utils.Log_OC;
/**
* Dialog showing a list activities able to resolve a given Intent,

View file

@ -36,11 +36,11 @@ import com.actionbarsherlock.app.SherlockDialogFragment;
import com.owncloud.android.R;
import com.owncloud.android.lib.common.network.CertificateCombinedException;
import com.owncloud.android.lib.common.network.NetworkUtils;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.ui.adapter.CertificateCombinedExceptionViewAdapter;
import com.owncloud.android.ui.adapter.SslCertificateViewAdapter;
import com.owncloud.android.ui.adapter.SslErrorViewAdapter;
import com.owncloud.android.ui.adapter.X509CertificateViewAdapter;
import com.owncloud.android.utils.Log_OC;
/**
* Dialog to show information about an untrusted certificate and allow the user

View file

@ -42,7 +42,7 @@ import android.widget.TextView;
import com.owncloud.android.lib.common.network.CertificateCombinedException;
import com.owncloud.android.lib.common.network.NetworkUtils;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.utils.Log_OC;
import com.owncloud.android.lib.common.utils.Log_OC;
/**
* Dialog to request the user about a certificate that could not be validated with the certificates store in the system.

View file

@ -33,9 +33,9 @@ import android.widget.TextView;
import com.actionbarsherlock.app.SherlockFragment;
import com.owncloud.android.R;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.ui.ExtendedListView;
import com.owncloud.android.ui.activity.OnEnforceableRefreshListener;
import com.owncloud.android.utils.Log_OC;
/**
* TODO extending SherlockListFragment instead of SherlockFragment

View file

@ -41,13 +41,13 @@ import com.owncloud.android.files.FileMenuFilter;
import com.owncloud.android.files.services.FileDownloader.FileDownloaderBinder;
import com.owncloud.android.files.services.FileUploader.FileUploaderBinder;
import com.owncloud.android.lib.common.network.OnDatatransferProgressListener;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.services.observer.FileObserverService;
import com.owncloud.android.ui.activity.FileActivity;
import com.owncloud.android.ui.activity.FileDisplayActivity;
import com.owncloud.android.ui.dialog.RemoveFileDialogFragment;
import com.owncloud.android.ui.dialog.RenameFileDialogFragment;
import com.owncloud.android.utils.DisplayUtils;
import com.owncloud.android.utils.Log_OC;
/**

View file

@ -31,8 +31,8 @@ import android.widget.ImageView;
import android.widget.ListView;
import com.owncloud.android.R;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.ui.adapter.LocalFileListAdapter;
import com.owncloud.android.utils.Log_OC;
/**

View file

@ -34,6 +34,7 @@ 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.lib.common.utils.Log_OC;
import com.owncloud.android.ui.activity.FileDisplayActivity;
import com.owncloud.android.ui.activity.MoveActivity;
import com.owncloud.android.ui.activity.OnEnforceableRefreshListener;
@ -43,7 +44,6 @@ import com.owncloud.android.ui.dialog.RemoveFileDialogFragment;
import com.owncloud.android.ui.dialog.RenameFileDialogFragment;
import com.owncloud.android.ui.preview.PreviewImageFragment;
import com.owncloud.android.ui.preview.PreviewMediaFragment;
import com.owncloud.android.utils.Log_OC;
/**
* A Fragment that lists all files and folders in a given path.

View file

@ -23,7 +23,6 @@ import com.owncloud.android.R;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.files.services.FileDownloader.FileDownloaderBinder;
import com.owncloud.android.ui.fragment.FileFragment;
import com.owncloud.android.utils.Log_OC;
import android.accounts.Account;
import android.os.Bundle;
@ -37,6 +36,7 @@ import android.widget.ProgressBar;
import android.widget.TextView;
import com.owncloud.android.lib.common.network.OnDatatransferProgressListener;
import com.owncloud.android.lib.common.utils.Log_OC;
/**

View file

@ -49,6 +49,7 @@ import com.owncloud.android.lib.common.operations.OnRemoteOperationListener;
import com.owncloud.android.lib.common.operations.RemoteOperation;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.operations.CreateShareOperation;
import com.owncloud.android.operations.RemoveFileOperation;
import com.owncloud.android.operations.UnshareLinkOperation;
@ -57,7 +58,6 @@ import com.owncloud.android.ui.activity.FileDisplayActivity;
import com.owncloud.android.ui.activity.PinCodeActivity;
import com.owncloud.android.ui.fragment.FileFragment;
import com.owncloud.android.utils.DisplayUtils;
import com.owncloud.android.utils.Log_OC;
/**
@ -320,7 +320,7 @@ ViewPager.OnPageChangeListener, OnRemoteOperationListener {
@Override
protected void onResume() {
super.onResume();
//Log.e(TAG, "ACTIVITY, ONRESUME");
//Log_OC.e(TAG, "ACTIVITY, ONRESUME");
mDownloadFinishReceiver = new DownloadFinishReceiver();
IntentFilter filter = new IntentFilter(FileDownloader.getDownloadFinishMessage());
@ -330,7 +330,7 @@ ViewPager.OnPageChangeListener, OnRemoteOperationListener {
@Override
protected void onPostResume() {
//Log.e(TAG, "ACTIVITY, ONPOSTRESUME");
//Log_OC.e(TAG, "ACTIVITY, ONPOSTRESUME");
super.onPostResume();
}

View file

@ -44,10 +44,10 @@ import com.ortiz.touch.TouchImageView;
import com.owncloud.android.R;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.files.FileMenuFilter;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.ui.dialog.ConfirmationDialogFragment;
import com.owncloud.android.ui.dialog.RemoveFileDialogFragment;
import com.owncloud.android.ui.fragment.FileFragment;
import com.owncloud.android.utils.Log_OC;
/**

View file

@ -199,17 +199,17 @@ public class PreviewImagePagerAdapter extends FragmentStatePagerAdapter {
*- /
@Override
public void startUpdate(ViewGroup container) {
Log.e(TAG, "** startUpdate");
Log_OC.e(TAG, "** startUpdate");
}
@Override
public Object instantiateItem(ViewGroup container, int position) {
Log.e(TAG, "** instantiateItem " + position);
Log_OC.e(TAG, "** instantiateItem " + position);
if (mFragments.size() > position) {
Fragment fragment = mFragments.get(position);
if (fragment != null) {
Log.e(TAG, "** \t returning cached item");
Log_OC.e(TAG, "** \t returning cached item");
return fragment;
}
}
@ -235,7 +235,7 @@ public class PreviewImagePagerAdapter extends FragmentStatePagerAdapter {
}
fragment.setMenuVisibility(false);
mFragments.set(position, fragment);
//Log.e(TAG, "** \t adding fragment at position " + position + ", containerId " + container.getId());
//Log_OC.e(TAG, "** \t adding fragment at position " + position + ", containerId " + container.getId());
mCurTransaction.add(container.getId(), fragment);
return fragment;
@ -243,13 +243,13 @@ public class PreviewImagePagerAdapter extends FragmentStatePagerAdapter {
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
Log.e(TAG, "** destroyItem " + position);
Log_OC.e(TAG, "** destroyItem " + position);
Fragment fragment = (Fragment)object;
if (mCurTransaction == null) {
mCurTransaction = mFragmentManager.beginTransaction();
}
Log.e(TAG, "** \t removing fragment at position " + position);
Log_OC.e(TAG, "** \t removing fragment at position " + position);
while (mSavedState.size() <= position) {
mSavedState.add(null);
}
@ -275,13 +275,13 @@ public class PreviewImagePagerAdapter extends FragmentStatePagerAdapter {
@Override
public void finishUpdate(ViewGroup container) {
Log.e(TAG, "** finishUpdate (start)");
Log_OC.e(TAG, "** finishUpdate (start)");
if (mCurTransaction != null) {
mCurTransaction.commitAllowingStateLoss();
mCurTransaction = null;
mFragmentManager.executePendingTransactions();
}
Log.e(TAG, "** finishUpdate (end)");
Log_OC.e(TAG, "** finishUpdate (end)");
}
@Override
@ -336,7 +336,7 @@ public class PreviewImagePagerAdapter extends FragmentStatePagerAdapter {
f.setMenuVisibility(false);
mFragments.set(index, f);
} else {
Log.w(TAG, "Bad fragment at key " + key);
Log_OC.w(TAG, "Bad fragment at key " + key);
}
}
}

View file

@ -47,6 +47,7 @@ import com.actionbarsherlock.view.MenuItem;
import com.owncloud.android.R;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.files.FileMenuFilter;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.media.MediaControlView;
import com.owncloud.android.media.MediaService;
import com.owncloud.android.media.MediaServiceBinder;
@ -54,7 +55,6 @@ import com.owncloud.android.ui.activity.FileActivity;
import com.owncloud.android.ui.dialog.ConfirmationDialogFragment;
import com.owncloud.android.ui.dialog.RemoveFileDialogFragment;
import com.owncloud.android.ui.fragment.FileFragment;
import com.owncloud.android.utils.Log_OC;
/**

View file

@ -21,7 +21,6 @@ import com.owncloud.android.R;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.media.MediaService;
import com.owncloud.android.ui.activity.FileActivity;
import com.owncloud.android.utils.Log_OC;
import android.accounts.Account;
import android.app.AlertDialog;
@ -38,6 +37,7 @@ import android.widget.VideoView;
import com.owncloud.android.lib.common.accounts.AccountUtils;
import com.owncloud.android.lib.common.accounts.AccountUtils.AccountNotFoundException;
import com.owncloud.android.lib.common.utils.Log_OC;
/**
* Activity implementing a basic video player.

View file

@ -1,129 +0,0 @@
package com.owncloud.android.utils;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import com.owncloud.android.MainApp;
import android.util.Log;
public class Log_OC {
private static boolean isEnabled = false;
private static File logFile;
private static File folder;
private static BufferedWriter buf;
public static void i(String TAG, String message){
// Printing the message to LogCat console
int a = Log.i(TAG, message);
// Write the log message to the file
appendLog(TAG+" : "+message);
}
public static void d(String TAG, String message){
Log.d(TAG, message);
appendLog(TAG + " : " + message);
}
public static void d(String TAG, String message, Exception e) {
Log.d(TAG, message, e);
appendLog(TAG + " : " + message + " Exception : "+ e.getStackTrace());
}
public static void e(String TAG, String message){
Log.e(TAG, message);
appendLog(TAG + " : " + message);
}
public static void e(String TAG, String message, Throwable e) {
Log.e(TAG, message, e);
appendLog(TAG+" : " + message +" Exception : " + e.getStackTrace());
}
public static void v(String TAG, String message){
Log.v(TAG, message);
appendLog(TAG+" : "+ message);
}
public static void w(String TAG, String message) {
Log.w(TAG,message);
appendLog(TAG+" : "+ message);
}
public static void wtf(String TAG, String message) {
Log.wtf(TAG,message);
appendLog(TAG+" : "+ message);
}
public static void startLogging(String logPath) {
folder = new File(logPath);
logFile = new File(folder + File.separator + "log.txt");
if (!folder.exists()) {
folder.mkdirs();
}
if (logFile.exists()) {
logFile.delete();
}
try {
logFile.createNewFile();
buf = new BufferedWriter(new FileWriter(logFile, true));
isEnabled = true;
appendPhoneInfo();
}catch (IOException e){
e.printStackTrace();
}
}
public static void stopLogging() {
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.getDefault());
String currentDateandTime = sdf.format(new Date());
if (logFile != null) {
logFile.renameTo(new File(folder + File.separator + MainApp.getLogName() + currentDateandTime+".log"));
isEnabled = false;
try {
buf.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
private static void appendPhoneInfo() {
appendLog("Model : " + android.os.Build.MODEL);
appendLog("Brand : " + android.os.Build.BRAND);
appendLog("Product : " + android.os.Build.PRODUCT);
appendLog("Device : " + android.os.Build.DEVICE);
appendLog("Version-Codename : " + android.os.Build.VERSION.CODENAME);
appendLog("Version-Release : " + android.os.Build.VERSION.RELEASE);
}
private static void appendLog(String text) {
if (isEnabled) {
try {
buf.append(text);
buf.newLine();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}