Android Open Source - photo-paper User

From Project

Back to project page photo-paper.


The source code is released under:

MIT License

If you think the Android project photo-paper listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.lukekorth.android_500px.models;
/*from w  w  w  . j av a 2s  .c om*/
import android.content.Context;
import android.content.Intent;

import com.activeandroid.Model;
import com.activeandroid.annotation.Column;
import com.activeandroid.annotation.Table;
import com.activeandroid.query.Select;
import com.fivehundredpx.api.auth.AccessToken;

@Table(name = "User")
public class User extends Model {

    @Column(name = "user_id")
    public int id;

    @Column(name = "username")
    public String userName;

    @Column(name = "firstname")
    public String firstName;

    @Column(name = "lastname")
    public String lastName;

    @Column(name = "photo")
    public String photo;

    @Column(name = "access_token")
    public String accessToken;

    @Column(name = "access_token_secret")
    public String accessTokenSecret;

    public static User getUser() {
        return new Select().from(User.class)

    public static boolean isUserLoggedIn() {
        return new Select().from(User.class)

    public static void logout() {
        new Select().from(User.class)

    public static void newUser(Context context, AccessToken accessToken) {
        User user = getUser();
        if (user != null) {

        user = new User();
        user.accessToken = accessToken.getToken();
        user.accessTokenSecret = accessToken.getTokenSecret();;

        context.startService(new Intent(context, UserInfoIntentService.class));

    public static AccessToken getLoggedInUserAccessToken() {
        User user = getUser();
        if (user == null) {
            return null;

        return new AccessToken(user.accessToken, user.accessTokenSecret);


Java Source Code List