From 1b5d1fdc94d5eeea41b341e6bcab1cce60f6827c Mon Sep 17 00:00:00 2001 From: Maxime Biais Date: Wed, 4 Feb 2015 17:47:23 +0100 Subject: [PATCH] add dependency on WordPressUtils and use AppLog instead of Log --- .../wordpress/android/editor/EditorActivity.java | 14 -------------- .../wordpress/android/editor/EditorFragment.java | 15 ++++++++------- example/build.gradle | 4 ++++ settings.gradle | 1 + 4 files changed, 13 insertions(+), 21 deletions(-) diff --git a/editor/src/main/java/org/wordpress/android/editor/EditorActivity.java b/editor/src/main/java/org/wordpress/android/editor/EditorActivity.java index 6f24de43fc95..8fd4092b11fc 100644 --- a/editor/src/main/java/org/wordpress/android/editor/EditorActivity.java +++ b/editor/src/main/java/org/wordpress/android/editor/EditorActivity.java @@ -1,21 +1,7 @@ package org.wordpress.android.editor; -import android.annotation.SuppressLint; -import android.content.res.AssetManager; import android.os.Bundle; import android.support.v7.app.ActionBarActivity; -import android.util.Log; -import android.webkit.ConsoleMessage; -import android.webkit.JsResult; -import android.webkit.WebChromeClient; -import android.webkit.WebSettings; -import android.webkit.WebView; -import android.webkit.WebViewClient; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; public class EditorActivity extends ActionBarActivity { @Override diff --git a/editor/src/main/java/org/wordpress/android/editor/EditorFragment.java b/editor/src/main/java/org/wordpress/android/editor/EditorFragment.java index 309962134107..433abd900cac 100644 --- a/editor/src/main/java/org/wordpress/android/editor/EditorFragment.java +++ b/editor/src/main/java/org/wordpress/android/editor/EditorFragment.java @@ -4,7 +4,6 @@ import android.content.res.AssetManager; import android.os.Bundle; import android.support.v4.app.Fragment; -import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -15,6 +14,9 @@ import android.webkit.WebView; import android.webkit.WebViewClient; +import org.wordpress.android.util.AppLog; +import org.wordpress.android.util.AppLog.T; + import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; @@ -63,7 +65,6 @@ public void onDetach() { super.onDetach(); } - // TODO: use AppLog instead of Log @SuppressLint("SetJavaScriptEnabled") private void initWebView() { WebSettings webSettings = mWebView.getSettings(); @@ -71,24 +72,24 @@ private void initWebView() { webSettings.setDefaultTextEncodingName("utf-8"); mWebView.setWebViewClient(new WebViewClient() { public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { - Log.e("WordPress-Editor", description); + AppLog.e(T.EDITOR, description); } }); mWebView.setWebChromeClient(new WebChromeClient() { public boolean onConsoleMessage(ConsoleMessage cm) { - Log.e("WordPress-Editor", cm.message() + " -- From line " + cm.lineNumber() + " of " + cm.sourceId()); + AppLog.e(T.EDITOR, cm.message() + " -- From line " + cm.lineNumber() + " of " + cm.sourceId()); return true; } @Override public boolean onJsAlert(WebView view, String url, String message, JsResult result) { - Log.e("WordPress-Editor", message); + AppLog.e(T.EDITOR, message); return true; } @Override public void onConsoleMessage(String message, int lineNumber, String sourceId) { - Log.e("WordPress-Editor", message + " -- from line " + lineNumber + " of " + sourceId); + AppLog.e(T.EDITOR, message + " -- from line " + lineNumber + " of " + sourceId); } }); String htmlEditor = getHtmlEditor(); @@ -117,7 +118,7 @@ private String getHtmlEditor() { try { return getStringFromAsset("android-editor.html"); } catch (IOException e) { - Log.e("WordPress-Editor", e.getMessage()); + AppLog.e(T.EDITOR, e.getMessage()); return null; } } diff --git a/example/build.gradle b/example/build.gradle index d44d0e34ee1b..63015b16b19a 100644 --- a/example/build.gradle +++ b/example/build.gradle @@ -7,6 +7,10 @@ buildscript { } } +repositories { + mavenCentral() +} + apply plugin: 'com.android.application' android { diff --git a/settings.gradle b/settings.gradle index 169d9325d973..4fc7fe0ffb66 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,2 +1,3 @@ include ':editor' include ':example' +include ':libs:utils:WordPressUtils'