Init
3
.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
.project
|
||||||
|
.settings
|
||||||
|
.classpath
|
25
AndroidManifest.xml
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
package="fr.gaulupeau.apps.Poche"
|
||||||
|
android:versionCode="1"
|
||||||
|
android:versionName="1.0">
|
||||||
|
<uses-sdk android:minSdkVersion="4"
|
||||||
|
android:targetSdkVersion="11" />
|
||||||
|
|
||||||
|
|
||||||
|
<application android:icon="@drawable/icon" android:label="@string/app_name">
|
||||||
|
<activity android:name="fr.gaulupeau.apps.Poche.Poche"
|
||||||
|
android:label="@string/app_name">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.SEND" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<data android:mimeType="text/plain" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
|
||||||
|
</application>
|
||||||
|
</manifest>
|
25
bin/AndroidManifest.xml
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
package="fr.gaulupeau.apps.Poche"
|
||||||
|
android:versionCode="1"
|
||||||
|
android:versionName="1.0">
|
||||||
|
<uses-sdk android:minSdkVersion="4"
|
||||||
|
android:targetSdkVersion="11" />
|
||||||
|
|
||||||
|
|
||||||
|
<application android:icon="@drawable/icon" android:label="@string/app_name">
|
||||||
|
<activity android:name="fr.gaulupeau.apps.Poche.Poche"
|
||||||
|
android:label="@string/app_name">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.SEND" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<data android:mimeType="text/plain" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
|
||||||
|
</application>
|
||||||
|
</manifest>
|
BIN
bin/Poche.apk
Normal file
BIN
bin/classes.dex
Normal file
BIN
bin/classes/fr/gaulupeau/apps/Poche/BuildConfig.class
Normal file
BIN
bin/classes/fr/gaulupeau/apps/Poche/Poche$1.class
Normal file
BIN
bin/classes/fr/gaulupeau/apps/Poche/Poche.class
Normal file
BIN
bin/classes/fr/gaulupeau/apps/Poche/R$attr.class
Normal file
BIN
bin/classes/fr/gaulupeau/apps/Poche/R$dimen.class
Normal file
BIN
bin/classes/fr/gaulupeau/apps/Poche/R$drawable.class
Normal file
BIN
bin/classes/fr/gaulupeau/apps/Poche/R$id.class
Normal file
BIN
bin/classes/fr/gaulupeau/apps/Poche/R$layout.class
Normal file
BIN
bin/classes/fr/gaulupeau/apps/Poche/R$string.class
Normal file
BIN
bin/classes/fr/gaulupeau/apps/Poche/R.class
Normal file
BIN
bin/res/drawable-hdpi/icon.png
Normal file
After Width: | Height: | Size: 555 B |
BIN
bin/res/drawable-ldpi/icon.png
Normal file
After Width: | Height: | Size: 317 B |
BIN
bin/res/drawable-mdpi/icon.png
Normal file
After Width: | Height: | Size: 409 B |
BIN
bin/res/drawable-xhdpi/icon.png
Normal file
After Width: | Height: | Size: 752 B |
BIN
bin/resources.ap_
Normal file
6
gen/fr/gaulupeau/apps/Poche/BuildConfig.java
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
/** Automatically generated file. DO NOT MODIFY */
|
||||||
|
package fr.gaulupeau.apps.Poche;
|
||||||
|
|
||||||
|
public final class BuildConfig {
|
||||||
|
public final static boolean DEBUG = true;
|
||||||
|
}
|
40
gen/fr/gaulupeau/apps/Poche/R.java
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
/* 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 fr.gaulupeau.apps.Poche;
|
||||||
|
|
||||||
|
public final class R {
|
||||||
|
public static final class attr {
|
||||||
|
}
|
||||||
|
public static final class dimen {
|
||||||
|
public static final int toppadding=0x7f040000;
|
||||||
|
}
|
||||||
|
public static final class drawable {
|
||||||
|
public static final int icon=0x7f020000;
|
||||||
|
}
|
||||||
|
public static final class id {
|
||||||
|
public static final int author=0x7f060004;
|
||||||
|
public static final int btnDone=0x7f060005;
|
||||||
|
public static final int instructions=0x7f060003;
|
||||||
|
public static final int pageUrl_label=0x7f060001;
|
||||||
|
public static final int pocheUrl=0x7f060002;
|
||||||
|
public static final int scrollView1=0x7f060000;
|
||||||
|
}
|
||||||
|
public static final class layout {
|
||||||
|
public static final int main=0x7f030000;
|
||||||
|
}
|
||||||
|
public static final class string {
|
||||||
|
public static final int app_name=0x7f050001;
|
||||||
|
public static final int author=0x7f050002;
|
||||||
|
public static final int authorSite=0x7f050006;
|
||||||
|
public static final int btnDone=0x7f050004;
|
||||||
|
public static final int hello=0x7f050000;
|
||||||
|
public static final int instructions=0x7f050003;
|
||||||
|
public static final int url_label=0x7f050007;
|
||||||
|
public static final int which_browser=0x7f050005;
|
||||||
|
}
|
||||||
|
}
|
3
lint.xml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<lint>
|
||||||
|
</lint>
|
14
project.properties
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
# This file is automatically generated by Android Tools.
|
||||||
|
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
||||||
|
#
|
||||||
|
# This file must be checked in Version Control Systems.
|
||||||
|
#
|
||||||
|
# To customize properties used by the Ant build system edit
|
||||||
|
# "ant.properties", and override values to adapt the script to your
|
||||||
|
# project structure.
|
||||||
|
#
|
||||||
|
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
|
||||||
|
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
|
||||||
|
|
||||||
|
# Project target.
|
||||||
|
target=android-18
|
BIN
res/drawable-hdpi/icon.png
Normal file
After Width: | Height: | Size: 592 B |
BIN
res/drawable-ldpi/icon.png
Normal file
After Width: | Height: | Size: 354 B |
BIN
res/drawable-mdpi/icon.png
Normal file
After Width: | Height: | Size: 445 B |
BIN
res/drawable-xhdpi/icon.png
Normal file
After Width: | Height: | Size: 788 B |
50
res/layout/main.xml
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@+id/scrollView1"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_width="fill_parent">
|
||||||
|
<LinearLayout
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:paddingLeft="30sp"
|
||||||
|
android:paddingRight="30sp"
|
||||||
|
>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/hello"
|
||||||
|
android:textSize="34sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/pageUrl_label"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/url_label"
|
||||||
|
android:textSize="20sp" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/pocheUrl"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:ems="10"
|
||||||
|
android:inputType="text"
|
||||||
|
android:linksClickable="false"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:scrollHorizontally="false" >
|
||||||
|
|
||||||
|
<requestFocus />
|
||||||
|
</EditText>
|
||||||
|
|
||||||
|
<TextView android:id="@+id/instructions" android:layout_width="wrap_content" android:text="@string/instructions" android:layout_height="wrap_content" android:layout_marginTop="@dimen/toppadding" android:textSize="25sp" android:paddingTop="5sp" android:paddingBottom="30sp"></TextView>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/author"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/author" />
|
||||||
|
|
||||||
|
<Button android:layout_width="wrap_content" android:id="@+id/btnDone" android:layout_height="wrap_content" android:text="@string/btnDone"></Button>
|
||||||
|
</LinearLayout>
|
||||||
|
</ScrollView>
|
4
res/values/dimens.xml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<dimen name="toppadding">10px</dimen>
|
||||||
|
</resources>
|
11
res/values/strings.xml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="hello">Welcome to Android2Poche !</string>
|
||||||
|
<string name="app_name">Android2Poche</string>
|
||||||
|
<string name="author">By GAULUPEAU Jonathan</string>
|
||||||
|
<string name="instructions">To save a web page to Poche, open the page in a browser then tap <i>Share</i> and tap on <i>Android to Poche</i>. You should then see a save window. When you have finished the browser will return to the original location.</string>
|
||||||
|
<string name="btnDone">Done</string>
|
||||||
|
<string name="which_browser">Which browser would you like to use?</string>
|
||||||
|
<string name="authorSite">http://links.gaulupeau.fr</string>
|
||||||
|
<string name="url_label">Your Poche URL :</string>
|
||||||
|
</resources>
|
105
src/fr/gaulupeau/apps/Poche/Poche.java
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
/**
|
||||||
|
* Android to Poche
|
||||||
|
* A simple app to make the full save bookmark to Poche
|
||||||
|
* web page available via the Share menu on Android tablets
|
||||||
|
* @author GAULUPEAU Jonathan
|
||||||
|
* August 2013
|
||||||
|
*/
|
||||||
|
|
||||||
|
package fr.gaulupeau.apps.Poche;
|
||||||
|
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
|
||||||
|
import android.annotation.TargetApi;
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.util.Base64;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.View.OnClickListener;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Main activity class
|
||||||
|
*/
|
||||||
|
@TargetApi(Build.VERSION_CODES.FROYO) public class Poche extends Activity {
|
||||||
|
TextView authorSite; // the author and site line on the information page
|
||||||
|
Button btnDone; // done/close button
|
||||||
|
EditText editPocheUrl;
|
||||||
|
public static final String PREFS_NAME = "MyPrefsFile";
|
||||||
|
/** Called when the activity is first created.
|
||||||
|
* Will act differently depending on whether sharing or
|
||||||
|
* displaying information page. */
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
// Get information about the call to start this activity
|
||||||
|
Intent intent = getIntent();
|
||||||
|
Bundle extras = intent.getExtras();
|
||||||
|
String action = intent.getAction();
|
||||||
|
|
||||||
|
SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);
|
||||||
|
String pocheUrl = settings.getString("pocheUrl", "");
|
||||||
|
|
||||||
|
// Find out if Sharing or if app has been launched from icon
|
||||||
|
if (action.equals(Intent.ACTION_SEND)) {
|
||||||
|
// ACTION_SEND is called when sharing, get the title and URL from
|
||||||
|
// the call
|
||||||
|
String pageUrl = extras.getString("android.intent.extra.TEXT");
|
||||||
|
String pageTitle = extras.getString("android.intent.extra.SUBJECT");
|
||||||
|
// Some apps do not provide the page title, so in this case use the URL again
|
||||||
|
if (pageTitle == null) {
|
||||||
|
pageTitle = pageUrl;
|
||||||
|
}
|
||||||
|
// Start to build the Delicious URL
|
||||||
|
Uri.Builder deliciousSaveUrl = Uri.parse(pocheUrl).buildUpon();
|
||||||
|
// Add the parameters from the call
|
||||||
|
deliciousSaveUrl.appendQueryParameter("action", "add");
|
||||||
|
byte[] data = null;
|
||||||
|
try {
|
||||||
|
data = pageUrl.getBytes("UTF-8");
|
||||||
|
} catch (UnsupportedEncodingException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
String base64 = Base64.encodeToString(data, Base64.DEFAULT);
|
||||||
|
deliciousSaveUrl.appendQueryParameter("url", base64);
|
||||||
|
//System.out.println("base64 : " + base64);
|
||||||
|
//System.out.println("pageurl : " + pageUrl);
|
||||||
|
|
||||||
|
// Load the constructed URL in the browser
|
||||||
|
Intent i = new Intent(Intent.ACTION_VIEW);
|
||||||
|
i.setData(deliciousSaveUrl.build());
|
||||||
|
// If user has more then one browser installed give them a chance to
|
||||||
|
// select which one they want to use
|
||||||
|
startActivity(Intent.createChooser(i, getString(R.string.which_browser)));
|
||||||
|
// That is all this app needs to do, so call finish()
|
||||||
|
this.finish();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// app has been launched from menu - show information window
|
||||||
|
setContentView(R.layout.main);
|
||||||
|
// handle done/close button
|
||||||
|
editPocheUrl = (EditText)findViewById(R.id.pocheUrl);
|
||||||
|
editPocheUrl.setText(pocheUrl);
|
||||||
|
|
||||||
|
btnDone = (Button)findViewById(R.id.btnDone);
|
||||||
|
btnDone.setOnClickListener(new OnClickListener() {
|
||||||
|
public void onClick(View v) {
|
||||||
|
// close the app
|
||||||
|
System.out.println(editPocheUrl.getText().toString());
|
||||||
|
SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);
|
||||||
|
SharedPreferences.Editor editor = settings.edit();
|
||||||
|
editor.putString("pocheUrl", editPocheUrl.getText().toString());
|
||||||
|
editor.commit();
|
||||||
|
Poche.this.finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|