Skip to content

Commit

Permalink
Restructure project for using as a library with source.
Browse files Browse the repository at this point in the history
  • Loading branch information
androidquery committed Oct 22, 2011
1 parent 6426bb6 commit 856edaa
Show file tree
Hide file tree
Showing 174 changed files with 5,181 additions and 160 deletions.
7 changes: 1 addition & 6 deletions .classpath
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="test"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="src" path="beta"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="lib" path="lib/FlurryAgent.jar"/>
<classpathentry kind="lib" path="lib/signpost-commonshttp4-1.2.1.1.jar"/>
<classpathentry kind="lib" path="lib/signpost-core-1.2.1.1.jar"/>
<classpathentry kind="output" path="bin"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# built application files
*.apk
#*.apk
*.ap_

# files for the dex VM
*.dex

# Java class files
*.class
*.jar
#*.jar

# generated files
bin/
Expand Down
53 changes: 2 additions & 51 deletions AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,53 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.androidquery"
android:versionCode="23"
android:versionName="0.15.3">


<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />

<!--
<uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS" />
-->


<uses-sdk android:minSdkVersion="7"/>


<application android:icon="@drawable/launch" android:label="@string/app_name">

<!--
<application android:icon="@drawable/launch" android:label="@string/app_name" android:hardwareAccelerated="true">
-->
<activity android:name=".test.IntentListActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<activity android:name=".test.AdhocActivity" android:theme="@style/android:Theme.Light"></activity>
<activity android:name=".test.AdhocActivity2" android:theme="@style/android:Theme.Light"></activity>
<activity android:name=".test.async.AjaxLoadingActivity" android:theme="@style/android:Theme.Light"></activity>
<activity android:name=".test.image.ImageLoadingActivity" android:theme="@style/android:Theme.Light"></activity>
<activity android:name=".test.image.ImageLoadingListActivity" android:theme="@style/android:Theme.Light"></activity>
<activity android:name=".test.image.ImageLoadingList2Activity" android:theme="@style/android:Theme.Light"></activity>
<activity android:name=".test.image.ImageLoadingList3Activity" android:theme="@style/android:Theme.Light"></activity>
<activity android:name=".test.image.ImageLoadingList4Activity" android:theme="@style/android:Theme.Light"></activity>
<activity android:name=".test.image.ImageLoadingListOptionsActivity" android:theme="@style/android:Theme.Light"></activity>
<activity android:name=".test.image.ImageLoadingGridActivity" android:theme="@style/android:Theme.Light"></activity>
<activity android:name=".test.image.ImageLoadingAspectRatioActivity" android:theme="@style/android:Theme.Light"></activity>
<activity android:name=".test.async.AjaxAuthActivity" android:theme="@style/android:Theme.Light"></activity>
<activity android:name=".test.async.XmlActivity" android:theme="@style/android:Theme.Light"></activity>
<activity android:name=".test.async.ServiceActivity"></activity>
</application>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.androidquery">
<application/>
</manifest>
111 changes: 80 additions & 31 deletions build.xml
Original file line number Diff line number Diff line change
@@ -1,36 +1,85 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="AndroidQuery" default="help">

<project>

<property name="down-version" value="0-2-1"/>

<target name="proguard">

<input addproperty="version">Enter version number</input>
<java fork="true" jar="dist/proguard.jar">
<arg value="@dist/proguard.cfg"/>
<arg value="-injars"/>
<arg value="dist/android-query.jar"/>
<arg value="-outjars"/>
<arg value="dist/android-query.${version}.jar"/>
<arg value="-keepparameternames"/>
</java>

<copy file="dist/android-query.${version}.jar" tofile="dist/android-query-optimized.jar"/>

<!--
<java fork="true" jar="dist/proguard.jar">
<arg value="@dist/proguard.cfg"/>
<arg value="-injars"/>
<arg value="dist/android-query.jar"/>
<arg value="-outjars"/>
<arg value="dist/android-query-optimized.jar"/>
</java>
<copy file="dist/android-query-optimized.jar" tofile="dist/android-query-optimized.${version}.jar"/>
-->
<!-- The local.properties file is created and updated by the 'android' tool.
It contains the path to the SDK. It should *NOT* be checked into
Version Control Systems. -->
<loadproperties srcFile="local.properties" />

<!-- The ant.properties file can be created by you. It is only edited by the
'android' tool to add properties to it.
This is the place to change some Ant specific build properties.
Here are some properties you may want to change/update:
source.dir
The name of the source directory. Default is 'src'.
out.dir
The name of the output directory. Default is 'bin'.
For other overridable properties, look at the beginning of the rules
files in the SDK, at tools/ant/build.xml
Properties related to the SDK location or the project target should
be updated using the 'android' tool with the 'update' action.
This file is an integral part of the build system for your
application and should be checked into Version Control Systems.
-->
<property file="ant.properties" />

<!-- The project.properties file is created and updated by the 'android'
tool, as well as ADT.
This contains project specific properties such as project target, and library
dependencies. Lower level build properties are stored in ant.properties
(or in .classpath for Eclipse projects).
This file is an integral part of the build system for your
application and should be checked into Version Control Systems. -->
<loadproperties srcFile="project.properties" />

<!-- quick check on sdk.dir -->
<fail
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project'"
unless="sdk.dir"
/>


<!-- extension targets. Uncomment the ones where you want to do custom work
in between standard targets -->
<!--
<target name="-pre-build">
</target>

<target name="-pre-compile">
</target>
/* This is typically used for code obfuscation.
Compiled code location: ${out.classes.absolute.dir}
If this is not done in place, override ${out.dex.input.absolute.dir} */
<target name="-post-compile">
</target>
-->

<!-- Import the actual build file.
To customize existing targets, there are two options:
- Customize only one target:
- copy/paste the target into this file, *before* the
<import> task.
- customize it to your needs.
- Customize the whole content of build.xml
- copy/paste the content of the rules files (minus the top node)
into this file, replacing the <import> task.
- customize to your needs.
***********************
****** IMPORTANT ******
***********************
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
in order to avoid having your file be overridden by tools such as "android update project"
-->
<!-- version-tag: 1 -->
<import file="${sdk.dir}/tools/ant/build.xml" />

</project>
13 changes: 13 additions & 0 deletions demo/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="beta"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry kind="lib" path="lib/FlurryAgent.jar"/>
<classpathentry kind="lib" path="lib/signpost-commonshttp4-1.2.1.1.jar"/>
<classpathentry kind="lib" path="lib/signpost-core-1.2.1.1.jar"/>
<classpathentry kind="lib" path="/AndroidQuery/bin/androidquery.jar"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>
33 changes: 33 additions & 0 deletions demo/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>AndroidQueryDemo</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
53 changes: 53 additions & 0 deletions demo/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.androidquery"
android:versionCode="23"
android:versionName="0.15.3">


<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />

<!--
<uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS" />
-->


<uses-sdk android:minSdkVersion="7"/>


<application android:icon="@drawable/launch" android:label="@string/app_name">

<!--
<application android:icon="@drawable/launch" android:label="@string/app_name" android:hardwareAccelerated="true">
-->
<activity android:name=".test.IntentListActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<activity android:name=".test.AdhocActivity" android:theme="@style/android:Theme.Light"></activity>
<activity android:name=".test.AdhocActivity2" android:theme="@style/android:Theme.Light"></activity>
<activity android:name=".test.async.AjaxLoadingActivity" android:theme="@style/android:Theme.Light"></activity>
<activity android:name=".test.image.ImageLoadingActivity" android:theme="@style/android:Theme.Light"></activity>
<activity android:name=".test.image.ImageLoadingListActivity" android:theme="@style/android:Theme.Light"></activity>
<activity android:name=".test.image.ImageLoadingList2Activity" android:theme="@style/android:Theme.Light"></activity>
<activity android:name=".test.image.ImageLoadingList3Activity" android:theme="@style/android:Theme.Light"></activity>
<activity android:name=".test.image.ImageLoadingList4Activity" android:theme="@style/android:Theme.Light"></activity>
<activity android:name=".test.image.ImageLoadingListOptionsActivity" android:theme="@style/android:Theme.Light"></activity>
<activity android:name=".test.image.ImageLoadingGridActivity" android:theme="@style/android:Theme.Light"></activity>
<activity android:name=".test.image.ImageLoadingAspectRatioActivity" android:theme="@style/android:Theme.Light"></activity>
<activity android:name=".test.async.AjaxAuthActivity" android:theme="@style/android:Theme.Light"></activity>
<activity android:name=".test.async.XmlActivity" android:theme="@style/android:Theme.Light"></activity>
<activity android:name=".test.async.ServiceActivity"></activity>
</application>
</manifest>
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public class FacebookHandle extends AccountHandle{
private Activity act;
private WebDialog dialog;
private String token;
private String permissions;

private static final String OAUTH_ENDPOINT = "https://graph.facebook.com/oauth/authorize";
private static final String REDIRECT_URI = "https://www.facebook.com/connect/login_success.html";
Expand All @@ -33,11 +34,12 @@ public class FacebookHandle extends AccountHandle{
//private static final String TOKEN = "access_token";
//private static final String EXPIRES = "expires_in";

private static final String DISPLAY_STRING = "touch";
//private static final String DISPLAY_STRING = "touch";

public FacebookHandle(Activity act, String appId) {
public FacebookHandle(Activity act, String appId, String permissions) {
this.appId = appId;
this.act = act;
this.permissions = permissions;
token = fetchToken();
}

Expand Down Expand Up @@ -69,6 +71,10 @@ protected void auth() {
Bundle parameters = new Bundle();
parameters.putString("client_id", appId);
parameters.putString("type", "user_agent");
if(permissions != null){
parameters.putString("scope", permissions);
}

parameters.putString("redirect_uri", REDIRECT_URI);
String url = OAUTH_ENDPOINT + "?" + encodeUrl(parameters);

Expand Down Expand Up @@ -222,9 +228,11 @@ private static Bundle parseUrl(String url) {
}
}


@Override
public boolean expired(int code) {
return code == 400 || code == 401;

return code == 400 || code == 401 || code == 403;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ private String getHost(){
}

private String getQueryUrl(){
String url = getHost() + "/api/market?app=" + getAppId() + "&locale=" + locale + "&version=" + getVersion() + "&code=" + getVersionCode();
String url = getHost() + "/api/market?app=" + getAppId() + "&locale=" + locale + "&version=" + getVersion() + "&code=" + getVersionCode() + "&aq=" + AQuery.VERSION;
return url;
}

Expand Down
Binary file added demo/dist/AndroidQueryDemo24.apk
Binary file not shown.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file added demo/lib/signpost-commonshttp4-1.2.1.1.jar
Binary file not shown.
Binary file added demo/lib/signpost-core-1.2.1.1.jar
Binary file not shown.
File renamed without changes.
Loading

0 comments on commit 856edaa

Please sign in to comment.