Android Open Source - android_twitter_client Sample Model






From Project

Back to project page android_twitter_client.

License

The source code is released under:

GNU General Public License

If you think the Android project android_twitter_client 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.github.snambi.twitterclient.models;
/*from   w ww.ja  va 2s  . c  o  m*/
import java.util.List;

import org.json.JSONException;
import org.json.JSONObject;

import com.activeandroid.Model;
import com.activeandroid.annotation.Column;
import com.activeandroid.annotation.Table;
import com.activeandroid.query.Select;

/*
 * This is a temporary, sample model that demonstrates the basic structure
 * of a SQLite persisted Model object. Check out the ActiveAndroid wiki for more details:
 * https://github.com/pardom/ActiveAndroid/wiki/Creating-your-database-model
 * 
 */
@Table(name = "items")
public class SampleModel extends Model {
  // Define table fields
  @Column(name = "name")
  private String name;

  public SampleModel() {
    super();
  }

  // Parse model from JSON
  public SampleModel(JSONObject object){
    super();

    try {
      this.name = object.getString("title");
    } catch (JSONException e) {
      e.printStackTrace();
    }
  }

  // Getters
  public String getName() {
    return name;
  }

  // Record Finders
  public static SampleModel byId(long id) {
    return new Select().from(SampleModel.class).where("id = ?", id).executeSingle();
  }

  public static List<SampleModel> recentItems() {
    return new Select().from(SampleModel.class).orderBy("id DESC").limit("300").execute();
  }
}




Java Source Code List

com.github.snambi.twitterclient.TwitterApplication.java
com.github.snambi.twitterclient.activities.ComposeActivity.java
com.github.snambi.twitterclient.activities.LoginActivity.java
com.github.snambi.twitterclient.activities.ProfileActivity.java
com.github.snambi.twitterclient.activities.TimelineActivity.java
com.github.snambi.twitterclient.adapters.TwitterArrayAdapter.java
com.github.snambi.twitterclient.clients.TwitterRestClient.java
com.github.snambi.twitterclient.db.TweetDbHelper.java
com.github.snambi.twitterclient.fragemets.HomeTimelineFragment.java
com.github.snambi.twitterclient.fragemets.MentionsTimelineFragment.java
com.github.snambi.twitterclient.fragemets.ProfileHeaderFragment.java
com.github.snambi.twitterclient.fragemets.TwitterListFragment.java
com.github.snambi.twitterclient.fragemets.UserTimelineFragment.java
com.github.snambi.twitterclient.listeners.EndlessScrollListener.java
com.github.snambi.twitterclient.listeners.FragmentTabListener.java
com.github.snambi.twitterclient.models.SampleModel.java
com.github.snambi.twitterclient.models.Tweet.java
com.github.snambi.twitterclient.models.User.java
com.github.snambi.twitterclient.utils.TwitterTimeUtils.java