Android Open Source - Team7-301Project Browse Request Singleton






From Project

Back to project page Team7-301Project.

License

The source code is released under:

Apache License

If you think the Android project Team7-301Project 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 ca.ualberta.cs.intent_singletons;
/*from  w  w w  .  ja v a  2 s . co  m*/
/**
 * This is a singleton used for passing around browse requests to activites.
 * A browse request is simply one activity asking the browse activity to 
 * display everything that matches a certain string.
 * @author bbruner
 *
 */
public class BrowseRequestSingleton 
{
  private static BrowseRequestSingleton browseRequestSingleton = null;
  private String searchToken;
  private String viewToken;
  
  public static final String ON_LINE_VIEW_SEARCH = "Search";
  public static final String ON_LINE_VIEW = "Browse";
  public static final String READ_LATER_VIEW = "Saved";
  public static final String FAVOURITES_VIEW = "Favourites";
  public static final String MY_AUTHORED_VIEW = "My Questions";
  
  public static final String SEARCH_EVERYTHING = "";
  
  private BrowseRequestSingleton()
  {
    super();
    searchToken = BrowseRequestSingleton.SEARCH_EVERYTHING;
    viewToken = BrowseRequestSingleton.ON_LINE_VIEW;
  }
  
  /**
   * Get an instance of this singleton.
   * @return BrowseRequestionSingleton
   */
  public static BrowseRequestSingleton getInstance()
  {
    if(browseRequestSingleton == null)
    {
      browseRequestSingleton = new BrowseRequestSingleton();
    }
    return browseRequestSingleton;
  }
  
  /**
   * Set the view token to what sort of view should be used. ie, read later, favourites, etc..
   * @param viewToken The token. Take this from BrowseRequestSingleton. ie, BrowseRequestSingleton.ON_LINE_VIEW.
   */
  public void setViewToken(String viewToken)
  {
    this.viewToken = viewToken;
  }
  
  /**
   * Get the view token to what sort of view should be used. ie, read later, favourites, etc..
   * @return the view token.
   */
  public String getViewToken()
  {
    return this.viewToken;
  }
  
  /**
   * Set the search token in this singleton.
   * @param searchToken To search for everything (wild card) give as input 
   * BrowseRequestSingleton.SEARCH_EVERYTHING
   */
  public void setSearchToken(String searchToken)
  {
    this.searchToken = searchToken;
  }
  
  /**
   * Get the search token in this singleton
   * @return String The search token
   */
  public String getSearchToken()
  {
    return this.searchToken;
  }
}




Java Source Code List

ca.ualberta.cs.controllers.AuthorController.java
ca.ualberta.cs.controllers.BrowseController.java
ca.ualberta.cs.controllers.ForumEntryController.java
ca.ualberta.cs.controllers.SearchController.java
ca.ualberta.cs.f14t07_application.Hits.java
ca.ualberta.cs.f14t07_application.LogoActivity.java
ca.ualberta.cs.f14t07_application.Post.java
ca.ualberta.cs.intent_singletons.BrowseRequestSingleton.java
ca.ualberta.cs.intent_singletons.ContextSingleton.java
ca.ualberta.cs.intent_singletons.EntrySingleton.java
ca.ualberta.cs.intent_singletons.ForumEntrySingleton.java
ca.ualberta.cs.models.Answer.java
ca.ualberta.cs.models.AuthorModel.java
ca.ualberta.cs.models.DataManager.java
ca.ualberta.cs.models.Entry.java
ca.ualberta.cs.models.ForumEntryList.java
ca.ualberta.cs.models.ForumEntry.java
ca.ualberta.cs.models.JsonDriver.java
ca.ualberta.cs.models.Observable.java
ca.ualberta.cs.models.Question.java
ca.ualberta.cs.models.Reply.java
ca.ualberta.cs.remote_server.NetworkChecker.java
ca.ualberta.cs.remote_server.SearchHit.java
ca.ualberta.cs.remote_server.SearchResponse.java
ca.ualberta.cs.remote_server.SimpleSearchCommand.java
ca.ualberta.cs.views.AnswerActivity.java
ca.ualberta.cs.views.AnswerListAdapter.java
ca.ualberta.cs.views.AskActivity.java
ca.ualberta.cs.views.BrowseActivity.java
ca.ualberta.cs.views.HelpActivity.java
ca.ualberta.cs.views.MainScreenActivity.java
ca.ualberta.cs.views.Observer.java
ca.ualberta.cs.views.QuestionActivity.java
ca.ualberta.cs.views.ReplyListAdapter.java