├── .gitignore
├── .travis.yml
├── CODE_OF_CONDUCT.md
├── LICENSE
├── ParseLoginSampleBasic
├── build.gradle
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── parse
│ │ └── loginsample
│ │ └── basic
│ │ ├── SampleApplication.java
│ │ └── SampleProfileActivity.java
│ └── res
│ ├── drawable-xxhdpi
│ └── ic_launcher.png
│ ├── layout-land
│ └── activity_profile.xml
│ ├── layout
│ └── activity_profile.xml
│ ├── values-v11
│ └── themes.xml
│ └── values
│ ├── strings.xml
│ └── themes.xml
├── ParseLoginSampleCodeCustomization
├── build.gradle
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── parse
│ │ └── loginsample
│ │ └── codecustomization
│ │ ├── SampleApplication.java
│ │ └── SampleProfileActivity.java
│ └── res
│ ├── drawable-xxhdpi
│ └── ic_launcher.png
│ ├── layout-land
│ └── activity_profile.xml
│ ├── layout
│ └── activity_profile.xml
│ ├── values-v11
│ └── themes.xml
│ └── values
│ ├── strings.xml
│ └── themes.xml
├── ParseLoginSampleLayoutOverride
├── build.gradle
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── parse
│ │ └── loginsample
│ │ └── layoutoverride
│ │ ├── SampleApplication.java
│ │ └── SampleProfileActivity.java
│ └── res
│ ├── drawable-xxhdpi
│ ├── background.png
│ └── ic_launcher.png
│ ├── layout-land
│ ├── activity_profile.xml
│ └── com_parse_ui_parse_login_fragment.xml
│ ├── layout
│ ├── activity_profile.xml
│ └── com_parse_ui_parse_login_fragment.xml
│ ├── values-v11
│ └── themes.xml
│ └── values
│ ├── strings.xml
│ ├── styles.xml
│ └── themes.xml
├── ParseLoginSampleWithDispatchActivity
├── build.gradle
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── parse
│ │ └── loginsample
│ │ └── withdispatchactivity
│ │ ├── SampleApplication.java
│ │ ├── SampleDispatchActivity.java
│ │ └── SampleProfileActivity.java
│ └── res
│ ├── drawable-xxhdpi
│ └── ic_launcher.png
│ ├── layout-land
│ └── activity_profile.xml
│ ├── layout
│ └── activity_profile.xml
│ ├── values-v11
│ └── themes.xml
│ └── values
│ ├── strings.xml
│ └── themes.xml
├── ParseUI-Widget-Sample
├── build.gradle
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── parse
│ │ └── ui
│ │ └── widget
│ │ └── sample
│ │ ├── MainActivity.java
│ │ └── MyApplication.java
│ └── res
│ ├── layout
│ ├── activity_list.xml
│ └── activity_main.xml
│ ├── mipmap-hdpi
│ └── ic_launcher.png
│ ├── mipmap-mdpi
│ └── ic_launcher.png
│ ├── mipmap-xhdpi
│ └── ic_launcher.png
│ ├── mipmap-xxhdpi
│ └── ic_launcher.png
│ ├── mipmap-xxxhdpi
│ └── ic_launcher.png
│ ├── values-w820dp
│ └── dimens.xml
│ └── values
│ ├── colors.xml
│ ├── dimens.xml
│ ├── keys.xml
│ ├── strings.xml
│ └── styles.xml
├── README.md
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── login
├── build.gradle
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── parse
│ │ └── ui
│ │ └── login
│ │ ├── ParseLoginActivity.java
│ │ ├── ParseLoginBuilder.java
│ │ ├── ParseLoginConfig.java
│ │ ├── ParseLoginDispatchActivity.java
│ │ ├── ParseLoginFragment.java
│ │ ├── ParseLoginFragmentBase.java
│ │ ├── ParseLoginHelpFragment.java
│ │ ├── ParseOnLoadingListener.java
│ │ ├── ParseOnLoginSuccessListener.java
│ │ └── ParseSignupFragment.java
│ └── res
│ ├── color
│ └── com_parse_ui_parse_login_help_button_label_selector.xml
│ ├── drawable-xxhdpi
│ ├── com_parse_ui_app_logo.png
│ ├── com_parse_ui_facebook_login_logo.png
│ └── com_parse_ui_twitter_login_logo.png
│ ├── drawable
│ ├── com_parse_ui_facebook_login_button_background_selector.xml
│ ├── com_parse_ui_parse_login_button_background_selector.xml
│ └── com_parse_ui_twitter_login_button_background_selector.xml
│ ├── layout-land
│ ├── com_parse_ui_parse_login_fragment.xml
│ ├── com_parse_ui_parse_login_help_fragment.xml
│ └── com_parse_ui_parse_signup_fragment.xml
│ ├── layout
│ ├── com_parse_ui_parse_login_app_logo.xml
│ ├── com_parse_ui_parse_login_form.xml
│ ├── com_parse_ui_parse_login_fragment.xml
│ ├── com_parse_ui_parse_login_help_form.xml
│ ├── com_parse_ui_parse_login_help_fragment.xml
│ ├── com_parse_ui_parse_login_third_party_section.xml
│ ├── com_parse_ui_parse_signup_form.xml
│ └── com_parse_ui_parse_signup_fragment.xml
│ ├── values-es
│ └── strings.xml
│ ├── values-ko
│ └── strings.xml
│ ├── values-pt
│ └── strings.xml
│ ├── values-zh-rHK
│ └── strings.xml
│ ├── values-zh-rTW
│ └── strings.xml
│ ├── values-zh
│ └── strings.xml
│ └── values
│ ├── colors.xml
│ ├── dimens.xml
│ ├── strings.xml
│ └── styles.xml
├── settings.gradle
└── widget
├── build.gradle
└── src
├── androidTest
├── AndroidManifest.xml
├── java
│ └── com
│ │ └── parse
│ │ ├── ParseImageViewTest.java
│ │ ├── ParseQueryAdapterOfflineEnabledTest.java
│ │ ├── ParseQueryAdapterTest.java
│ │ └── TestActivity.java
└── res
│ ├── drawable
│ └── icon.png
│ └── layout
│ └── view_item.xml
└── main
├── AndroidManifest.xml
└── java
└── com
└── parse
├── ParseUiUtil.java
└── ui
└── widget
├── ParseImageView.java
├── ParseQueryAdapter.java
└── ParseQueryPager.java
/.gitignore:
--------------------------------------------------------------------------------
1 | # Eclipse
2 | .project
3 | .metadata
4 | tmp/**
5 | tmp/**/*
6 | *.tmp
7 | *.bak
8 | *~.nib
9 | .classpath
10 | .settings/
11 | .loadpath
12 | **/bin/*
13 | **/gen/*
14 | testData
15 | testCache
16 | server.config
17 |
18 | # Locally stored "Eclipse launch configurations"
19 | *.launch
20 |
21 | # Android
22 | # built application files
23 | *.apk
24 | *.ap_
25 |
26 | # Java class files
27 | *.class
28 |
29 | # Local configuration file (sdk path, etc)
30 | local.properties
31 |
32 | # Other
33 | .DS_Store
34 |
35 | # Android Studio
36 | .idea
37 | *.iml
38 | *.ipr
39 | *.iws
40 | classes
41 | gen-external-apklibs
42 |
43 | # Gradle
44 | .gradle
45 | build
46 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | branches:
2 | only:
3 | - master
4 | - /^v4-\d+\.\d+\.\d+$/ # regex
5 |
6 | language: android
7 |
8 | jdk:
9 | - openjdk8
10 |
11 | before_install:
12 | - mkdir "$ANDROID_HOME/licenses" || true
13 | - echo "24333f8a63b6825ea9c5514f83c2829b004d1fee" > "$ANDROID_HOME/licenses/android-sdk-license"
14 |
15 | script:
16 | - ./gradlew clean build
17 |
18 | cache:
19 | directories:
20 | - $HOME/.gradle
21 | - $HOME/.m2/repository
22 |
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | # Contributor Covenant Code of Conduct
2 |
3 | ## Our Pledge
4 |
5 | In the interest of fostering an open and welcoming environment, we as
6 | contributors and maintainers pledge to making participation in our project and
7 | our community a harassment-free experience for everyone, regardless of age, body
8 | size, disability, ethnicity, sex characteristics, gender identity and expression,
9 | level of experience, education, socio-economic status, nationality, personal
10 | appearance, race, religion, or sexual identity and orientation.
11 |
12 | ## Our Standards
13 |
14 | Examples of behavior that contributes to creating a positive environment
15 | include:
16 |
17 | * Using welcoming and inclusive language
18 | * Being respectful of differing viewpoints and experiences
19 | * Gracefully accepting constructive criticism
20 | * Focusing on what is best for the community
21 | * Showing empathy towards other community members
22 |
23 | Examples of unacceptable behavior by participants include:
24 |
25 | * The use of sexualized language or imagery and unwelcome sexual attention or
26 | advances
27 | * Trolling, insulting/derogatory comments, and personal or political attacks
28 | * Public or private harassment
29 | * Publishing others' private information, such as a physical or electronic
30 | address, without explicit permission
31 | * Other conduct which could reasonably be considered inappropriate in a
32 | professional setting
33 |
34 | ## Our Responsibilities
35 |
36 | Project maintainers are responsible for clarifying the standards of acceptable
37 | behavior and are expected to take appropriate and fair corrective action in
38 | response to any instances of unacceptable behavior.
39 |
40 | Project maintainers have the right and responsibility to remove, edit, or
41 | reject comments, commits, code, wiki edits, issues, and other contributions
42 | that are not aligned to this Code of Conduct, or to ban temporarily or
43 | permanently any contributor for other behaviors that they deem inappropriate,
44 | threatening, offensive, or harmful.
45 |
46 | ## Scope
47 |
48 | This Code of Conduct applies both within project spaces and in public spaces
49 | when an individual is representing the project or its community. Examples of
50 | representing a project or community include using an official project e-mail
51 | address, posting via an official social media account, or acting as an appointed
52 | representative at an online or offline event. Representation of a project may be
53 | further defined and clarified by project maintainers.
54 |
55 | ## Enforcement
56 |
57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be
58 | reported by contacting the project team at codeofconduct@parseplatform.org. All
59 | complaints will be reviewed and investigated and will result in a response that
60 | is deemed necessary and appropriate to the circumstances. The project team is
61 | obligated to maintain confidentiality with regard to the reporter of an incident.
62 | Further details of specific enforcement policies may be posted separately.
63 |
64 | Project maintainers who do not follow or enforce the Code of Conduct in good
65 | faith may face temporary or permanent repercussions as determined by other
66 | members of the project's leadership.
67 |
68 | ## Attribution
69 |
70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
72 |
73 | [homepage]: https://www.contributor-covenant.org
74 |
75 | For answers to common questions about this code of conduct, see
76 | https://www.contributor-covenant.org/faq
77 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2014, Parse, LLC. All rights reserved.
2 |
3 | You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
4 | copy, modify, and distribute this software in source code or binary form for use
5 | in connection with the web services and APIs provided by Parse.
6 |
7 | As with any software that integrates with the Parse platform, your use of
8 | this software is subject to the Parse Terms of Service
9 | [https://www.parse.com/about/terms]. This copyright notice shall be
10 | included in all copies or substantial portions of the software.
11 |
12 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
14 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
15 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
16 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
17 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
18 |
19 | -----
20 |
21 | As of April 5, 2017, Parse, LLC has transferred this code to the parse-community organization, and will no longer be contributing to or distributing this code.
22 |
--------------------------------------------------------------------------------
/ParseLoginSampleBasic/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: "com.android.application"
2 |
3 | android {
4 | compileSdkVersion rootProject.ext.compileSdkVersion
5 |
6 | defaultConfig {
7 | minSdkVersion rootProject.ext.minSdkVersion
8 | targetSdkVersion rootProject.ext.targetSdkVersion
9 | }
10 | lintOptions {
11 | abortOnError false
12 | }
13 | }
14 |
15 | dependencies {
16 | // rootProject.ext.* variables are defined in project gradle file, you can also use path here.
17 | implementation project(":login")
18 | implementation rootProject.ext.appcompat
19 | implementation rootProject.ext.parse
20 | implementation rootProject.ext.parseFacebookUtils
21 | implementation rootProject.ext.parseTwitterUtils
22 | }
23 |
--------------------------------------------------------------------------------
/ParseLoginSampleBasic/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
20 |
22 |
23 |
24 |
25 |
26 |
32 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
46 |
49 |
52 |
55 |
58 |
59 |
60 |
63 |
66 |
69 |
70 |
71 |
72 |
--------------------------------------------------------------------------------
/ParseLoginSampleBasic/src/main/java/com/parse/loginsample/basic/SampleApplication.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Parse, LLC. All rights reserved.
3 | *
4 | * You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
5 | * copy, modify, and distribute this software in source code or binary form for use
6 | * in connection with the web services and APIs provided by Parse.
7 | *
8 | * As with any software that integrates with the Parse platform, your use of
9 | * this software is subject to the Parse Terms of Service
10 | * [https://www.parse.com/about/terms]. This copyright notice shall be
11 | * included in all copies or substantial portions of the software.
12 | *
13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 | *
20 | */
21 |
22 | package com.parse.loginsample.basic;
23 |
24 | import android.app.Application;
25 |
26 | import com.parse.Parse;
27 | import com.parse.facebook.ParseFacebookUtils;
28 | import com.parse.twitter.ParseTwitterUtils;
29 |
30 | public class SampleApplication extends Application {
31 | @Override
32 | public void onCreate() {
33 | super.onCreate();
34 | // Required - Initialize the Parse SDK
35 | Parse.Configuration configuration = new Parse.Configuration.Builder(this)
36 | .build();
37 | Parse.initialize(configuration);
38 |
39 | Parse.setLogLevel(Parse.LOG_LEVEL_DEBUG);
40 |
41 | ParseFacebookUtils.initialize(this);
42 |
43 | // Optional - If you don't want to allow Twitter login, you can
44 | // remove this line (and other related ParseTwitterUtils calls)
45 | ParseTwitterUtils.initialize(getString(R.string.twitter_consumer_key),
46 | getString(R.string.twitter_consumer_secret));
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/ParseLoginSampleBasic/src/main/java/com/parse/loginsample/basic/SampleProfileActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Parse, LLC. All rights reserved.
3 | *
4 | * You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
5 | * copy, modify, and distribute this software in source code or binary form for use
6 | * in connection with the web services and APIs provided by Parse.
7 | *
8 | * As with any software that integrates with the Parse platform, your use of
9 | * this software is subject to the Parse Terms of Service
10 | * [https://www.parse.com/about/terms]. This copyright notice shall be
11 | * included in all copies or substantial portions of the software.
12 | *
13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 | *
20 | */
21 |
22 | package com.parse.loginsample.basic;
23 |
24 | import android.app.Activity;
25 | import android.os.Bundle;
26 | import android.view.View;
27 | import android.view.View.OnClickListener;
28 | import android.widget.Button;
29 | import android.widget.TextView;
30 |
31 | import com.parse.ParseUser;
32 | import com.parse.ui.login.ParseLoginBuilder;
33 |
34 | /**
35 | * Shows the user profile. This simple activity can function regardless of whether the user
36 | * is currently logged in.
37 | */
38 | public class SampleProfileActivity extends Activity {
39 | private static final int LOGIN_REQUEST = 0;
40 |
41 | private TextView titleTextView;
42 | private TextView emailTextView;
43 | private TextView nameTextView;
44 | private Button loginOrLogoutButton;
45 |
46 | private ParseUser currentUser;
47 |
48 | @Override
49 | protected void onCreate(Bundle savedInstanceState) {
50 | super.onCreate(savedInstanceState);
51 |
52 | setContentView(R.layout.activity_profile);
53 | titleTextView = (TextView) findViewById(R.id.profile_title);
54 | emailTextView = (TextView) findViewById(R.id.profile_email);
55 | nameTextView = (TextView) findViewById(R.id.profile_name);
56 | loginOrLogoutButton = (Button) findViewById(R.id.login_or_logout_button);
57 | titleTextView.setText(R.string.profile_title_logged_in);
58 |
59 | loginOrLogoutButton.setOnClickListener(new OnClickListener() {
60 | @Override
61 | public void onClick(View v) {
62 | if (currentUser != null) {
63 | // User clicked to log out.
64 | ParseUser.logOut();
65 | currentUser = null;
66 | showProfileLoggedOut();
67 | } else {
68 | // User clicked to log in.
69 | ParseLoginBuilder loginBuilder = new ParseLoginBuilder(
70 | SampleProfileActivity.this);
71 | startActivityForResult(loginBuilder.build(), LOGIN_REQUEST);
72 | }
73 | }
74 | });
75 | }
76 |
77 | @Override
78 | protected void onStart() {
79 | super.onStart();
80 |
81 | currentUser = ParseUser.getCurrentUser();
82 | if (currentUser != null) {
83 | showProfileLoggedIn();
84 | } else {
85 | showProfileLoggedOut();
86 | }
87 | }
88 |
89 | /**
90 | * Shows the profile of the given user.
91 | */
92 | private void showProfileLoggedIn() {
93 | titleTextView.setText(R.string.profile_title_logged_in);
94 | emailTextView.setText(currentUser.getEmail());
95 | String fullName = currentUser.getString("name");
96 | if (fullName != null) {
97 | nameTextView.setText(fullName);
98 | }
99 | loginOrLogoutButton.setText(R.string.profile_logout_button_label);
100 | }
101 |
102 | /**
103 | * Show a message asking the user to log in, toggle login/logout button text.
104 | */
105 | private void showProfileLoggedOut() {
106 | titleTextView.setText(R.string.profile_title_logged_out);
107 | emailTextView.setText("");
108 | nameTextView.setText("");
109 | loginOrLogoutButton.setText(R.string.profile_login_button_label);
110 | }
111 | }
112 |
--------------------------------------------------------------------------------
/ParseLoginSampleBasic/src/main/res/drawable-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parse-community/ParseUI-Android/e904896af739bb0cc3331a2801e7335a3ffcb5a7/ParseLoginSampleBasic/src/main/res/drawable-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/ParseLoginSampleBasic/src/main/res/layout-land/activity_profile.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
16 |
17 |
23 |
24 |
29 |
30 |
35 |
36 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/ParseLoginSampleBasic/src/main/res/layout/activity_profile.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
16 |
17 |
23 |
24 |
30 |
31 |
36 |
37 |
42 |
43 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/ParseLoginSampleBasic/src/main/res/values-v11/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/ParseLoginSampleBasic/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | YOUR_PARSE_APP_ID
6 | YOUR_PARSE_CLIENT_KEY
7 | YOUR_FACEBOOK_APP_ID
8 | YOUR_TWITTER_CONSUMER_KEY
9 | YOUR_TWITTER_CONSUMER_SECRET
10 |
11 | Parse Login Sample Basic
12 | Logo
13 | Your are logged in as
14 | Log out
15 | You must be logged in to view your profile
16 | Log in
17 |
18 |
--------------------------------------------------------------------------------
/ParseLoginSampleBasic/src/main/res/values/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
14 |
15 |
16 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/ParseLoginSampleCodeCustomization/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: "com.android.application"
2 |
3 | android {
4 | compileSdkVersion rootProject.ext.compileSdkVersion
5 |
6 | defaultConfig {
7 | minSdkVersion rootProject.ext.minSdkVersion
8 | targetSdkVersion rootProject.ext.targetSdkVersion
9 | }
10 | lintOptions {
11 | abortOnError false
12 | }
13 | }
14 |
15 | dependencies {
16 | // rootProject.ext.* variables are defined in project gradle file, you can also use path here.
17 | implementation project(":login")
18 | implementation rootProject.ext.appcompat
19 | implementation rootProject.ext.parse
20 | implementation rootProject.ext.parseFacebookUtils
21 | implementation rootProject.ext.parseTwitterUtils
22 | }
23 |
--------------------------------------------------------------------------------
/ParseLoginSampleCodeCustomization/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
20 |
24 |
25 |
26 |
27 |
28 |
34 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
48 |
49 |
52 |
55 |
58 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/ParseLoginSampleCodeCustomization/src/main/java/com/parse/loginsample/codecustomization/SampleApplication.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Parse, LLC. All rights reserved.
3 | *
4 | * You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
5 | * copy, modify, and distribute this software in source code or binary form for use
6 | * in connection with the web services and APIs provided by Parse.
7 | *
8 | * As with any software that integrates with the Parse platform, your use of
9 | * this software is subject to the Parse Terms of Service
10 | * [https://www.parse.com/about/terms]. This copyright notice shall be
11 | * included in all copies or substantial portions of the software.
12 | *
13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 | *
20 | */
21 |
22 | package com.parse.loginsample.codecustomization;
23 |
24 | import android.app.Application;
25 |
26 | import com.parse.Parse;
27 | import com.parse.facebook.ParseFacebookUtils;
28 | import com.parse.twitter.ParseTwitterUtils;
29 |
30 | public class SampleApplication extends Application {
31 | @Override
32 | public void onCreate() {
33 | super.onCreate();
34 | // Required - Initialize the Parse SDK
35 | Parse.Configuration configuration = new Parse.Configuration.Builder(this)
36 | .build();
37 | Parse.initialize(configuration);
38 |
39 | Parse.setLogLevel(Parse.LOG_LEVEL_DEBUG);
40 |
41 | ParseFacebookUtils.initialize(this);
42 |
43 | // Optional - If you don't want to allow Twitter login, you can
44 | // remove this line (and other related ParseTwitterUtils calls)
45 | ParseTwitterUtils.initialize(getString(R.string.twitter_consumer_key),
46 | getString(R.string.twitter_consumer_secret));
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/ParseLoginSampleCodeCustomization/src/main/java/com/parse/loginsample/codecustomization/SampleProfileActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Parse, LLC. All rights reserved.
3 | *
4 | * You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
5 | * copy, modify, and distribute this software in source code or binary form for use
6 | * in connection with the web services and APIs provided by Parse.
7 | *
8 | * As with any software that integrates with the Parse platform, your use of
9 | * this software is subject to the Parse Terms of Service
10 | * [https://www.parse.com/about/terms]. This copyright notice shall be
11 | * included in all copies or substantial portions of the software.
12 | *
13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 | *
20 | */
21 |
22 | package com.parse.loginsample.codecustomization;
23 |
24 | import android.app.Activity;
25 | import android.content.Intent;
26 | import android.os.Bundle;
27 | import android.view.View;
28 | import android.view.View.OnClickListener;
29 | import android.widget.Button;
30 | import android.widget.TextView;
31 |
32 | import com.parse.ParseUser;
33 | import com.parse.ui.login.ParseLoginBuilder;
34 |
35 | import java.util.Arrays;
36 |
37 | /**
38 | * Shows the user profile. This simple activity can function regardless of whether the user
39 | * is currently logged in.
40 | */
41 | public class SampleProfileActivity extends Activity {
42 | private static final int LOGIN_REQUEST = 0;
43 |
44 | private TextView titleTextView;
45 | private TextView emailTextView;
46 | private TextView nameTextView;
47 | private Button loginOrLogoutButton;
48 |
49 | private ParseUser currentUser;
50 |
51 | @Override
52 | protected void onCreate(Bundle savedInstanceState) {
53 | super.onCreate(savedInstanceState);
54 |
55 | setContentView(R.layout.activity_profile);
56 | titleTextView = (TextView) findViewById(R.id.profile_title);
57 | emailTextView = (TextView) findViewById(R.id.profile_email);
58 | nameTextView = (TextView) findViewById(R.id.profile_name);
59 | loginOrLogoutButton = (Button) findViewById(R.id.login_or_logout_button);
60 | titleTextView.setText(R.string.profile_title_logged_in);
61 |
62 | loginOrLogoutButton.setOnClickListener(new OnClickListener() {
63 | @Override
64 | public void onClick(View v) {
65 | if (currentUser != null) {
66 | // User clicked to log out.
67 | ParseUser.logOut();
68 | currentUser = null;
69 | showProfileLoggedOut();
70 | } else {
71 | // User clicked to log in.
72 | // This example customizes ParseLoginActivity in code.
73 | ParseLoginBuilder builder = new ParseLoginBuilder(
74 | SampleProfileActivity.this);
75 | Intent parseLoginIntent = builder.setParseLoginEnabled(true)
76 | .setParseLoginButtonText("Go")
77 | .setParseSignupButtonText("Register")
78 | .setParseLoginHelpText("Forgot password?")
79 | .setParseLoginInvalidCredentialsToastText("You email and/or password is not correct")
80 | .setParseLoginEmailAsUsername(true)
81 | .setParseSignupSubmitButtonText("Submit registration")
82 | .setFacebookLoginEnabled(true)
83 | .setFacebookLoginButtonText("Facebook")
84 | .setFacebookLoginPermissions(Arrays.asList("user_status", "read_stream"))
85 | .setTwitterLoginEnabled(true)
86 | .setTwitterLoginButtontext("Twitter")
87 | .build();
88 | startActivityForResult(parseLoginIntent, LOGIN_REQUEST);
89 | }
90 | }
91 | });
92 | }
93 |
94 | @Override
95 | protected void onStart() {
96 | super.onStart();
97 |
98 | currentUser = ParseUser.getCurrentUser();
99 | if (currentUser != null) {
100 | showProfileLoggedIn();
101 | } else {
102 | showProfileLoggedOut();
103 | }
104 | }
105 |
106 | /**
107 | * Shows the profile of the given user.
108 | */
109 | private void showProfileLoggedIn() {
110 | titleTextView.setText(R.string.profile_title_logged_in);
111 | emailTextView.setText(currentUser.getEmail());
112 | String fullName = currentUser.getString("name");
113 | if (fullName != null) {
114 | nameTextView.setText(fullName);
115 | }
116 | loginOrLogoutButton.setText(R.string.profile_logout_button_label);
117 | }
118 |
119 | /**
120 | * Show a message asking the user to log in, toggle login/logout button text.
121 | */
122 | private void showProfileLoggedOut() {
123 | titleTextView.setText(R.string.profile_title_logged_out);
124 | emailTextView.setText("");
125 | nameTextView.setText("");
126 | loginOrLogoutButton.setText(R.string.profile_login_button_label);
127 | }
128 | }
129 |
--------------------------------------------------------------------------------
/ParseLoginSampleCodeCustomization/src/main/res/drawable-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parse-community/ParseUI-Android/e904896af739bb0cc3331a2801e7335a3ffcb5a7/ParseLoginSampleCodeCustomization/src/main/res/drawable-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/ParseLoginSampleCodeCustomization/src/main/res/layout-land/activity_profile.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
16 |
17 |
23 |
24 |
29 |
30 |
35 |
36 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/ParseLoginSampleCodeCustomization/src/main/res/layout/activity_profile.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
16 |
17 |
23 |
24 |
30 |
31 |
36 |
37 |
42 |
43 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/ParseLoginSampleCodeCustomization/src/main/res/values-v11/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/ParseLoginSampleCodeCustomization/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | YOUR_PARSE_APP_ID
6 | YOUR_PARSE_CLIENT_KEY
7 | YOUR_FACEBOOK_APP_ID
8 | YOUR_TWITTER_CONSUMER_KEY
9 | YOUR_TWITTER_CONSUMER_SECRET
10 |
11 | Parse Login Sample Code Customization
12 | Logo
13 | Your are logged in as
14 | Log out
15 | You must be logged in to view your profile
16 | Log in
17 |
18 |
--------------------------------------------------------------------------------
/ParseLoginSampleCodeCustomization/src/main/res/values/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
14 |
15 |
16 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/ParseLoginSampleLayoutOverride/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: "com.android.application"
2 |
3 | android {
4 | compileSdkVersion rootProject.ext.compileSdkVersion
5 |
6 | defaultConfig {
7 | minSdkVersion rootProject.ext.minSdkVersion
8 | targetSdkVersion rootProject.ext.targetSdkVersion
9 | }
10 | lintOptions {
11 | abortOnError false
12 | }
13 | }
14 |
15 | dependencies {
16 | // rootProject.ext.* variables are defined in project gradle file, you can also use path here.
17 | implementation project(":login")
18 | implementation rootProject.ext.appcompat
19 | implementation rootProject.ext.parse
20 | implementation rootProject.ext.parseFacebookUtils
21 | implementation rootProject.ext.parseTwitterUtils
22 | }
23 |
--------------------------------------------------------------------------------
/ParseLoginSampleLayoutOverride/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
21 |
23 |
24 |
25 |
26 |
27 |
33 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
47 |
50 |
53 |
56 |
59 |
60 |
61 |
64 |
67 |
70 |
71 |
72 |
73 |
--------------------------------------------------------------------------------
/ParseLoginSampleLayoutOverride/src/main/java/com/parse/loginsample/layoutoverride/SampleApplication.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Parse, LLC. All rights reserved.
3 | *
4 | * You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
5 | * copy, modify, and distribute this software in source code or binary form for use
6 | * in connection with the web services and APIs provided by Parse.
7 | *
8 | * As with any software that integrates with the Parse platform, your use of
9 | * this software is subject to the Parse Terms of Service
10 | * [https://www.parse.com/about/terms]. This copyright notice shall be
11 | * included in all copies or substantial portions of the software.
12 | *
13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 | *
20 | */
21 |
22 | package com.parse.loginsample.layoutoverride;
23 |
24 | import android.app.Application;
25 |
26 | import com.parse.Parse;
27 | import com.parse.facebook.ParseFacebookUtils;
28 | import com.parse.twitter.ParseTwitterUtils;
29 |
30 | public class SampleApplication extends Application {
31 | @Override
32 | public void onCreate() {
33 | super.onCreate();
34 | // Required - Initialize the Parse SDK
35 | Parse.Configuration configuration = new Parse.Configuration.Builder(this)
36 | .build();
37 | Parse.initialize(configuration);
38 |
39 | Parse.setLogLevel(Parse.LOG_LEVEL_DEBUG);
40 |
41 | ParseFacebookUtils.initialize(this);
42 |
43 | // Optional - If you don't want to allow Twitter login, you can
44 | // remove this line (and other related ParseTwitterUtils calls)
45 | ParseTwitterUtils.initialize(getString(R.string.twitter_consumer_key),
46 | getString(R.string.twitter_consumer_secret));
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/ParseLoginSampleLayoutOverride/src/main/java/com/parse/loginsample/layoutoverride/SampleProfileActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Parse, LLC. All rights reserved.
3 | *
4 | * You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
5 | * copy, modify, and distribute this software in source code or binary form for use
6 | * in connection with the web services and APIs provided by Parse.
7 | *
8 | * As with any software that integrates with the Parse platform, your use of
9 | * this software is subject to the Parse Terms of Service
10 | * [https://www.parse.com/about/terms]. This copyright notice shall be
11 | * included in all copies or substantial portions of the software.
12 | *
13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 | *
20 | */
21 |
22 | package com.parse.loginsample.layoutoverride;
23 |
24 | import android.app.Activity;
25 | import android.os.Bundle;
26 | import android.view.View;
27 | import android.view.View.OnClickListener;
28 | import android.widget.Button;
29 | import android.widget.TextView;
30 |
31 | import com.parse.ParseUser;
32 | import com.parse.ui.login.ParseLoginBuilder;
33 |
34 | /**
35 | * Shows the user profile. This simple activity can function regardless of whether the user
36 | * is currently logged in.
37 | */
38 | public class SampleProfileActivity extends Activity {
39 | private static final int LOGIN_REQUEST = 0;
40 |
41 | private TextView titleTextView;
42 | private TextView emailTextView;
43 | private TextView nameTextView;
44 | private Button loginOrLogoutButton;
45 |
46 | private ParseUser currentUser;
47 |
48 | @Override
49 | protected void onCreate(Bundle savedInstanceState) {
50 | super.onCreate(savedInstanceState);
51 |
52 | setContentView(R.layout.activity_profile);
53 | titleTextView = (TextView) findViewById(R.id.profile_title);
54 | emailTextView = (TextView) findViewById(R.id.profile_email);
55 | nameTextView = (TextView) findViewById(R.id.profile_name);
56 | loginOrLogoutButton = (Button) findViewById(R.id.login_or_logout_button);
57 | titleTextView.setText(R.string.profile_title_logged_in);
58 |
59 | loginOrLogoutButton.setOnClickListener(new OnClickListener() {
60 | @Override
61 | public void onClick(View v) {
62 | if (currentUser != null) {
63 | // User clicked to log out.
64 | ParseUser.logOut();
65 | currentUser = null;
66 | showProfileLoggedOut();
67 | } else {
68 | // User clicked to log in.
69 | ParseLoginBuilder loginBuilder = new ParseLoginBuilder(
70 | SampleProfileActivity.this);
71 | startActivityForResult(loginBuilder.build(), LOGIN_REQUEST);
72 | }
73 | }
74 | });
75 | }
76 |
77 | @Override
78 | protected void onStart() {
79 | super.onStart();
80 |
81 | currentUser = ParseUser.getCurrentUser();
82 | if (currentUser != null) {
83 | showProfileLoggedIn();
84 | } else {
85 | showProfileLoggedOut();
86 | }
87 | }
88 |
89 | /**
90 | * Shows the profile of the given user.
91 | */
92 | private void showProfileLoggedIn() {
93 | titleTextView.setText(R.string.profile_title_logged_in);
94 | emailTextView.setText(currentUser.getEmail());
95 | String fullName = currentUser.getString("name");
96 | if (fullName != null) {
97 | nameTextView.setText(fullName);
98 | }
99 | loginOrLogoutButton.setText(R.string.profile_logout_button_label);
100 | }
101 |
102 | /**
103 | * Show a message asking the user to log in, toggle login/logout button text.
104 | */
105 | private void showProfileLoggedOut() {
106 | titleTextView.setText(R.string.profile_title_logged_out);
107 | emailTextView.setText("");
108 | nameTextView.setText("");
109 | loginOrLogoutButton.setText(R.string.profile_login_button_label);
110 | }
111 | }
112 |
--------------------------------------------------------------------------------
/ParseLoginSampleLayoutOverride/src/main/res/drawable-xxhdpi/background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parse-community/ParseUI-Android/e904896af739bb0cc3331a2801e7335a3ffcb5a7/ParseLoginSampleLayoutOverride/src/main/res/drawable-xxhdpi/background.png
--------------------------------------------------------------------------------
/ParseLoginSampleLayoutOverride/src/main/res/drawable-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parse-community/ParseUI-Android/e904896af739bb0cc3331a2801e7335a3ffcb5a7/ParseLoginSampleLayoutOverride/src/main/res/drawable-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/ParseLoginSampleLayoutOverride/src/main/res/layout-land/activity_profile.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
16 |
17 |
23 |
24 |
29 |
30 |
35 |
36 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/ParseLoginSampleLayoutOverride/src/main/res/layout-land/com_parse_ui_parse_login_fragment.xml:
--------------------------------------------------------------------------------
1 |
11 |
12 |
17 |
18 |
26 |
27 |
--------------------------------------------------------------------------------
/ParseLoginSampleLayoutOverride/src/main/res/layout/activity_profile.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
16 |
17 |
23 |
24 |
30 |
31 |
36 |
37 |
42 |
43 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/ParseLoginSampleLayoutOverride/src/main/res/layout/com_parse_ui_parse_login_fragment.xml:
--------------------------------------------------------------------------------
1 |
11 |
12 |
17 |
18 |
24 |
25 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/ParseLoginSampleLayoutOverride/src/main/res/values-v11/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/ParseLoginSampleLayoutOverride/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | YOUR_PARSE_APP_ID
6 | YOUR_PARSE_CLIENT_KEY
7 | YOUR_FACEBOOK_APP_ID
8 | YOUR_TWITTER_CONSUMER_KEY
9 | YOUR_TWITTER_CONSUMER_SECRET
10 |
11 | Parse Login Sample Layout Override
12 | Logo
13 | Your are logged in as
14 | Log out
15 | You must be logged in to view your profile
16 | Log in
17 |
18 |
--------------------------------------------------------------------------------
/ParseLoginSampleLayoutOverride/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
--------------------------------------------------------------------------------
/ParseLoginSampleLayoutOverride/src/main/res/values/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
14 |
15 |
16 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/ParseLoginSampleWithDispatchActivity/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: "com.android.application"
2 |
3 | android {
4 | compileSdkVersion rootProject.ext.compileSdkVersion
5 |
6 | defaultConfig {
7 | minSdkVersion rootProject.ext.minSdkVersion
8 | targetSdkVersion rootProject.ext.targetSdkVersion
9 | }
10 | lintOptions {
11 | abortOnError false
12 | }
13 | }
14 |
15 | dependencies {
16 | // rootProject.ext.* variables are defined in project gradle file, you can also use path here.
17 | implementation project(":login")
18 | implementation rootProject.ext.appcompat
19 | implementation rootProject.ext.parse
20 | implementation rootProject.ext.parseFacebookUtils
21 | implementation rootProject.ext.parseTwitterUtils
22 | }
23 |
--------------------------------------------------------------------------------
/ParseLoginSampleWithDispatchActivity/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
20 |
22 |
23 |
24 |
25 |
26 |
32 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
46 |
50 |
53 |
56 |
59 |
62 |
63 |
64 |
67 |
70 |
73 |
74 |
75 |
76 |
--------------------------------------------------------------------------------
/ParseLoginSampleWithDispatchActivity/src/main/java/com/parse/loginsample/withdispatchactivity/SampleApplication.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Parse, LLC. All rights reserved.
3 | *
4 | * You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
5 | * copy, modify, and distribute this software in source code or binary form for use
6 | * in connection with the web services and APIs provided by Parse.
7 | *
8 | * As with any software that integrates with the Parse platform, your use of
9 | * this software is subject to the Parse Terms of Service
10 | * [https://www.parse.com/about/terms]. This copyright notice shall be
11 | * included in all copies or substantial portions of the software.
12 | *
13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 | *
20 | */
21 |
22 | package com.parse.loginsample.withdispatchactivity;
23 |
24 | import android.app.Application;
25 |
26 | import com.parse.Parse;
27 | import com.parse.facebook.ParseFacebookUtils;
28 | import com.parse.twitter.ParseTwitterUtils;
29 |
30 | public class SampleApplication extends Application {
31 | @Override
32 | public void onCreate() {
33 | super.onCreate();
34 | // Required - Initialize the Parse SDK
35 | Parse.Configuration configuration = new Parse.Configuration.Builder(this)
36 | .build();
37 | Parse.initialize(configuration);
38 |
39 | Parse.setLogLevel(Parse.LOG_LEVEL_DEBUG);
40 |
41 | ParseFacebookUtils.initialize(this);
42 |
43 | // Optional - If you don't want to allow Twitter login, you can
44 | // remove this line (and other related ParseTwitterUtils calls)
45 | ParseTwitterUtils.initialize(getString(R.string.twitter_consumer_key),
46 | getString(R.string.twitter_consumer_secret));
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/ParseLoginSampleWithDispatchActivity/src/main/java/com/parse/loginsample/withdispatchactivity/SampleDispatchActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Parse, LLC. All rights reserved.
3 | *
4 | * You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
5 | * copy, modify, and distribute this software in source code or binary form for use
6 | * in connection with the web services and APIs provided by Parse.
7 | *
8 | * As with any software that integrates with the Parse platform, your use of
9 | * this software is subject to the Parse Terms of Service
10 | * [https://www.parse.com/about/terms]. This copyright notice shall be
11 | * included in all copies or substantial portions of the software.
12 | *
13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 | *
20 | */
21 |
22 | package com.parse.loginsample.withdispatchactivity;
23 |
24 | import com.parse.ui.login.ParseLoginDispatchActivity;
25 |
26 | public class SampleDispatchActivity extends ParseLoginDispatchActivity {
27 |
28 | @Override
29 | protected Class> getTargetClass() {
30 | return SampleProfileActivity.class;
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/ParseLoginSampleWithDispatchActivity/src/main/java/com/parse/loginsample/withdispatchactivity/SampleProfileActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Parse, LLC. All rights reserved.
3 | *
4 | * You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
5 | * copy, modify, and distribute this software in source code or binary form for use
6 | * in connection with the web services and APIs provided by Parse.
7 | *
8 | * As with any software that integrates with the Parse platform, your use of
9 | * this software is subject to the Parse Terms of Service
10 | * [https://www.parse.com/about/terms]. This copyright notice shall be
11 | * included in all copies or substantial portions of the software.
12 | *
13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 | *
20 | */
21 |
22 | package com.parse.loginsample.withdispatchactivity;
23 |
24 | import android.annotation.TargetApi;
25 | import android.app.Activity;
26 | import android.content.Intent;
27 | import android.os.Build;
28 | import android.os.Bundle;
29 | import android.view.View;
30 | import android.view.View.OnClickListener;
31 | import android.widget.TextView;
32 |
33 | import com.parse.ParseUser;
34 |
35 | /**
36 | * Shows the user profile. This simple activity can only function when there is a valid
37 | * user, so we must protect it with SampleDispatchActivity in AndroidManifest.xml.
38 | */
39 | public class SampleProfileActivity extends Activity {
40 | private TextView titleTextView;
41 | private TextView emailTextView;
42 | private TextView nameTextView;
43 |
44 | @Override
45 | protected void onCreate(Bundle savedInstanceState) {
46 | super.onCreate(savedInstanceState);
47 |
48 | setContentView(R.layout.activity_profile);
49 | titleTextView = (TextView) findViewById(R.id.profile_title);
50 | emailTextView = (TextView) findViewById(R.id.profile_email);
51 | nameTextView = (TextView) findViewById(R.id.profile_name);
52 | titleTextView.setText(R.string.profile_title_logged_in);
53 |
54 | findViewById(R.id.logout_button).setOnClickListener(new OnClickListener() {
55 | @TargetApi(Build.VERSION_CODES.HONEYCOMB)
56 | @Override
57 | public void onClick(View v) {
58 | ParseUser.logOut();
59 |
60 | // FLAG_ACTIVITY_CLEAR_TASK only works on API 11, so if the user
61 | // logs out on older devices, we'll just exit.
62 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
63 | Intent intent = new Intent(SampleProfileActivity.this,
64 | SampleDispatchActivity.class);
65 | intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK
66 | | Intent.FLAG_ACTIVITY_NEW_TASK);
67 | startActivity(intent);
68 | } else {
69 | finish();
70 | }
71 | }
72 | });
73 | }
74 |
75 | @Override
76 | protected void onStart() {
77 | super.onStart();
78 | // Set up the profile page based on the current user.
79 | ParseUser user = ParseUser.getCurrentUser();
80 | showProfile(user);
81 | }
82 |
83 | /**
84 | * Shows the profile of the given user.
85 | *
86 | * @param user
87 | */
88 | private void showProfile(ParseUser user) {
89 | if (user != null) {
90 | emailTextView.setText(user.getEmail());
91 | String fullName = user.getString("name");
92 | if (fullName != null) {
93 | nameTextView.setText(fullName);
94 | }
95 | }
96 | }
97 | }
98 |
--------------------------------------------------------------------------------
/ParseLoginSampleWithDispatchActivity/src/main/res/drawable-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parse-community/ParseUI-Android/e904896af739bb0cc3331a2801e7335a3ffcb5a7/ParseLoginSampleWithDispatchActivity/src/main/res/drawable-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/ParseLoginSampleWithDispatchActivity/src/main/res/layout-land/activity_profile.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
16 |
17 |
23 |
24 |
29 |
30 |
35 |
36 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/ParseLoginSampleWithDispatchActivity/src/main/res/layout/activity_profile.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
16 |
17 |
23 |
24 |
30 |
31 |
36 |
37 |
42 |
43 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/ParseLoginSampleWithDispatchActivity/src/main/res/values-v11/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/ParseLoginSampleWithDispatchActivity/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | YOUR_PARSE_APP_ID
6 | YOUR_PARSE_CLIENT_KEY
7 | YOUR_FACEBOOK_APP_ID
8 | YOUR_TWITTER_CONSUMER_KEY
9 | YOUR_TWITTER_CONSUMER_SECRET
10 |
11 | Parse Login Sample With Dispatch Activity
12 | Logo
13 | You are logged in as
14 | Log out
15 |
16 |
17 |
--------------------------------------------------------------------------------
/ParseLoginSampleWithDispatchActivity/src/main/res/values/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
14 |
15 |
16 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/ParseUI-Widget-Sample/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: "com.android.application"
2 |
3 | android {
4 | compileSdkVersion rootProject.ext.compileSdkVersion
5 |
6 | defaultConfig {
7 | minSdkVersion rootProject.ext.minSdkVersion
8 | targetSdkVersion rootProject.ext.targetSdkVersion
9 | applicationId "com.parse.ui.widget.sample"
10 | versionCode 1
11 | versionName "1.0"
12 | }
13 | lintOptions {
14 | abortOnError false
15 | }
16 | }
17 |
18 | dependencies {
19 | implementation rootProject.ext.appcompat
20 | implementation project(":widget")
21 | }
22 |
--------------------------------------------------------------------------------
/ParseUI-Widget-Sample/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /usr/local/opt/android-sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/ParseUI-Widget-Sample/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
15 |
18 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/ParseUI-Widget-Sample/src/main/java/com/parse/ui/widget/sample/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.parse.ui.widget.sample;
2 |
3 | import android.os.Bundle;
4 | import androidx.appcompat.app.AppCompatActivity;
5 |
6 | public class MainActivity extends AppCompatActivity {
7 |
8 | @Override
9 | protected void onCreate(Bundle savedInstanceState) {
10 | super.onCreate(savedInstanceState);
11 | setContentView(R.layout.activity_main);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/ParseUI-Widget-Sample/src/main/java/com/parse/ui/widget/sample/MyApplication.java:
--------------------------------------------------------------------------------
1 | package com.parse.ui.widget.sample;
2 |
3 | import android.app.Application;
4 |
5 | import com.parse.Parse;
6 |
7 | public class MyApplication extends Application {
8 |
9 | @Override
10 | public void onCreate() {
11 | super.onCreate();
12 |
13 | Parse.Configuration configuration = new Parse.Configuration.Builder(this)
14 | .server("http://localhost")
15 | .build();
16 | Parse.initialize(configuration);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/ParseUI-Widget-Sample/src/main/res/layout/activity_list.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
10 |
--------------------------------------------------------------------------------
/ParseUI-Widget-Sample/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/ParseUI-Widget-Sample/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parse-community/ParseUI-Android/e904896af739bb0cc3331a2801e7335a3ffcb5a7/ParseUI-Widget-Sample/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/ParseUI-Widget-Sample/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parse-community/ParseUI-Android/e904896af739bb0cc3331a2801e7335a3ffcb5a7/ParseUI-Widget-Sample/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/ParseUI-Widget-Sample/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parse-community/ParseUI-Android/e904896af739bb0cc3331a2801e7335a3ffcb5a7/ParseUI-Widget-Sample/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/ParseUI-Widget-Sample/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parse-community/ParseUI-Android/e904896af739bb0cc3331a2801e7335a3ffcb5a7/ParseUI-Widget-Sample/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/ParseUI-Widget-Sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parse-community/ParseUI-Android/e904896af739bb0cc3331a2801e7335a3ffcb5a7/ParseUI-Widget-Sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/ParseUI-Widget-Sample/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/ParseUI-Widget-Sample/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/ParseUI-Widget-Sample/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/ParseUI-Widget-Sample/src/main/res/values/keys.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | YOUR_PARSE_APP_ID
4 | YOUR_PARSE_CLIENT_KEY
5 |
6 |
--------------------------------------------------------------------------------
/ParseUI-Widget-Sample/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | ParseUI-Widget Sample
3 | ListView Sample
4 |
5 |
--------------------------------------------------------------------------------
/ParseUI-Widget-Sample/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Parse UI for Android
2 | [](https://travis-ci.org/parse-community/ParseUI-Android)
3 | [](https://github.com/parse-community/ParseUI-Android/blob/master/LICENSE)
4 | [](https://jitpack.io/#parse-community/ParseUI-Android)
5 | [](https://community.parseplatform.org/c/parse-server)
6 | [](#backers)
7 | [](#sponsors)
8 | 
9 |
10 | This project contains two libraries, `login` and `widget`.
11 |
12 | The `login` library is used for building login and signup flows with the Parse Android SDK. You can easily configure the look and feel of the login screens by either specifying XML configurations or constructing an Intent in code.
13 |
14 | The `widget` library provides several useful UI widgets which integrate with [Parse SDK](https://github.com/ParsePlatform/Parse-SDK-Android) seamlessly.
15 |
16 |
17 | ## Dependency
18 |
19 | Add this in your root `build.gradle` file (**not** your module `build.gradle` file):
20 |
21 | ```gradle
22 | allprojects {
23 | repositories {
24 | ...
25 | maven { url "https://jitpack.io" }
26 | }
27 | }
28 | ```
29 |
30 | Then, add the library to your project `build.gradle`
31 | ```gradle
32 | dependencies {
33 | // for the widget dependency
34 | implementation "com.github.parse-community.ParseUI-Android:widget:latest.version.here"
35 | // for the login dependency
36 | implementation "com.github.parse-community.ParseUI-Android:login:latest.version.here"
37 | }
38 | ```
39 |
40 | ## Usage
41 | Please check the tutorial in our [wiki](https://github.com/parse-community/ParseUI-Android/wiki)
42 |
43 | ## Documentation
44 | For complete details about this library project, please see our [documentation](https://docs.parseplatform.org/android/guide/#user-interface) on the Parse website.
45 |
46 | ## How Do I Contribute?
47 | We want to make contributing to this project as easy and transparent as possible. Please refer to the [Contribution Guidelines](https://github.com/parse-community/Parse-SDK-Android/blob/master/CONTRIBUTING.md).
48 |
49 | ## License
50 | Copyright (c) 2015-present, Parse, LLC.
51 | All rights reserved.
52 |
53 | This source code is licensed under the BSD-style license found in the
54 | LICENSE file in the root directory of this source tree. An additional grant
55 | of patent rights can be found in the PATENTS file in the same directory.
56 |
57 | -----
58 | As of April 5, 2017, Parse, LLC has transferred this code to the parse-community organization, and will no longer be contributing to or distributing this code.
59 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | repositories {
3 | google()
4 | jcenter()
5 | }
6 | dependencies {
7 | classpath "com.android.tools.build:gradle:3.5.2"
8 | classpath "com.github.dcendents:android-maven-gradle-plugin:2.1"
9 | }
10 | }
11 |
12 | plugins {
13 | id "com.github.ben-manes.versions" version "0.27.0"
14 | }
15 |
16 | allprojects {
17 | repositories {
18 | google()
19 | jcenter()
20 | maven { url "https://jitpack.io" }
21 | }
22 | }
23 |
24 | ext {
25 | compileSdkVersion = 29
26 |
27 | minSdkVersion = 15
28 | targetSdkVersion = 29
29 |
30 | appcompat = "androidx.appcompat:appcompat:1.1.0"
31 | parse = "com.github.parse-community.Parse-SDK-Android:parse:1.22.1"
32 | parseFacebookUtils = "com.github.parse-community:ParseFacebookUtils-Android:1.14.0"
33 | parseTwitterUtils = "com.github.parse-community:ParseTwitterUtils-Android:1.13.0"
34 | }
35 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | android.enableJetifier=true
2 | android.useAndroidX=true
3 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parse-community/ParseUI-Android/e904896af739bb0cc3331a2801e7335a3ffcb5a7/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | #
4 | # Copyright 2015 the original author or authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # http://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | ##############################################################################
20 | ##
21 | ## Gradle start up script for UN*X
22 | ##
23 | ##############################################################################
24 |
25 | # Attempt to set APP_HOME
26 | # Resolve links: $0 may be a link
27 | PRG="$0"
28 | # Need this for relative symlinks.
29 | while [ -h "$PRG" ] ; do
30 | ls=`ls -ld "$PRG"`
31 | link=`expr "$ls" : '.*-> \(.*\)$'`
32 | if expr "$link" : '/.*' > /dev/null; then
33 | PRG="$link"
34 | else
35 | PRG=`dirname "$PRG"`"/$link"
36 | fi
37 | done
38 | SAVED="`pwd`"
39 | cd "`dirname \"$PRG\"`/" >/dev/null
40 | APP_HOME="`pwd -P`"
41 | cd "$SAVED" >/dev/null
42 |
43 | APP_NAME="Gradle"
44 | APP_BASE_NAME=`basename "$0"`
45 |
46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
48 |
49 | # Use the maximum available, or set MAX_FD != -1 to use that value.
50 | MAX_FD="maximum"
51 |
52 | warn () {
53 | echo "$*"
54 | }
55 |
56 | die () {
57 | echo
58 | echo "$*"
59 | echo
60 | exit 1
61 | }
62 |
63 | # OS specific support (must be 'true' or 'false').
64 | cygwin=false
65 | msys=false
66 | darwin=false
67 | nonstop=false
68 | case "`uname`" in
69 | CYGWIN* )
70 | cygwin=true
71 | ;;
72 | Darwin* )
73 | darwin=true
74 | ;;
75 | MINGW* )
76 | msys=true
77 | ;;
78 | NONSTOP* )
79 | nonstop=true
80 | ;;
81 | esac
82 |
83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
84 |
85 | # Determine the Java command to use to start the JVM.
86 | if [ -n "$JAVA_HOME" ] ; then
87 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
88 | # IBM's JDK on AIX uses strange locations for the executables
89 | JAVACMD="$JAVA_HOME/jre/sh/java"
90 | else
91 | JAVACMD="$JAVA_HOME/bin/java"
92 | fi
93 | if [ ! -x "$JAVACMD" ] ; then
94 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
95 |
96 | Please set the JAVA_HOME variable in your environment to match the
97 | location of your Java installation."
98 | fi
99 | else
100 | JAVACMD="java"
101 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
102 |
103 | Please set the JAVA_HOME variable in your environment to match the
104 | location of your Java installation."
105 | fi
106 |
107 | # Increase the maximum file descriptors if we can.
108 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
109 | MAX_FD_LIMIT=`ulimit -H -n`
110 | if [ $? -eq 0 ] ; then
111 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
112 | MAX_FD="$MAX_FD_LIMIT"
113 | fi
114 | ulimit -n $MAX_FD
115 | if [ $? -ne 0 ] ; then
116 | warn "Could not set maximum file descriptor limit: $MAX_FD"
117 | fi
118 | else
119 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
120 | fi
121 | fi
122 |
123 | # For Darwin, add options to specify how the application appears in the dock
124 | if $darwin; then
125 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
126 | fi
127 |
128 | # For Cygwin, switch paths to Windows format before running java
129 | if $cygwin ; then
130 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
131 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
132 | JAVACMD=`cygpath --unix "$JAVACMD"`
133 |
134 | # We build the pattern for arguments to be converted via cygpath
135 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
136 | SEP=""
137 | for dir in $ROOTDIRSRAW ; do
138 | ROOTDIRS="$ROOTDIRS$SEP$dir"
139 | SEP="|"
140 | done
141 | OURCYGPATTERN="(^($ROOTDIRS))"
142 | # Add a user-defined pattern to the cygpath arguments
143 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
144 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
145 | fi
146 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
147 | i=0
148 | for arg in "$@" ; do
149 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
150 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
151 |
152 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
153 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
154 | else
155 | eval `echo args$i`="\"$arg\""
156 | fi
157 | i=$((i+1))
158 | done
159 | case $i in
160 | (0) set -- ;;
161 | (1) set -- "$args0" ;;
162 | (2) set -- "$args0" "$args1" ;;
163 | (3) set -- "$args0" "$args1" "$args2" ;;
164 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
165 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
166 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
167 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
168 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
169 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
170 | esac
171 | fi
172 |
173 | # Escape application args
174 | save () {
175 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
176 | echo " "
177 | }
178 | APP_ARGS=$(save "$@")
179 |
180 | # Collect all arguments for the java command, following the shell quoting and substitution rules
181 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
182 |
183 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
184 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
185 | cd "$(dirname "$0")"
186 | fi
187 |
188 | exec "$JAVACMD" "$@"
189 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem http://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%" == "" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%" == "" set DIRNAME=.
29 | set APP_BASE_NAME=%~n0
30 | set APP_HOME=%DIRNAME%
31 |
32 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
33 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
34 |
35 | @rem Find java.exe
36 | if defined JAVA_HOME goto findJavaFromJavaHome
37 |
38 | set JAVA_EXE=java.exe
39 | %JAVA_EXE% -version >NUL 2>&1
40 | if "%ERRORLEVEL%" == "0" goto init
41 |
42 | echo.
43 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
44 | echo.
45 | echo Please set the JAVA_HOME variable in your environment to match the
46 | echo location of your Java installation.
47 |
48 | goto fail
49 |
50 | :findJavaFromJavaHome
51 | set JAVA_HOME=%JAVA_HOME:"=%
52 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
53 |
54 | if exist "%JAVA_EXE%" goto init
55 |
56 | echo.
57 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
58 | echo.
59 | echo Please set the JAVA_HOME variable in your environment to match the
60 | echo location of your Java installation.
61 |
62 | goto fail
63 |
64 | :init
65 | @rem Get command-line arguments, handling Windows variants
66 |
67 | if not "%OS%" == "Windows_NT" goto win9xME_args
68 |
69 | :win9xME_args
70 | @rem Slurp the command line arguments.
71 | set CMD_LINE_ARGS=
72 | set _SKIP=2
73 |
74 | :win9xME_args_slurp
75 | if "x%~1" == "x" goto execute
76 |
77 | set CMD_LINE_ARGS=%*
78 |
79 | :execute
80 | @rem Setup the command line
81 |
82 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
83 |
84 | @rem Execute Gradle
85 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
86 |
87 | :end
88 | @rem End local scope for the variables with windows NT shell
89 | if "%ERRORLEVEL%"=="0" goto mainEnd
90 |
91 | :fail
92 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
93 | rem the _cmd.exe /c_ return code!
94 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
95 | exit /b 1
96 |
97 | :mainEnd
98 | if "%OS%"=="Windows_NT" endlocal
99 |
100 | :omega
101 |
--------------------------------------------------------------------------------
/login/build.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Parse, LLC. All rights reserved.
3 | *
4 | * You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
5 | * copy, modify, and distribute this software in source code or binary form for use
6 | * in connection with the web services and APIs provided by Parse.
7 | *
8 | * As with any software that integrates with the Parse platform, your use of
9 | * this software is subject to the Parse Terms of Service
10 | * [https://www.parse.com/about/terms]. This copyright notice shall be
11 | * included in all copies or substantial portions of the software.
12 | *
13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 | *
20 | */
21 | apply plugin: "com.android.library"
22 |
23 | android {
24 | compileSdkVersion rootProject.ext.compileSdkVersion
25 |
26 | defaultConfig {
27 | minSdkVersion rootProject.ext.minSdkVersion
28 | targetSdkVersion rootProject.ext.targetSdkVersion
29 | versionName "1.0"
30 | versionCode 1
31 | }
32 | lintOptions {
33 | abortOnError false
34 | }
35 | }
36 |
37 | dependencies {
38 | api rootProject.ext.appcompat
39 | api rootProject.ext.parse
40 |
41 | compileOnly rootProject.ext.parseFacebookUtils
42 | compileOnly rootProject.ext.parseTwitterUtils
43 | }
44 |
45 | apply from: "https://raw.githubusercontent.com/Commit451/gradle-android-javadocs/1.1.0/gradle-android-javadocs.gradle"
46 |
--------------------------------------------------------------------------------
/login/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/login/src/main/java/com/parse/ui/login/ParseLoginActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Parse, LLC. All rights reserved.
3 | *
4 | * You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
5 | * copy, modify, and distribute this software in source code or binary form for use
6 | * in connection with the web services and APIs provided by Parse.
7 | *
8 | * As with any software that integrates with the Parse platform, your use of
9 | * this software is subject to the Parse Terms of Service
10 | * [https://www.parse.com/about/terms]. This copyright notice shall be
11 | * included in all copies or substantial portions of the software.
12 | *
13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 | *
20 | */
21 |
22 | package com.parse.ui.login;
23 |
24 | import android.annotation.TargetApi;
25 | import android.app.ProgressDialog;
26 | import android.content.Intent;
27 | import android.content.pm.ActivityInfo;
28 | import android.content.pm.PackageManager;
29 | import android.content.pm.PackageManager.NameNotFoundException;
30 | import android.os.Build;
31 | import android.os.Bundle;
32 | import androidx.fragment.app.FragmentTransaction;
33 | import androidx.appcompat.app.AppCompatActivity;
34 | import android.util.Log;
35 | import android.view.Window;
36 |
37 | import com.parse.Parse;
38 | import com.parse.facebook.ParseFacebookUtils;
39 | import com.parse.ui.R;
40 |
41 | /**
42 | * Encapsulates the Parse login flow. The user can log in by username/password,
43 | * Facebook, and Twitter. If the user is new, they can also sign up. Under
44 | * normal operation, the user can only exit this activity by either successfully
45 | * logging in, or backing out of the login/signup flow.
46 | *
47 | * If your app allows Facebook/Twitter login, you must initialize
48 | * ParseFacebookUtils/ParseTwitterUtils prior to starting this activity.
49 | *
50 | * The caller activity should expect to receive one of the following resultCode
51 | * values:
52 | *
53 | * Activity.RESULT_OK: The user successfully completed login or sign-up, and we
54 | * were able to retrieve a valid ParseUser object. ParseUser.getCurrentUser()
55 | * should be populated.
56 | *
57 | * Activity.RESULT_CANCELLED: The user exited the login flow without logging in
58 | * or signing up (by clicking the back button). ParseUser.getCurrentUser()
59 | * should be null.
60 | *
61 | * You can customize this activity by:
62 | *
63 | *
Adding activity meta-data in your app's Manifest.xml. Please see
64 | * {@link ParseLoginConfig} for available settings.
65 | *
Overriding any resource (layouts, strings, colors, etc) by specifying
66 | * them in your app's /res directory and using the same resource names. Your
67 | * app's resource values will override the values from this library project.
68 | *
Using {@link ParseLoginBuilder} to construct an intent that can be used
69 | * to start this activity with your customizations.
70 | *
71 | */
72 | public class ParseLoginActivity extends AppCompatActivity implements
73 | ParseLoginFragment.ParseLoginFragmentListener,
74 | ParseLoginHelpFragment.ParseOnLoginHelpSuccessListener,
75 | ParseOnLoginSuccessListener, ParseOnLoadingListener {
76 |
77 | public static final String LOG_TAG = "ParseLoginActivity";
78 |
79 | // All login UI fragment transactions will happen within this parent layout element.
80 | // Change this if you are modifying this code to be hosted in your own activity.
81 | private final int fragmentContainer = android.R.id.content;
82 |
83 | private ProgressDialog progressDialog;
84 | private Bundle configOptions;
85 |
86 | // Although Activity.isDestroyed() is in API 17, we implement it anyways for older versions.
87 | private boolean destroyed = false;
88 |
89 | @Override
90 | public void onCreate(Bundle savedInstanceState) {
91 | super.onCreate(savedInstanceState);
92 |
93 | // Disable landscape
94 | this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
95 |
96 | this.requestWindowFeature(Window.FEATURE_NO_TITLE);
97 |
98 | // Combine options from incoming intent and the activity metadata
99 | configOptions = getMergedOptions();
100 |
101 | // Show the login form
102 | if (savedInstanceState == null) {
103 | getSupportFragmentManager().beginTransaction().add(fragmentContainer,
104 | ParseLoginFragment.newInstance(configOptions)).commit();
105 | }
106 | }
107 |
108 | @Override
109 | protected void onDestroy() {
110 | super.onDestroy();
111 | if (progressDialog != null) {
112 | progressDialog.dismiss();
113 | }
114 | destroyed = true;
115 | }
116 |
117 | @Override
118 | public void onActivityResult(int requestCode, int resultCode, Intent data) {
119 | super.onActivityResult(requestCode, resultCode, data);
120 |
121 | // Required for making Facebook login work
122 | ParseFacebookUtils.onActivityResult(requestCode, resultCode, data);
123 | }
124 |
125 | /**
126 | * Called when the user clicked the sign up button on the login form.
127 | */
128 | @Override
129 | public void onSignUpClicked(String username, String password) {
130 | // Show the signup form, but keep the transaction on the back stack
131 | // so that if the user clicks the back button, they are brought back
132 | // to the login form.
133 | FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
134 | transaction.replace(fragmentContainer,
135 | ParseSignupFragment.newInstance(configOptions, username, password));
136 | transaction.addToBackStack(null);
137 | transaction.commit();
138 | }
139 |
140 | /**
141 | * Called when the user clicked the log in button on the login form.
142 | */
143 | @Override
144 | public void onLoginHelpClicked() {
145 | // Show the login help form for resetting the user's password.
146 | // Keep the transaction on the back stack so that if the user clicks
147 | // the back button, they are brought back to the login form.
148 | FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
149 | transaction.replace(fragmentContainer, ParseLoginHelpFragment.newInstance(configOptions));
150 | transaction.addToBackStack(null);
151 | transaction.commit();
152 | }
153 |
154 | /**
155 | * Called when the user successfully completes the login help flow.
156 | */
157 | @Override
158 | public void onLoginHelpSuccess() {
159 | // Display the login form, which is the previous item onto the stack
160 | getSupportFragmentManager().popBackStackImmediate();
161 | }
162 |
163 | /**
164 | * Called when the user successfully logs in or signs up.
165 | */
166 | @Override
167 | public void onLoginSuccess() {
168 | // This default implementation returns to the parent activity with
169 | // RESULT_OK.
170 | // You can change this implementation if you want a different behavior.
171 | setResult(RESULT_OK);
172 | finish();
173 | }
174 |
175 | /**
176 | * Called when we are in progress retrieving some data.
177 | *
178 | * @param showSpinner
179 | * Whether to show the loading dialog.
180 | */
181 | @Override
182 | public void onLoadingStart(boolean showSpinner) {
183 | if (showSpinner) {
184 | progressDialog = ProgressDialog.show(this, null,
185 | getString(R.string.com_parse_ui_progress_dialog_text), true, false);
186 | }
187 | }
188 |
189 | /**
190 | * Called when we are finished retrieving some data.
191 | */
192 | @Override
193 | public void onLoadingFinish() {
194 | if (progressDialog != null) {
195 | progressDialog.dismiss();
196 | }
197 | }
198 |
199 | /**
200 | * @see android.app.Activity#isDestroyed()
201 | */
202 | @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
203 | @Override
204 | public boolean isDestroyed() {
205 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
206 | return super.isDestroyed();
207 | }
208 | return destroyed;
209 | }
210 |
211 | private Bundle getMergedOptions() {
212 | // Read activity metadata from AndroidManifest.xml
213 | ActivityInfo activityInfo = null;
214 | try {
215 | activityInfo = getPackageManager().getActivityInfo(
216 | this.getComponentName(), PackageManager.GET_META_DATA);
217 | } catch (NameNotFoundException e) {
218 | if (Parse.getLogLevel() <= Parse.LOG_LEVEL_ERROR &&
219 | Log.isLoggable(LOG_TAG, Log.WARN)) {
220 | Log.w(LOG_TAG, e.getMessage());
221 | }
222 | }
223 |
224 | // The options specified in the Intent (from ParseLoginBuilder) will
225 | // override any duplicate options specified in the activity metadata
226 | Bundle mergedOptions = new Bundle();
227 | if (activityInfo != null && activityInfo.metaData != null) {
228 | mergedOptions.putAll(activityInfo.metaData);
229 | }
230 | if (getIntent().getExtras() != null) {
231 | mergedOptions.putAll(getIntent().getExtras());
232 | }
233 |
234 | return mergedOptions;
235 | }
236 | }
237 |
--------------------------------------------------------------------------------
/login/src/main/java/com/parse/ui/login/ParseLoginDispatchActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Parse, LLC. All rights reserved.
3 | *
4 | * You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
5 | * copy, modify, and distribute this software in source code or binary form for use
6 | * in connection with the web services and APIs provided by Parse.
7 | *
8 | * As with any software that integrates with the Parse platform, your use of
9 | * this software is subject to the Parse Terms of Service
10 | * [https://www.parse.com/about/terms]. This copyright notice shall be
11 | * included in all copies or substantial portions of the software.
12 | *
13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 | *
20 | */
21 |
22 | package com.parse.ui.login;
23 |
24 | import android.app.Activity;
25 | import android.content.Intent;
26 | import android.os.Bundle;
27 | import android.util.Log;
28 |
29 | import com.parse.Parse;
30 | import com.parse.ParseUser;
31 | import com.parse.ui.R;
32 |
33 | /**
34 | * Activity that starts ParseLoginActivity if the user is not logged in.
35 | * Otherwise, it starts the subclass-defined target activity.
36 | *
37 | * To use this, you should subclass this activity and implement
38 | * {@link ParseLoginDispatchActivity#getTargetClass} to return the class of the
39 | * target activity that should be launched after login succeeds. If the user
40 | * cancels the login, your app will go back to whatever activity it was on before
41 | * your subclass dispatch activity was launched, or exit the app if your subclass
42 | * is the first activity in your app's backstack.
43 | *
44 | * You can think of your subclass as a gate keeper for any activities that
45 | * require a logged-in user to function. You should have one gate keeper per
46 | * entry path into your app (e.g. launching the app, or entering through push
47 | * notifications). When your app launches or receives a push notification, you
48 | * should specify that your gate keeper activity be launched (and the gate
49 | * keeper will redirect to your target activity upon successful login).
50 | */
51 | public abstract class ParseLoginDispatchActivity extends Activity {
52 |
53 | protected abstract Class> getTargetClass();
54 |
55 | private static final int LOGIN_REQUEST = 0;
56 | private static final int TARGET_REQUEST = 1;
57 |
58 | private static final String LOG_TAG = "ParseLoginDispatch";
59 |
60 | @Override
61 | final protected void onCreate(Bundle savedInstanceState) {
62 | super.onCreate(savedInstanceState);
63 | runDispatch();
64 | }
65 |
66 | @Override
67 | final protected void onActivityResult(int requestCode, int resultCode, Intent data) {
68 | super.onActivityResult(requestCode, resultCode, data);
69 | setResult(resultCode);
70 | if (requestCode == LOGIN_REQUEST && resultCode == RESULT_OK) {
71 | runDispatch();
72 | } else {
73 | finish();
74 | }
75 | }
76 |
77 | /**
78 | * Override this to generate a customized intent for starting ParseLoginActivity.
79 | * However, the preferred method for configuring Parse Login UI components is by
80 | * specifying activity options in AndroidManifest.xml, not by overriding this.
81 | *
82 | * @return Intent that can be used to start ParseLoginActivity
83 | */
84 | protected Intent getParseLoginIntent() {
85 | ParseLoginBuilder builder = new ParseLoginBuilder(this);
86 | return builder.build();
87 | }
88 |
89 | private void runDispatch() {
90 | if (ParseUser.getCurrentUser() != null) {
91 | debugLog(getString(R.string.com_parse_ui_login_dispatch_user_logged_in) + getTargetClass());
92 | Intent targetIntent = new Intent(this, getTargetClass());
93 | Bundle extras = getIntent().getExtras();
94 | if (extras != null) {
95 | targetIntent.putExtras(extras);
96 | }
97 | startActivityForResult(targetIntent, TARGET_REQUEST);
98 | } else {
99 | debugLog(getString(R.string.com_parse_ui_login_dispatch_user_not_logged_in));
100 | startActivityForResult(getParseLoginIntent(), LOGIN_REQUEST);
101 | }
102 | }
103 |
104 | private void debugLog(String message) {
105 | if (Parse.getLogLevel() <= Parse.LOG_LEVEL_DEBUG &&
106 | Log.isLoggable(LOG_TAG, Log.DEBUG)) {
107 | Log.d(LOG_TAG, message);
108 | }
109 | }
110 | }
111 |
--------------------------------------------------------------------------------
/login/src/main/java/com/parse/ui/login/ParseLoginFragmentBase.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Parse, LLC. All rights reserved.
3 | *
4 | * You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
5 | * copy, modify, and distribute this software in source code or binary form for use
6 | * in connection with the web services and APIs provided by Parse.
7 | *
8 | * As with any software that integrates with the Parse platform, your use of
9 | * this software is subject to the Parse Terms of Service
10 | * [https://www.parse.com/about/terms]. This copyright notice shall be
11 | * included in all copies or substantial portions of the software.
12 | *
13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 | *
20 | */
21 |
22 | package com.parse.ui.login;
23 |
24 | import android.annotation.TargetApi;
25 | import android.os.Build;
26 | import androidx.fragment.app.Fragment;
27 | import androidx.fragment.app.FragmentActivity;
28 | import android.util.Log;
29 | import android.widget.Toast;
30 |
31 | import com.parse.Parse;
32 |
33 | /**
34 | * Base class with helper methods for fragments in ParseLoginUI.
35 | */
36 | public class ParseLoginFragmentBase extends Fragment {
37 | protected ParseOnLoadingListener onLoadingListener;
38 |
39 | protected String getLogTag() {
40 | return null;
41 | }
42 |
43 | protected void showToast(int id) {
44 | showToast(getString(id));
45 | }
46 |
47 | protected void showToast(CharSequence text) {
48 | Toast.makeText(getActivity(), text, Toast.LENGTH_SHORT).show();
49 | }
50 |
51 | protected void loadingStart() {
52 | loadingStart(true);
53 | }
54 |
55 | protected void loadingStart(boolean showSpinner) {
56 | if (onLoadingListener != null) {
57 | onLoadingListener.onLoadingStart(showSpinner);
58 | }
59 | }
60 |
61 | protected void loadingFinish() {
62 | if (onLoadingListener != null) {
63 | onLoadingListener.onLoadingFinish();
64 | }
65 | }
66 |
67 | protected void debugLog(int id) {
68 | debugLog(getString(id));
69 | }
70 |
71 | protected void debugLog(String text) {
72 | if (Parse.getLogLevel() <= Parse.LOG_LEVEL_DEBUG &&
73 | Log.isLoggable(getLogTag(), Log.WARN)) {
74 | Log.w(getLogTag(), text);
75 | }
76 | }
77 |
78 | @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
79 | protected boolean isActivityDestroyed() {
80 | FragmentActivity activity = getActivity();
81 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
82 | return activity == null || activity.isDestroyed();
83 | } else {
84 | return activity == null || ((ParseLoginActivity) activity).isDestroyed();
85 | }
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/login/src/main/java/com/parse/ui/login/ParseLoginHelpFragment.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Parse, LLC. All rights reserved.
3 | *
4 | * You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
5 | * copy, modify, and distribute this software in source code or binary form for use
6 | * in connection with the web services and APIs provided by Parse.
7 | *
8 | * As with any software that integrates with the Parse platform, your use of
9 | * this software is subject to the Parse Terms of Service
10 | * [https://www.parse.com/about/terms]. This copyright notice shall be
11 | * included in all copies or substantial portions of the software.
12 | *
13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 | *
20 | */
21 |
22 | package com.parse.ui.login;
23 |
24 | import android.app.Activity;
25 | import android.os.Bundle;
26 | import android.view.LayoutInflater;
27 | import android.view.View;
28 | import android.view.View.OnClickListener;
29 | import android.view.ViewGroup;
30 | import android.widget.Button;
31 | import android.widget.EditText;
32 | import android.widget.ImageView;
33 | import android.widget.TextView;
34 |
35 | import com.parse.ParseException;
36 | import com.parse.ParseUser;
37 | import com.parse.RequestPasswordResetCallback;
38 | import com.parse.ui.R;
39 |
40 | /**
41 | * Fragment for the login help screen for resetting the user's password.
42 | */
43 | public class ParseLoginHelpFragment extends ParseLoginFragmentBase implements OnClickListener {
44 |
45 | public interface ParseOnLoginHelpSuccessListener {
46 | public void onLoginHelpSuccess();
47 | }
48 |
49 | private TextView instructionsTextView;
50 | private EditText emailField;
51 | private Button submitButton;
52 | private boolean emailSent = false;
53 | private ParseOnLoginHelpSuccessListener onLoginHelpSuccessListener;
54 |
55 | private ParseLoginConfig config;
56 |
57 | private static final String LOG_TAG = "ParseLoginHelpFragment";
58 |
59 | public static ParseLoginHelpFragment newInstance(Bundle configOptions) {
60 | ParseLoginHelpFragment loginHelpFragment = new ParseLoginHelpFragment();
61 | loginHelpFragment.setArguments(configOptions);
62 | return loginHelpFragment;
63 | }
64 |
65 | @Override
66 | public View onCreateView(LayoutInflater inflater, ViewGroup parent,
67 | Bundle savedInstanceState) {
68 | config = ParseLoginConfig.fromBundle(getArguments(), getActivity());
69 |
70 | View v = inflater.inflate(R.layout.com_parse_ui_parse_login_help_fragment,
71 | parent, false);
72 | ImageView appLogo = (ImageView) v.findViewById(R.id.app_logo);
73 | instructionsTextView = (TextView) v
74 | .findViewById(R.id.login_help_instructions);
75 | emailField = (EditText) v.findViewById(R.id.login_help_email_input);
76 | submitButton = (Button) v.findViewById(R.id.login_help_submit);
77 |
78 | if (appLogo != null && config.getAppLogo() != null) {
79 | appLogo.setImageResource(config.getAppLogo());
80 | }
81 |
82 | submitButton.setOnClickListener(this);
83 | return v;
84 | }
85 |
86 | @Override
87 | public void onAttach(Activity activity) {
88 | super.onAttach(activity);
89 |
90 | if (activity instanceof ParseOnLoadingListener) {
91 | onLoadingListener = (ParseOnLoadingListener) activity;
92 | } else {
93 | throw new IllegalArgumentException(
94 | "Activity must implemement ParseOnLoadingListener");
95 | }
96 |
97 | if (activity instanceof ParseOnLoginHelpSuccessListener) {
98 | onLoginHelpSuccessListener = (ParseOnLoginHelpSuccessListener) activity;
99 | } else {
100 | throw new IllegalArgumentException(
101 | "Activity must implemement ParseOnLoginHelpSuccessListener");
102 | }
103 | }
104 |
105 | @Override
106 | public void onClick(View v) {
107 | if (!emailSent) {
108 | String email = emailField.getText().toString();
109 | if (email.length() == 0) {
110 | showToast(R.string.com_parse_ui_no_email_toast);
111 | } else {
112 | loadingStart();
113 | ParseUser.requestPasswordResetInBackground(email,
114 | new RequestPasswordResetCallback() {
115 | @Override
116 | public void done(ParseException e) {
117 | if (isActivityDestroyed()) {
118 | return;
119 | }
120 |
121 | loadingFinish();
122 | if (e == null) {
123 | instructionsTextView
124 | .setText(R.string.com_parse_ui_login_help_email_sent);
125 | emailField.setVisibility(View.INVISIBLE);
126 | submitButton
127 | .setText(R.string.com_parse_ui_login_help_login_again_button_label);
128 | emailSent = true;
129 | } else {
130 | debugLog(getString(R.string.com_parse_ui_login_warning_password_reset_failed) +
131 | e.toString());
132 | if (e.getCode() == ParseException.INVALID_EMAIL_ADDRESS ||
133 | e.getCode() == ParseException.EMAIL_NOT_FOUND) {
134 | showToast(R.string.com_parse_ui_invalid_email_toast);
135 | } else {
136 | showToast(R.string.com_parse_ui_login_help_submit_failed_unknown);
137 | }
138 | }
139 | }
140 | });
141 | }
142 | } else {
143 | onLoginHelpSuccessListener.onLoginHelpSuccess();
144 | }
145 | }
146 |
147 | @Override
148 | protected String getLogTag() {
149 | return LOG_TAG;
150 | }
151 | }
152 |
--------------------------------------------------------------------------------
/login/src/main/java/com/parse/ui/login/ParseOnLoadingListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Parse, LLC. All rights reserved.
3 | *
4 | * You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
5 | * copy, modify, and distribute this software in source code or binary form for use
6 | * in connection with the web services and APIs provided by Parse.
7 | *
8 | * As with any software that integrates with the Parse platform, your use of
9 | * this software is subject to the Parse Terms of Service
10 | * [https://www.parse.com/about/terms]. This copyright notice shall be
11 | * included in all copies or substantial portions of the software.
12 | *
13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 | *
20 | */
21 |
22 | package com.parse.ui.login;
23 |
24 | public interface ParseOnLoadingListener {
25 | public void onLoadingStart(boolean showSpinner);
26 |
27 | public void onLoadingFinish();
28 | }
29 |
--------------------------------------------------------------------------------
/login/src/main/java/com/parse/ui/login/ParseOnLoginSuccessListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Parse, LLC. All rights reserved.
3 | *
4 | * You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
5 | * copy, modify, and distribute this software in source code or binary form for use
6 | * in connection with the web services and APIs provided by Parse.
7 | *
8 | * As with any software that integrates with the Parse platform, your use of
9 | * this software is subject to the Parse Terms of Service
10 | * [https://www.parse.com/about/terms]. This copyright notice shall be
11 | * included in all copies or substantial portions of the software.
12 | *
13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 | *
20 | */
21 |
22 | package com.parse.ui.login;
23 |
24 | public interface ParseOnLoginSuccessListener {
25 | public void onLoginSuccess();
26 | }
27 |
--------------------------------------------------------------------------------
/login/src/main/java/com/parse/ui/login/ParseSignupFragment.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Parse, LLC. All rights reserved.
3 | *
4 | * You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
5 | * copy, modify, and distribute this software in source code or binary form for use
6 | * in connection with the web services and APIs provided by Parse.
7 | *
8 | * As with any software that integrates with the Parse platform, your use of
9 | * this software is subject to the Parse Terms of Service
10 | * [https://www.parse.com/about/terms]. This copyright notice shall be
11 | * included in all copies or substantial portions of the software.
12 | *
13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 | *
20 | */
21 |
22 | package com.parse.ui.login;
23 |
24 | import android.app.Activity;
25 | import android.os.Bundle;
26 | import android.text.InputType;
27 | import android.view.LayoutInflater;
28 | import android.view.View;
29 | import android.view.View.OnClickListener;
30 | import android.view.ViewGroup;
31 | import android.widget.Button;
32 | import android.widget.EditText;
33 | import android.widget.ImageView;
34 |
35 | import com.parse.ParseException;
36 | import com.parse.ParseObject;
37 | import com.parse.ParseUser;
38 | import com.parse.SignUpCallback;
39 | import com.parse.ui.R;
40 |
41 | /**
42 | * Fragment for the user signup screen.
43 | */
44 | public class ParseSignupFragment extends ParseLoginFragmentBase implements OnClickListener {
45 | public static final String USERNAME = "com.parse.ui.login.ParseSignupFragment.USERNAME";
46 | public static final String PASSWORD = "com.parse.ui.login.ParseSignupFragment.PASSWORD";
47 |
48 | private EditText usernameField;
49 | private EditText passwordField;
50 | private EditText confirmPasswordField;
51 | private EditText emailField;
52 | private EditText nameField;
53 | private Button createAccountButton;
54 | private ParseOnLoginSuccessListener onLoginSuccessListener;
55 |
56 | private ParseLoginConfig config;
57 | private int minPasswordLength;
58 |
59 | private static final String LOG_TAG = "ParseSignupFragment";
60 | private static final int DEFAULT_MIN_PASSWORD_LENGTH = 6;
61 | private static final String USER_OBJECT_NAME_FIELD = "name";
62 |
63 | public static ParseSignupFragment newInstance(Bundle configOptions, String username, String password) {
64 | ParseSignupFragment signupFragment = new ParseSignupFragment();
65 | Bundle args = new Bundle(configOptions);
66 | args.putString(ParseSignupFragment.USERNAME, username);
67 | args.putString(ParseSignupFragment.PASSWORD, password);
68 | signupFragment.setArguments(args);
69 | return signupFragment;
70 | }
71 |
72 | @Override
73 | public View onCreateView(LayoutInflater inflater, ViewGroup parent,
74 | Bundle savedInstanceState) {
75 |
76 | Bundle args = getArguments();
77 | config = ParseLoginConfig.fromBundle(args, getActivity());
78 |
79 | minPasswordLength = DEFAULT_MIN_PASSWORD_LENGTH;
80 | if (config.getParseSignupMinPasswordLength() != null) {
81 | minPasswordLength = config.getParseSignupMinPasswordLength();
82 | }
83 |
84 | String username = args.getString(USERNAME);
85 | String password = args.getString(PASSWORD);
86 |
87 | View v = inflater.inflate(R.layout.com_parse_ui_parse_signup_fragment,
88 | parent, false);
89 | ImageView appLogo = (ImageView) v.findViewById(R.id.app_logo);
90 | usernameField = (EditText) v.findViewById(R.id.signup_username_input);
91 | passwordField = (EditText) v.findViewById(R.id.signup_password_input);
92 | confirmPasswordField = (EditText) v
93 | .findViewById(R.id.signup_confirm_password_input);
94 | emailField = (EditText) v.findViewById(R.id.signup_email_input);
95 | nameField = (EditText) v.findViewById(R.id.signup_name_input);
96 | if (!config.isParseSignupNameFieldEnabled()) {
97 | nameField.setVisibility(View.INVISIBLE);
98 | }
99 | createAccountButton = (Button) v.findViewById(R.id.create_account);
100 |
101 | usernameField.setText(username);
102 | passwordField.setText(password);
103 |
104 | if (appLogo != null && config.getAppLogo() != null) {
105 | appLogo.setImageResource(config.getAppLogo());
106 | }
107 |
108 | if (config.isParseLoginEmailAsUsername()) {
109 | usernameField.setHint(R.string.com_parse_ui_email_input_hint);
110 | usernameField.setInputType(InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);
111 | if (emailField != null) {
112 | emailField.setVisibility(View.GONE);
113 | }
114 | }
115 |
116 | if (config.getParseSignupSubmitButtonText() != null) {
117 | createAccountButton.setText(config.getParseSignupSubmitButtonText());
118 | }
119 | createAccountButton.setOnClickListener(this);
120 |
121 | return v;
122 | }
123 |
124 | @Override
125 | public void onAttach(Activity activity) {
126 | super.onAttach(activity);
127 | if (activity instanceof ParseOnLoginSuccessListener) {
128 | onLoginSuccessListener = (ParseOnLoginSuccessListener) activity;
129 | } else {
130 | throw new IllegalArgumentException(
131 | "Activity must implemement ParseOnLoginSuccessListener");
132 | }
133 |
134 | if (activity instanceof ParseOnLoadingListener) {
135 | onLoadingListener = (ParseOnLoadingListener) activity;
136 | } else {
137 | throw new IllegalArgumentException(
138 | "Activity must implemement ParseOnLoadingListener");
139 | }
140 | }
141 |
142 | @Override
143 | public void onClick(View v) {
144 | String username = usernameField.getText().toString();
145 | String password = passwordField.getText().toString();
146 | String passwordAgain = confirmPasswordField.getText().toString();
147 |
148 | String email = null;
149 | if (config.isParseLoginEmailAsUsername()) {
150 | email = usernameField.getText().toString();
151 | } else if (emailField != null) {
152 | email = emailField.getText().toString();
153 | }
154 |
155 | String name = null;
156 | if (nameField != null) {
157 | name = nameField.getText().toString();
158 | }
159 |
160 | if (username.length() == 0) {
161 | if (config.isParseLoginEmailAsUsername()) {
162 | showToast(R.string.com_parse_ui_no_email_toast);
163 | } else {
164 | showToast(R.string.com_parse_ui_no_username_toast);
165 | }
166 | } else if (password.length() == 0) {
167 | showToast(R.string.com_parse_ui_no_password_toast);
168 | } else if (password.length() < minPasswordLength) {
169 | showToast(getResources().getQuantityString(
170 | R.plurals.com_parse_ui_password_too_short_toast,
171 | minPasswordLength, minPasswordLength));
172 | } else if (passwordAgain.length() == 0) {
173 | showToast(R.string.com_parse_ui_reenter_password_toast);
174 | } else if (!password.equals(passwordAgain)) {
175 | showToast(R.string.com_parse_ui_mismatch_confirm_password_toast);
176 | confirmPasswordField.selectAll();
177 | confirmPasswordField.requestFocus();
178 | } else if (email != null && email.length() == 0) {
179 | showToast(R.string.com_parse_ui_no_email_toast);
180 | } else if (name != null && name.length() == 0 && config.isParseSignupNameFieldEnabled()) {
181 | showToast(R.string.com_parse_ui_no_name_toast);
182 | } else {
183 | ParseUser user = ParseObject.create(ParseUser.class);
184 |
185 | // Set standard fields
186 | user.setUsername(username);
187 | user.setPassword(password);
188 | user.setEmail(email);
189 |
190 | // Set additional custom fields only if the user filled it out
191 | if (name.length() != 0 && config.isParseSignupNameFieldEnabled()) {
192 | user.put(USER_OBJECT_NAME_FIELD, name);
193 | }
194 |
195 | loadingStart();
196 | user.signUpInBackground(new SignUpCallback() {
197 |
198 | @Override
199 | public void done(ParseException e) {
200 | if (isActivityDestroyed()) {
201 | return;
202 | }
203 |
204 | if (e == null) {
205 | loadingFinish();
206 | signupSuccess();
207 | } else {
208 | loadingFinish();
209 | if (e != null) {
210 | debugLog(getString(R.string.com_parse_ui_login_warning_parse_signup_failed) +
211 | e.toString());
212 | switch (e.getCode()) {
213 | case ParseException.INVALID_EMAIL_ADDRESS:
214 | showToast(R.string.com_parse_ui_invalid_email_toast);
215 | break;
216 | case ParseException.USERNAME_TAKEN:
217 | showToast(R.string.com_parse_ui_username_taken_toast);
218 | break;
219 | case ParseException.EMAIL_TAKEN:
220 | showToast(R.string.com_parse_ui_email_taken_toast);
221 | break;
222 | default:
223 | showToast(R.string.com_parse_ui_signup_failed_unknown_toast);
224 | }
225 | }
226 | }
227 | }
228 | });
229 | }
230 | }
231 |
232 | @Override
233 | protected String getLogTag() {
234 | return LOG_TAG;
235 | }
236 |
237 | private void signupSuccess() {
238 | onLoginSuccessListener.onLoginSuccess();
239 | }
240 | }
241 |
--------------------------------------------------------------------------------
/login/src/main/res/color/com_parse_ui_parse_login_help_button_label_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/login/src/main/res/drawable-xxhdpi/com_parse_ui_app_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parse-community/ParseUI-Android/e904896af739bb0cc3331a2801e7335a3ffcb5a7/login/src/main/res/drawable-xxhdpi/com_parse_ui_app_logo.png
--------------------------------------------------------------------------------
/login/src/main/res/drawable-xxhdpi/com_parse_ui_facebook_login_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parse-community/ParseUI-Android/e904896af739bb0cc3331a2801e7335a3ffcb5a7/login/src/main/res/drawable-xxhdpi/com_parse_ui_facebook_login_logo.png
--------------------------------------------------------------------------------
/login/src/main/res/drawable-xxhdpi/com_parse_ui_twitter_login_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parse-community/ParseUI-Android/e904896af739bb0cc3331a2801e7335a3ffcb5a7/login/src/main/res/drawable-xxhdpi/com_parse_ui_twitter_login_logo.png
--------------------------------------------------------------------------------
/login/src/main/res/drawable/com_parse_ui_facebook_login_button_background_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/login/src/main/res/drawable/com_parse_ui_parse_login_button_background_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/login/src/main/res/drawable/com_parse_ui_twitter_login_button_background_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/login/src/main/res/layout-land/com_parse_ui_parse_login_fragment.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
17 |
18 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/login/src/main/res/layout-land/com_parse_ui_parse_login_help_fragment.xml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
13 |
14 |
--------------------------------------------------------------------------------
/login/src/main/res/layout-land/com_parse_ui_parse_signup_fragment.xml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
13 |
14 |
--------------------------------------------------------------------------------
/login/src/main/res/layout/com_parse_ui_parse_login_app_logo.xml:
--------------------------------------------------------------------------------
1 |
8 |
--------------------------------------------------------------------------------
/login/src/main/res/layout/com_parse_ui_parse_login_form.xml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
15 |
16 |
26 |
27 |
32 |
33 |
38 |
39 |
45 |
46 |
47 |
53 |
54 |
--------------------------------------------------------------------------------
/login/src/main/res/layout/com_parse_ui_parse_login_fragment.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
16 |
17 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/login/src/main/res/layout/com_parse_ui_parse_login_help_form.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
14 |
15 |
23 |
24 |
29 |
30 |
--------------------------------------------------------------------------------
/login/src/main/res/layout/com_parse_ui_parse_login_help_fragment.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
16 |
17 |
22 |
23 |
--------------------------------------------------------------------------------
/login/src/main/res/layout/com_parse_ui_parse_login_third_party_section.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
11 |
12 |
20 |
21 |
--------------------------------------------------------------------------------
/login/src/main/res/layout/com_parse_ui_parse_signup_form.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
13 |
14 |
24 |
25 |
35 |
36 |
44 |
45 |
53 |
54 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/login/src/main/res/layout/com_parse_ui_parse_signup_fragment.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
16 |
17 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/login/src/main/res/values-es/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Logo
3 | Cargando...
4 | Usuario
5 | Contraseña
6 | Olvidé mi contraseña
7 | Iniciar sesión
8 | Registrarme
9 | Iniciar sesión con Facebook
10 | Iniciar sesión con Twitter
11 | Correo electrónico
12 | Vuelve a escribir tu contraseña
13 | Nombre
14 | Registrarme
15 | Por favor introduce tu usuario
16 | Por favor introduce tu contraseña
17 | El usuario y contraseña no están registrados
18 | No se pudo iniciar sesión, inténtalo de nuevo más tarde
19 | Ha fallado el inicio de sesión con Facebook
20 | Ha fallado el inicio de sesión con Twitter
21 |
22 |
23 | La contraseña debe tener al menos %d caracteres
24 | La contraseña debe tener al menos %d caracteres
25 |
26 |
27 | El usuario ya está uso, por favor escribe otro
28 | Por favor vuelve a indroducir tu contraseña
29 | Las contraseñas no coinciden, por favor inténtalo de nuevo
30 | Por favor introduce tu correo electrónico
31 | Correo electrónico inválido, por favor corrígelo e inténtalo de nuevo
32 | Este correo electrónico ya está en uso, por favor reestablece tu contraseña si la olvidaste
33 | Por favor introduce tu nombre
34 | Error registrándote, por favor inténtalo de nuevo más tarde
35 | Introduce tu correo electrónico para reestablecer tu contraseña
36 | Correo electrónico
37 | Enviar
38 | Ir al inicio de sesión
39 | Error al pedir el reestablecimiento de la contraseña, por favor inténtalo de nuevo
40 | Por favor comprueba tu correo electrónico para leer las instrucciones de cómo acceder a tu cuenta
41 |
42 | El layout no dispone del campo username
43 | El layout no dispone del campo password
44 | El layout no dispone del botón login
45 | El layout no dispone del botón signup
46 | El layout no dispone del botón help
47 | Desactivado el inicio de sesión con usuario/contraseña porque faltan algunos elementos en el layout
48 | El layout no dispone del botón de Facebook. Desactivado el inicio de sesión con Facebook.
49 | El layout no dispone del botón de Twitter. Desactivado el inicio de sesión con Twitter.
50 | "Error iniciando sesión con usuario/contraseña. Excepción: "
51 | "Error iniciando sesión con Facebook. Excepción: "
52 | "Error iniciando sesión con Twitter. Excepción: "
53 | "Erro actualizando el usuario después de iniciar sesión con Facebook. Excepción: "
54 | "Erro actualizando el usuario después de iniciar sesión con Twitter. Excepción: "
55 | "Error registrando en Parse. Excepción: "
56 | "Error restableciendo la contraseña en Parse. Excepción: "
57 |
58 | "El usuario ha iniciado sesión, arrancando: "
59 | El usuario no ha iniciado sesión, arrancando ParseLoginActivity
60 |
--------------------------------------------------------------------------------
/login/src/main/res/values-ko/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 불러오는중...
4 | 아이디
5 | 암호
6 | 암호를 잃어버렸나요?
7 | 로그인
8 | 새로 등록
9 | Facebook으로 로그인
10 | Twitter로 로그인
11 | 이메일
12 | 암호 확인
13 | 아이디
14 | 아이디 생성
15 | 아이디를 입력해 주세요
16 | 암호를 입력해 주세요
17 | 입력한 아이디 또는 암호가 맞지 않습니다
18 | 로그인 실패, 잠시 후 다시 시도해 보세요
19 | Facebook 로그인 실패
20 | Twitter 로그인 실패
21 |
22 |
23 | 암호는 %d 자 이상 입력해 주세요
24 | 암호는 %d 자 이상 입력해 주세요
25 |
26 |
27 | 이미 존재하는 아이디입니다. 다른 아이디를 입력해 주세요
28 | 암호 확인 창에 암호를 한번 더 입력해 주세요
29 | 암호가 맞지 않습니다. 다시 시도해 보세요
30 | 이메일을 입력해 주세요
31 | 잘못된 이메일입니다. 수정후 다시 시도해 보세요
32 | 이미 사용중인 이메일 입니다. 암호를 재설정 해 보세요
33 | 아이디를 입력해 주세요
34 | 등록에 실패했습니다. 잠시 후 다시 시도해 보세요
35 | 암호를 재설정 하려면 귀하의 이메일 주소를 입력해 주세요
36 | 이메일
37 | 제출
38 | 로그인 화면으로 복귀
39 | 암호 재설정 요청 실패, 다시 시도해 보세요
40 | 귀하의 아이디를 되찾을 방법이 적힌 이메일이 발송되었습니다. 메일을 확인해 보세요
41 |
42 |
43 |
--------------------------------------------------------------------------------
/login/src/main/res/values-pt/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Logomarca
4 | Carregando…
5 | Usuário
6 | Senha
7 | Esqueci a senha
8 | Entrar
9 | Cadastrar
10 | Entrar com Facebook
11 | Entrar com Twitter
12 | E-mail
13 | Confirmar senha
14 | Nome
15 | Criar conta
16 | Informe seu usuário
17 | Informe sua senha
18 | Usuário e senha não conferem
19 | Não foi possível entrar, tente novamente mais tarde
20 | Entrar com Facebook falhou
21 | Entrar com Twitter falhou
22 |
23 |
24 | Senha deve conter pelo menos %d caracter
25 | Senha deve conter pelo menos %d caracteres
26 |
27 |
28 | Usuário já cadastrado, escolha outro
29 | Informe a senha novamente
30 | Senha não confere, tente novamente
31 | Informe seu e-mail
32 | E-mail inválido, corrija e tente novamente
33 | E-mail já foi cadastrado, por favor redefina a sua senha
34 | Informe seu nome
35 | Não foi possível cadastrar, tente novamente mais tarde
36 | Informe seu e-mail para recuperar sua senha
37 | E-mail
38 | Enviar
39 | Voltar para o Login
40 | Erro ao solicitar recadastramento da senha, tente novamente
41 | Verifique seu e-mail para obter informações sobre como acessar sua conta
42 |
43 | Campo usuário faltando no layout
44 | Campo senha faltando no layout
45 | Botão entrar faltando no layout
46 | Botão cadastrar faltando no layout
47 | Botão ajuda faltando no layout
48 | Entrar e cadastrar com usuário e senha desabilitados devido a falta de elementos no layout
49 | Botão de login pelo Facebook faltando no layout, desabilite login pelo Facebook
50 | Botão de login pelo Twitter faltando no layout, desabilite login pelo Twitter
51 | "Entrar com usuário e senha falhou, exception: "
52 | "Login pelo Facebook falhou, exception: "
53 | "Login pelo Twitter falhou, exception: "
54 | "Atualizar objeto usuário falhou após o login pelo Facebook, exception: "
55 | "Atualizar objeto usuário falhou após o login pelo Twitter, exception: "
56 | "Cadastrar falhou, exception: "
57 | "Redefinir senha falhou, exception: "
58 |
59 | "Usuário conectado, iniciando: "
60 | Usuário não conectado, iniciando ParseLoginActivity
61 |
62 |
63 |
--------------------------------------------------------------------------------
/login/src/main/res/values-zh-rHK/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 載入中...
4 | 帳號
5 | 密碼
6 | 忘記密碼
7 | 登入
8 | 註冊
9 | 使用Facebook登入
10 | 使用Twitter登入
11 | Email
12 | 重新輸入密碼
13 | 名字
14 | 建立帳號
15 | 請輸入您的帳號
16 | 請輸入您的密碼
17 | 您輸入的帳號密碼不符合
18 | 無法登入,請稍候再試
19 | Facebook 登入失敗
20 | Twitter 登入失敗
21 |
22 |
23 | 密碼至少需要 %d 個字元
24 | 密碼至少需要 %d 個字元
25 |
26 |
27 | 帳號已經被註冊了,請輸入其他帳號名稱
28 | 請重新輸入您的密碼
29 | 密碼不吻合,請再試一次
30 | 請輸入您的Email
31 | Email無效,請輸入正確的Email
32 | Email已被註冊,請使用忘記密碼來取回帳號
33 | 請輸入您的名字
34 | 無法註冊,請稍候再試
35 | 輸入您的Email來取回您的帳號
36 | Email
37 | 送出
38 | 返回至登入畫面
39 | 請求密碼重設失敗,請再試一次
40 | 重設密碼郵件已發送,請檢查您的Email
41 |
42 |
43 |
--------------------------------------------------------------------------------
/login/src/main/res/values-zh-rTW/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 載入中...
4 | 帳號
5 | 密碼
6 | 忘記密碼
7 | 登入
8 | 註冊
9 | 使用Facebook登入
10 | 使用Twitter登入
11 | Email
12 | 重新輸入密碼
13 | 名字
14 | 建立帳號
15 | 請輸入您的帳號
16 | 請輸入您的密碼
17 | 您輸入的帳號密碼不符合
18 | 無法登入,請稍候再試
19 | Facebook 登入失敗
20 | Twitter 登入失敗
21 |
22 |
23 | 密碼至少需要 %d 個字元
24 | 密碼至少需要 %d 個字元
25 |
26 |
27 | 帳號已經被註冊了,請輸入其他帳號名稱
28 | 請重新輸入您的密碼
29 | 密碼不吻合,請再試一次
30 | 請輸入您的Email
31 | Email無效,請輸入正確的Email
32 | Email已被註冊,請使用忘記密碼來取回帳號
33 | 請輸入您的名字
34 | 無法註冊,請稍候再試
35 | 輸入您的Email來取回您的帳號
36 | Email
37 | 送出
38 | 返回至登入畫面
39 | 請求密碼重設失敗,請再試一次
40 | 重設密碼郵件已發送,請檢查您的Email
41 |
42 |
43 |
--------------------------------------------------------------------------------
/login/src/main/res/values-zh/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 载入中...
4 | 用户名
5 | 密码
6 | 忘记密码
7 | 登陆
8 | 注册
9 | 使用Facebook登陆
10 | 使用Twitter登陆
11 | 邮箱
12 | 确认密码
13 | 姓名
14 | 注册
15 | 请输入用户名
16 | 请输入密码
17 | 用户名密码不匹配
18 | 登陆失败,请重试
19 | Facebook登陆失败
20 | Twitter登陆失败
21 |
22 |
23 | 密码至少%d个字符
24 | 密码至少%d个字符
25 |
26 |
27 | 用户名已经存在,请换一个重试
28 | 请重新输入密码
29 | 密码不匹配,请重试
30 | 请输入邮箱
31 | 邮箱无效,请更正并重试
32 | 邮箱已经存在,请换一个重试
33 | 请输入姓名
34 | 注册失败,请稍后重试
35 | 输入邮箱找回密码
36 | 邮箱
37 | 提交
38 | 返回登陆
39 | 重置密码失败,请重试
40 | 重置密码邮件已发送,请检查邮箱
41 |
42 |
43 |
--------------------------------------------------------------------------------
/login/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #40CCCCCC
4 | #30CCCCCC
5 | #35CCCCCC
6 | #E0E0E0
7 | #AAAAAA
8 | #CCCCCC
9 | #AAAAAA
10 | @android:color/white
11 | #3B5998
12 | #2E4677
13 | #304F8B
14 | #2DAAE2
15 | #2588B5
16 | #2788BE
17 |
18 |
19 |
--------------------------------------------------------------------------------
/login/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 | 8dp
6 | 16dp
7 | 24dp
8 | 36dp
9 | 8dp
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/login/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Logo
4 | Loading...
5 | Username
6 | Password
7 | Forgot password
8 | Log in
9 | Sign up
10 | Log in with Facebook
11 | Log in with Twitter
12 | Email
13 | Re-enter password
14 | Name
15 | Create account
16 | Please enter your username
17 | Please enter your password
18 | The username and password you entered don\'t match
19 | Could not log in, please try again later
20 | Facebook login failed
21 | Twitter login failed
22 |
23 |
24 | Password must be at least %d character long
25 | Password must be at least %d characters long
26 |
27 |
28 | Username is already taken, please choose a different one
29 | Please re-enter your password
30 | Passwords don\'t match, please try again
31 | Please enter your email
32 | Email is invalid, please correct it and try again
33 | Email is already taken, please reset your password instead
34 | Please enter your name
35 | Could not sign up, please try again later
36 | Enter your email to recover your password
37 | Email
38 | Submit
39 | Back to Login
40 | Failed to request password reset, please try again
41 | Please check your email for instructions on how to access your account
42 |
43 | Layout missing username field
44 | Layout missing password field
45 | Layout missing login button
46 | Layout missing signup button
47 | Layout missing login help button
48 | Disabled username/password login and signup because of missing layout elements
49 | Layout missing Facebook login button, disabled Facebook login
50 | Layout missing Twitter login button, disabled Twitter login
51 | "Parse username/password login failed, exception: "
52 | "Facebook login failed, exception: "
53 | "Twitter login failed, exception: "
54 | "Updating user object after Facebook login failed, exception: "
55 | "Updating user object after Twitter login failed, exception: "
56 | "Parse signup failed, exception: "
57 | "Parse password reset failed, exception: "
58 |
59 | "User logged in, starting: "
60 | User not logged in, starting ParseLoginActivity
61 |
62 |
--------------------------------------------------------------------------------
/login/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
14 |
15 |
19 |
20 |
29 |
30 |
34 |
35 |
38 |
39 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | // Parse UI Widget Library
2 | include ':widget'
3 |
4 | // Parse UI Login Library
5 | include ':login'
6 |
7 | // Sample Projects
8 | include ':ParseUI-Widget-Sample'
9 | include ':ParseLoginSampleBasic'
10 | include ':ParseLoginSampleWithDispatchActivity'
11 | include ':ParseLoginSampleCodeCustomization'
12 | include ':ParseLoginSampleLayoutOverride'
13 |
--------------------------------------------------------------------------------
/widget/build.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Parse, LLC. All rights reserved.
3 | *
4 | * You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
5 | * copy, modify, and distribute this software in source code or binary form for use
6 | * in connection with the web services and APIs provided by Parse.
7 | *
8 | * As with any software that integrates with the Parse platform, your use of
9 | * this software is subject to the Parse Terms of Service
10 | * [https://www.parse.com/about/terms]. This copyright notice shall be
11 | * included in all copies or substantial portions of the software.
12 | *
13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 | */
20 | apply plugin: "com.android.library"
21 |
22 | android {
23 | compileSdkVersion rootProject.ext.compileSdkVersion
24 |
25 | defaultConfig {
26 | minSdkVersion rootProject.ext.minSdkVersion
27 | targetSdkVersion rootProject.ext.targetSdkVersion
28 | versionName "1.0"
29 | versionCode 1
30 | }
31 | lintOptions {
32 | abortOnError false
33 | }
34 | }
35 |
36 | dependencies {
37 | api rootProject.ext.parse
38 |
39 | androidTestImplementation "com.crittercism.dexmaker:dexmaker:1.4"
40 | androidTestImplementation "com.crittercism.dexmaker:dexmaker-mockito:1.4"
41 | androidTestImplementation "com.crittercism.dexmaker:dexmaker-dx:1.4"
42 | androidTestImplementation "org.mockito:mockito-core:1.10.19"
43 | androidTestImplementation ("org.skyscreamer:jsonassert:1.2.3") {
44 | exclude module: "json"
45 | }
46 | }
47 |
48 | apply from: "https://raw.githubusercontent.com/Commit451/gradle-android-javadocs/1.1.0/gradle-android-javadocs.gradle"
49 |
--------------------------------------------------------------------------------
/widget/src/androidTest/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
22 |
23 |
26 |
27 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/widget/src/androidTest/java/com/parse/ParseImageViewTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Parse, LLC. All rights reserved.
3 | *
4 | * You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
5 | * copy, modify, and distribute this software in source code or binary form for use
6 | * in connection with the web services and APIs provided by Parse.
7 | *
8 | * As with any software that integrates with the Parse platform, your use of
9 | * this software is subject to the Parse Terms of Service
10 | * [https://www.parse.com/about/terms]. This copyright notice shall be
11 | * included in all copies or substantial portions of the software.
12 | *
13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 | *
20 | */
21 |
22 | package com.parse;
23 |
24 | import android.content.Context;
25 | import android.graphics.Bitmap;
26 | import android.graphics.drawable.BitmapDrawable;
27 | import android.graphics.drawable.ColorDrawable;
28 | import android.graphics.drawable.Drawable;
29 | import android.test.InstrumentationTestCase;
30 |
31 | import com.parse.ui.widget.ParseImageView;
32 | import com.parse.widget.test.R;
33 |
34 | import java.io.ByteArrayOutputStream;
35 | import java.util.Arrays;
36 |
37 | import bolts.Task;
38 |
39 | import static org.mockito.Mockito.mock;
40 | import static org.mockito.Mockito.when;
41 |
42 | public class ParseImageViewTest extends InstrumentationTestCase {
43 |
44 | public void testParseImageViewWithNullParseFile() throws Exception {
45 | final Drawable drawable = new ColorDrawable();
46 | final ParseImageView imageView = new ParseImageView(getInstrumentation().getTargetContext());
47 | imageView.setPlaceholder(drawable);
48 | imageView.setParseFile(null);
49 |
50 | byte[] data = ParseTaskUtils.wait(imageView.loadInBackground());
51 |
52 | assertNull(data);
53 | assertEquals(drawable, imageView.getDrawable());
54 | }
55 |
56 | public void testParseImageViewWithNotImageParseFile() throws Exception {
57 | byte[] data = "hello".getBytes();
58 | ParseFile file = mock(ParseFile.class);
59 | when(file.getDataInBackground()).thenReturn(Task.forResult(data));
60 |
61 | final Drawable drawable = new ColorDrawable();
62 | final ParseImageView imageView = new ParseImageView(getInstrumentation().getTargetContext());
63 | imageView.setPlaceholder(drawable);
64 | imageView.setParseFile(file);
65 |
66 | byte[] dataAgain = ParseTaskUtils.wait(imageView.loadInBackground());
67 |
68 | assertTrue(Arrays.equals(data, dataAgain));
69 | // Since the parseFile can not be decode as an image, the getDrawable should not be changed
70 | assertEquals(drawable, imageView.getDrawable());
71 | }
72 |
73 | public void testParseImageViewWithImageParseFile() throws Exception {
74 | Context context = getInstrumentation().getTargetContext();
75 | final Drawable iconImage = context.getResources().getDrawable(R.drawable.icon);
76 | Bitmap iconBitmap = ((BitmapDrawable) iconImage).getBitmap();
77 | ByteArrayOutputStream stream = new ByteArrayOutputStream();
78 | iconBitmap.compress(Bitmap.CompressFormat.PNG, 100, stream);
79 | final byte[] imageData = stream.toByteArray();
80 |
81 | ParseFile file = mock(ParseFile.class);
82 | when(file.getDataInBackground()).thenReturn(Task.forResult(imageData));
83 |
84 | final Drawable drawable = new ColorDrawable();
85 | final ParseImageView imageView = new ParseImageView(context);
86 | imageView.setPlaceholder(drawable);
87 | imageView.setParseFile(file);
88 |
89 | byte[] dataAgain = ParseTaskUtils.wait(imageView.loadInBackground());
90 |
91 | assertEquals(imageData, dataAgain);
92 | assertNotNull(imageView.getDrawable());
93 | // It is hard to assert whether the two images are equal or not, so we just verify the image has
94 | // been changed
95 | assertNotSame(drawable, imageView.getDrawable());
96 | }
97 | }
98 |
99 |
100 |
--------------------------------------------------------------------------------
/widget/src/androidTest/java/com/parse/ParseQueryAdapterOfflineEnabledTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Parse, LLC. All rights reserved.
3 | *
4 | * You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
5 | * copy, modify, and distribute this software in source code or binary form for use
6 | * in connection with the web services and APIs provided by Parse.
7 | *
8 | * As with any software that integrates with the Parse platform, your use of
9 | * this software is subject to the Parse Terms of Service
10 | * [https://www.parse.com/about/terms]. This copyright notice shall be
11 | * included in all copies or substantial portions of the software.
12 | *
13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 | *
20 | */
21 |
22 | package com.parse;
23 |
24 | public class ParseQueryAdapterOfflineEnabledTest extends ParseQueryAdapterTest {
25 |
26 | @Override
27 | public void setUp() throws Exception {
28 | super.setUp();
29 | Parse.enableLocalDatastore(null);
30 | }
31 |
32 | @Override
33 | public void tearDown() throws Exception {
34 | Parse.disableLocalDatastore();
35 | super.tearDown();
36 | }
37 |
38 | @Override
39 | public void testLoadObjectsWithCacheThenNetworkQueryAndPagination() throws Exception {
40 | // Do nothing, there is no cache policy when LDS is enabled.
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/widget/src/androidTest/java/com/parse/TestActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Parse, LLC. All rights reserved.
3 | *
4 | * You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
5 | * copy, modify, and distribute this software in source code or binary form for use
6 | * in connection with the web services and APIs provided by Parse.
7 | *
8 | * As with any software that integrates with the Parse platform, your use of
9 | * this software is subject to the Parse Terms of Service
10 | * [https://www.parse.com/about/terms]. This copyright notice shall be
11 | * included in all copies or substantial portions of the software.
12 | *
13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 | *
20 | */
21 |
22 | package com.parse;
23 |
24 | import android.app.Activity;
25 |
26 | /**
27 | * This is a blank Activity placeholder class for test, used to get the ParseQueryAdapterTest
28 | * to satisfy the BaseActivityInstrumentationTestCase2 constructor.
29 | */
30 | public class TestActivity extends Activity {
31 | }
32 |
--------------------------------------------------------------------------------
/widget/src/androidTest/res/drawable/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parse-community/ParseUI-Android/e904896af739bb0cc3331a2801e7335a3ffcb5a7/widget/src/androidTest/res/drawable/icon.png
--------------------------------------------------------------------------------
/widget/src/androidTest/res/layout/view_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
21 |
22 |
26 |
30 |
34 |
35 |
--------------------------------------------------------------------------------
/widget/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/widget/src/main/java/com/parse/ParseUiUtil.java:
--------------------------------------------------------------------------------
1 | package com.parse;
2 |
3 | import bolts.Task;
4 |
5 | /**
6 | * Plz ignore
7 | */
8 | public class ParseUiUtil {
9 |
10 | public static Task callbackOnMainThreadAsync(Task task,
11 | final ParseCallback2 callback, final boolean reportCancellation) {
12 | return ParseTaskUtils.callbackOnMainThreadAsync(task, callback, reportCancellation);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/widget/src/main/java/com/parse/ui/widget/ParseImageView.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Parse, LLC. All rights reserved.
3 | *
4 | * You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
5 | * copy, modify, and distribute this software in source code or binary form for use
6 | * in connection with the web services and APIs provided by Parse.
7 | *
8 | * As with any software that integrates with the Parse platform, your use of
9 | * this software is subject to the Parse Terms of Service
10 | * [https://www.parse.com/about/terms]. This copyright notice shall be
11 | * included in all copies or substantial portions of the software.
12 | *
13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 | *
20 | */
21 |
22 | package com.parse.ui.widget;
23 |
24 | import android.content.Context;
25 | import android.graphics.Bitmap;
26 | import android.graphics.BitmapFactory;
27 | import android.graphics.drawable.Drawable;
28 | import android.util.AttributeSet;
29 | import android.widget.ImageView;
30 |
31 | import com.parse.GetDataCallback;
32 | import com.parse.ParseFile;
33 | import com.parse.ParseUiUtil;
34 |
35 | import bolts.Continuation;
36 | import bolts.Task;
37 |
38 | /**
39 | * A specialized {@code ImageView} that downloads and displays remote images stored on Parse's
40 | * servers.
41 | *
42 | * Given a {@code ParseFile} storing an image, a {@code ParseImageView} works seamlessly to fetch
43 | * the file data and display it in the background. See below for an example:
44 | *
45 | *
46 | * ParseImageView imageView = (ParseImageView) findViewById(android.R.id.icon);
47 | * // The placeholder will be used before and during the fetch, to be replaced by the fetched image
48 | * // data.
49 | * imageView.setPlaceholder(getResources().getDrawable(R.drawable.placeholder));
50 | * imageView.setParseFile(file);
51 | * imageView.loadInBackground(new GetDataCallback() {
52 | * @Override
53 | * public void done(byte[] data, ParseException e) {
54 | * Log.i("ParseImageView",
55 | * "Fetched! Data length: " + data.length + ", or exception: " + e.getMessage());
56 | * }
57 | * });
58 | *
59 | */
60 | public class ParseImageView extends ImageView {
61 | private ParseFile file;
62 | private Drawable placeholder;
63 | private boolean isLoaded = false;
64 |
65 | /**
66 | * Simple constructor to use when creating a {@code ParseImageView} from code.
67 | *
68 | * @param context
69 | * Context for this View
70 | */
71 | public ParseImageView(Context context) {
72 | super(context);
73 | }
74 |
75 | /**
76 | * Constructor that is called when inflating a {@code ParseImageView} from XML.
77 | *
78 | * @param context
79 | * Context for this View
80 | * @param attributeSet
81 | * AttributeSet defined for this View in XML
82 | */
83 | public ParseImageView(Context context, AttributeSet attributeSet) {
84 | super(context, attributeSet);
85 | }
86 |
87 | /**
88 | * Perform inflation from XML and apply a class-specific base style.
89 | *
90 | * @param context
91 | * Context for this View
92 | * @param attributeSet
93 | * AttributeSet defined for this View in XML
94 | * @param defStyle
95 | * Class-specific base style.
96 | */
97 | public ParseImageView(Context context, AttributeSet attributeSet, int defStyle) {
98 | super(context, attributeSet, defStyle);
99 | }
100 |
101 | @Override
102 | protected void onDetachedFromWindow() {
103 | super.onDetachedFromWindow();
104 | // AdapterViews tend to try and avoid calling this, instead preferring to recycle the Views +
105 | // subviews. This is, however, called when the AdapterView itself is detached, or the Activity
106 | // is destroyed.
107 | if (this.file != null) {
108 | this.file.cancel();
109 | }
110 | }
111 |
112 | @Override
113 | public void setImageBitmap(Bitmap bitmap) {
114 | super.setImageBitmap(bitmap);
115 | this.isLoaded = true;
116 | }
117 |
118 | /**
119 | * Sets the placeholder to be used while waiting for an image to be loaded.
120 | *
121 | * @param placeholder
122 | * A {@code Drawable} to be displayed while the remote image data is being fetched. This
123 | * value can be null, and this {@code ImageView} will simply be blank while data is
124 | * fetched.
125 | */
126 | public void setPlaceholder(Drawable placeholder) {
127 | this.placeholder = placeholder;
128 | if (!this.isLoaded) {
129 | this.setImageDrawable(this.placeholder);
130 | }
131 | }
132 |
133 | /**
134 | * Sets the remote file on Parse's server that stores the image.
135 | *
136 | * @param file
137 | * The remote file on Parse's server.
138 | */
139 | public void setParseFile(ParseFile file) {
140 | if (this.file != null) {
141 | this.file.cancel();
142 | }
143 | this.isLoaded = false;
144 | this.file = file;
145 | this.setImageDrawable(this.placeholder);
146 | }
147 |
148 | /**
149 | * Kick off downloading of remote image. When the download is finished, the image data will be
150 | * displayed.
151 | *
152 | * @return A Task that is resolved when the image data is fetched and this View displays the image.
153 | */
154 | public Task loadInBackground() {
155 | if (file == null) {
156 | return Task.forResult(null);
157 | }
158 |
159 | final ParseFile loadingFile = file;
160 | return file.getDataInBackground().onSuccessTask(new Continuation>() {
161 | @Override
162 | public Task then(Task task) throws Exception {
163 | byte[] data = task.getResult();
164 | if (file != loadingFile) {
165 | // This prevents the very slim chance of the file's download finishing and the callback
166 | // triggering just before this ImageView is reused for another ParseObject.
167 | return Task.cancelled();
168 | }
169 | if (data != null) {
170 | Bitmap bitmap = BitmapFactory.decodeByteArray(data, 0, data.length);
171 | if (bitmap != null) {
172 | setImageBitmap(bitmap);
173 | }
174 | }
175 | return task;
176 | }
177 | }, Task.UI_THREAD_EXECUTOR);
178 | }
179 |
180 | /**
181 | * Kick off downloading of remote image. When the download is finished, the image data will be
182 | * displayed and the {@code completionCallback} will be triggered.
183 | *
184 | * @param completionCallback
185 | * A custom {@code GetDataCallback} to be called after the image data is fetched and this
186 | * {@code ImageView} displays the image.
187 | */
188 | public void loadInBackground(final GetDataCallback completionCallback) {
189 | ParseUiUtil.callbackOnMainThreadAsync(loadInBackground(), completionCallback, true);
190 | }
191 | }
--------------------------------------------------------------------------------