Skip to content

Commit 5df2a9b

Browse files
committed
Squashed 'libs/editor/' changes from fc65662..86805a0
86805a0 Add 'libs/utils/' from commit '94d1dbb0f5220525759de83c60cba3e95ce95eff' cfc3ff0 use title/content params in the editor 9f26eb3 remove useless test in example 83ff559 fix appcompat and support-v4 dependencies 714eeb1 move new editor logic to a fragment 4a2f1ba back to 21.1.1 tools 279f2ee fix appcompat dependency d3985f0 new travis config ee42dda fix build for example project 66fb19b rename package name to org.wordpress.android b61040c rename package name to org.wordpress.android 4edc93f add signing to publish artifact 94d1dbb Merge branch 'release/3.7' into develop 8ff9413 fix AppLogViewerActivity when a log is message is null 7c208db Merge pull request #2264 from wordpress-mobile/issue/2222-theme-preview-title 9eb7273 new BlogUtils.getHostNameFromAccountMap function a80859d Theme live preview no longer changes the activity title 6186933 Photo viewer now uses low quality for the lo-res image 2eb9839 Simplified comments bfa7ecb Switched to quality enum which defaults to medium a2ce056 Added default quality param to photon 5a48a06 html encode log entries in AppLog.toHtml() c8a4d89 fix #103: retain menu drawer scroll position after switching activities c1e0778 Merge branch 'develop' into issue/985-make-sfactory-private fe1d125 fix build files for android studio 1.0 f7a2d48 Merge remote-tracking branch 'origin/develop' into issue/985-make-sfactory-private 72fe2b7 update support lib version for travis 0b03b71 Merge branch 'develop' of https://github.com/wordpress-mobile/WordPress-Android into feature/material-appcompat 0f5751d Merge branch 'develop' into release/3.4 b68f755 remove unused code (refresh button) cb8321b fix #985: maks sFactory private - force injection in test module faae1d3 Merge branch 'release/3.4' into issue/1982-simperium-concurrency Conflicts: WordPress/src/main/java/org/wordpress/android/models/Note.java a0982d1 Updated build.gradle to specify com.android.support:appcompat-v7:21.0.2 3a0c45e Removed unsuccessful fix for #1982. b967d59 first step at replacing PreferenceActivity by a PreferenceFragment + ActionBarActivity 92d4e15 Merge branch 'develop' into feature/material-appcompat 7c8d5ab Merge branch 'release/3.4' into develop 1e499a6 Merge branch 'hotfix/3.3.1' into release/3.4 7a4a364 Merge branch 'develop' of https://github.com/wordpress-mobile/WordPress-Android into feature/material-appcompat 5451df7 update subtrees to use build tools 21.1.1 4024637 rename PullToRefresh to SwipeToRefresh 0d8d414 remove unused viewClass in PTR constructor 2424201 fix circle spinner color style d392885 Return a copy of the JSONObject in getDiffableValue(). 106affa replace Chris Banes' PullToRefresh by the native SwipeToRefresh view 3108a36 Merge remote-tracking branch 'origin/develop' into feature/1961-add-mentions-to-commenting db25827 Merge branch 'develop' into issue/1958-round-avatars 2801610 Merge remote-tracking branch 'origin/develop' into feature/1961-add-mentions-to-commenting 6ac0248 Merge branch 'hotfix/3.3.1' into release/3.4 eb70e6f upgrade to android-gradle 0.14.0 9bc4ba6 Rounds all WPNetworkImageViews with `AVATAR` type. c2fd6c7 Initial commit adding mentions to notification comments 0a3da42 Added image spans directly instead of using Html.fromHtml(). 5b22440 Merge branch 'release/3.2' into develop 1a2a73f fix debug/release build propagation to sub projects d9eac2e Merge branch 'release/3.2' into develop 380ece6 Merge pull request #1861 from wordpress-mobile/feature/notifications-redesign c38f131 Merge pull request #1860 from wordpress-mobile/issue/1821-remove-istablet 4e92eaa Merge branch 'hotfix/3.1.2' into release/3.2 cbc7b24 fix #1821: remove DisplayUtis.isTablet() method 343771a Catch NPE in Bitmap.CreateBitmap and make sure the returned bitmap is not null c44a87a Merge branch 'release/3.2' into feature/notifications-redesign 97c557c Revert "Revert "Merge pull request #1799 from wordpress-mobile/feature/1795-reader-render-attachments"" 1cacaf2 Merge branch 'hotfix/3.1.1' into release/3.2 568782f Merge branch 'hotfix/3.1.1' into develop 96fd180 remove isTablet() check 870944d Merge branch 'release/3.2' into feature/notifications-redesign 3390393 Revert "Merge pull request #1799 from wordpress-mobile/feature/1795-reader-render-attachments" 03bbac0 Merge branch 'develop' into feature/notifications-redesign 8ec2915 Replaced String.format() with string concatenation in ReaderUtils and PhotonUtils after profiler showed String.format() to be hurting performance 1623d65 fix lint error in utils e273dd3 Merge branch 'develop' into feature/notifications-redesign 4bfc641 Removed aggressive `JSONUtil` logging f7f4556 update support-v13 library to version 19.1.0 fafcf67 Merge pull request #1781 from wordpress-mobile/issue/17760-reader-comment-full-images 1868cc5 disable refresh on the attacher 082c13f use the PTR library version 0.9.7 f21f5d3 set network refresh mode as default d262f8d remove unused code 9e592fd add a network mode in PullToRefreshHeaderTransformer to show a different message when network is disabled f85a003 move NetworkUtils to WPUtils subtree d19c080 Updated comment cabb8a7 TextView content is reset to itself to force it to correctly resize using cached image 48e4ed2 More cleanup 2426243 Cleanup WPImageGetter based on code analysis c955d26 Merge pull request #1764 from wordpress-mobile/issue/1713-send-version-code-to-mixpanel 3bc1080 Merge branch 'release/3.1' into develop f75a9e7 increment version number caa9db0 fix #1762: show blog url in the share blog spinner if the blog title is an empty string e1eecbf remove ProfilingUtils.getVersionName calls 075b989 remove unused method from ProfilingUtils b48cbda move BuildUtils to WPUtils subtree, rename BuildUtils to PackageUtils and add getPackageInfo and getVersionCode methods 44bb61e Rewrote the AppLog viewer to use a ListView+adapter 59f0bfa Merge branch 'develop' into issue/1690-track-last-seen-screen 9300d28 remove unused util file ActivityUtils b15cf64 Bump libs/utils version number. 0d89a80 generic way to track last seen activity - requires GET_TASKS permission 391276c Use the unicode version of the Horizontal ellipsis char. Restrict the visibility of some methods to private. c8dc1e8 Text view that auto adjusts text size to fit within the view.If the text size equals the minimum text size and still does not fit, append with an ellipsis. aa5b665 init utils readme 76df52f import libs/utis 449639d set defaultPublishConfig to debug - in case we had source dependencies to this module 5b1f8f1 remove gradle wrapper cd72102 Bump version number 90f9f22 Merge pull request #1 from wordpress-mobile/issue/move-ptr-to-utils c6b0ff9 showToast methods now return a Toast object 3e93210 Move pull to refresh to Utils b302b44 Move ToastUtils to Utils a0e973c document getPrimaryEmail method d68fb87 add getCircularBitmap and getRoundedEdgeBitmap from the main project merge in 80014b7 d2a76e2 avoid build failure when gradle.properties file is missing 5d683f6 use maven plugin to deploy maven artifact 70a91cb bump version number to 1.0.1 575579d gitignore tools/deploy-mvn-artifact.conf 50f2c80 maven deploying script cf85e19 ignore .idea and local.properties 7c6d4f4 add WPImageGetter and fix HtmlUtils b4baff8 remove crashlytics reference from Utils 32e98a9 merge from WordPress-Android@1a74364d0 79b7014 gitignore all build/ directories c9e6b52 Restores query separator period in `JSONUtils`. fddb5a0 Ignoring iml files 4263343 Initial commit of utils classes. 0228ac4 Fix package id name 826c265 Move java source to correct directory a528b8e Initial Project Structure git-subtree-dir: libs/editor git-subtree-split: 86805a0
1 parent fc65662 commit 5df2a9b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+4402
-71
lines changed

.travis.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
language: android
2+
jdk: oraclejdk7
3+
4+
android:
5+
components:
6+
- build-tools-21.1.1
7+
- android-19
8+
9+
env:
10+
global:
11+
- GRADLE_OPTS="-XX:MaxPermSize=4g -Xmx4g"
12+
- ANDROID_SDKS=android-14
13+
- ANDROID_TARGET=android-14
14+
15+
script:
16+
- ./gradlew -PdisablePreDex build

build.gradle

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +0,0 @@
1-
// Top-level build file where you can add configuration options common to all sub-projects/modules.
2-
3-
buildscript {
4-
repositories {
5-
jcenter()
6-
}
7-
dependencies {
8-
classpath 'com.android.tools.build:gradle:1.0.0-rc4'
9-
10-
// NOTE: Do not place your application dependencies here; they belong
11-
// in the individual module build.gradle files
12-
}
13-
}
14-
15-
allprojects {
16-
repositories {
17-
jcenter()
18-
}
19-
}

editor/build.gradle

Lines changed: 80 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,31 @@
1+
buildscript {
2+
repositories {
3+
mavenCentral()
4+
}
5+
dependencies {
6+
classpath 'com.android.tools.build:gradle:1.0.0'
7+
}
8+
}
9+
110
apply plugin: 'com.android.library'
11+
apply plugin: 'maven'
12+
apply plugin: 'signing'
13+
14+
repositories {
15+
mavenCentral()
16+
}
217

318
android {
19+
publishNonDefault true
20+
421
compileSdkVersion 21
5-
buildToolsVersion "21.1.2"
22+
buildToolsVersion "21.1.1"
623

724
defaultConfig {
8-
minSdkVersion 15
9-
targetSdkVersion 21
1025
versionCode 1
1126
versionName "1.0"
27+
minSdkVersion 9
28+
targetSdkVersion 21
1229
}
1330
buildTypes {
1431
release {
@@ -19,5 +36,64 @@ android {
1936
}
2037

2138
dependencies {
22-
compile 'com.android.support:appcompat-v7:21.0.3'
39+
compile 'com.android.support:appcompat-v7:21.0.+'
40+
compile 'com.android.support:support-v4:21.0.+'
41+
releaseCompile project(path:':libs:utils:WordPressUtils', configuration: 'release')
42+
debugCompile project(path:':libs:utils:WordPressUtils', configuration: 'debug')
43+
}
44+
45+
signing {
46+
required {
47+
project.properties.containsKey("signing.keyId") && project.properties.containsKey("signing.secretKeyRingFile")
48+
}
49+
sign configurations.archives
50+
}
51+
52+
version android.defaultConfig.versionName
53+
group = "org.wordpress"
54+
archivesBaseName = "editor"
55+
56+
// http://central.sonatype.org/pages/gradle.html
57+
58+
uploadArchives {
59+
repositories {
60+
mavenDeployer {
61+
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
62+
63+
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
64+
authentication(userName: project.properties.ossrhUsername, password: project.properties.ossrhPassword)
65+
}
66+
67+
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
68+
authentication(userName: project.properties.ossrhUsername, password: project.properties.ossrhPassword)
69+
}
70+
71+
pom.project {
72+
name 'WordPress-Android-Editor'
73+
packaging 'aar'
74+
description 'A reusable Android rich text editor component'
75+
url 'https://github.com/wordpress-mobile/WordPress-Android-Editor'
76+
scm {
77+
connection 'scm:git:https://github.com/wordpress-mobile/WordPress-Android-Editor.git'
78+
developerConnection 'scm:git:https://github.com/wordpress-mobile/WordPress-Android-Editor.git'
79+
url 'https://github.com/wordpress-mobile/WordPress-Android-Editor'
80+
}
81+
82+
licenses {
83+
license {
84+
name 'The MIT License (MIT)'
85+
url 'http://opensource.org/licenses/MIT'
86+
}
87+
}
88+
89+
developers {
90+
developer {
91+
id 'maxme'
92+
name 'Maxime Biais'
93+
email 'maxime@automattic.com'
94+
}
95+
}
96+
}
97+
}
98+
}
2399
}

editor/src/androidTest/java/org/wordpress/editor/ApplicationTest.java renamed to editor/src/androidTest/java/org/wordpress/android/editor/ApplicationTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package org.wordpress.editor;
1+
package org.wordpress.android.editor;
22

33
import android.app.Application;
44
import android.test.ApplicationTestCase;
Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3-
package="org.wordpress.editor" >
4-
5-
<application
6-
android:allowBackup="true"
7-
android:label="@string/app_name" >
8-
<activity
9-
android:name=".EditorActivity"
10-
android:label="@string/app_name" >
11-
<intent-filter>
12-
<action android:name="android.intent.action.MAIN" />
13-
14-
<category android:name="android.intent.category.LAUNCHER" />
15-
</intent-filter>
16-
</activity>
17-
</application>
3+
package="org.wordpress.android.editor" >
184

195
</manifest>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package org.wordpress.android.editor;
2+
3+
import android.annotation.SuppressLint;
4+
import android.content.res.AssetManager;
5+
import android.os.Bundle;
6+
import android.support.v7.app.ActionBarActivity;
7+
import android.util.Log;
8+
import android.webkit.ConsoleMessage;
9+
import android.webkit.JsResult;
10+
import android.webkit.WebChromeClient;
11+
import android.webkit.WebSettings;
12+
import android.webkit.WebView;
13+
import android.webkit.WebViewClient;
14+
15+
import java.io.BufferedReader;
16+
import java.io.IOException;
17+
import java.io.InputStream;
18+
import java.io.InputStreamReader;
19+
20+
public class EditorActivity extends ActionBarActivity {
21+
@Override
22+
protected void onCreate(Bundle savedInstanceState) {
23+
super.onCreate(savedInstanceState);
24+
setContentView(R.layout.activity_editor);
25+
}
26+
}

editor/src/main/java/org/wordpress/editor/EditorActivity.java renamed to editor/src/main/java/org/wordpress/android/editor/EditorFragment.java

Lines changed: 52 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
package org.wordpress.editor;
1+
package org.wordpress.android.editor;
22

33
import android.annotation.SuppressLint;
44
import android.content.res.AssetManager;
55
import android.os.Bundle;
6-
import android.support.v7.app.ActionBarActivity;
6+
import android.support.v4.app.Fragment;
77
import android.util.Log;
8+
import android.view.LayoutInflater;
9+
import android.view.View;
10+
import android.view.ViewGroup;
811
import android.webkit.ConsoleMessage;
912
import android.webkit.JsResult;
1013
import android.webkit.WebChromeClient;
@@ -17,19 +20,55 @@
1720
import java.io.InputStream;
1821
import java.io.InputStreamReader;
1922

20-
public class EditorActivity extends ActionBarActivity {
21-
WebView mWebView;
23+
public class EditorFragment extends Fragment {
24+
private static final String ARG_PARAM_TITLE = "param_title";
25+
private static final String ARG_PARAM_CONTENT = "param_content";
26+
27+
private String mParamTitle;
28+
private String mParamContent;
29+
private WebView mWebView;
30+
31+
public static EditorFragment newInstance(String title, String content) {
32+
EditorFragment fragment = new EditorFragment();
33+
Bundle args = new Bundle();
34+
args.putString(ARG_PARAM_TITLE, title);
35+
args.putString(ARG_PARAM_CONTENT, content);
36+
fragment.setArguments(args);
37+
return fragment;
38+
}
39+
40+
public EditorFragment() {
41+
}
2242

23-
@SuppressLint("SetJavaScriptEnabled")
2443
@Override
25-
protected void onCreate(Bundle savedInstanceState) {
44+
public void onCreate(Bundle savedInstanceState) {
2645
super.onCreate(savedInstanceState);
27-
setContentView(R.layout.activity_editor);
28-
mWebView = (WebView) findViewById(R.id.webview);
46+
if (getArguments() != null) {
47+
mParamTitle = getArguments().getString(ARG_PARAM_TITLE);
48+
mParamContent = getArguments().getString(ARG_PARAM_CONTENT);
49+
}
50+
}
51+
52+
@Override
53+
public View onCreateView(LayoutInflater inflater, ViewGroup container,
54+
Bundle savedInstanceState) {
55+
View view = inflater.inflate(R.layout.fragment_editor, container, false);
56+
mWebView = (WebView) view.findViewById(R.id.webview);
57+
initWebView();
58+
return view;
59+
}
60+
61+
@Override
62+
public void onDetach() {
63+
super.onDetach();
64+
}
65+
66+
// TODO: use AppLog instead of Log
67+
@SuppressLint("SetJavaScriptEnabled")
68+
private void initWebView() {
2969
WebSettings webSettings = mWebView.getSettings();
3070
webSettings.setJavaScriptEnabled(true);
3171
webSettings.setDefaultTextEncodingName("utf-8");
32-
mWebView.getSettings().setJavaScriptEnabled(true);
3372
mWebView.setWebViewClient(new WebViewClient() {
3473
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
3574
Log.e("WordPress-Editor", description);
@@ -57,7 +96,10 @@ public void onConsoleMessage(String message, int lineNumber, String sourceId) {
5796
}
5897

5998
private String getStringFromAsset(String filename) throws IOException {
60-
AssetManager assetManager = getAssets();
99+
if (!isAdded()) {
100+
return null;
101+
}
102+
AssetManager assetManager = getActivity().getAssets();
61103
InputStream in = assetManager.open(filename);
62104
InputStreamReader is = new InputStreamReader(in);
63105
StringBuilder sb = new StringBuilder();

editor/src/main/res/layout/activity_editor.xml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
android:layout_height="match_parent"
55
tools:context=".EditorActivity">
66

7-
<WebView
7+
<fragment
8+
android:id="@+id/postEditor"
9+
android:name="org.wordpress.android.editor.EditorFragment"
810
android:layout_width="match_parent"
9-
android:layout_height="match_parent"
10-
android:id="@+id/webview"/>
11+
android:layout_height="match_parent"/>
1112

1213
</RelativeLayout>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
2+
xmlns:tools="http://schemas.android.com/tools"
3+
android:layout_width="match_parent"
4+
android:layout_height="match_parent"
5+
tools:context="org.wordpress.android.editor.EditorFragment">
6+
7+
<WebView
8+
android:layout_width="match_parent"
9+
android:layout_height="match_parent"
10+
android:id="@+id/webview"/>
11+
12+
</FrameLayout>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
<resources>
22
<string name="app_name">Editor</string>
3+
4+
<!-- TODO: Remove or change this placeholder text -->
5+
<string name="hello_blank_fragment">Hello blank fragment</string>
36
</resources>

0 commit comments

Comments
 (0)