summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--AndroidManifest.xml2
-rw-r--r--src/clojure/io/cons/carddav_sync/authenticator.clj15
-rw-r--r--src/clojure/io/cons/carddav_sync/authenticator_activity.clj15
3 files changed, 29 insertions, 3 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index ca8a713..539769d 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -36,6 +36,8 @@
<category android:name='android.intent.category.DEFAULT'/>
</intent-filter>
</activity>
+ <activity android:name=".authenticator_activity">
+ </activity>
<service android:name=".sync_service"
android:exported="true">
<intent-filter>
diff --git a/src/clojure/io/cons/carddav_sync/authenticator.clj b/src/clojure/io/cons/carddav_sync/authenticator.clj
index 99aefe7..c8bd349 100644
--- a/src/clojure/io/cons/carddav_sync/authenticator.clj
+++ b/src/clojure/io/cons/carddav_sync/authenticator.clj
@@ -1,18 +1,27 @@
(ns io.cons.carddav_sync.authenticator
(:use io.cons.carddav_sync.log)
+ (:import android.accounts.AccountManager
+ android.content.Intent
+ android.os.Bundle
+ io.cons.carddav_sync.authenticator_activity)
(:gen-class
:extends android.accounts.AbstractAccountAuthenticator
- :state state
+ :state context
:init init))
(defn -init
[context]
- [[context] nil])
+ [[context] context])
(defn -addAccount
[this response accountType authTokenType requiredFeatures options]
(log-i "addAccount")
- nil)
+ (let [intent (Intent. (.context this) authenticator_activity)
+ bundle (Bundle.)]
+ (.putExtra intent AccountManager/KEY_ACCOUNT_AUTHENTICATOR_RESPONSE
+ response)
+ (.putParcelable bundle AccountManager/KEY_INTENT intent)
+ bundle))
(defn -confirmCredentials
[this response account options]
diff --git a/src/clojure/io/cons/carddav_sync/authenticator_activity.clj b/src/clojure/io/cons/carddav_sync/authenticator_activity.clj
new file mode 100644
index 0000000..4e23d63
--- /dev/null
+++ b/src/clojure/io/cons/carddav_sync/authenticator_activity.clj
@@ -0,0 +1,15 @@
+(ns io.cons.carddav_sync.authenticator_activity
+ (:use [neko.activity :only [defactivity set-content-view!]]
+ [neko.threading :only [on-ui]]
+ [neko.ui :only [make-ui]])
+ (:gen-class
+ :extends android.app.Activity
+ :exposes-methods {onCreate superOnCreate}))
+
+(defn -onCreate
+ [this savedInstanceState]
+ (.superOnCreate this savedInstanceState)
+ (on-ui
+ (set-content-view! this
+ (make-ui [:linear-layout {}
+ [:text-view {:text "Hello from Clojure!"}]]))))