Java 类com.parse.ParseUser 实例源码

项目:EletroFisio    文件:CadastroActivity.java   
private void cadastrarUsuario() {

        //Cria objeto usuario
        ParseUser usuario = new ParseUser();
        usuario.setUsername(textoUsuario.getText().toString());
        usuario.setEmail(textoEmail.getText().toString());
        usuario.setPassword(textoSenha.getText().toString());

        //salva dados do usuario
        usuario.signUpInBackground(new SignUpCallback() {
            @Override
            public void done(ParseException e) {
                if (e == null) {//sucesso ao salvar
                    Toast.makeText(CadastroActivity.this, "Cadastro feito com sucesso!",
                            Toast.LENGTH_LONG).show();
                    abrirLoginUsuario();
                } else {//erro ao salvar
                    ParseErros parseErros = new ParseErros();
                    String erro = parseErros.getErro(e.getCode());
                    Toast.makeText(CadastroActivity.this, erro, Toast.LENGTH_LONG).show();
                }
            }
        });

    }
项目:EletroFisio    文件:LoginActivity.java   
private void verificarLogin(String usuario, String senha) {
    ParseUser.logInInBackground(usuario, senha, new LogInCallback() {
        @Override
        public void done(ParseUser user, ParseException e) {

            if (e == null) {//sucesso no login
                Toast.makeText(LoginActivity.this, "Login realizado com sucesso!!", Toast.LENGTH_LONG).show();
                abrirAreaPrincipal();
            } else {//erro ao logar
                ParseErros parseErros = new ParseErros();
                String erro = parseErros.getErro(e.getCode());
                Toast.makeText(LoginActivity.this, erro, Toast.LENGTH_LONG).show();
            }

        }
    });
}
项目:My-Sheep    文件:MainActivity.java   
private void logIn() {
    prefs = getSharedPreferences("prefFile", 0);
    String userName = prefs.getString("userName",null);
    String password = prefs.getString("password",null);
    user.logInInBackground(userName, password, new LogInCallback() {
        @Override
        public void done(ParseUser parseUser, @Nullable ParseException e) {
            if (e == null){
                toaster("Login successful!","l");

            }else {
                toaster("Failed to connect!","l");
            }
        }
    });
}
项目:My-Sheep    文件:Splash.java   
public void autoLogin(){
    if (checkConnection()){
    String userName = prefs.getString("userName",null);
    String password = prefs.getString("password",null);
    user.logInInBackground(userName, password, new LogInCallback() {
        @Override
        public void done(ParseUser parseUser, @Nullable ParseException e) {
            if (e == null){
                isLoggedIn = true;
                splash(1500);
                Snackbar.make(findViewById(R.id.activity_splash),"Login successful..",Snackbar.LENGTH_LONG).show();
            }
        }
        });
    }else {
        isLoggedIn = false;
        splash(4000);
        Snackbar.make(findViewById(R.id.activity_splash),"You are offline, Working on local data",Snackbar.LENGTH_LONG).show();}
}
项目:My-Sheep    文件:ParseApplication.java   
@Override
public void onCreate() {
    super.onCreate();
    ParseObject.registerSubclass(Kid.class);
    ParseObject.registerSubclass(Visit.class);
    ParseObject.registerSubclass(Attendance.class);
    Parse.initialize(new  Parse.Configuration.Builder(this)
            .applicationId("PARSE applicationId to be added here")
            .clientKey("Parse Client Id to be added here")
            .server("Parse server address to be added here").enableLocalDataStore().build());

    ParseUser.enableAutomaticUser();
    ParseACL defaultACL = new ParseACL();
    defaultACL.setPublicReadAccess(true);
    defaultACL.setPublicWriteAccess(true);
    ParseACL.setDefaultACL(defaultACL, true);
}
项目:ParseLiveo    文件:MainActivity.java   
private void signUp(){
    ParseUser user = new ParseUser();
    user.setUsername(USER_NAME);
    user.setPassword(PASSWORD);
    user.setEmail(EMAIL);
    user.signUpInBackground(new SignUpCallback() {
        public void done(ParseException e) {
            if (e == null) {
                login();
                Toast.makeText(getApplicationContext(), "Login cadastrado com sucesso", Toast.LENGTH_SHORT).show();
            }else{
                Toast.makeText(getApplicationContext(), "Erro ao cadastrar login", Toast.LENGTH_SHORT).show();
            }
        }
    });
}
项目:ParseLiveo    文件:ParsePushApp.java   
public static void setUpParse(Context context) {

        Parse.enableLocalDatastore(context);
        Parse.initialize(context, "SUA_APPLICATION_ID", "SUA CLIENT_KEY");
        ParseInstallation.getCurrentInstallation().saveInBackground();

        ParseUser.enableAutomaticUser();
        ParseACL defaultACL = new ParseACL();
        defaultACL.setPublicReadAccess(true);
        defaultACL.setPublicWriteAccess(true);

        ParsePush.subscribeInBackground(Constants.CHANNEL, new SaveCallback() {
            @Override
            public void done(ParseException error) {
                if (error == null) {
                    Log.i(Constants.TAG, "Successfully subscribed to Parse!");
                }else{
                    Log.i(Constants.TAG, "Error subscribed to Parse!");
                }
            }
        });
    }
项目:RegLog    文件:LoginServiceParseImpl.java   
@Override
public void login(String username, String password) {

    //Make sure parse is initialized in the Application class of the main app
    ParseUser.logInInBackground(username, password,
            new LogInCallback() {
                @Override
                public void done(ParseUser user, ParseException e) {
                    if (e == null){
                        //User exist and authenticated, send user to Welcome.class
                        EventBus.getDefault().post(new LoginCallbackEvent(true,null));
                    } else {
                        EventBus.getDefault().post(new LoginCallbackEvent(false, e.getMessage()));
                    }

                }
            });

}
项目:Madad_SOS    文件:ChatlistFragment.java   
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    // TODO Auto-generated method stub
    LayoutInflater inflater=(LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    final View row=inflater.inflate(R.layout.list_single, parent, false);

    TextView sos_title=(TextView) row.findViewById(R.id.name);
    TextView sos_message=(TextView) row.findViewById(R.id.txt);
    TextView sos_time=(TextView) row.findViewById(R.id.time);

    //Log.d("Chatlist","view "+sos_list.get(position).getClassName());
    final ParseUser user = sos_list.get(position).getParseUser("UserID");
    user.pinInBackground();

    sos_title.setText(user.getString("displayname"));
    sos_message.setText(sos_list.get(position).getString("Description"));

    sos_time.setText(DateFormater.formatTime(sos_list.get(position).getCreatedAt()));

    CircleImageView iv1=(CircleImageView) row.findViewById(R.id.img);
    iv1.setImageResource(R.drawable.sample_man);
    Log.d("ChatList", "Pos " + position);
    Helper.GetProfilePic(user, iv1, context);
    Log.d("ChatList", "wow");
    return row;
}
项目:Marketplace    文件:StarterApplication.java   
@Override
public void onCreate() {
  super.onCreate();

  // Enable Local Datastore.
  Parse.enableLocalDatastore(this);

  // Add your initialization code here
  Parse.initialize(this);

  ParseUser.enableAutomaticUser();
  ParseACL defaultACL = new ParseACL();
  // Optionally enable public read access.
  // defaultACL.setPublicReadAccess(true);
  ParseACL.setDefaultACL(defaultACL, true);
}
项目:langren    文件:CommonActivity.java   
@Override
public void onOtherButtonClick(ActionSheet actionSheet, int index) {
    switch (index) {
        case 0:
            startActivity(new Intent(this, GameTopActivity.class));
            break;
        case 1:
            ParseUser.getCurrentUser().logOut();
            MainApplication.socket.disconnect();
            startActivity(new Intent(this, LoginActivty.class));
            finish();
            break;
        case 2:
            Toast.makeText(CommonActivity.this, "当前已是最新版本", Toast.LENGTH_SHORT).show();
            break;
    }
}
项目:flowlist    文件:LoginActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);

    Button verifyPhoneLogin = (Button) findViewById(R.id.start_phone_login);
    verifyPhoneLogin.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View view) {
            onPhoneLogin();
        }
    });

    loginFormView = findViewById(R.id.login_form);
    progressView = findViewById(R.id.login_progress);

    // Log out any existing session
    ParseUser currentUser = ParseUser.getCurrentUser();
    if (currentUser != null) {
        ParseUser.logOut();
    }
}
项目:Chateau    文件:ParseHelper.java   
public Observable<ParseUser> signUp(@NonNull String userName, @NonNull String password, @NonNull Map<String, ?> params) {
    Log.d(TAG, "Running sign up");
    return Observable.create(new SimpleParseRequest<ParseUser>("Exception while calling signUp") {

        @NonNull
        @Override
        protected ParseUser networkCall() throws ParseException {
            final ParseUser user = new ParseUser();
            user.setUsername(userName);
            user.setPassword(password);
            for (Map.Entry<String, ?> param : params.entrySet()) {
                user.put(param.getKey(), param.getValue());
            }
            user.signUp();
            return user;
        }
    });
}
项目:Chateau    文件:ParseSessionDataSourceTest.java   
@Test
public void signIn() {
    // Given
    ParseUser currentUser = ModelTestHelper.createParseUser(USER_ID);
    when(mParseHelper.signIn(USER_NAME, PASSWORD)).thenReturn(Observable.just(currentUser));

    // When
    TestSubscriber<BaseUser> testSubscriber = executeTarget(mTarget.signIn(new SessionQuery.SignIn(USER_NAME, PASSWORD)));

    // Then
    assertThat(testSubscriber.getOnNextEvents().size(), is(1));
    BaseUser user = testSubscriber.getOnNextEvents().get(0);
    assertEquals(USER_ID, user.getUserId());
    testSubscriber.assertCompleted();
    verify(mBroadcaster).userSignedIn();
}
项目:Chateau    文件:ParseSessionDataSourceTest.java   
@Test
public void register() {
    // Given
    ParseUser currentUser = ModelTestHelper.createParseUser(USER_ID);
    when(mParseHelper.signUp(eq(USER_NAME), eq(PASSWORD), any())).thenReturn(Observable.just(currentUser));

    // When
    TestSubscriber<BaseUser> testSubscriber = executeTarget(mTarget.register(new SessionQuery.Register(USER_NAME, DISPLAY_NAME, PASSWORD)));

    // Then
    assertThat(testSubscriber.getOnNextEvents().size(), is(1));
    BaseUser user = testSubscriber.getOnNextEvents().get(0);
    assertEquals(USER_ID, user.getUserId());
    testSubscriber.assertCompleted();
    verify(mBroadcaster).userSignedIn();
}
项目:HackathonPADLS    文件:StarterApplication.java   
@Override
public void onCreate() {
  super.onCreate();

  // Enable Local Datastore.
  Parse.enableLocalDatastore(this);

  // Add your initialization code here
  Parse.initialize(this, "COLFRcv3xi8naPtnDUHK4QwXpY8E49t9OuBYzKmN", "NJsKhQZ9pSJXPQ1EnMdzptxWxvLyzAp4AihbEdVp");
  ParseInstallation.getCurrentInstallation().saveInBackground();

  ParseUser.enableAutomaticUser();
  ParseACL defaultACL = new ParseACL();
  // Optionally enable public read access.
  // defaultACL.setPublicReadAccess(true);
  ParseACL.setDefaultACL(defaultACL, true);

}
项目:roboscout    文件:TeamListActivity.java   
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();

    //noinspection SimplifiableIfStatement
    if (id == R.id.action_logout) {
        sessionManager.logout();
        ParseUser.logOut();
        startActivity(new Intent(getApplicationContext(), RedirectActivity.class));
        finish();
    }

    return super.onOptionsItemSelected(item);
}
项目:Snapchat-parse    文件:StarterApplication.java   
@Override
public void onCreate() {
  super.onCreate();

  // Enable Local Datastore.
  Parse.enableLocalDatastore(this);

  // Add your initialization code here
  Parse.initialize(this);

  ParseUser.enableAutomaticUser();
  ParseACL defaultACL = new ParseACL();
  // Optionally enable public read access.
  // defaultACL.setPublicReadAccess(true);
  ParseACL.setDefaultACL(defaultACL, true);
}
项目:ActivityMapper    文件:LocationManager.java   
public void onLocationEvent(Location location) {
    if (location.getAccuracy() < LOCATION_ACCURACY_THRESHOLD) {
        if (_locationCache.size() == 10) {
            _locationCache.remove(0);
        }
        _locationCache.add(location);

        if (isActive()) {
            Record record = new Record();
            int lastDetectedActivity = getLastDetectedActivityType();
            if (lastDetectedActivity == ON_FOOT) {
                lastDetectedActivity = WALKING;
            }
            record.setActivityType(lastDetectedActivity);
            record.setUser(ParseUser.getCurrentUser());
            record.setLocation(new ParseGeoPoint(location.getLatitude(),
                                                 location.getLongitude()));
            Account.get()
                   .addRecord(record);
        }
    }
}
项目:AutoTimeHelper    文件:UserAPI.java   
public void updateName(final String name, final String id) {
    Log.d("UserAPI", "start updateName");
    ParseQuery<ParseUser> query = ParseUser.getQuery();
    query.whereEqualTo(USERNAME, ParseUser.getCurrentUser().getUsername());
    query.findInBackground(new FindCallback<ParseUser>() {
        public void done(List<ParseUser> objects, ParseException e) {
            if (e == null) {
                for (ParseUser parseUser : objects) {
                    Log.d("UserAPI", "find object");
                    if (parseUser.getObjectId().equals(id)) {
                        Log.d("UserAPI", "found, rename");
                        ParseUser.getCurrentUser().put(USERNAME, name);
                    }
                }
            } else {
                Log.d("UserAPI", "problem in updateName");
                e.printStackTrace();
            }
        }
    });
}
项目:SpartanDrive    文件:MainActivity.java   
private void onSignOutClicked() {
    // Clear the default account so that GoogleApiClient will not automatically
    // connect in the future.
    if (mGoogleApiClient.isConnected()) {
        Plus.AccountApi.clearDefaultAccount(mGoogleApiClient);
        mGoogleApiClient.disconnect();
    }

    //If Parse user was successfully signed up and logged in before
    if (ParseUser.getCurrentUser() != null){
        //Logout Parse user
        ParseUser.getCurrentUser().logOut();
    }

    showSignedOutUI();
}
项目:ParseApp    文件:MainActivity.java   
private void getUserDetailsFromParse() {
        parseUser = ParseUser.getCurrentUser();

//Fetch profile photo
        try {
            ParseFile parseFile = parseUser.getParseFile("profileThumb");
            byte[] data = parseFile.getData();
            Bitmap bitmap = BitmapFactory.decodeByteArray(data, 0, data.length);
            mProfileImage.setImageBitmap(bitmap);
        } catch (Exception e) {
            e.printStackTrace();
        }

        mEmailID.setText(parseUser.getEmail());
        mUsername.setText(parseUser.getUsername());

        Toast.makeText(MainActivity.this, "Welcome back " + mUsername.getText().toString(), Toast.LENGTH_SHORT).show();

    }
项目:bitdate    文件:ActionDataSource.java   
public static void getMatches(final ActionDataCallbacks callbacks) {
    ParseQuery<ParseObject> query = new ParseQuery<ParseObject>(TABLE_NAME);
    query.whereEqualTo(COLUMN_BY_USER, ParseUser.getCurrentUser().getObjectId());
    query.whereEqualTo(COLUMN_TYPE, TYPE_MATCHED);
    query.orderByDescending(COLUMN_UPDATED_AT);
    query.findInBackground(new FindCallback<ParseObject>() {
        @Override
        public void done(List<ParseObject> list, ParseException e) {
            if(e == null) {
                List<String> ids = new ArrayList<String>();
                for(ParseObject object : list) {
                    ids.add(object.getString(COLUMN_TO_USER));
                }

                if(callbacks != null) {
                    callbacks.onFetchedMatches(ids);
                }
            }
        }
    });
}
项目:bitdate    文件:SignInActivity.java   
private void getFacebookInfo() {
    Bundle parameters = new Bundle();
    parameters.putString("fields", "picture, first_name, id");
    new GraphRequest(AccessToken.getCurrentAccessToken(), "/me", parameters, HttpMethod.GET, new GraphRequest.Callback() {
        @Override
        public void onCompleted(GraphResponse graphResponse) {
            JSONObject user = graphResponse.getJSONObject();
            ParseUser currentUser = ParseUser.getCurrentUser();
            currentUser.put("firstName", user.optString("first_name"));
            currentUser.put("facebookId", user.optString("id"));
            currentUser.put("pictureURL", user.optJSONObject("picture").optJSONObject("data").optString("url"));
            currentUser.saveInBackground(new SaveCallback() {
                @Override
                public void done(ParseException e) {
                    if(e == null) {
                        Log.i(TAG, "User saved");
                        setResult(RESULT_OK);
                        finish();
                    }
                }
            });
        }
    }).executeAsync();
}
项目:Bookd_Android_App    文件:SignOnFragment.java   
private void signInFB() {
    List<String> permissions = Arrays.asList(
            "public_profile", "email");
    ParseFacebookUtils.logInWithReadPermissionsInBackground(getActivity(), permissions, new LogInCallback() {
        @Override
        public void done(ParseUser parseUser, ParseException e) {
            Log.d(TAG, "logInWithReadPermissionsInBackground done");
            if (e == null) {
                boolean fullyRegistered = parseUser.getBoolean(ParseTables.Users.FULLY_REGISTERED);
                if (parseUser == null)
                    Log.d("MyApp", "Uh oh. The user cancelled the Facebook login.");
                else if(!fullyRegistered || parseUser.isNew()) {
                    getFacebookData();
                } else {
                    Utils.goToMainActivity(getActivity());
                }
            } else {
                e.printStackTrace();
            }
        }
    });
}
项目:Bookd_Android_App    文件:SignOnFragment.java   
private void signIn() {
    boolean isValid = validate();
    if(isValid){
        ParseUser.logInInBackground(
                mUsername.getText().toString(),
                mPassword.getText().toString(),
                new LogInCallback() {
                    @Override
                    public void done(ParseUser parseUser, ParseException e) {
                        if (parseUser != null) {
                            Utils.goToMainActivity(getActivity());
                        } else {
                            new AlertDialog.Builder(getActivity())
                                    .setTitle("Login failed")
                                    .setCancelable(true)
                                    .setMessage("Try again!")
                                    .show();
                        }
                    }
                }
        );
    }
}
项目:diet    文件:PreviousEntriesFragment.java   
@Override
public void onSnackListUpdateComplete(ParseException e) {
    // Start the login activity if the session token is invalid.
    if(e != null && e.getCode() == ParseException.INVALID_SESSION_TOKEN){
        if(myActivity != null){
            Intent startLoginIntent = new Intent(myActivity, LoginActivity.class);
            ParseUser.logOutInBackground();
            myActivity.finish();
            startActivity(startLoginIntent);
        }
    }

    adapter.notifyDataSetChanged();

    if(progressOverlay != null){
        progressOverlay.setVisibility(View.GONE);
    }

    // Show the help message if appropriate.
    // That is, if we haven't already showed it for the current user this session and the
    // current user has zero entries. Only show the help message if the SnackList is pointing
    // at the current user.
    if(lastShowedHelpFor != ParseUser.getCurrentUser()
            && !showingHelp && SnackList.getInstance().size() == 0
            && ParseUser.getCurrentUser().equals(SnackList.getInstance().getUser())){
        try{
            showHelpMessage();
        } catch(IllegalStateException ignored){
            // In the case that onSaveInstanceState has been already been called, we ignore
            // the exception.
        }
    }
}
项目:connectedteam-android    文件:LoginFragment.java   
private void doLogin(final String email, final String password){
    if(email.length()<MIN_USERNAME_PASSWORD_LENGTH || password.length()<MIN_USERNAME_PASSWORD_LENGTH){
        setLastValidation("Please enter your email address and password");
        return;
    }
    setLastValidation("");
    requestingCount=1;
    onRequestingChanged();
    ParseUser.logInInBackground(email, password, new LogInCallback() {
        @Override
        public void done(ParseUser user, ParseException e) {
            requestingCount=0;
            onRequestingChanged();
            if(e!=null){
                setLastValidation(e.getMessage());
            }
            else{
                Session.getInstance().setCustomerHeader(user, password);
            }
        }
    });
}
项目:connectedteam-android    文件:EventDetailsFragment.java   
private void joinEvent() {
    showLoadingDialog(getString(R.string.submitting));
    ParseRelation<ParseObject> attendees = mEvent.getRelation("attendees");
    attendees.add(ParseUser.getCurrentUser());
    mEvent.saveInBackground(new SaveCallback() {
        @Override
        public void done(ParseException e) {
            dismissDialog();
            if(e!=null){
                new AlertDialog.Builder(getActivity()).setMessage(e.getMessage()).setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int i) {
                        getActivity().finish();
                    }
                }).setCancelable(false).show();
            }
            else{
                Toast.makeText(getActivity(), "You're going!", Toast.LENGTH_SHORT).show();
                aq.id(R.id.btn_submit).enabled(false);
                mHasJoined=true;
            }
        }
    });
}
项目:AutoTimeHelper    文件:GoogleMapFragment.java   
private void outTheRadius() {
    c = Calendar.getInstance();
    Date finishtime = c.getTime();

    Log.d(LOG, "he is standing now = true");

    Point finish = new Point(point.getLat(), point.getLong());
    Point start = new Point(pointRadius.getLat(), pointRadius.getLong());
    Line line = new Line(start, finish, ParseUser.getCurrentUser().getObjectId());
    Slice slice = new Slice(ParseUser.getCurrentUser().getObjectId(), line, starttime, finishtime,
            "rest time", SliceType.REST);
    controllerGoogleMap.addSlise(slice);
    Log.d(LOG, "start = " + start.toString());
    Log.d(LOG, "finish = " + finish.toString());
    Log.d(LOG, "slice = " + slice.toString());
    Log.d(LOG, " ---------------------------------------- ");
    listSlice.add(slice);
    starttime = finishtime;
}
项目:androidMobileDeviceManager    文件:BootstrapService.java   
public void authenticate(String email, String password)
{
    ParseUser.logInInBackground(email, password, new LogInCallback()
    {
        public void done(ParseUser user, ParseException e)
        {
            if (e == null && user != null)
            {
            }
            else if (user == null)
            {
                //  usernameOrPasswordIsInvalid();
            }
            else
            {
                //  somethingWentWrong();
            }
        }
    });
}
项目:diet    文件:DisplayDietitiansFragment.java   
private void dietitianSearch(final String userId) {
    ParseQuery<ParseUser> query = ParseQuery.getQuery("_User");
    query.whereEqualTo("objectId", userId);
    query.findInBackground(new FindCallback<ParseUser>() {
        @Override
        public void done(List<ParseUser> objects, ParseException e) {
            if (e == null) {
                if (!objects.isEmpty()) {
                    ParseUser result = objects.get(0);
                    ParseUser.getCurrentUser().put("myDietitian", result);
                    giveAccess(result);
                } else
                    Toast.makeText(cont, "User not found", Toast.LENGTH_LONG).show();
            } else
                Log.e("SEARCH ERROR", "ERROR IN SEARCHING");
        }
    });
}
项目:mirante    文件:HomeActivity.java   
@Override protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_home);
        ButterKnife.bind(this);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);

        if (ParseUser.getCurrentUser() != null) {
            getSelectedChannel();

            Log.e(LOG_TAG, "User is already logged in: " + ParseUser.getCurrentUser().get(Constants.PARSE_USER_ATTR_NAME));
//            showFeed();
        } else {
            retrieveChannels();
            Log.e(LOG_TAG, "User not logged in");

        }

    }
项目:ClassDiscuss    文件:MainActivity.java   
public void connectToParse(){
    Profiles profiles = Profiles.getInstance();
    String loginUser = profiles.loginEmail.replace("@ualberta.ca", "");
    //create new user
    ParseUser userParse = new ParseUser();
    userParse.setUsername(loginUser);
    userParse.setPassword(loginUser);
    userParse.setEmail(profiles.loginEmail);

    userParse.signUpInBackground(new SignUpCallback() {
        public void done(ParseException e) {
            if (e == null) {
                // Hooray! Let them use the app now.
                initiateParse();
                startApp();
            } else {
                // Sign up didn't succeed. Look at the ParseException
                // to figure out what went wrong
                login();
            }
        }
    });
}
项目:Cloud_Base-To-Do-App    文件:Settings.java   
@Override
public View onCreateView(LayoutInflater inflater,  ViewGroup container,  Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.settings_fragment, container, false);
    ParseUser currentUser = ParseUser.getCurrentUser();
    // Convert currentUser into String
    String struser = currentUser.getUsername().toString();

    TextView txtuser = (TextView) view.findViewById(R.id.txtuser);

    txtuser.setText(getString(R.string.loggedAs) + struser);

    logout = (Button) view.findViewById(R.id.logout);

    logout.setOnClickListener(new View.OnClickListener() {

        public void onClick(View arg0) {
            getActivity().finish();
        }
    });
    return view;
}
项目:Cloud_Base-To-Do-App    文件:LoginSignupActivity.java   
private void signup(String usernametxt, String passwordtxt) {
    if (!isEmpty()){

        int numberParse = 0;
        ParseQuery<ParseUser> numberofUsers = ParseUser.getQuery();  // Note to myself : count users in parse class
        try {
            numberParse=numberofUsers.count();
        } catch (ParseException e1) {
            e1.printStackTrace();
        }
        user = new ParseUser();
        user.setUsername(usernametxt);
        user.setPassword(passwordtxt);
        user.put("userID",numberParse+1);
        user.signUpInBackground(new SignUpCallback() {
            public void done(ParseException e) {
                checkSignup(e);
            }
        });
    }
}
项目:connectedteam-android    文件:Session.java   
public void setCustomerHeader(ParseUser customerData, String password){
    if(ParseUser.getCurrentUser()==customerData) {
        ParseInstallation installation = ParseInstallation.getCurrentInstallation();
        installation.put("user", customerData);
        installation.saveInBackground();

        mEmail = customerData.getEmail();
        mPassword = password;

        SharedPreferences settings = ConnectedApp.getContextStatic().getSharedPreferences(AppConfig.PREFS_FILE_USERPREFS, Context.MODE_PRIVATE);
        Editor e = settings.edit();
        e.putString(AppConfig.LOGIN_REMEMBERME_EMAIL, mEmail);
        e.putString(AppConfig.LOGIN_REMEMBERME_PASSWORD, mPassword);
        //e.putInt(AppConfig.LOGIN_REMEMBERME_CUSTOMER_ID, customerData.getObjectId());
        e.commit();

        setChanged(WhatChanged.LOG_IN_OUT);
    }
}
项目:FashionSpot    文件:SearchFragment.java   
@Override
public void onItemClicked(final View v, int position) {
    User userToFollow = mAdapter.get(position);
    User user = (User) ParseUser.createWithoutData(ParseUser.class, ParseUser.getCurrentUser().getObjectId());
    user.add("followersIds", userToFollow.getObjectId());
    user.saveInBackground(new SaveCallback() {
        @Override
        public void done(ParseException e) {
            if (e == null) {
                v.setVisibility(View.INVISIBLE);
            } else {
                e.printStackTrace();
            }
        }
    });
}
项目:IPRJapp    文件:ListUsersActivity.java   
public void openConversation(ArrayList<String> names, int pos) {
    ParseQuery<ParseUser> query = ParseUser.getQuery();
    query.whereEqualTo("username", names.get(pos));
    query.findInBackground(new FindCallback<ParseUser>() {
       public void done(List<ParseUser> user, com.parse.ParseException e) {
           if (e == null) {
               Intent intent = new Intent(getApplicationContext(), MessagingActivity.class);
               intent.putExtra("RECIPIENT_ID", user.get(0).getObjectId());
               startActivity(intent);
           } else {
               Toast.makeText(getApplicationContext(),
                   "Error finding that user",
                       Toast.LENGTH_SHORT).show();
           }
       }
    });
}
项目:Barter    文件:SignIn.java   
public void login(){
    final Intent myintent = new Intent(getActivity(),HomePage.class);

    ParseUser.logInInBackground(email.getText().toString(), pass.getText().toString(), new LogInCallback() {
        public void done(ParseUser user, ParseException e) {
            if (user != null) {
                Log.i("User", user.getEmail());
                boolean worked = user.getBoolean("emailVerified");
                if(!worked) {
                    showIssue("Please make sure you have verified your email");

                }else {
                    myuser = ParseUser.getCurrentUser();
                    startActivity(myintent);
                }
            } else {

                showIssue(e.toString());


            }
        }
    });
}