├── Demo
├── .classpath
├── .project
├── .settings
│ └── org.eclipse.jdt.core.prefs
├── AndroidManifest.xml
├── bin
│ ├── AndroidManifest.xml
│ ├── Demo.apk
│ ├── classes.dex
│ ├── classes
│ │ └── com
│ │ │ └── example
│ │ │ └── demo
│ │ │ ├── BuildConfig.class
│ │ │ ├── LoginFragment$1.class
│ │ │ ├── LoginFragment.class
│ │ │ ├── MainActivity.class
│ │ │ ├── MainFragment$1$1.class
│ │ │ ├── MainFragment$1.class
│ │ │ ├── MainFragment.class
│ │ │ ├── R$attr.class
│ │ │ ├── R$dimen.class
│ │ │ ├── R$drawable.class
│ │ │ ├── R$id.class
│ │ │ ├── R$layout.class
│ │ │ ├── R$menu.class
│ │ │ ├── R$string.class
│ │ │ ├── R$style.class
│ │ │ ├── R.class
│ │ │ └── SignupFragment.class
│ ├── dexedLibs
│ │ ├── android-support-v4-48ed6b96efff843cc24bad93d74ab476.jar
│ │ ├── gson-2.2.4-e449ad82ce0c4df73bd6e3531c444a0f.jar
│ │ ├── gson-2.2.4-javadoc-992cf6eae773d8f6070b904a23aaccb7.jar
│ │ ├── gson-2.2.4-sources-e82d742f34c315829db1aa99a9c8b8e0.jar
│ │ ├── json-20131018-b51cc6a7f0e9fbba62a7a0921db97709.jar
│ │ └── userapp-android-ced4443df28254b4deea5f4d0652076e.jar
│ ├── jarlist.cache
│ ├── res
│ │ └── crunch
│ │ │ ├── drawable-hdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── drawable-mdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── drawable-xhdpi
│ │ │ └── ic_launcher.png
│ │ │ └── drawable-xxhdpi
│ │ │ └── ic_launcher.png
│ └── resources.ap_
├── gen
│ └── com
│ │ └── example
│ │ └── demo
│ │ ├── BuildConfig.java
│ │ └── R.java
├── ic_launcher-web.png
├── libs
│ ├── android-support-v4.jar
│ ├── gson-2.2.4-javadoc.jar
│ ├── gson-2.2.4-sources.jar
│ ├── gson-2.2.4.jar
│ ├── json-20131018.jar
│ └── userapp-android.jar
├── lint.xml
├── proguard-project.txt
├── project.properties
├── res
│ ├── drawable-hdpi
│ │ └── ic_launcher.png
│ ├── drawable-mdpi
│ │ └── ic_launcher.png
│ ├── drawable-xhdpi
│ │ └── ic_launcher.png
│ ├── drawable-xxhdpi
│ │ └── ic_launcher.png
│ ├── layout
│ │ ├── activity_main.xml
│ │ ├── fragment_login.xml
│ │ ├── fragment_main.xml
│ │ └── fragment_signup.xml
│ ├── menu
│ │ └── main.xml
│ ├── values-sw600dp
│ │ └── dimens.xml
│ ├── values-sw720dp-land
│ │ └── dimens.xml
│ ├── values-v11
│ │ └── styles.xml
│ ├── values-v14
│ │ └── styles.xml
│ └── values
│ │ ├── dimens.xml
│ │ ├── strings.xml
│ │ └── styles.xml
└── src
│ └── com
│ └── example
│ └── demo
│ ├── LoginFragment.java
│ ├── MainActivity.java
│ ├── MainFragment.java
│ └── SignupFragment.java
├── LICENSE
├── README.md
├── UserApp-Android
├── .classpath
├── .project
├── AndroidManifest.xml
├── bin
│ ├── AndroidManifest.xml
│ ├── R.txt
│ ├── classes
│ │ └── io
│ │ │ └── userapp
│ │ │ └── client
│ │ │ ├── JsonHelper.class
│ │ │ ├── UserAppClient$API.class
│ │ │ ├── UserAppClient$Array.class
│ │ │ ├── UserAppClient$ClientOptions.class
│ │ │ ├── UserAppClient$Parameter.class
│ │ │ ├── UserAppClient$Result.class
│ │ │ ├── UserAppClient$Struct.class
│ │ │ ├── UserAppClient.class
│ │ │ ├── android
│ │ │ ├── AuthFragment$1.class
│ │ │ ├── AuthFragment$2.class
│ │ │ ├── AuthFragment$3$1$1.class
│ │ │ ├── AuthFragment$3$1.class
│ │ │ ├── AuthFragment$3.class
│ │ │ ├── AuthFragment$4.class
│ │ │ ├── AuthFragment$5.class
│ │ │ ├── AuthFragment$6.class
│ │ │ ├── AuthFragment.class
│ │ │ ├── BuildConfig.class
│ │ │ ├── Feature.class
│ │ │ ├── Lock.class
│ │ │ ├── OAuthFragment$1.class
│ │ │ ├── OAuthFragment.class
│ │ │ ├── Permission.class
│ │ │ ├── Property.class
│ │ │ ├── R$attr.class
│ │ │ ├── R$dimen.class
│ │ │ ├── R$drawable.class
│ │ │ ├── R$string.class
│ │ │ ├── R$style.class
│ │ │ ├── R.class
│ │ │ ├── Subscription.class
│ │ │ ├── User.class
│ │ │ ├── UserApp$Session$1.class
│ │ │ ├── UserApp$Session$2.class
│ │ │ ├── UserApp$Session$3.class
│ │ │ ├── UserApp$Session$AsyncResult.class
│ │ │ ├── UserApp$Session$GetOAuthUrlTask.class
│ │ │ ├── UserApp$Session$LoadUserTask.class
│ │ │ ├── UserApp$Session$LoginTask.class
│ │ │ ├── UserApp$Session$LogoutTask.class
│ │ │ ├── UserApp$Session$OAuthUrlCallback.class
│ │ │ ├── UserApp$Session$SaveUserTask.class
│ │ │ ├── UserApp$Session$StatusCallback.class
│ │ │ ├── UserApp$Session$UserCallback.class
│ │ │ ├── UserApp$Session.class
│ │ │ ├── UserApp$UIHelper$1.class
│ │ │ ├── UserApp$UIHelper.class
│ │ │ ├── UserApp.class
│ │ │ └── WebViewRelativeLayout.class
│ │ │ ├── exceptions
│ │ │ ├── InvalidMethodException.class
│ │ │ ├── InvalidServiceException.class
│ │ │ ├── ServiceException.class
│ │ │ ├── TransportException.class
│ │ │ └── UserAppException.class
│ │ │ └── rest
│ │ │ ├── Restful.class
│ │ │ ├── RestfulContext.class
│ │ │ ├── UserCredentials.class
│ │ │ └── core
│ │ │ ├── HttpHeaderCollection.class
│ │ │ ├── HttpMethodType.class
│ │ │ ├── HttpProtocolVersionType.class
│ │ │ ├── HttpResponse.class
│ │ │ ├── HttpResponseHead.class
│ │ │ ├── HttpResponseStatusHead.class
│ │ │ └── HttpStatusCode.class
│ ├── jarlist.cache
│ └── userapp android.jar
├── gen
│ └── io
│ │ └── userapp
│ │ └── client
│ │ └── android
│ │ ├── BuildConfig.java
│ │ └── R.java
├── libs
│ ├── android-support-v4.jar
│ ├── gson-2.2.4-javadoc.jar
│ ├── gson-2.2.4-sources.jar
│ ├── gson-2.2.4.jar
│ └── json-20131018.jar
├── lint.xml
├── proguard-project.txt
├── project.properties
└── src
│ └── io
│ └── userapp
│ └── client
│ ├── JsonHelper.java
│ ├── UserAppClient.java
│ ├── android
│ ├── AuthFragment.java
│ ├── Feature.java
│ ├── Lock.java
│ ├── OAuthFragment.java
│ ├── Permission.java
│ ├── Property.java
│ ├── Subscription.java
│ ├── User.java
│ ├── UserApp.java
│ └── WebViewRelativeLayout.java
│ ├── exceptions
│ ├── InvalidMethodException.java
│ ├── InvalidServiceException.java
│ ├── ServiceException.java
│ ├── TransportException.java
│ └── UserAppException.java
│ └── rest
│ ├── Restful.java
│ ├── RestfulContext.java
│ ├── UserCredentials.java
│ └── core
│ ├── HttpHeaderCollection.java
│ ├── HttpMethodType.java
│ ├── HttpProtocolVersionType.java
│ ├── HttpResponse.java
│ ├── HttpResponseHead.java
│ ├── HttpResponseStatusHead.java
│ └── HttpStatusCode.java
└── userapp-android.jar
/Demo/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Demo/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | Demo
4 |
5 |
6 |
7 |
8 |
9 | com.android.ide.eclipse.adt.ResourceManagerBuilder
10 |
11 |
12 |
13 |
14 | com.android.ide.eclipse.adt.PreCompilerBuilder
15 |
16 |
17 |
18 |
19 | org.eclipse.jdt.core.javabuilder
20 |
21 |
22 |
23 |
24 | com.android.ide.eclipse.adt.ApkBuilder
25 |
26 |
27 |
28 |
29 |
30 | com.android.ide.eclipse.adt.AndroidNature
31 | org.eclipse.jdt.core.javanature
32 |
33 |
34 |
--------------------------------------------------------------------------------
/Demo/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
3 | org.eclipse.jdt.core.compiler.compliance=1.6
4 | org.eclipse.jdt.core.compiler.source=1.6
5 |
--------------------------------------------------------------------------------
/Demo/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
10 |
11 |
12 |
13 |
18 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/Demo/bin/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
10 |
11 |
12 |
13 |
18 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/Demo/bin/Demo.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/Demo/bin/Demo.apk
--------------------------------------------------------------------------------
/Demo/bin/classes.dex:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/Demo/bin/classes.dex
--------------------------------------------------------------------------------
/Demo/bin/classes/com/example/demo/BuildConfig.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/Demo/bin/classes/com/example/demo/BuildConfig.class
--------------------------------------------------------------------------------
/Demo/bin/classes/com/example/demo/LoginFragment$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/Demo/bin/classes/com/example/demo/LoginFragment$1.class
--------------------------------------------------------------------------------
/Demo/bin/classes/com/example/demo/LoginFragment.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/Demo/bin/classes/com/example/demo/LoginFragment.class
--------------------------------------------------------------------------------
/Demo/bin/classes/com/example/demo/MainActivity.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/Demo/bin/classes/com/example/demo/MainActivity.class
--------------------------------------------------------------------------------
/Demo/bin/classes/com/example/demo/MainFragment$1$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/Demo/bin/classes/com/example/demo/MainFragment$1$1.class
--------------------------------------------------------------------------------
/Demo/bin/classes/com/example/demo/MainFragment$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/Demo/bin/classes/com/example/demo/MainFragment$1.class
--------------------------------------------------------------------------------
/Demo/bin/classes/com/example/demo/MainFragment.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/Demo/bin/classes/com/example/demo/MainFragment.class
--------------------------------------------------------------------------------
/Demo/bin/classes/com/example/demo/R$attr.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/Demo/bin/classes/com/example/demo/R$attr.class
--------------------------------------------------------------------------------
/Demo/bin/classes/com/example/demo/R$dimen.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/Demo/bin/classes/com/example/demo/R$dimen.class
--------------------------------------------------------------------------------
/Demo/bin/classes/com/example/demo/R$drawable.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/Demo/bin/classes/com/example/demo/R$drawable.class
--------------------------------------------------------------------------------
/Demo/bin/classes/com/example/demo/R$id.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/Demo/bin/classes/com/example/demo/R$id.class
--------------------------------------------------------------------------------
/Demo/bin/classes/com/example/demo/R$layout.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/Demo/bin/classes/com/example/demo/R$layout.class
--------------------------------------------------------------------------------
/Demo/bin/classes/com/example/demo/R$menu.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/Demo/bin/classes/com/example/demo/R$menu.class
--------------------------------------------------------------------------------
/Demo/bin/classes/com/example/demo/R$string.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/Demo/bin/classes/com/example/demo/R$string.class
--------------------------------------------------------------------------------
/Demo/bin/classes/com/example/demo/R$style.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/Demo/bin/classes/com/example/demo/R$style.class
--------------------------------------------------------------------------------
/Demo/bin/classes/com/example/demo/R.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/Demo/bin/classes/com/example/demo/R.class
--------------------------------------------------------------------------------
/Demo/bin/classes/com/example/demo/SignupFragment.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/Demo/bin/classes/com/example/demo/SignupFragment.class
--------------------------------------------------------------------------------
/Demo/bin/dexedLibs/android-support-v4-48ed6b96efff843cc24bad93d74ab476.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/Demo/bin/dexedLibs/android-support-v4-48ed6b96efff843cc24bad93d74ab476.jar
--------------------------------------------------------------------------------
/Demo/bin/dexedLibs/gson-2.2.4-e449ad82ce0c4df73bd6e3531c444a0f.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/Demo/bin/dexedLibs/gson-2.2.4-e449ad82ce0c4df73bd6e3531c444a0f.jar
--------------------------------------------------------------------------------
/Demo/bin/dexedLibs/gson-2.2.4-javadoc-992cf6eae773d8f6070b904a23aaccb7.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/Demo/bin/dexedLibs/gson-2.2.4-javadoc-992cf6eae773d8f6070b904a23aaccb7.jar
--------------------------------------------------------------------------------
/Demo/bin/dexedLibs/gson-2.2.4-sources-e82d742f34c315829db1aa99a9c8b8e0.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/Demo/bin/dexedLibs/gson-2.2.4-sources-e82d742f34c315829db1aa99a9c8b8e0.jar
--------------------------------------------------------------------------------
/Demo/bin/dexedLibs/json-20131018-b51cc6a7f0e9fbba62a7a0921db97709.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/Demo/bin/dexedLibs/json-20131018-b51cc6a7f0e9fbba62a7a0921db97709.jar
--------------------------------------------------------------------------------
/Demo/bin/dexedLibs/userapp-android-ced4443df28254b4deea5f4d0652076e.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/Demo/bin/dexedLibs/userapp-android-ced4443df28254b4deea5f4d0652076e.jar
--------------------------------------------------------------------------------
/Demo/bin/jarlist.cache:
--------------------------------------------------------------------------------
1 | # cache for current jar dependency. DO NOT EDIT.
2 | # format is
3 | # Encoding is UTF-8
4 |
--------------------------------------------------------------------------------
/Demo/bin/res/crunch/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/Demo/bin/res/crunch/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Demo/bin/res/crunch/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/Demo/bin/res/crunch/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Demo/bin/res/crunch/drawable-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/Demo/bin/res/crunch/drawable-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Demo/bin/res/crunch/drawable-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/Demo/bin/res/crunch/drawable-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Demo/bin/resources.ap_:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/Demo/bin/resources.ap_
--------------------------------------------------------------------------------
/Demo/gen/com/example/demo/BuildConfig.java:
--------------------------------------------------------------------------------
1 | /** Automatically generated file. DO NOT MODIFY */
2 | package com.example.demo;
3 |
4 | public final class BuildConfig {
5 | public final static boolean DEBUG = true;
6 | }
--------------------------------------------------------------------------------
/Demo/gen/com/example/demo/R.java:
--------------------------------------------------------------------------------
1 | /* AUTO-GENERATED FILE. DO NOT MODIFY.
2 | *
3 | * This class was automatically generated by the
4 | * aapt tool from the resource data it found. It
5 | * should not be modified by hand.
6 | */
7 |
8 | package com.example.demo;
9 |
10 | public final class R {
11 | public static final class attr {
12 | }
13 | public static final class dimen {
14 | /** Default screen margins, per the Android Design guidelines.
15 |
16 | Customize dimensions originally defined in res/values/dimens.xml (such as
17 | screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here.
18 |
19 | */
20 | public static final int activity_horizontal_margin=0x7f040000;
21 | public static final int activity_vertical_margin=0x7f040001;
22 | }
23 | public static final class drawable {
24 | public static final int ic_launcher=0x7f020000;
25 | }
26 | public static final class id {
27 | public static final int action_logout=0x7f080013;
28 | public static final int action_settings=0x7f080012;
29 | public static final int email=0x7f080010;
30 | public static final int error_text=0x7f08000b;
31 | public static final int facebook_button=0x7f080009;
32 | public static final int login=0x7f080006;
33 | public static final int loginFragment=0x7f080000;
34 | public static final int login_button=0x7f080008;
35 | public static final int login_form=0x7f080005;
36 | public static final int login_status=0x7f080003;
37 | public static final int login_status_message=0x7f080004;
38 | public static final int mainFragment=0x7f080002;
39 | public static final int password=0x7f080007;
40 | public static final int show_signup=0x7f08000a;
41 | public static final int signupFragment=0x7f080001;
42 | public static final int signup_button=0x7f080011;
43 | public static final int signup_form=0x7f08000f;
44 | public static final int signup_status=0x7f08000d;
45 | public static final int signup_status_message=0x7f08000e;
46 | public static final int welcome_text=0x7f08000c;
47 | }
48 | public static final class layout {
49 | public static final int activity_main=0x7f030000;
50 | public static final int fragment_login=0x7f030001;
51 | public static final int fragment_main=0x7f030002;
52 | public static final int fragment_signup=0x7f030003;
53 | }
54 | public static final class menu {
55 | public static final int main=0x7f070000;
56 | }
57 | public static final class string {
58 | public static final int action_logout=0x7f050002;
59 | public static final int action_settings=0x7f050001;
60 | public static final int app_name=0x7f050000;
61 | public static final int email=0x7f05000a;
62 | public static final int error_field_required=0x7f050007;
63 | public static final int facebook_login=0x7f05000d;
64 | public static final int facebook_signup=0x7f05000e;
65 | public static final int hello_world=0x7f050003;
66 | public static final int login=0x7f050008;
67 | public static final int login_progress_signing_in=0x7f050004;
68 | public static final int password=0x7f05000c;
69 | public static final int signup=0x7f050009;
70 | public static final int signup_progress_signing_up=0x7f050005;
71 | public static final int title_activity_main_fragment=0x7f050006;
72 | public static final int username=0x7f05000b;
73 | }
74 | public static final class style {
75 | /**
76 | Base application theme, dependent on API level. This theme is replaced
77 | by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
78 |
79 |
80 | Theme customizations available in newer API levels can go in
81 | res/values-vXX/styles.xml, while customizations related to
82 | backward-compatibility can go here.
83 |
84 |
85 | Base application theme for API 11+. This theme completely replaces
86 | AppBaseTheme from res/values/styles.xml on API 11+ devices.
87 |
88 | API 11 theme customizations can go here.
89 |
90 | Base application theme for API 14+. This theme completely replaces
91 | AppBaseTheme from BOTH res/values/styles.xml and
92 | res/values-v11/styles.xml on API 14+ devices.
93 |
94 | API 14 theme customizations can go here.
95 | */
96 | public static final int AppBaseTheme=0x7f060000;
97 | /** Application theme.
98 | All customizations that are NOT specific to a particular API-level can go here.
99 | */
100 | public static final int AppTheme=0x7f060001;
101 | }
102 | }
103 |
--------------------------------------------------------------------------------
/Demo/ic_launcher-web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/Demo/ic_launcher-web.png
--------------------------------------------------------------------------------
/Demo/libs/android-support-v4.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/Demo/libs/android-support-v4.jar
--------------------------------------------------------------------------------
/Demo/libs/gson-2.2.4-javadoc.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/Demo/libs/gson-2.2.4-javadoc.jar
--------------------------------------------------------------------------------
/Demo/libs/gson-2.2.4-sources.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/Demo/libs/gson-2.2.4-sources.jar
--------------------------------------------------------------------------------
/Demo/libs/gson-2.2.4.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/Demo/libs/gson-2.2.4.jar
--------------------------------------------------------------------------------
/Demo/libs/json-20131018.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/Demo/libs/json-20131018.jar
--------------------------------------------------------------------------------
/Demo/libs/userapp-android.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/Demo/libs/userapp-android.jar
--------------------------------------------------------------------------------
/Demo/lint.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/Demo/proguard-project.txt:
--------------------------------------------------------------------------------
1 | # To enable ProGuard in your project, edit project.properties
2 | # to define the proguard.config property as described in that file.
3 | #
4 | # Add project specific ProGuard rules here.
5 | # By default, the flags in this file are appended to flags specified
6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt
7 | # You can edit the include path and order by changing the ProGuard
8 | # include property in project.properties.
9 | #
10 | # For more details, see
11 | # http://developer.android.com/guide/developing/tools/proguard.html
12 |
13 | # Add any project specific keep options here:
14 |
15 | # If your project uses WebView with JS, uncomment the following
16 | # and specify the fully qualified class name to the JavaScript interface
17 | # class:
18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
19 | # public *;
20 | #}
21 |
--------------------------------------------------------------------------------
/Demo/project.properties:
--------------------------------------------------------------------------------
1 | # This file is automatically generated by Android Tools.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must be checked in Version Control Systems.
5 | #
6 | # To customize properties used by the Ant build system edit
7 | # "ant.properties", and override values to adapt the script to your
8 | # project structure.
9 | #
10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
12 |
13 | # Project target.
14 | target=android-19
15 |
--------------------------------------------------------------------------------
/Demo/res/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/Demo/res/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Demo/res/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/Demo/res/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Demo/res/drawable-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/Demo/res/drawable-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Demo/res/drawable-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/Demo/res/drawable-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Demo/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
18 |
19 |
26 |
27 |
34 |
35 |
--------------------------------------------------------------------------------
/Demo/res/layout/fragment_login.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
17 |
18 |
23 |
24 |
32 |
33 |
34 |
35 |
39 |
40 |
45 |
46 |
54 |
55 |
63 |
64 |
72 |
73 |
81 |
82 |
90 |
91 |
97 |
98 |
99 |
100 |
101 |
--------------------------------------------------------------------------------
/Demo/res/layout/fragment_main.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
19 |
20 |
--------------------------------------------------------------------------------
/Demo/res/layout/fragment_signup.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
17 |
18 |
23 |
24 |
32 |
33 |
34 |
35 |
39 |
40 |
45 |
46 |
55 |
56 |
65 |
66 |
75 |
76 |
84 |
85 |
91 |
92 |
93 |
94 |
95 |
--------------------------------------------------------------------------------
/Demo/res/menu/main.xml:
--------------------------------------------------------------------------------
1 |
16 |
--------------------------------------------------------------------------------
/Demo/res/values-sw600dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Demo/res/values-sw720dp-land/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 | 128dp
8 |
9 |
10 |
--------------------------------------------------------------------------------
/Demo/res/values-v11/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Demo/res/values-v14/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/Demo/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 16dp
5 | 16dp
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Demo/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Demo
5 | Settings
6 | Log Out
7 | Welcome!
8 | Logging in…
9 | Signing up…
10 | Welcome!
11 | Field is required
12 | Log In
13 | Sign Up
14 | Email
15 | Username
16 | Password
17 | Log In with Facebook
18 | Sign Up with Facebook
19 |
20 |
21 |
--------------------------------------------------------------------------------
/Demo/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
14 |
15 |
16 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/Demo/src/com/example/demo/LoginFragment.java:
--------------------------------------------------------------------------------
1 | package com.example.demo;
2 |
3 | import android.os.Bundle;
4 | import android.support.v4.app.FragmentTransaction;
5 | import android.view.LayoutInflater;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 | import android.view.View.OnClickListener;
9 | import android.widget.Button;
10 | import android.widget.TextView;
11 | import io.userapp.client.android.AuthFragment;
12 |
13 | public class LoginFragment extends AuthFragment {
14 |
15 | @Override
16 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
17 | // Inflate the layout for this fragment
18 | View view = inflater.inflate(R.layout.fragment_login, container, false);
19 |
20 | // Setup the login form with bindings to UserApp
21 | super.setupLoginForm(view, R.id.login, R.id.password, R.id.login_button);
22 |
23 | // Attach the Facebook button
24 | super.setupSocialLogin(view, R.id.facebook_button, "facebook");
25 |
26 | // Attach the signup button link
27 | Button signupButton = (Button) view.findViewById(R.id.show_signup);
28 | signupButton.setOnClickListener(new OnClickListener() {
29 | @Override
30 | public void onClick(View v) {
31 | FragmentTransaction transaction = getFragmentManager().beginTransaction();
32 | transaction.hide(getFragmentManager().findFragmentById(R.id.loginFragment));
33 | transaction.show(getFragmentManager().findFragmentById(R.id.signupFragment));
34 | transaction.addToBackStack(null);
35 | transaction.commit();
36 | }
37 | });
38 |
39 | return view;
40 | }
41 |
42 | @Override
43 | public Boolean onLoginStart(String login, String password, Boolean isSocialLogin) {
44 | // Show loader when waiting for server
45 | getView().findViewById(R.id.login_form).setVisibility(View.GONE);
46 | getView().findViewById(R.id.login_status).setVisibility(View.VISIBLE);
47 |
48 | // Return true to complete the login
49 | return true;
50 | }
51 |
52 | @Override
53 | public void onLoginCompleted(Boolean authenticated, Exception exception) {
54 | // Hide the loader
55 | getView().findViewById(R.id.login_form).setVisibility(View.VISIBLE);
56 | getView().findViewById(R.id.login_status).setVisibility(View.GONE);
57 |
58 | if (exception != null) {
59 | // Show an error message
60 | ((TextView) getView().findViewById(R.id.error_text)).setText(exception.getMessage());
61 | } else {
62 | // Clear the message
63 | ((TextView) getView().findViewById(R.id.error_text)).setText("");
64 | }
65 | }
66 |
67 | }
68 |
--------------------------------------------------------------------------------
/Demo/src/com/example/demo/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.demo;
2 |
3 | import io.userapp.client.android.UserApp;
4 | import android.os.Bundle;
5 | import android.support.v4.app.FragmentActivity;
6 | import android.view.Menu;
7 | import android.view.MenuItem;
8 |
9 | public class MainActivity extends FragmentActivity {
10 | // Instances for session and its UI helper
11 | UserApp.Session session;
12 | UserApp.UIHelper uiHelper;
13 |
14 | @Override
15 | protected void onCreate(Bundle savedInstanceState) {
16 | super.onCreate(savedInstanceState);
17 | setContentView(R.layout.activity_main);
18 |
19 | // Initiate the session and create a new UI helper bound to it
20 | session = new UserApp.Session(this);
21 | uiHelper = session.createUIHelper(R.id.loginFragment, R.id.mainFragment, R.id.signupFragment);
22 | }
23 |
24 | @Override
25 | public boolean onCreateOptionsMenu(Menu menu) {
26 | getMenuInflater().inflate(R.menu.main, menu);
27 | return true;
28 | }
29 |
30 | @Override
31 | public boolean onOptionsItemSelected(MenuItem item) {
32 | // Handle presses on the action bar items
33 | switch (item.getItemId()) {
34 | // Logout action
35 | case R.id.action_logout:
36 | session.logout();
37 | return true;
38 | default:
39 | return super.onOptionsItemSelected(item);
40 | }
41 | }
42 |
43 | @Override
44 | public void onResume() {
45 | super.onResume();
46 | uiHelper.onResume();
47 | }
48 |
49 | @Override
50 | public void onPause() {
51 | super.onPause();
52 | uiHelper.onPause();
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/Demo/src/com/example/demo/MainFragment.java:
--------------------------------------------------------------------------------
1 | package com.example.demo;
2 |
3 | import io.userapp.client.android.User;
4 | import io.userapp.client.android.UserApp;
5 | import android.support.v4.app.Fragment;
6 | import android.os.Bundle;
7 | import android.view.LayoutInflater;
8 | import android.view.View;
9 | import android.view.ViewGroup;
10 | import android.widget.TextView;
11 |
12 | public class MainFragment extends Fragment {
13 | UserApp.Session session;
14 |
15 | @Override
16 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
17 | // Inflate the layout for this fragment
18 | final View view = inflater.inflate(R.layout.fragment_main, container, false);
19 |
20 | // Listen for the login event so we could update the UI
21 | session = new UserApp.Session(this.getActivity(), new UserApp.Session.StatusCallback() {
22 | @Override
23 | public void call(Boolean authenticated, Exception exception) {
24 | if (authenticated) {
25 | if (session.hasPermission("admin")) {
26 | ((TextView) view.findViewById(R.id.welcome_text)).setText("Welcome Admin, " + session.user.first_name);
27 | } else {
28 | ((TextView) view.findViewById(R.id.welcome_text)).setText("Welcome " + session.user.first_name);
29 | }
30 |
31 | // Change name and save
32 | session.user.first_name = "John";
33 | session.saveUser(session.user, new UserApp.Session.UserCallback() {
34 | @Override
35 | public void call(User user, Exception exception) {
36 | if (exception == null) {
37 | System.out.println("USER SAVED");
38 | } else {
39 | System.out.println("ERROR SAVING USER: " + exception.getMessage());
40 | }
41 | }
42 | });
43 | }
44 | }
45 | });
46 |
47 | return view;
48 | }
49 |
50 | @Override
51 | public void onResume() {
52 | super.onResume();
53 | session.onResume();
54 | }
55 |
56 | @Override
57 | public void onPause() {
58 | super.onPause();
59 | session.onPause();
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/Demo/src/com/example/demo/SignupFragment.java:
--------------------------------------------------------------------------------
1 | package com.example.demo;
2 |
3 | import android.os.Bundle;
4 | import android.view.LayoutInflater;
5 | import android.view.View;
6 | import android.view.ViewGroup;
7 | import android.widget.TextView;
8 | import io.userapp.client.android.AuthFragment;
9 | import io.userapp.client.android.Property;
10 | import io.userapp.client.android.Subscription;
11 | import io.userapp.client.android.User;
12 |
13 | public class SignupFragment extends AuthFragment {
14 |
15 | @Override
16 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
17 | // Inflate the layout for this fragment
18 | View view = inflater.inflate(R.layout.fragment_signup, container, false);
19 |
20 | // Setup the login form with bindings to UserApp
21 | super.setupSignupForm(view, R.id.signup_button, R.id.email, R.id.login, R.id.password);
22 |
23 | return view;
24 | }
25 |
26 | @Override
27 | public User onSignupStart(User user) {
28 | // Show loader when waiting for server
29 | getView().findViewById(R.id.signup_form).setVisibility(View.GONE);
30 | getView().findViewById(R.id.signup_status).setVisibility(View.VISIBLE);
31 |
32 | // Set subscription
33 | user.subscription = new Subscription();
34 | user.subscription.price_list_id = "IEiVxVpxSxy1xE8oIzsSeA";
35 | user.subscription.plan_id = "CBPJdFORQ-qsefa7LxrX-A";
36 |
37 | // Set age property
38 | user.properties.put("age", new Property(42, true));
39 |
40 | // Return the user to complete the signup
41 | return user;
42 | }
43 |
44 | @Override
45 | public void onSignupCompleted(User user, Boolean verified, Exception exception) {
46 | if (exception != null) {
47 | // Hide the loader
48 | getView().findViewById(R.id.signup_form).setVisibility(View.VISIBLE);
49 | getView().findViewById(R.id.signup_status).setVisibility(View.GONE);
50 |
51 | // Show an error message
52 | ((TextView) getView().findViewById(R.id.error_text)).setText(exception.getMessage());
53 | } else {
54 | // Clear the message
55 | ((TextView) getView().findViewById(R.id.error_text)).setText("");
56 |
57 | // Need to verify the email address?
58 | if (verified == false) {
59 | // Hide the loader
60 | getView().findViewById(R.id.signup_form).setVisibility(View.VISIBLE);
61 | getView().findViewById(R.id.signup_status).setVisibility(View.GONE);
62 |
63 | ((TextView) getView().findViewById(R.id.error_text)).setText("An email has been sent to your inbox.");
64 | } else {
65 | // Call the superclass to log in the signed up user
66 | super.onSignupCompleted(user, verified, exception);
67 | }
68 | }
69 | }
70 |
71 | }
72 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2014 UserApp
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | this software and associated documentation files (the "Software"), to deal in
7 | the Software without restriction, including without limitation the rights to
8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | the Software, and to permit persons to whom the Software is furnished to do so,
10 | subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | UserApp SDK for Android
2 | =======================
3 |
4 | This SDK adds user authentication and management to your Android app with [UserApp](https://www.userapp.io). Then easily integrate your users with MailChimp, SendGrid, Mixpanel, etc. with just one click.
5 |
6 | **Android Min SDK Version:** 11
7 | **Android Target SDK Version:** 19
8 |
9 | * [Getting Started](#getting-started)
10 | * [Intro](#intro)
11 | * [Log In](#log-in)
12 | * [Log Out](#log-out)
13 | * [Social Login (OAuth)](#social-login)
14 | * [Sign Up](#sign-up)
15 | * [Back-end](#back-end)
16 | * [State Changes](#state-changes)
17 | * [Reload User Profile](#reload-user-profile)
18 | * [Save User Profile](#save-user-profile)
19 | * [Check Permissions](#check-permissions)
20 | * [Personalization](#personalization)
21 | * [Multiple Activities](#multiple-activities)
22 | * [Example](#example)
23 | * [Help](#help)
24 | * [License](#license)
25 |
26 | ## Getting Started
27 |
28 | **Download the SDK**
29 |
30 | Download and include the [userapp-android.jar](https://github.com/userapp-io/userapp-android/raw/master/userapp-android.jar) file into your project.
31 |
32 | **Include dependencies**
33 |
34 | * [org.json](http://mvnrepository.com/artifact/org.json/json)
35 |
36 | * [google-gson](https://code.google.com/p/google-gson/)
37 |
38 | **Configure it**
39 |
40 | Open your `AndroidManifest.xml` and add your UserApp App Id like this:
41 |
42 | ```xml
43 |
44 |
45 | ...
46 |
47 | ```
48 |
49 | [How do I find my App Id?](https://help.userapp.io/customer/portal/articles/1322336-how-do-i-find-my-app-id-)
50 |
51 | **Add permissions**
52 |
53 | Request Internet access in your manifest file, for example:
54 |
55 | ```xml
56 |
57 |
58 | ...
59 |
60 | ```
61 |
62 | ## Intro
63 |
64 | This SDK integrates your Android app with UserApp by adding logic for authentication such as login and signup. It also keeps track of sessions, the logged in user, etc.
65 |
66 | The SDK is focused on the use of fragments to show a login or signup form to the user when he/she is not logged in. And will automatically show it based on the session state. It also takes care of setting up persistent sessions so the user only would have to login once.
67 |
68 | The authentication fragments should be placed inside your main activity.
69 |
70 | There are 3 main parts of this SDK that you should know about:
71 |
72 | 1. **UserApp.Session**
73 |
74 | This class takes care of everything related to the session; login, logout, events, etc. This should be created as an instance variable and have a life cycle of `onPause()` and `onResume()`.
75 |
76 | 2. **UserApp.UIHelper**
77 |
78 | This class helps you to show/hide the right fragment. It connects to your session and listens for state changes and show the login fragment when the user needs to log in. It can be created using the `session.createUIHelper()` which will automatically bind it to your session.
79 |
80 | 3. **AuthFragment**
81 |
82 | To facilitate the creation of login and signup forms, this class can be extended to take care of the most of your bindings to UserApp. It has a few functions that can be overridden to take more control over it.
83 |
84 | Read this documentation to learn how these 3 components can be used to easily add user authentication to your Android app. Take a look at the [demo app](https://github.com/userapp-io/userapp-android/tree/master/Demo) if there's any doubts on how to use the SDK.
85 |
86 | ## Log In
87 |
88 | #### Create a fragment
89 |
90 | Start with creating a new layout called `fragment_login`. The layout should include text fields for username and password, a login button, a progress loader, and a text for displaying errors.
91 |
92 | Then create a new fragment called `LoginFragment` that extends
93 | `AuthFragment` (*io.userapp.client.android.AuthFragment*) and inflates the `fragment_login` layout.
94 |
95 | Now you need to bind the form to UserApp by calling the method `setupLoginForm()` on the superclass. Place this
96 | code in the `onCreateView` function:
97 |
98 | ```java
99 | super.setupLoginForm(view, R.id.login, R.id.password, R.id.login_button);
100 | ```
101 |
102 | The first parameter is the view of the fragment, the second is the username field ID, then the password field ID, and last the ID of the login button.
103 |
104 | Optionally, override the methods `onLoginStart` and `onLoginCompleted` to show error messages and a progress loader.
105 |
106 | **The code should now look something like this:**
107 |
108 | ```java
109 | public class LoginFragment extends AuthFragment {
110 | @Override
111 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
112 | // Inflate the layout for this fragment
113 | View view = inflater.inflate(R.layout.fragment_signup, container, false);
114 |
115 | // Setup the login form with bindings to UserApp
116 | super.setupLoginForm(view, R.id.login, R.id.password, R.id.login_button);
117 |
118 | return view;
119 | }
120 |
121 | @Override
122 | public Boolean onLoginStart(String login, String password, Boolean isSocialLogin) {
123 | // Show loader when waiting for server
124 | getView().findViewById(R.id.login_form).setVisibility(View.GONE);
125 | getView().findViewById(R.id.login_status).setVisibility(View.VISIBLE);
126 |
127 | // Return true to complete the login
128 | return true;
129 | }
130 |
131 | @Override
132 | public void onLoginCompleted(Boolean authenticated, Exception exception) {
133 | // Hide the loader
134 | getView().findViewById(R.id.login_form).setVisibility(View.VISIBLE);
135 | getView().findViewById(R.id.login_status).setVisibility(View.GONE);
136 |
137 | if (exception != null) {
138 | // Show an error message
139 | ((TextView) getView().findViewById(R.id.error_text)).setText(exception.getMessage());
140 | } else {
141 | // Clear the message
142 | ((TextView) getView().findViewById(R.id.error_text)).setText("");
143 | }
144 | }
145 | }
146 | ```
147 |
148 | #### Add the fragment to your main activity
149 |
150 | The login fragment is ready, add it to your main activity's layout:
151 |
152 | ```xml
153 |
154 |
161 |
162 | ...
163 |
164 | ```
165 |
166 | Also create a main fragment that will be shown after a successful login.
167 |
168 | #### Attach the login screen to the session
169 |
170 | And last we will add the code to show/hide the right fragments; the login fragment when the user needs to log in,
171 | and the main fragment when the user has logged in. In your `MainActivity` class, begin with creating instances of `UserApp.Session` and `UserApp.UIHelper`.
172 |
173 | These should be placed as instance variables in the class, and you should call `session.onResume()` and `session.onPause()` in the activity's or fragment's life cycle events. In this case you will be using the UIHelper and then you will call these methods on that object instead (see below).
174 |
175 | Then call the method `session.createUIHelper()` in `onCreate`, which takes the login fragment ID as the first argument, the main fragment ID as the second, and the rest should be one argument for each additional fragments you have in your activity. In this case we will only have two arguments since we don't have any more fragments. The return will be a new instance of a `UIHelper`.
176 |
177 | Also make sure to call `uiHelper.onResume()` and `uiHelper.onPause()` in the events as the example below.
178 |
179 | ```java
180 | public class MainActivity extends FragmentActivity {
181 | // Instances for session and its UI helper
182 | UserApp.Session session;
183 | UserApp.UIHelper uiHelper;
184 |
185 | @Override
186 | protected void onCreate(Bundle savedInstanceState) {
187 | super.onCreate(savedInstanceState);
188 | setContentView(R.layout.activity_main);
189 |
190 | // Initiate the session and create a new UI helper bound to it
191 | session = new UserApp.Session(this);
192 | uiHelper = session.createUIHelper(R.id.loginFragment, R.id.mainFragment);
193 | }
194 |
195 | @Override
196 | public void onResume() {
197 | super.onResume();
198 | uiHelper.onResume();
199 | }
200 |
201 | @Override
202 | public void onPause() {
203 | super.onPause();
204 | uiHelper.onPause();
205 | }
206 | }
207 | ```
208 |
209 | ## Log Out
210 |
211 | When you've got login to work, you probably want to have the option to log out. All you have to do is to call the method `session.logout()`. Here's an example of a logout menu in the `MainActivity` class:
212 |
213 | ```java
214 | public class MainActivity extends FragmentActivity {
215 | UserApp.Session session;
216 | ...
217 |
218 | @Override
219 | public boolean onOptionsItemSelected(MenuItem item) {
220 | // Handle presses on the action bar items
221 | switch (item.getItemId()) {
222 | // Logout action
223 | case R.id.action_logout:
224 | session.logout();
225 | return true;
226 | default:
227 | return super.onOptionsItemSelected(item);
228 | }
229 | }
230 |
231 | ...
232 | }
233 | ```
234 |
235 | This will automatically end the session and show the login fragment. If you have multiple activities you will need to show the main activity after you called `session.logout()`.
236 |
237 | ## Social Login
238 |
239 | If you rather want your users logging in with their social account (or both), it's easy to add login with Facebook, etc. using the SDK.
240 |
241 | Start by adding a new button to your login fragment layout:
242 |
243 | ```xml
244 |
245 | ...
246 |
247 |
255 |
256 | ...
257 |
258 | ```
259 |
260 | Then go to your `LoginFragment` class and call `super.setupSocialLogin()` from `onCreateView`. The first argument is the view, the second is the button ID you want to attach, and the third is the Provider Id of the provider your want to attach, e.g. `"facebook"`.
261 |
262 | ```java
263 | @Override
264 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
265 | // Inflate the layout for this fragment
266 | View view = inflater.inflate(R.layout.fragment_login, container, false);
267 |
268 | ...
269 |
270 | // Attach the Facebook button
271 | super.setupSocialLogin(view, R.id.facebook_button, "facebook");
272 |
273 | return view;
274 | }
275 | ```
276 |
277 | [All supported providers...](https://app.userapp.io/#/docs/concepts/#social-login)
278 |
279 | **Note:** If you have whitelisted redirect URI's you must include `userapp-oauth:///`.
280 |
281 | ## Sign Up
282 |
283 | Great, login is done! But users may still want to sign up the regular way, without using their social network accounts. This is easily fixed with a new fragment, just as with the login fragment.
284 |
285 | #### Create a fragment
286 |
287 | Start with creating a new layout called `fragment_signup`. Add 3 text boxes; one for username, one for name, one for email, and one for password. Use `android:tag` to specify which field it should be mapped to, e.g. `android:tag="password"`. Also create a button and a progress loader.
288 |
289 | Create a new fragment called `SignupFragment` that extends
290 | `AuthFragment` (*io.userapp.client.android.AuthFragment*) and inflates the `fragment_signup` layout.
291 |
292 | Now you need to bind the form to UserApp by calling the method `setupSignupForm()` on the superclass:
293 |
294 | ```java
295 | super.setupSignupForm(view, R.id.signup_button, R.id.email, R.id.login, R.id.password);
296 | ```
297 |
298 | The first parameter is the view of the fragment, the second is the signup button field ID, then the IDs of all the input fields.
299 |
300 | Optionally, override the methods `onSignupStart` and `onSignupCompleted` to show error messages and a progress loader. `onSignupStart` can also be used to fill the user profile with additional information before submitting.
301 |
302 | **The code should now look something like this:**
303 |
304 | ```java
305 | public class SignupFragment extends AuthFragment {
306 |
307 | @Override
308 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
309 | // Inflate the layout for this fragment
310 | View view = inflater.inflate(R.layout.fragment_signup, container, false);
311 |
312 | // Setup the login form with bindings to UserApp
313 | super.setupSignupForm(view, R.id.signup_button, R.id.email, R.id.login, R.id.password);
314 |
315 | return view;
316 | }
317 |
318 | @Override
319 | public User onSignupStart(User user) {
320 | // Show loader when waiting for server
321 | getView().findViewById(R.id.signup_form).setVisibility(View.GONE);
322 | getView().findViewById(R.id.signup_status).setVisibility(View.VISIBLE);
323 |
324 | // Set subscription
325 | user.subscription = new Subscription();
326 | user.subscription.price_list_id = "IEiVxVpxSxy1xE8oIzsSeA";
327 | user.subscription.plan_id = "CBPJdFORQ-qsefa7LxrX-A";
328 |
329 | // Set age property
330 | user.properties.put("age", new Property(42, true));
331 |
332 | // Return the user to complete the signup
333 | return user;
334 | }
335 |
336 | @Override
337 | public void onSignupCompleted(User user, Boolean verified, Exception exception) {
338 | if (exception != null) {
339 | // Hide the loader
340 | getView().findViewById(R.id.signup_form).setVisibility(View.VISIBLE);
341 | getView().findViewById(R.id.signup_status).setVisibility(View.GONE);
342 |
343 | // Show an error message
344 | ((TextView) getView().findViewById(R.id.error_text)).setText(exception.getMessage());
345 | } else {
346 | // Clear the error message
347 | ((TextView) getView().findViewById(R.id.error_text)).setText("");
348 |
349 | // Need to verify the email address?
350 | if (verified == false) {
351 | // Hide the loader
352 | getView().findViewById(R.id.signup_form).setVisibility(View.VISIBLE);
353 | getView().findViewById(R.id.signup_status).setVisibility(View.GONE);
354 |
355 | ((TextView) getView().findViewById(R.id.error_text)).setText("An email has been sent to your inbox.");
356 | } else {
357 | // Call the superclass to log in the signed up user
358 | super.onSignupCompleted(user, verified, exception);
359 | }
360 | }
361 | }
362 |
363 | }
364 | ```
365 |
366 | #### Add the fragment to your main activity
367 |
368 | The signup fragment is ready, add it to your main activity's layout:
369 |
370 | ```xml
371 |
372 |
379 |
380 | ...
381 |
382 | ```
383 |
384 | #### Make sure it gets hidden after signup/login
385 |
386 | Now go to your main activity and add it to the `createUIHelper` arguments (this will hide it when the login or main fragment is shown):
387 |
388 | ```java
389 | @Override
390 | protected void onCreate(Bundle savedInstanceState) {
391 | super.onCreate(savedInstanceState);
392 | setContentView(R.layout.activity_main);
393 |
394 | // Initiate the session and create a new UI helper bound to it
395 | session = new UserApp.Session(this);
396 | uiHelper = session.createUIHelper(R.id.loginFragment, R.id.mainFragment, R.id.signupFragment);
397 | }
398 | ```
399 |
400 | You would need to add a link from the login fragment so your users would be able to access your signup screen.
401 | See the demo app for an example on how to do that.
402 |
403 | ## Back-end
404 |
405 | To connect your Android app to a back-end API, use `session.token` to get the session token and send that along with all HTTP requests. And then on the back-end, get that token and use UserApp's [token.heartbeat()](https://app.userapp.io/#/docs/token/#heartbeat) or [user.get()](https://app.userapp.io/#/docs/user/#get) to verify that the user is authenticated. The result should then be cached to reduce round-trips to UserApp.
406 |
407 | ## State Changes
408 |
409 | Sometimes it would be good to know when a user logs in or logs out. One use-case would be in the main fragment to update the UI with the user's name.
410 |
411 | ```java
412 | session = new UserApp.Session(this.getActivity(), new UserApp.Session.StatusCallback() {
413 | @Override
414 | public void call(Boolean authenticated, Exception exception) {
415 | if (authenticated) {
416 | ((TextView) view.findViewById(R.id.welcome_text)).setText("Welcome " + session.user.first_name);
417 | }
418 | }
419 | });
420 | ```
421 |
422 | You can also use `session.addCallback()` to add more callbacks.
423 |
424 | This will also be called when the app starts and the user has already logged in before.
425 |
426 | **Note:** Always call `session.onPause()` and `session.onResume()` in the fragment's or activity's life cycle events.
427 |
428 | ## Reload User Profile
429 |
430 | The user profile is cached locally at login, but you can easily reload it by calling:
431 |
432 | ```java
433 | session.reloadUser(new UserApp.Session.UserCallback() {
434 | @Override
435 | public void call(User user, Exception exception) {
436 | if (exception == null) {
437 | ((TextView) view.findViewById(R.id.welcome_text)).setText("Welcome " + user.first_name);
438 | } else {
439 | System.out.println("ERROR LOADING USER: " + exception.getMessage());
440 | }
441 | }
442 | });
443 | ```
444 |
445 | You can also listen for profile update events with a callback:
446 |
447 | ```java
448 | session.addUserCallback(new UserApp.Session.UserCallback() {
449 | @Override
450 | public void call(User user, Exception exception) {
451 | if (exception == null) {
452 | ...
453 | } else {
454 | ...
455 | }
456 | }
457 | });
458 | ```
459 |
460 | ## Save User Profile
461 |
462 | #### Save the current user
463 |
464 | If you want to change and save the user's profile, make the changes in the user object and then call `session.save()` to save it, like this:
465 |
466 | ```java
467 | // Save user changes
468 | session.user.first_name = "John";
469 | session.user.properties.get("age").value = 34;
470 | session.user.properties.get("age").override = true;
471 |
472 | session.saveUser(session.user, new UserApp.Session.UserCallback() {
473 | @Override
474 | public void call(User user, Exception exception) {
475 | if (exception == null) {
476 | System.out.println("USER SAVED");
477 | } else {
478 | System.out.println("ERROR SAVING USER: " + exception.getMessage());
479 | }
480 | }
481 | });
482 | ```
483 |
484 | #### Save a new user
485 |
486 | If you want to save a new user (i.e. "sign up"), just create a new `User` object and leave `user_id` empty and then save it.
487 |
488 | #### Callback events
489 |
490 | When you save a user, all the user callbacks will be called (see [Reload User Profile](#reload-user-profile)).
491 |
492 | ## Check Permissions
493 |
494 | To check if a logged in user has a specific set of permissions, use this code:
495 |
496 | ```java
497 | if (session.hasPermission("admin")) {
498 | // Is admin
499 | } else {
500 | // Is not admin
501 | }
502 | ```
503 |
504 | You can also check for features using `session.hasFeature()`. Use a space delimited string to insert multiple permissions or features.
505 |
506 | **Note:** These checks should be wrapped in a state callback to make sure that the user is logged in and loaded.
507 |
508 | ## Personalization
509 |
510 | When a user has logged in you probably want to personalize their experience. Use the session object to get the logged in user's profile.
511 |
512 | ```java
513 | User user = session.user;
514 | ```
515 |
516 | ## Multiple Activities
517 |
518 | If you have multiple activities in your project, you would need to listen for session state changes in all of them and show the main activity if the user has logged out. It could also be a good idea to set the main activity to only have a single instance.
519 |
520 | ## Example
521 |
522 | See [Demo/](https://github.com/userapp-io/userapp-android/tree/master/Demo) for a demo app with login, social login with Facebook, signup, etc.
523 |
524 | ## Help
525 |
526 | Contact us via email at support@userapp.io or visit our [support center](https://help.userapp.io). You can also see the [UserApp documentation](https://app.userapp.io/#/docs/) for more information.
527 |
528 | ## License
529 |
530 | MIT, see [LICENSE](https://github.com/userapp-io/userapp-android/blob/master/LICENSE).
531 |
--------------------------------------------------------------------------------
/UserApp-Android/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/UserApp-Android/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | UserApp Android
4 |
5 |
6 |
7 |
8 |
9 | com.android.ide.eclipse.adt.ResourceManagerBuilder
10 |
11 |
12 |
13 |
14 | com.android.ide.eclipse.adt.PreCompilerBuilder
15 |
16 |
17 |
18 |
19 | org.eclipse.jdt.core.javabuilder
20 |
21 |
22 |
23 |
24 | com.android.ide.eclipse.adt.ApkBuilder
25 |
26 |
27 |
28 |
29 |
30 | com.android.ide.eclipse.adt.AndroidNature
31 | org.eclipse.jdt.core.javanature
32 |
33 |
34 |
--------------------------------------------------------------------------------
/UserApp-Android/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/UserApp-Android/bin/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/UserApp-Android/bin/R.txt:
--------------------------------------------------------------------------------
1 | int dimen activity_horizontal_margin 0x7f030000
2 | int drawable ic_launcher 0x7f020000
3 | int string userapp_email 0x7f040002
4 | int string userapp_facebook_login 0x7f040005
5 | int string userapp_facebook_signup 0x7f040006
6 | int string userapp_login 0x7f040000
7 | int string userapp_password 0x7f040004
8 | int string userapp_signup 0x7f040001
9 | int string userapp_username 0x7f040003
10 | int style AppBaseTheme 0x7f050000
11 |
--------------------------------------------------------------------------------
/UserApp-Android/bin/classes/io/userapp/client/JsonHelper.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/bin/classes/io/userapp/client/JsonHelper.class
--------------------------------------------------------------------------------
/UserApp-Android/bin/classes/io/userapp/client/UserAppClient$API.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/bin/classes/io/userapp/client/UserAppClient$API.class
--------------------------------------------------------------------------------
/UserApp-Android/bin/classes/io/userapp/client/UserAppClient$Array.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/bin/classes/io/userapp/client/UserAppClient$Array.class
--------------------------------------------------------------------------------
/UserApp-Android/bin/classes/io/userapp/client/UserAppClient$ClientOptions.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/bin/classes/io/userapp/client/UserAppClient$ClientOptions.class
--------------------------------------------------------------------------------
/UserApp-Android/bin/classes/io/userapp/client/UserAppClient$Parameter.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/bin/classes/io/userapp/client/UserAppClient$Parameter.class
--------------------------------------------------------------------------------
/UserApp-Android/bin/classes/io/userapp/client/UserAppClient$Result.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/bin/classes/io/userapp/client/UserAppClient$Result.class
--------------------------------------------------------------------------------
/UserApp-Android/bin/classes/io/userapp/client/UserAppClient$Struct.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/bin/classes/io/userapp/client/UserAppClient$Struct.class
--------------------------------------------------------------------------------
/UserApp-Android/bin/classes/io/userapp/client/UserAppClient.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/bin/classes/io/userapp/client/UserAppClient.class
--------------------------------------------------------------------------------
/UserApp-Android/bin/classes/io/userapp/client/android/AuthFragment$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/bin/classes/io/userapp/client/android/AuthFragment$1.class
--------------------------------------------------------------------------------
/UserApp-Android/bin/classes/io/userapp/client/android/AuthFragment$2.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/bin/classes/io/userapp/client/android/AuthFragment$2.class
--------------------------------------------------------------------------------
/UserApp-Android/bin/classes/io/userapp/client/android/AuthFragment$3$1$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/bin/classes/io/userapp/client/android/AuthFragment$3$1$1.class
--------------------------------------------------------------------------------
/UserApp-Android/bin/classes/io/userapp/client/android/AuthFragment$3$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/bin/classes/io/userapp/client/android/AuthFragment$3$1.class
--------------------------------------------------------------------------------
/UserApp-Android/bin/classes/io/userapp/client/android/AuthFragment$3.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/bin/classes/io/userapp/client/android/AuthFragment$3.class
--------------------------------------------------------------------------------
/UserApp-Android/bin/classes/io/userapp/client/android/AuthFragment$4.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/bin/classes/io/userapp/client/android/AuthFragment$4.class
--------------------------------------------------------------------------------
/UserApp-Android/bin/classes/io/userapp/client/android/AuthFragment$5.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/bin/classes/io/userapp/client/android/AuthFragment$5.class
--------------------------------------------------------------------------------
/UserApp-Android/bin/classes/io/userapp/client/android/AuthFragment$6.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/bin/classes/io/userapp/client/android/AuthFragment$6.class
--------------------------------------------------------------------------------
/UserApp-Android/bin/classes/io/userapp/client/android/AuthFragment.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/bin/classes/io/userapp/client/android/AuthFragment.class
--------------------------------------------------------------------------------
/UserApp-Android/bin/classes/io/userapp/client/android/BuildConfig.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/bin/classes/io/userapp/client/android/BuildConfig.class
--------------------------------------------------------------------------------
/UserApp-Android/bin/classes/io/userapp/client/android/Feature.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/bin/classes/io/userapp/client/android/Feature.class
--------------------------------------------------------------------------------
/UserApp-Android/bin/classes/io/userapp/client/android/Lock.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/bin/classes/io/userapp/client/android/Lock.class
--------------------------------------------------------------------------------
/UserApp-Android/bin/classes/io/userapp/client/android/OAuthFragment$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/bin/classes/io/userapp/client/android/OAuthFragment$1.class
--------------------------------------------------------------------------------
/UserApp-Android/bin/classes/io/userapp/client/android/OAuthFragment.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/bin/classes/io/userapp/client/android/OAuthFragment.class
--------------------------------------------------------------------------------
/UserApp-Android/bin/classes/io/userapp/client/android/Permission.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/bin/classes/io/userapp/client/android/Permission.class
--------------------------------------------------------------------------------
/UserApp-Android/bin/classes/io/userapp/client/android/Property.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/bin/classes/io/userapp/client/android/Property.class
--------------------------------------------------------------------------------
/UserApp-Android/bin/classes/io/userapp/client/android/R$attr.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/bin/classes/io/userapp/client/android/R$attr.class
--------------------------------------------------------------------------------
/UserApp-Android/bin/classes/io/userapp/client/android/R$dimen.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/bin/classes/io/userapp/client/android/R$dimen.class
--------------------------------------------------------------------------------
/UserApp-Android/bin/classes/io/userapp/client/android/R$drawable.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/bin/classes/io/userapp/client/android/R$drawable.class
--------------------------------------------------------------------------------
/UserApp-Android/bin/classes/io/userapp/client/android/R$string.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/bin/classes/io/userapp/client/android/R$string.class
--------------------------------------------------------------------------------
/UserApp-Android/bin/classes/io/userapp/client/android/R$style.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/bin/classes/io/userapp/client/android/R$style.class
--------------------------------------------------------------------------------
/UserApp-Android/bin/classes/io/userapp/client/android/R.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/bin/classes/io/userapp/client/android/R.class
--------------------------------------------------------------------------------
/UserApp-Android/bin/classes/io/userapp/client/android/Subscription.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/bin/classes/io/userapp/client/android/Subscription.class
--------------------------------------------------------------------------------
/UserApp-Android/bin/classes/io/userapp/client/android/User.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/bin/classes/io/userapp/client/android/User.class
--------------------------------------------------------------------------------
/UserApp-Android/bin/classes/io/userapp/client/android/UserApp$Session$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/bin/classes/io/userapp/client/android/UserApp$Session$1.class
--------------------------------------------------------------------------------
/UserApp-Android/bin/classes/io/userapp/client/android/UserApp$Session$2.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/bin/classes/io/userapp/client/android/UserApp$Session$2.class
--------------------------------------------------------------------------------
/UserApp-Android/bin/classes/io/userapp/client/android/UserApp$Session$3.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/bin/classes/io/userapp/client/android/UserApp$Session$3.class
--------------------------------------------------------------------------------
/UserApp-Android/bin/classes/io/userapp/client/android/UserApp$Session$AsyncResult.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/bin/classes/io/userapp/client/android/UserApp$Session$AsyncResult.class
--------------------------------------------------------------------------------
/UserApp-Android/bin/classes/io/userapp/client/android/UserApp$Session$GetOAuthUrlTask.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/bin/classes/io/userapp/client/android/UserApp$Session$GetOAuthUrlTask.class
--------------------------------------------------------------------------------
/UserApp-Android/bin/classes/io/userapp/client/android/UserApp$Session$LoadUserTask.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/bin/classes/io/userapp/client/android/UserApp$Session$LoadUserTask.class
--------------------------------------------------------------------------------
/UserApp-Android/bin/classes/io/userapp/client/android/UserApp$Session$LoginTask.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/bin/classes/io/userapp/client/android/UserApp$Session$LoginTask.class
--------------------------------------------------------------------------------
/UserApp-Android/bin/classes/io/userapp/client/android/UserApp$Session$LogoutTask.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/bin/classes/io/userapp/client/android/UserApp$Session$LogoutTask.class
--------------------------------------------------------------------------------
/UserApp-Android/bin/classes/io/userapp/client/android/UserApp$Session$OAuthUrlCallback.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/bin/classes/io/userapp/client/android/UserApp$Session$OAuthUrlCallback.class
--------------------------------------------------------------------------------
/UserApp-Android/bin/classes/io/userapp/client/android/UserApp$Session$SaveUserTask.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/bin/classes/io/userapp/client/android/UserApp$Session$SaveUserTask.class
--------------------------------------------------------------------------------
/UserApp-Android/bin/classes/io/userapp/client/android/UserApp$Session$StatusCallback.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/bin/classes/io/userapp/client/android/UserApp$Session$StatusCallback.class
--------------------------------------------------------------------------------
/UserApp-Android/bin/classes/io/userapp/client/android/UserApp$Session$UserCallback.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/bin/classes/io/userapp/client/android/UserApp$Session$UserCallback.class
--------------------------------------------------------------------------------
/UserApp-Android/bin/classes/io/userapp/client/android/UserApp$Session.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/bin/classes/io/userapp/client/android/UserApp$Session.class
--------------------------------------------------------------------------------
/UserApp-Android/bin/classes/io/userapp/client/android/UserApp$UIHelper$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/bin/classes/io/userapp/client/android/UserApp$UIHelper$1.class
--------------------------------------------------------------------------------
/UserApp-Android/bin/classes/io/userapp/client/android/UserApp$UIHelper.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/bin/classes/io/userapp/client/android/UserApp$UIHelper.class
--------------------------------------------------------------------------------
/UserApp-Android/bin/classes/io/userapp/client/android/UserApp.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/bin/classes/io/userapp/client/android/UserApp.class
--------------------------------------------------------------------------------
/UserApp-Android/bin/classes/io/userapp/client/android/WebViewRelativeLayout.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/bin/classes/io/userapp/client/android/WebViewRelativeLayout.class
--------------------------------------------------------------------------------
/UserApp-Android/bin/classes/io/userapp/client/exceptions/InvalidMethodException.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/bin/classes/io/userapp/client/exceptions/InvalidMethodException.class
--------------------------------------------------------------------------------
/UserApp-Android/bin/classes/io/userapp/client/exceptions/InvalidServiceException.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/bin/classes/io/userapp/client/exceptions/InvalidServiceException.class
--------------------------------------------------------------------------------
/UserApp-Android/bin/classes/io/userapp/client/exceptions/ServiceException.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/bin/classes/io/userapp/client/exceptions/ServiceException.class
--------------------------------------------------------------------------------
/UserApp-Android/bin/classes/io/userapp/client/exceptions/TransportException.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/bin/classes/io/userapp/client/exceptions/TransportException.class
--------------------------------------------------------------------------------
/UserApp-Android/bin/classes/io/userapp/client/exceptions/UserAppException.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/bin/classes/io/userapp/client/exceptions/UserAppException.class
--------------------------------------------------------------------------------
/UserApp-Android/bin/classes/io/userapp/client/rest/Restful.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/bin/classes/io/userapp/client/rest/Restful.class
--------------------------------------------------------------------------------
/UserApp-Android/bin/classes/io/userapp/client/rest/RestfulContext.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/bin/classes/io/userapp/client/rest/RestfulContext.class
--------------------------------------------------------------------------------
/UserApp-Android/bin/classes/io/userapp/client/rest/UserCredentials.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/bin/classes/io/userapp/client/rest/UserCredentials.class
--------------------------------------------------------------------------------
/UserApp-Android/bin/classes/io/userapp/client/rest/core/HttpHeaderCollection.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/bin/classes/io/userapp/client/rest/core/HttpHeaderCollection.class
--------------------------------------------------------------------------------
/UserApp-Android/bin/classes/io/userapp/client/rest/core/HttpMethodType.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/bin/classes/io/userapp/client/rest/core/HttpMethodType.class
--------------------------------------------------------------------------------
/UserApp-Android/bin/classes/io/userapp/client/rest/core/HttpProtocolVersionType.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/bin/classes/io/userapp/client/rest/core/HttpProtocolVersionType.class
--------------------------------------------------------------------------------
/UserApp-Android/bin/classes/io/userapp/client/rest/core/HttpResponse.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/bin/classes/io/userapp/client/rest/core/HttpResponse.class
--------------------------------------------------------------------------------
/UserApp-Android/bin/classes/io/userapp/client/rest/core/HttpResponseHead.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/bin/classes/io/userapp/client/rest/core/HttpResponseHead.class
--------------------------------------------------------------------------------
/UserApp-Android/bin/classes/io/userapp/client/rest/core/HttpResponseStatusHead.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/bin/classes/io/userapp/client/rest/core/HttpResponseStatusHead.class
--------------------------------------------------------------------------------
/UserApp-Android/bin/classes/io/userapp/client/rest/core/HttpStatusCode.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/bin/classes/io/userapp/client/rest/core/HttpStatusCode.class
--------------------------------------------------------------------------------
/UserApp-Android/bin/jarlist.cache:
--------------------------------------------------------------------------------
1 | # cache for current jar dependency. DO NOT EDIT.
2 | # format is
3 | # Encoding is UTF-8
4 |
--------------------------------------------------------------------------------
/UserApp-Android/bin/userapp android.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/bin/userapp android.jar
--------------------------------------------------------------------------------
/UserApp-Android/gen/io/userapp/client/android/BuildConfig.java:
--------------------------------------------------------------------------------
1 | /** Automatically generated file. DO NOT MODIFY */
2 | package io.userapp.client.android;
3 |
4 | public final class BuildConfig {
5 | public final static boolean DEBUG = true;
6 | }
--------------------------------------------------------------------------------
/UserApp-Android/gen/io/userapp/client/android/R.java:
--------------------------------------------------------------------------------
1 | /* AUTO-GENERATED FILE. DO NOT MODIFY.
2 | *
3 | * This class was automatically generated by the
4 | * aapt tool from the resource data it found. It
5 | * should not be modified by hand.
6 | */
7 |
8 | package io.userapp.client.android;
9 |
10 | public final class R {
11 | public static final class attr {
12 | }
13 | public static final class dimen {
14 | /**
15 | Customize dimensions originally defined in res/values/dimens.xml (such as
16 | screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here.
17 |
18 | */
19 | public static int activity_horizontal_margin=0x7f030000;
20 | }
21 | public static final class drawable {
22 | public static int ic_launcher=0x7f020000;
23 | }
24 | public static final class string {
25 | public static int userapp_email=0x7f040002;
26 | public static int userapp_facebook_login=0x7f040005;
27 | public static int userapp_facebook_signup=0x7f040006;
28 | public static int userapp_login=0x7f040000;
29 | public static int userapp_password=0x7f040004;
30 | public static int userapp_signup=0x7f040001;
31 | public static int userapp_username=0x7f040003;
32 | }
33 | public static final class style {
34 | /**
35 | Base application theme for API 11+. This theme completely replaces
36 | AppBaseTheme from res/values/styles.xml on API 11+ devices.
37 |
38 | API 11 theme customizations can go here.
39 |
40 | Base application theme for API 14+. This theme completely replaces
41 | AppBaseTheme from BOTH res/values/styles.xml and
42 | res/values-v11/styles.xml on API 14+ devices.
43 |
44 | API 14 theme customizations can go here.
45 | */
46 | public static int AppBaseTheme=0x7f050000;
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/UserApp-Android/libs/android-support-v4.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/libs/android-support-v4.jar
--------------------------------------------------------------------------------
/UserApp-Android/libs/gson-2.2.4-javadoc.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/libs/gson-2.2.4-javadoc.jar
--------------------------------------------------------------------------------
/UserApp-Android/libs/gson-2.2.4-sources.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/libs/gson-2.2.4-sources.jar
--------------------------------------------------------------------------------
/UserApp-Android/libs/gson-2.2.4.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/libs/gson-2.2.4.jar
--------------------------------------------------------------------------------
/UserApp-Android/libs/json-20131018.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/userapp-io/userapp-android/248cb85ce5cabd20baee1a42efbde764a99d52fa/UserApp-Android/libs/json-20131018.jar
--------------------------------------------------------------------------------
/UserApp-Android/lint.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/UserApp-Android/proguard-project.txt:
--------------------------------------------------------------------------------
1 | # To enable ProGuard in your project, edit project.properties
2 | # to define the proguard.config property as described in that file.
3 | #
4 | # Add project specific ProGuard rules here.
5 | # By default, the flags in this file are appended to flags specified
6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt
7 | # You can edit the include path and order by changing the ProGuard
8 | # include property in project.properties.
9 | #
10 | # For more details, see
11 | # http://developer.android.com/guide/developing/tools/proguard.html
12 |
13 | # Add any project specific keep options here:
14 |
15 | # If your project uses WebView with JS, uncomment the following
16 | # and specify the fully qualified class name to the JavaScript interface
17 | # class:
18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
19 | # public *;
20 | #}
21 |
--------------------------------------------------------------------------------
/UserApp-Android/project.properties:
--------------------------------------------------------------------------------
1 | # This file is automatically generated by Android Tools.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must be checked in Version Control Systems.
5 | #
6 | # To customize properties used by the Ant build system edit
7 | # "ant.properties", and override values to adapt the script to your
8 | # project structure.
9 | #
10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
12 |
13 | # Project target.
14 | target=android-19
15 | android.library=true
16 |
--------------------------------------------------------------------------------
/UserApp-Android/src/io/userapp/client/JsonHelper.java:
--------------------------------------------------------------------------------
1 | package io.userapp.client;
2 |
3 | import org.json.JSONArray;
4 | import org.json.JSONException;
5 | import org.json.JSONObject;
6 |
7 | import java.util.*;
8 |
9 | public class JsonHelper {
10 | public static Object toJSON(Object object) throws JSONException {
11 | if (object instanceof Map) {
12 | JSONObject json = new JSONObject();
13 | Map map = (Map) object;
14 | for (Object key : map.keySet()) {
15 | json.put(key.toString(), toJSON(map.get(key)));
16 | }
17 | return json;
18 | } else if (object instanceof Iterable) {
19 | JSONArray json = new JSONArray();
20 | for (Object value : ((Iterable)object)) {
21 | json.put(value);
22 | }
23 | return json;
24 | } else {
25 | return object;
26 | }
27 | }
28 |
29 | public static boolean isEmptyObject(JSONObject object) {
30 | return object.names() == null;
31 | }
32 |
33 | public static HashMap getMap(JSONObject object) throws JSONException {
34 | return toMap(object);
35 | }
36 |
37 | public static HashMap toMap(JSONObject object) throws JSONException {
38 | HashMap map = new HashMap();
39 | Iterator keys = object.keys();
40 | while (keys.hasNext()) {
41 | String key = (String) keys.next();
42 | map.put(key, fromJson(object.get(key)));
43 | }
44 | return map;
45 | }
46 |
47 | public static List toList(JSONArray array) throws JSONException {
48 | List list = new ArrayList();
49 | for (int i = 0; i < array.length(); i++) {
50 | list.add(fromJson(array.get(i)));
51 | }
52 | return list;
53 | }
54 |
55 | private static Object fromJson(Object json) throws JSONException {
56 | if (json == JSONObject.NULL) {
57 | return null;
58 | } else if (json instanceof JSONObject) {
59 | return toMap((JSONObject) json);
60 | } else if (json instanceof JSONArray) {
61 | return toList((JSONArray) json);
62 | } else {
63 | return json;
64 | }
65 | }
66 |
67 | public static String quote(String string) {
68 | if (string == null || string.length() == 0) {
69 | return "\"\"";
70 | }
71 |
72 | char c = 0;
73 | int i;
74 | int len = string.length();
75 | StringBuilder sb = new StringBuilder(len + 4);
76 | String t;
77 |
78 | sb.append('"');
79 | for (i = 0; i < len; i += 1) {
80 | c = string.charAt(i);
81 | switch (c) {
82 | case '\\':
83 | case '"':
84 | sb.append('\\');
85 | sb.append(c);
86 | break;
87 | case '/':
88 | // if (b == '<') {
89 | sb.append('\\');
90 | // }
91 | sb.append(c);
92 | break;
93 | case '\b':
94 | sb.append("\\b");
95 | break;
96 | case '\t':
97 | sb.append("\\t");
98 | break;
99 | case '\n':
100 | sb.append("\\n");
101 | break;
102 | case '\f':
103 | sb.append("\\f");
104 | break;
105 | case '\r':
106 | sb.append("\\r");
107 | break;
108 | default:
109 | if (c < ' ') {
110 | t = "000" + Integer.toHexString(c);
111 | sb.append("\\u" + t.substring(t.length() - 4));
112 | } else {
113 | sb.append(c);
114 | }
115 | }
116 | }
117 | sb.append('"');
118 | return sb.toString();
119 | }
120 | }
--------------------------------------------------------------------------------
/UserApp-Android/src/io/userapp/client/UserAppClient.java:
--------------------------------------------------------------------------------
1 | package io.userapp.client;
2 |
3 | import org.json.JSONArray;
4 | import org.json.JSONObject;
5 | import org.json.JSONWriter;
6 |
7 | import io.userapp.client.exceptions.*;
8 | import io.userapp.client.rest.Restful;
9 | import io.userapp.client.rest.RestfulContext;
10 | import io.userapp.client.rest.UserCredentials;
11 | import io.userapp.client.rest.core.HttpResponse;
12 |
13 | import java.net.URI;
14 | import java.util.ArrayList;
15 | import java.util.HashMap;
16 | import java.util.List;
17 |
18 | /*
19 | * Implementation of the UserApp API.
20 | * https://app.userapp.io/#/docs/
21 | */
22 | public class UserAppClient {
23 |
24 | /* Configuration object */
25 | public static class ClientOptions {
26 | public int version = 1;
27 | public String appId = null;
28 | public String token = null;
29 | public boolean debug = false;
30 | public boolean secure = true;
31 | public String baseAddress = "api.userapp.io";
32 | public boolean throwErrors = true;
33 |
34 | public ClientOptions() {}
35 |
36 | public ClientOptions(String appId) {
37 | this(appId, null);
38 | }
39 |
40 | public ClientOptions(String appId, String token) {
41 | this.appId = appId;
42 | this.token = token;
43 | }
44 | }
45 |
46 | /* Representation of an input parameter */
47 | public static class Parameter {
48 | String name;
49 | Object value;
50 |
51 | public Parameter(String name, Object value) {
52 | this.name = name;
53 | this.value = value;
54 | }
55 | }
56 |
57 | /* Representation of an input parameter struct */
58 | public static class Struct {
59 | ArrayList parameters = new ArrayList();
60 |
61 | public Struct() {}
62 | public UserAppClient.Struct parameter(String name, Object value) {
63 | this.parameters.add(new UserAppClient.Parameter(name, value));
64 | return this;
65 | }
66 |
67 | /* Convert to JSON */
68 | private String toJSON() {
69 | String result = "";
70 |
71 | for (UserAppClient.Parameter parameter : this.parameters) {
72 | if (result.length() > 0) {
73 | result += ",";
74 | }
75 | result += UserAppClient.ObjectToJson(parameter);
76 | }
77 |
78 | return "{" + result + "}";
79 | }
80 | }
81 |
82 | /* Representation of an input parameter array */
83 | public static class Array {
84 | ArrayList