Added parsing of text before URL if not title included.
This commit is contained in:
parent
17bb0a4c61
commit
a9aa527c3a
12 changed files with 20 additions and 151 deletions
1
.idea/.name
generated
1
.idea/.name
generated
|
@ -1 +0,0 @@
|
|||
Emaily
|
23
.idea/compiler.xml
generated
23
.idea/compiler.xml
generated
|
@ -1,23 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<option name="DEFAULT_COMPILER" value="Javac" />
|
||||
<resourceExtensions />
|
||||
<wildcardResourcePatterns>
|
||||
<entry name="!?*.java" />
|
||||
<entry name="!?*.form" />
|
||||
<entry name="!?*.class" />
|
||||
<entry name="!?*.groovy" />
|
||||
<entry name="!?*.scala" />
|
||||
<entry name="!?*.flex" />
|
||||
<entry name="!?*.kt" />
|
||||
<entry name="!?*.clj" />
|
||||
</wildcardResourcePatterns>
|
||||
<annotationProcessing>
|
||||
<profile default="true" name="Default" enabled="false">
|
||||
<processorPath useClasspath="true" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
</component>
|
||||
</project>
|
||||
|
5
.idea/copyright/profiles_settings.xml
generated
5
.idea/copyright/profiles_settings.xml
generated
|
@ -1,5 +0,0 @@
|
|||
<component name="CopyrightManager">
|
||||
<settings default="">
|
||||
<module2copyright />
|
||||
</settings>
|
||||
</component>
|
5
.idea/encodings.xml
generated
5
.idea/encodings.xml
generated
|
@ -1,5 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
|
||||
</project>
|
||||
|
23
.idea/misc.xml
generated
23
.idea/misc.xml
generated
|
@ -1,23 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" assert-keyword="true" jdk-15="true" project-jdk-name="1.7" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
<component name="masterDetails">
|
||||
<states>
|
||||
<state key="ProjectJDKs.UI">
|
||||
<settings>
|
||||
<last-edited>1.7</last-edited>
|
||||
<splitter-proportions>
|
||||
<option name="proportions">
|
||||
<list>
|
||||
<option value="0.2" />
|
||||
</list>
|
||||
</option>
|
||||
</splitter-proportions>
|
||||
</settings>
|
||||
</state>
|
||||
</states>
|
||||
</component>
|
||||
</project>
|
||||
|
9
.idea/modules.xml
generated
9
.idea/modules.xml
generated
|
@ -1,9 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/Emaily.iml" filepath="$PROJECT_DIR$/Emaily.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
|
5
.idea/scopes/scope_settings.xml
generated
5
.idea/scopes/scope_settings.xml
generated
|
@ -1,5 +0,0 @@
|
|||
<component name="DependencyValidationManager">
|
||||
<state>
|
||||
<option name="SKIP_IMPORT_STATEMENTS" value="false" />
|
||||
</state>
|
||||
</component>
|
7
.idea/vcs.xml
generated
7
.idea/vcs.xml
generated
|
@ -1,7 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="net.thauvin.erik.android.emaily"
|
||||
android:versionCode="2"
|
||||
android:versionName="1.1b7" >
|
||||
android:versionName="1.1b8" >
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="10"
|
||||
|
|
19
Emaily.iml
19
Emaily.iml
|
@ -1,19 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="android" name="Android">
|
||||
<configuration />
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/gen" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="Android 4.2.2" jdkType="Android SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="lib" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
|
49
build.gradle
49
build.gradle
|
@ -1,49 +0,0 @@
|
|||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:0.4'
|
||||
}
|
||||
}
|
||||
apply plugin: 'android'
|
||||
|
||||
dependencies {
|
||||
compile files('lib/bitlyj-2.0.0.jar')
|
||||
compile files('../../Emaily/lib/commons-codec-1.6.jar')
|
||||
compile files('../../Emaily/lib/google-api-client-1.7.0-beta.jar')
|
||||
compile files('../../Emaily/lib/google-api-client-android2-1.7.0-beta.jar')
|
||||
compile files('../../Emaily/lib/google-api-urlshortener-v1-rev2-java-1.4.0-beta.jar')
|
||||
compile files('../../Emaily/lib/google-http-client-1.7.0-beta.jar')
|
||||
compile files('../../Emaily/lib/google-http-client-android2-1.7.0-beta.jar')
|
||||
compile files('../../Emaily/lib/google-http-client-android3-1.7.0-beta.jar')
|
||||
compile files('../../Emaily/lib/google-oauth-client-1.7.0-beta.jar')
|
||||
compile files('../../Emaily/lib/gson-2.1.jar')
|
||||
compile files('../../Emaily/lib/guava-11.0.1.jar')
|
||||
compile files('../../Emaily/lib/jackson-core-asl-1.9.4.jar')
|
||||
compile files('../../Emaily/lib/jsr305-1.3.9.jar')
|
||||
compile files('../../Emaily/lib/protobuf-java-2.2.0.jar')
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion 17
|
||||
buildToolsVersion "17"
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 10
|
||||
targetSdkVersion 11
|
||||
}
|
||||
sourceSets {
|
||||
main {
|
||||
manifest.srcFile 'AndroidManifest.xml'
|
||||
java.srcDirs = ['src']
|
||||
resources.srcDirs = ['src']
|
||||
aidl.srcDirs = ['src']
|
||||
renderscript.srcDirs = ['src']
|
||||
res.srcDirs = ['res']
|
||||
assets.srcDirs = ['assets']
|
||||
}
|
||||
|
||||
instrumentTest.setRoot('tests')
|
||||
}
|
||||
}
|
|
@ -386,10 +386,12 @@ public class Emaily extends Activity
|
|||
emailIntent.setType("text/plain");
|
||||
}
|
||||
|
||||
|
||||
final Bundle extras = intent[0].getExtras();
|
||||
|
||||
final String pageUrl = extras.getString(Intent.EXTRA_TEXT);
|
||||
final String pageTitle = extras.getString(Intent.EXTRA_SUBJECT);
|
||||
final StringBuilder textBefore = new StringBuilder();
|
||||
|
||||
if (isValid(pageTitle))
|
||||
{
|
||||
|
@ -417,7 +419,9 @@ public class Emaily extends Activity
|
|||
|
||||
final Url toInsert = new Url();
|
||||
|
||||
for (String item : pageUrl.split("\\s"))
|
||||
final String[] splits = pageUrl.split("\\s");
|
||||
|
||||
for (String item : splits)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -524,6 +528,12 @@ public class Emaily extends Activity
|
|||
{
|
||||
Log.d(appName, "Attempted to process an invalid URL: " + item, mue);
|
||||
|
||||
if (textBefore.length() > 0)
|
||||
{
|
||||
textBefore.append(" ");
|
||||
}
|
||||
|
||||
textBefore.append(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -544,14 +554,19 @@ public class Emaily extends Activity
|
|||
{
|
||||
emailIntent.putExtra(Intent.EXTRA_TEXT, shortUrl.toString());
|
||||
}
|
||||
|
||||
if (!isValid(pageTitle) && textBefore.length() > 0)
|
||||
{
|
||||
emailIntent.putExtra(Intent.EXTRA_SUBJECT, textBefore.toString());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
final CharSequence text = extras.getCharSequence(Intent.EXTRA_TEXT);
|
||||
final CharSequence chars = extras.getCharSequence(Intent.EXTRA_TEXT);
|
||||
|
||||
if (text.length() > 0)
|
||||
if (chars.length() > 0)
|
||||
{
|
||||
emailIntent.putExtra(Intent.EXTRA_TEXT, text);
|
||||
emailIntent.putExtra(Intent.EXTRA_TEXT, chars);
|
||||
}
|
||||
else if (isValid(pageUrl))
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue