commit 3a63e68d2843d6658ff09cbcfefd920122266ea8 Author: Sadique Ali Date: Sat Jul 20 13:07:19 2013 -0700 Initial commit. diff --git a/.gradle/1.6/taskArtifacts/cache.properties b/.gradle/1.6/taskArtifacts/cache.properties new file mode 100644 index 0000000..b2867b7 --- /dev/null +++ b/.gradle/1.6/taskArtifacts/cache.properties @@ -0,0 +1 @@ +#Sat Jul 20 11:26:01 PDT 2013 diff --git a/.gradle/1.6/taskArtifacts/cache.properties.lock b/.gradle/1.6/taskArtifacts/cache.properties.lock new file mode 100644 index 0000000..40fdece --- /dev/null +++ b/.gradle/1.6/taskArtifacts/cache.properties.lock @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/.gradle/1.6/taskArtifacts/fileHashes.bin b/.gradle/1.6/taskArtifacts/fileHashes.bin new file mode 100644 index 0000000..fa7fe42 Binary files /dev/null and b/.gradle/1.6/taskArtifacts/fileHashes.bin differ diff --git a/.gradle/1.6/taskArtifacts/fileSnapshots.bin b/.gradle/1.6/taskArtifacts/fileSnapshots.bin new file mode 100644 index 0000000..7499cbb Binary files /dev/null and b/.gradle/1.6/taskArtifacts/fileSnapshots.bin differ diff --git a/.gradle/1.6/taskArtifacts/outputFileStates.bin b/.gradle/1.6/taskArtifacts/outputFileStates.bin new file mode 100644 index 0000000..779fe44 Binary files /dev/null and b/.gradle/1.6/taskArtifacts/outputFileStates.bin differ diff --git a/.gradle/1.6/taskArtifacts/taskArtifacts.bin b/.gradle/1.6/taskArtifacts/taskArtifacts.bin new file mode 100644 index 0000000..8fbbb95 Binary files /dev/null and b/.gradle/1.6/taskArtifacts/taskArtifacts.bin differ diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 0000000..674f243 --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +ShareWithTitle \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..217af47 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,23 @@ + + + + + + diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..3572571 --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..e206d70 --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/.idea/gradle.xml b/.idea/gradle.xml new file mode 100644 index 0000000..a9986e4 --- /dev/null +++ b/.idea/gradle.xml @@ -0,0 +1,12 @@ + + + + + + + diff --git a/.idea/libraries/android_support_v4.xml b/.idea/libraries/android_support_v4.xml new file mode 100644 index 0000000..a811a3e --- /dev/null +++ b/.idea/libraries/android_support_v4.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..877b2d2 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + 1.6 + + + + + + + + + diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..83e9495 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/.idea/scopes/scope_settings.xml b/.idea/scopes/scope_settings.xml new file mode 100644 index 0000000..922003b --- /dev/null +++ b/.idea/scopes/scope_settings.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..def6a6a --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..ebf305c --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,566 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + localhost + 5050 + + + + + + + + + + 1374344744086 + 1374344744086 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ShareWithTitle/ShareWithTitle.iml b/ShareWithTitle/ShareWithTitle.iml new file mode 100644 index 0000000..f3f55f8 --- /dev/null +++ b/ShareWithTitle/ShareWithTitle.iml @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ShareWithTitle/build.gradle b/ShareWithTitle/build.gradle new file mode 100644 index 0000000..95d6226 --- /dev/null +++ b/ShareWithTitle/build.gradle @@ -0,0 +1,23 @@ +buildscript { + repositories { + maven { url 'http://repo1.maven.org/maven2' } + } + dependencies { + classpath 'com.android.tools.build:gradle:0.4' + } +} +apply plugin: 'android' + +dependencies { + compile files('libs/android-support-v4.jar') +} + +android { + compileSdkVersion 17 + buildToolsVersion "17.0.0" + + defaultConfig { + minSdkVersion 14 + targetSdkVersion 16 + } +} diff --git a/ShareWithTitle/build/incremental/aidl/debug/dependency.store b/ShareWithTitle/build/incremental/aidl/debug/dependency.store new file mode 100644 index 0000000..8b8400d Binary files /dev/null and b/ShareWithTitle/build/incremental/aidl/debug/dependency.store differ diff --git a/ShareWithTitle/build/incremental/aidl/debug/inputs.data b/ShareWithTitle/build/incremental/aidl/debug/inputs.data new file mode 100644 index 0000000..bed4bfb --- /dev/null +++ b/ShareWithTitle/build/incremental/aidl/debug/inputs.data @@ -0,0 +1,3 @@ +# incremental data. DO NOT EDIT. +# format is +# Encoding is UTF-8 diff --git a/ShareWithTitle/build/incremental/aidl/debug/outputs.data b/ShareWithTitle/build/incremental/aidl/debug/outputs.data new file mode 100644 index 0000000..bed4bfb --- /dev/null +++ b/ShareWithTitle/build/incremental/aidl/debug/outputs.data @@ -0,0 +1,3 @@ +# incremental data. DO NOT EDIT. +# format is +# Encoding is UTF-8 diff --git a/ShareWithTitle/build/incremental/mergeAssets/debug/inputs.data b/ShareWithTitle/build/incremental/mergeAssets/debug/inputs.data new file mode 100644 index 0000000..bed4bfb --- /dev/null +++ b/ShareWithTitle/build/incremental/mergeAssets/debug/inputs.data @@ -0,0 +1,3 @@ +# incremental data. DO NOT EDIT. +# format is +# Encoding is UTF-8 diff --git a/ShareWithTitle/build/incremental/mergeAssets/debug/merger.xml b/ShareWithTitle/build/incremental/mergeAssets/debug/merger.xml new file mode 100644 index 0000000..61df574 --- /dev/null +++ b/ShareWithTitle/build/incremental/mergeAssets/debug/merger.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/ShareWithTitle/build/incremental/mergeAssets/debug/outputs.data b/ShareWithTitle/build/incremental/mergeAssets/debug/outputs.data new file mode 100644 index 0000000..bed4bfb --- /dev/null +++ b/ShareWithTitle/build/incremental/mergeAssets/debug/outputs.data @@ -0,0 +1,3 @@ +# incremental data. DO NOT EDIT. +# format is +# Encoding is UTF-8 diff --git a/ShareWithTitle/build/incremental/mergeResources/debug/inputs.data b/ShareWithTitle/build/incremental/mergeResources/debug/inputs.data new file mode 100644 index 0000000..08128f6 --- /dev/null +++ b/ShareWithTitle/build/incremental/mergeResources/debug/inputs.data @@ -0,0 +1,16 @@ +# incremental data. DO NOT EDIT. +# format is +# Encoding is UTF-8 +1374344744000 12356 75154d4f6e93c8832a74d3c27c8cf0d44672ea3e /Users/sdqali/AndroidStudioProjects/ShareWithTitleProject/ShareWithTitle/src/main/res/drawable-xhdpi/ic_launcher.png +1374344744000 211 4e1904afba59d31e5cd6133f6a4c360fa9a5913f /Users/sdqali/AndroidStudioProjects/ShareWithTitleProject/ShareWithTitle/src/main/res/values/dimens.xml +1374344744000 226 1df2a848b931c8d007834dbdaf20699eb4df13e5 /Users/sdqali/AndroidStudioProjects/ShareWithTitleProject/ShareWithTitle/src/main/res/values/strings.xml +1374344744000 3760 9d45e7de00dac30e9738dc369dece2835bf9677e /Users/sdqali/AndroidStudioProjects/ShareWithTitleProject/ShareWithTitle/src/main/res/drawable-mdpi/ic_launcher.png +1374344743000 381 b129b276e01126de5b3b753572ac67cbfc19454c /Users/sdqali/AndroidStudioProjects/ShareWithTitleProject/ShareWithTitle/src/main/res/values-v14/styles.xml +1374344744000 181 84de2797380184d8b39af6f829afb092fb956173 /Users/sdqali/AndroidStudioProjects/ShareWithTitleProject/ShareWithTitle/src/main/res/values-sw600dp/dimens.xml +1374344743000 324 aa1f5f1723de9aee2669dc44a26fbc0ce776d35f /Users/sdqali/AndroidStudioProjects/ShareWithTitleProject/ShareWithTitle/src/main/res/values-v11/styles.xml +1374344743000 680 c76f4caaa7a8dfe9727fa93001b3aee3b22d6716 /Users/sdqali/AndroidStudioProjects/ShareWithTitleProject/ShareWithTitle/src/main/res/values/styles.xml +1374346392000 686 650027c97bb28a93265e6fd320e7fee56d23dee1 /Users/sdqali/AndroidStudioProjects/ShareWithTitleProject/ShareWithTitle/src/main/res/layout/activity_main.xml +1374344744000 254 25b6404e44acb50c82590049639d4fb5fefbac8e /Users/sdqali/AndroidStudioProjects/ShareWithTitleProject/ShareWithTitle/src/main/res/values-sw720dp-land/dimens.xml +1374344744000 24780 6c2954bdacb8129ac00edfd084b98daf226518e3 /Users/sdqali/AndroidStudioProjects/ShareWithTitleProject/ShareWithTitle/src/main/res/drawable-xxhdpi/ic_launcher.png +1374344743000 244 045ff451db7cd8e61285502b8c9bbf7405f2078d /Users/sdqali/AndroidStudioProjects/ShareWithTitleProject/ShareWithTitle/src/main/res/menu/main.xml +1374344744000 7783 03172612ec7d8d2cc6295a185410c3e6501771aa /Users/sdqali/AndroidStudioProjects/ShareWithTitleProject/ShareWithTitle/src/main/res/drawable-hdpi/ic_launcher.png diff --git a/ShareWithTitle/build/incremental/mergeResources/debug/merger.xml b/ShareWithTitle/build/incremental/mergeResources/debug/merger.xml new file mode 100644 index 0000000..31f2d3a --- /dev/null +++ b/ShareWithTitle/build/incremental/mergeResources/debug/merger.xml @@ -0,0 +1,114 @@ + + + + + + + + + + + + + 16dp + + 16dp + + + + Settings + + Share With Title + + Hello world! + + + + + + + + + + + 128dp + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ShareWithTitle/build/incremental/mergeResources/debug/outputs.data b/ShareWithTitle/build/incremental/mergeResources/debug/outputs.data new file mode 100644 index 0000000..267f7de --- /dev/null +++ b/ShareWithTitle/build/incremental/mergeResources/debug/outputs.data @@ -0,0 +1,13 @@ +# incremental data. DO NOT EDIT. +# format is +# Encoding is UTF-8 +1374350553000 794 bca07e5e6f52443c8f5f85ba904ed6e2232ee6e4 /Users/sdqali/AndroidStudioProjects/ShareWithTitleProject/ShareWithTitle/build/res/all/debug/values/values.xml +1374350553000 203 19aedb7cdc3386344e36087b035a0a6b2b91d4cd /Users/sdqali/AndroidStudioProjects/ShareWithTitleProject/ShareWithTitle/build/res/all/debug/values-v11/values.xml +1374350553000 244 045ff451db7cd8e61285502b8c9bbf7405f2078d /Users/sdqali/AndroidStudioProjects/ShareWithTitleProject/ShareWithTitle/build/res/all/debug/menu/main.xml +1374350553000 686 650027c97bb28a93265e6fd320e7fee56d23dee1 /Users/sdqali/AndroidStudioProjects/ShareWithTitleProject/ShareWithTitle/build/res/all/debug/layout/activity_main.xml +1374350553000 125 fae9d1b71d520745438010c9ca7cde9c81dfefac /Users/sdqali/AndroidStudioProjects/ShareWithTitleProject/ShareWithTitle/build/res/all/debug/values-sw720dp-land/values.xml +1374350553000 12356 75154d4f6e93c8832a74d3c27c8cf0d44672ea3e /Users/sdqali/AndroidStudioProjects/ShareWithTitleProject/ShareWithTitle/build/res/all/debug/drawable-xhdpi/ic_launcher.png +1374350553000 3760 9d45e7de00dac30e9738dc369dece2835bf9677e /Users/sdqali/AndroidStudioProjects/ShareWithTitleProject/ShareWithTitle/build/res/all/debug/drawable-mdpi/ic_launcher.png +1374350553000 217 f02e000d05a079992d2dba18039216c1e6b8784f /Users/sdqali/AndroidStudioProjects/ShareWithTitleProject/ShareWithTitle/build/res/all/debug/values-v14/values.xml +1374350553000 24780 6c2954bdacb8129ac00edfd084b98daf226518e3 /Users/sdqali/AndroidStudioProjects/ShareWithTitleProject/ShareWithTitle/build/res/all/debug/drawable-xxhdpi/ic_launcher.png +1374350553000 7783 03172612ec7d8d2cc6295a185410c3e6501771aa /Users/sdqali/AndroidStudioProjects/ShareWithTitleProject/ShareWithTitle/build/res/all/debug/drawable-hdpi/ic_launcher.png diff --git a/ShareWithTitle/build/libs/ShareWithTitle-debug.ap_ b/ShareWithTitle/build/libs/ShareWithTitle-debug.ap_ new file mode 100644 index 0000000..75d6414 Binary files /dev/null and b/ShareWithTitle/build/libs/ShareWithTitle-debug.ap_ differ diff --git a/ShareWithTitle/build/manifests/debug/AndroidManifest.xml b/ShareWithTitle/build/manifests/debug/AndroidManifest.xml new file mode 100644 index 0000000..fbde61f --- /dev/null +++ b/ShareWithTitle/build/manifests/debug/AndroidManifest.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/ShareWithTitle/build/res/all/debug/drawable-hdpi/ic_launcher.png b/ShareWithTitle/build/res/all/debug/drawable-hdpi/ic_launcher.png new file mode 100644 index 0000000..55621cc Binary files /dev/null and b/ShareWithTitle/build/res/all/debug/drawable-hdpi/ic_launcher.png differ diff --git a/ShareWithTitle/build/res/all/debug/drawable-mdpi/ic_launcher.png b/ShareWithTitle/build/res/all/debug/drawable-mdpi/ic_launcher.png new file mode 100644 index 0000000..11ec206 Binary files /dev/null and b/ShareWithTitle/build/res/all/debug/drawable-mdpi/ic_launcher.png differ diff --git a/ShareWithTitle/build/res/all/debug/drawable-xhdpi/ic_launcher.png b/ShareWithTitle/build/res/all/debug/drawable-xhdpi/ic_launcher.png new file mode 100644 index 0000000..7c02b78 Binary files /dev/null and b/ShareWithTitle/build/res/all/debug/drawable-xhdpi/ic_launcher.png differ diff --git a/ShareWithTitle/build/res/all/debug/drawable-xxhdpi/ic_launcher.png b/ShareWithTitle/build/res/all/debug/drawable-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..915d914 Binary files /dev/null and b/ShareWithTitle/build/res/all/debug/drawable-xxhdpi/ic_launcher.png differ diff --git a/ShareWithTitle/build/res/all/debug/layout/activity_main.xml b/ShareWithTitle/build/res/all/debug/layout/activity_main.xml new file mode 100644 index 0000000..a0860a2 --- /dev/null +++ b/ShareWithTitle/build/res/all/debug/layout/activity_main.xml @@ -0,0 +1,17 @@ + + + + + diff --git a/ShareWithTitle/build/res/all/debug/menu/main.xml b/ShareWithTitle/build/res/all/debug/menu/main.xml new file mode 100644 index 0000000..f3b10b6 --- /dev/null +++ b/ShareWithTitle/build/res/all/debug/menu/main.xml @@ -0,0 +1,6 @@ + + + diff --git a/ShareWithTitle/build/res/all/debug/values-sw720dp-land/values.xml b/ShareWithTitle/build/res/all/debug/values-sw720dp-land/values.xml new file mode 100644 index 0000000..19ee6d2 --- /dev/null +++ b/ShareWithTitle/build/res/all/debug/values-sw720dp-land/values.xml @@ -0,0 +1,6 @@ + + + + 128dp + + diff --git a/ShareWithTitle/build/res/all/debug/values-v11/values.xml b/ShareWithTitle/build/res/all/debug/values-v11/values.xml new file mode 100644 index 0000000..ee8bf4c --- /dev/null +++ b/ShareWithTitle/build/res/all/debug/values-v11/values.xml @@ -0,0 +1,8 @@ + + + + + + diff --git a/ShareWithTitle/build/res/all/debug/values-v14/values.xml b/ShareWithTitle/build/res/all/debug/values-v14/values.xml new file mode 100644 index 0000000..6d5f46f --- /dev/null +++ b/ShareWithTitle/build/res/all/debug/values-v14/values.xml @@ -0,0 +1,8 @@ + + + + + + diff --git a/ShareWithTitle/build/res/all/debug/values/values.xml b/ShareWithTitle/build/res/all/debug/values/values.xml new file mode 100644 index 0000000..a7a4a80 --- /dev/null +++ b/ShareWithTitle/build/res/all/debug/values/values.xml @@ -0,0 +1,23 @@ + + + + 16dp + 16dp + + Settings + Share With Title + Hello world! + + + + + + diff --git a/ShareWithTitle/build/source/buildConfig/debug/in/sdqali/sharewithtitle/BuildConfig.java b/ShareWithTitle/build/source/buildConfig/debug/in/sdqali/sharewithtitle/BuildConfig.java new file mode 100644 index 0000000..295b6bb --- /dev/null +++ b/ShareWithTitle/build/source/buildConfig/debug/in/sdqali/sharewithtitle/BuildConfig.java @@ -0,0 +1,7 @@ +/** Automatically generated file. DO NOT MODIFY */ +package in.sdqali.sharewithtitle; + +public final class BuildConfig { + public final static boolean DEBUG = true; + +} \ No newline at end of file diff --git a/ShareWithTitle/build/source/r/debug/in/sdqali/sharewithtitle/R.java b/ShareWithTitle/build/source/r/debug/in/sdqali/sharewithtitle/R.java new file mode 100644 index 0000000..a5f738e --- /dev/null +++ b/ShareWithTitle/build/source/r/debug/in/sdqali/sharewithtitle/R.java @@ -0,0 +1,49 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * aapt tool from the resource data it found. It + * should not be modified by hand. + */ + +package in.sdqali.sharewithtitle; + +public final class R { + public static final class attr { + } + public static final class dimen { + public static final int activity_horizontal_margin=0x7f040000; + public static final int activity_vertical_margin=0x7f040001; + } + public static final class drawable { + public static final int ic_launcher=0x7f020000; + } + public static final class id { + public static final int action_settings=0x7f080001; + public static final int greet_text=0x7f080000; + } + public static final class layout { + public static final int activity_main=0x7f030000; + } + public static final class menu { + public static final int main=0x7f070000; + } + public static final class string { + public static final int action_settings=0x7f050000; + public static final int app_name=0x7f050001; + public static final int hello_world=0x7f050002; + } + public static final class style { + /** + Theme customizations available in newer API levels can go in + res/values-vXX/styles.xml, while customizations related to + backward-compatibility can go here. + + API 11 theme customizations can go here. + API 14 theme customizations can go here. + */ + public static final int AppBaseTheme=0x7f060000; + /** All customizations that are NOT specific to a particular API-level can go here. + */ + public static final int AppTheme=0x7f060001; + } +} diff --git a/ShareWithTitle/build/source/r/debug/in/sdqali/sharewithtitle/ShareableOutput.java b/ShareWithTitle/build/source/r/debug/in/sdqali/sharewithtitle/ShareableOutput.java new file mode 100644 index 0000000..b8a0d78 --- /dev/null +++ b/ShareWithTitle/build/source/r/debug/in/sdqali/sharewithtitle/ShareableOutput.java @@ -0,0 +1,37 @@ +package in.sdqali.sharewithtitle; + +import android.net.Uri; +import android.util.Log; +import android.webkit.URLUtil; +import android.widget.Toast; + +/** + * Created by sdqali on 7/20/13. + */ +public class ShareableOutput { + private String input; + + public ShareableOutput(String input) { + this.input = input; + } + + public boolean isValidUrl() { + if(URLUtil.isHttpsUrl(input) || URLUtil.isHttpUrl(input)) { + return true; + } else { + return false; + } + } + + public String output() { + if (isValidUrl()) { + Log.d("Share With Title", "$$$$$$$$$$$ VALID URL"); + + return new TitleRetriever(input).retrieve(); + } else { + Log.d("Share With Title", "$$$$$$$$$$$ Invalid URL"); + + return input; + } + } +} diff --git a/ShareWithTitle/build/source/r/debug/in/sdqali/sharewithtitle/TitleRetriever.java b/ShareWithTitle/build/source/r/debug/in/sdqali/sharewithtitle/TitleRetriever.java new file mode 100644 index 0000000..4a99bff --- /dev/null +++ b/ShareWithTitle/build/source/r/debug/in/sdqali/sharewithtitle/TitleRetriever.java @@ -0,0 +1,70 @@ +package in.sdqali.sharewithtitle; + +import android.net.http.AndroidHttpClient; +import android.text.AndroidCharacter; +import android.util.Log; + +import org.apache.http.HttpRequest; +import org.apache.http.client.HttpClient; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.URL; + +/** + * Created by sdqali on 7/20/13. + */ +public class TitleRetriever { + private String urlText; + + public TitleRetriever(String url) { + this.urlText = url; + } + + public String retrieve() { + try { + URL url = new URL(urlText); + HttpURLConnection con = (HttpURLConnection) url + .openConnection(); + String content = readStream(con.getInputStream()); + Log.d("Share With Title", "content: " + content); + + return content; + } catch (Exception e) { + Log.d("Share With Title", e.getStackTrace().toString()); + + e.printStackTrace(); +// } catch (IOException e) { +// e.printStackTrace(); + } finally { + return urlText; + } + } + + private String readStream(InputStream in) { + String output = ""; + BufferedReader reader = null; + try { + reader = new BufferedReader(new InputStreamReader(in)); + String line = ""; + while ((line = reader.readLine()) != null) { + output += line; + } + } catch (IOException e) { + e.printStackTrace(); + } finally { + if (reader != null) { + try { + reader.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + return output; + } +} diff --git a/ShareWithTitle/libs/android-support-v4.jar b/ShareWithTitle/libs/android-support-v4.jar new file mode 100644 index 0000000..428bdbc Binary files /dev/null and b/ShareWithTitle/libs/android-support-v4.jar differ diff --git a/ShareWithTitle/src/main/AndroidManifest.xml b/ShareWithTitle/src/main/AndroidManifest.xml new file mode 100644 index 0000000..2664039 --- /dev/null +++ b/ShareWithTitle/src/main/AndroidManifest.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + diff --git a/ShareWithTitle/src/main/ic_launcher-web.png b/ShareWithTitle/src/main/ic_launcher-web.png new file mode 100644 index 0000000..5c63bc5 Binary files /dev/null and b/ShareWithTitle/src/main/ic_launcher-web.png differ diff --git a/ShareWithTitle/src/main/java/in/sdqali/sharewithtitle/MainActivity.java b/ShareWithTitle/src/main/java/in/sdqali/sharewithtitle/MainActivity.java new file mode 100644 index 0000000..a6509d7 --- /dev/null +++ b/ShareWithTitle/src/main/java/in/sdqali/sharewithtitle/MainActivity.java @@ -0,0 +1,59 @@ +package in.sdqali.sharewithtitle; + +import android.content.Context; +import android.content.Intent; +import android.os.Bundle; +import android.app.Activity; +import android.util.Log; +import android.view.Menu; +import android.widget.TextView; +import android.widget.Toast; + +public class MainActivity extends Activity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + Intent intent = getIntent(); + String action = intent.getAction(); + + TextView textView = (TextView) findViewById(R.id.greet_text); + textView.setText(""); + + if(action.equals(Intent.ACTION_SEND)) { + String sharedText = intent.getStringExtra(Intent.EXTRA_TEXT); + Log.d("Share With Title", "Received shared text: " + sharedText); + + + ShareableOutput shareableOutput = new ShareableOutput(sharedText); + textView.setText(shareableOutput.output()); + if (shareableOutput.isValidUrl()) { + return; + } + showToast("Could not retrieve title. Not a valid url."); + } else if (action.equals(Intent.ACTION_MAIN)) { + Log.d("Share With Title", "Started from main"); + + textView.setText("Nothing to see here!"); + } + } + + private void showToast(String text) { + Context context = getApplicationContext(); + int duration = Toast.LENGTH_SHORT; + + Toast toast = Toast.makeText(context, text, duration); + toast.show(); + } + + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + // Inflate the menu; this adds items to the action bar if it is present. + getMenuInflater().inflate(R.menu.main, menu); + return true; + } + +} diff --git a/ShareWithTitle/src/main/res/drawable-hdpi/ic_launcher.png b/ShareWithTitle/src/main/res/drawable-hdpi/ic_launcher.png new file mode 100644 index 0000000..55621cc Binary files /dev/null and b/ShareWithTitle/src/main/res/drawable-hdpi/ic_launcher.png differ diff --git a/ShareWithTitle/src/main/res/drawable-mdpi/ic_launcher.png b/ShareWithTitle/src/main/res/drawable-mdpi/ic_launcher.png new file mode 100644 index 0000000..11ec206 Binary files /dev/null and b/ShareWithTitle/src/main/res/drawable-mdpi/ic_launcher.png differ diff --git a/ShareWithTitle/src/main/res/drawable-xhdpi/ic_launcher.png b/ShareWithTitle/src/main/res/drawable-xhdpi/ic_launcher.png new file mode 100644 index 0000000..7c02b78 Binary files /dev/null and b/ShareWithTitle/src/main/res/drawable-xhdpi/ic_launcher.png differ diff --git a/ShareWithTitle/src/main/res/drawable-xxhdpi/ic_launcher.png b/ShareWithTitle/src/main/res/drawable-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..915d914 Binary files /dev/null and b/ShareWithTitle/src/main/res/drawable-xxhdpi/ic_launcher.png differ diff --git a/ShareWithTitle/src/main/res/layout/activity_main.xml b/ShareWithTitle/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..a0860a2 --- /dev/null +++ b/ShareWithTitle/src/main/res/layout/activity_main.xml @@ -0,0 +1,17 @@ + + + + + diff --git a/ShareWithTitle/src/main/res/menu/main.xml b/ShareWithTitle/src/main/res/menu/main.xml new file mode 100644 index 0000000..f3b10b6 --- /dev/null +++ b/ShareWithTitle/src/main/res/menu/main.xml @@ -0,0 +1,6 @@ + + + diff --git a/ShareWithTitle/src/main/res/values-sw600dp/dimens.xml b/ShareWithTitle/src/main/res/values-sw600dp/dimens.xml new file mode 100644 index 0000000..886b05f --- /dev/null +++ b/ShareWithTitle/src/main/res/values-sw600dp/dimens.xml @@ -0,0 +1,4 @@ + + + diff --git a/ShareWithTitle/src/main/res/values-sw720dp-land/dimens.xml b/ShareWithTitle/src/main/res/values-sw720dp-land/dimens.xml new file mode 100644 index 0000000..00059fc --- /dev/null +++ b/ShareWithTitle/src/main/res/values-sw720dp-land/dimens.xml @@ -0,0 +1,5 @@ + + + 128dp + diff --git a/ShareWithTitle/src/main/res/values-v11/styles.xml b/ShareWithTitle/src/main/res/values-v11/styles.xml new file mode 100644 index 0000000..3c02242 --- /dev/null +++ b/ShareWithTitle/src/main/res/values-v11/styles.xml @@ -0,0 +1,11 @@ + + + + + + diff --git a/ShareWithTitle/src/main/res/values-v14/styles.xml b/ShareWithTitle/src/main/res/values-v14/styles.xml new file mode 100644 index 0000000..a91fd03 --- /dev/null +++ b/ShareWithTitle/src/main/res/values-v14/styles.xml @@ -0,0 +1,12 @@ + + + + + + diff --git a/ShareWithTitle/src/main/res/values/dimens.xml b/ShareWithTitle/src/main/res/values/dimens.xml new file mode 100644 index 0000000..47c8224 --- /dev/null +++ b/ShareWithTitle/src/main/res/values/dimens.xml @@ -0,0 +1,5 @@ + + + 16dp + 16dp + diff --git a/ShareWithTitle/src/main/res/values/strings.xml b/ShareWithTitle/src/main/res/values/strings.xml new file mode 100644 index 0000000..1dd2edf --- /dev/null +++ b/ShareWithTitle/src/main/res/values/strings.xml @@ -0,0 +1,8 @@ + + + + Share With Title + Settings + Hello world! + + diff --git a/ShareWithTitle/src/main/res/values/styles.xml b/ShareWithTitle/src/main/res/values/styles.xml new file mode 100644 index 0000000..6ce89c7 --- /dev/null +++ b/ShareWithTitle/src/main/res/values/styles.xml @@ -0,0 +1,20 @@ + + + + + + + + + diff --git a/ShareWithTitleProject.iml b/ShareWithTitleProject.iml new file mode 100644 index 0000000..13da953 --- /dev/null +++ b/ShareWithTitleProject.iml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..495c503 --- /dev/null +++ b/build.gradle @@ -0,0 +1 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..8c0fb64 Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..5c22dec --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Wed Apr 10 15:27:10 PDT 2013 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=http\://services.gradle.org/distributions/gradle-1.6-bin.zip diff --git a/gradlew b/gradlew new file mode 100755 index 0000000..91a7e26 --- /dev/null +++ b/gradlew @@ -0,0 +1,164 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# For Cygwin, ensure paths are in UNIX format before anything is touched. +if $cygwin ; then + [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` +fi + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >&- +APP_HOME="`pwd -P`" +cd "$SAVED" >&- + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..aec9973 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/local.properties b/local.properties new file mode 100644 index 0000000..90aafac --- /dev/null +++ b/local.properties @@ -0,0 +1,10 @@ +# This file is automatically generated by Android Studio. +# Do not modify this file -- YOUR CHANGES WILL BE ERASED! +# +# This file must *NOT* be checked into Version Control Systems, +# as it contains information specific to your local configuration. + +# Location of the SDK. This is only used by Gradle. +# For customization when using a Version Control System, please read the +# header note. +sdk.dir=/Applications/Android Studio.app/sdk \ No newline at end of file diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..35c6f48 --- /dev/null +++ b/settings.gradle @@ -0,0 +1 @@ +include ':ShareWithTitle'