Skip to content

Commit

Permalink
first version that may be working
Browse files Browse the repository at this point in the history
  • Loading branch information
thasmin committed Feb 19, 2012
1 parent 2d30ee9 commit 05a0985
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 3 deletions.
31 changes: 30 additions & 1 deletion AndroidManifest.xml
Expand Up @@ -6,9 +6,38 @@

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

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS" />
<uses-permission android:name="android.permission.READ_SYNC_STATS" />
<uses-permission android:name="android.permission.READ_SYNC_SETTINGS" />
<uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS" />

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

<activity android:name=".AuthenticatorActivity"
android:label="@string/authenticator_activity_title" />

<service android:name=".AuthenticationService">
<intent-filter>
<action android:name="android.accounts.AccountAuthenticator" />
</intent-filter>
<meta-data android:name="android.accounts.AccountAuthenticator"
android:resource="@xml/authenticator" />
</service>
<service android:name=".SyncService">
<intent-filter>
<action android:name="android.content.SyncAdapter" />
</intent-filter>
<meta-data android:name="android.content.SyncAdapter"
android:resource="@xml/syncadapter" />
</service>

<provider android:name=".Provider"
android:label="Podcasts"
android:authorities="com.axelby.gpodder.podcasts" />

</application>

</manifest>
2 changes: 2 additions & 0 deletions res/values/strings.xml
@@ -1,4 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">GPodder</string>
<string name="authenticator_activity_title">GPodder Account Details</string>
<string name="gpodder">GPodder</string>
</resources>
7 changes: 7 additions & 0 deletions res/xml/authenticator.xml
@@ -0,0 +1,7 @@
<account-authenticator xmlns:android="http://schemas.android.com/apk/res/android"
android:accountType="com.axelby.gpodder.account"
android:icon="@drawable/mygpo"
android:smallIcon="@drawable/mygpo"
android:label="@string/gpodder"
android:accountPreferences="@xml/preferences">
</account-authenticator>
16 changes: 16 additions & 0 deletions res/xml/preferences.xml
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<!--
<PreferenceCategory android:title="Preferences">
<EditTextPreference
android:title="Username"
android:summary="GPodder username"
android:key="username" />
<EditTextPreference
android:title="Password"
android:summary="GPodder password"
android:key="password" />
</PreferenceCategory>
-->
</PreferenceScreen>
5 changes: 5 additions & 0 deletions res/xml/syncadapter.xml
@@ -0,0 +1,5 @@
<sync-adapter xmlns:android="http://schemas.android.com/apk/res/android"
android:contentAuthority="com.axelby.gpodder.podcasts"
android:accountType="com.axelby.gpodder.account"
android:supportsUploading="false"
/>
1 change: 1 addition & 0 deletions src/com/axelby/gpodder/Constants.java
Expand Up @@ -2,4 +2,5 @@

public class Constants {
public static final String ACCOUNT_TYPE = "com.axelby.gpodder.account";
public static final String AUTHORITY = "com.axelby.gpodder.podcasts";
}
6 changes: 4 additions & 2 deletions src/com/axelby/gpodder/Provider.java
Expand Up @@ -8,7 +8,7 @@
import android.net.Uri;

public class Provider extends ContentProvider {
public static String AUTHORITY = "com.axelby.gpodder";
public static String AUTHORITY = "com.axelby.gpodder.podcasts";
public static Uri URI = Uri.parse("content://" + AUTHORITY);
public static final String ITEM_TYPE = ContentResolver.CURSOR_ITEM_BASE_TYPE
+ "/vnd.axelby.gpodder.podcast";
Expand Down Expand Up @@ -37,7 +37,9 @@ public Cursor query(Uri uri, String[] projection, String selection,
DBAdapter dbAdapter = new DBAdapter(this.getContext());
SQLiteDatabase db = dbAdapter.getReadableDatabase();
if (uri.equals(AUTHORITY))
return db.query("subscriptions", new String[] { "url" }, null, null, null, null, "url");
return db.rawQuery("SELECT url FROM " +
"(SELECT url FROM subscriptions UNION select url from pending_add)" +
"WHERE url NOT IN (SELECT url FROM pending_remove)", null);
else
return db.query("subscriptions", new String[] { "url" }, "url = ?", new String[] { uri.getPath() }, null, null, null);
}
Expand Down

0 comments on commit 05a0985

Please sign in to comment.