Skip to content

Commit

Permalink
Squashed 'libs/editor/' changes from fc65662..86805a0
Browse files Browse the repository at this point in the history
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
  • Loading branch information
maxme committed Feb 4, 2015
1 parent fc65662 commit 5df2a9b
Show file tree
Hide file tree
Showing 65 changed files with 4,402 additions and 71 deletions.
16 changes: 16 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
language: android
jdk: oraclejdk7

android:
components:
- build-tools-21.1.1
- android-19

env:
global:
- GRADLE_OPTS="-XX:MaxPermSize=4g -Xmx4g"
- ANDROID_SDKS=android-14
- ANDROID_TARGET=android-14

script:
- ./gradlew -PdisablePreDex build
19 changes: 0 additions & 19 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,19 +0,0 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0-rc4'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
jcenter()
}
}
84 changes: 80 additions & 4 deletions editor/build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,31 @@
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
}
}

apply plugin: 'com.android.library'
apply plugin: 'maven'
apply plugin: 'signing'

repositories {
mavenCentral()
}

android {
publishNonDefault true

compileSdkVersion 21
buildToolsVersion "21.1.2"
buildToolsVersion "21.1.1"

defaultConfig {
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.0"
minSdkVersion 9
targetSdkVersion 21
}
buildTypes {
release {
Expand All @@ -19,5 +36,64 @@ android {
}

dependencies {
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.android.support:appcompat-v7:21.0.+'
compile 'com.android.support:support-v4:21.0.+'
releaseCompile project(path:':libs:utils:WordPressUtils', configuration: 'release')
debugCompile project(path:':libs:utils:WordPressUtils', configuration: 'debug')
}

signing {
required {
project.properties.containsKey("signing.keyId") && project.properties.containsKey("signing.secretKeyRingFile")
}
sign configurations.archives
}

version android.defaultConfig.versionName
group = "org.wordpress"
archivesBaseName = "editor"

// http://central.sonatype.org/pages/gradle.html

uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }

repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: project.properties.ossrhUsername, password: project.properties.ossrhPassword)
}

snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
authentication(userName: project.properties.ossrhUsername, password: project.properties.ossrhPassword)
}

pom.project {
name 'WordPress-Android-Editor'
packaging 'aar'
description 'A reusable Android rich text editor component'
url 'https://github.com/wordpress-mobile/WordPress-Android-Editor'
scm {
connection 'scm:git:https://github.com/wordpress-mobile/WordPress-Android-Editor.git'
developerConnection 'scm:git:https://github.com/wordpress-mobile/WordPress-Android-Editor.git'
url 'https://github.com/wordpress-mobile/WordPress-Android-Editor'
}

licenses {
license {
name 'The MIT License (MIT)'
url 'http://opensource.org/licenses/MIT'
}
}

developers {
developer {
id 'maxme'
name 'Maxime Biais'
email 'maxime@automattic.com'
}
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.wordpress.editor;
package org.wordpress.android.editor;

import android.app.Application;
import android.test.ApplicationTestCase;
Expand Down
16 changes: 1 addition & 15 deletions editor/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,19 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.wordpress.editor" >

<application
android:allowBackup="true"
android:label="@string/app_name" >
<activity
android:name=".EditorActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
package="org.wordpress.android.editor" >

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
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
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_editor);
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package org.wordpress.editor;
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.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.ConsoleMessage;
import android.webkit.JsResult;
import android.webkit.WebChromeClient;
Expand All @@ -17,19 +20,55 @@
import java.io.InputStream;
import java.io.InputStreamReader;

public class EditorActivity extends ActionBarActivity {
WebView mWebView;
public class EditorFragment extends Fragment {
private static final String ARG_PARAM_TITLE = "param_title";
private static final String ARG_PARAM_CONTENT = "param_content";

private String mParamTitle;
private String mParamContent;
private WebView mWebView;

public static EditorFragment newInstance(String title, String content) {
EditorFragment fragment = new EditorFragment();
Bundle args = new Bundle();
args.putString(ARG_PARAM_TITLE, title);
args.putString(ARG_PARAM_CONTENT, content);
fragment.setArguments(args);
return fragment;
}

public EditorFragment() {
}

@SuppressLint("SetJavaScriptEnabled")
@Override
protected void onCreate(Bundle savedInstanceState) {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_editor);
mWebView = (WebView) findViewById(R.id.webview);
if (getArguments() != null) {
mParamTitle = getArguments().getString(ARG_PARAM_TITLE);
mParamContent = getArguments().getString(ARG_PARAM_CONTENT);
}
}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_editor, container, false);
mWebView = (WebView) view.findViewById(R.id.webview);
initWebView();
return view;
}

@Override
public void onDetach() {
super.onDetach();
}

// TODO: use AppLog instead of Log
@SuppressLint("SetJavaScriptEnabled")
private void initWebView() {
WebSettings webSettings = mWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setDefaultTextEncodingName("utf-8");
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.setWebViewClient(new WebViewClient() {
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
Log.e("WordPress-Editor", description);
Expand Down Expand Up @@ -57,7 +96,10 @@ public void onConsoleMessage(String message, int lineNumber, String sourceId) {
}

private String getStringFromAsset(String filename) throws IOException {
AssetManager assetManager = getAssets();
if (!isAdded()) {
return null;
}
AssetManager assetManager = getActivity().getAssets();
InputStream in = assetManager.open(filename);
InputStreamReader is = new InputStreamReader(in);
StringBuilder sb = new StringBuilder();
Expand Down
7 changes: 4 additions & 3 deletions editor/src/main/res/layout/activity_editor.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
android:layout_height="match_parent"
tools:context=".EditorActivity">

<WebView
<fragment
android:id="@+id/postEditor"
android:name="org.wordpress.android.editor.EditorFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/webview"/>
android:layout_height="match_parent"/>

</RelativeLayout>
12 changes: 12 additions & 0 deletions editor/src/main/res/layout/fragment_editor.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="org.wordpress.android.editor.EditorFragment">

<WebView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/webview"/>

</FrameLayout>
3 changes: 3 additions & 0 deletions editor/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
<resources>
<string name="app_name">Editor</string>

<!-- TODO: Remove or change this placeholder text -->
<string name="hello_blank_fragment">Hello blank fragment</string>
</resources>
12 changes: 10 additions & 2 deletions example/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
}
}

apply plugin: 'com.android.application'

android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
buildToolsVersion "21.1.1"

defaultConfig {
applicationId "org.wordpress.editorexample"
Expand All @@ -20,6 +29,5 @@ android {
}

dependencies {
compile 'com.android.support:appcompat-v7:21.0.3'
compile project(":editor");
}

This file was deleted.

5 changes: 4 additions & 1 deletion example/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.wordpress.editorexample" >
package="org.wordpress.android.editor.example" >

<application
android:allowBackup="true"
Expand All @@ -11,6 +11,9 @@
android:name=".ExampleActivity"
android:label="@string/title_activity_example" >
</activity>
<activity
android:name="org.wordpress.android.editor.EditorActivity" >
</activity>
</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.wordpress.editorexample;
package org.wordpress.android.editor.example;

import android.content.Intent;
import android.os.Bundle;
Expand All @@ -7,7 +7,7 @@
import android.view.View.OnClickListener;
import android.widget.Button;

import org.wordpress.editor.EditorActivity;
import org.wordpress.android.editor.EditorActivity;

public class ExampleActivity extends ActionBarActivity {
@Override
Expand Down
2 changes: 1 addition & 1 deletion example/src/main/res/layout/activity_example.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="org.wordpress.editorexample.ExampleActivity">
tools:context="org.wordpress.android.editor.example.ExampleActivity">

<Button
android:layout_width="wrap_content"
Expand Down

0 comments on commit 5df2a9b

Please sign in to comment.