Android Open Source - Team7-301Project Forum Entry 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;
/* w w w .j a  va 2 s . c o m*/
import ca.ualberta.cs.models.ForumEntry;

/**
 * This is a singleton class that is useful for setting a focus ForumEntry. By this, I mean that this 
 * singleton allows a person to set a ForumEntry which anyone can see and 'focus' on. It
 * provides a global access point to one ForumEntry.
 *
 * @author bbruner
 */


public class ForumEntrySingleton 
{
  private static ForumEntrySingleton forumEntrySingleton = null;
  private ForumEntry forumEntry;
  private boolean replyFlag;
  private int replyIndex=0;
  private ForumEntrySingleton()
  {
    super();
    this.forumEntry = null;
  }
  
  /**
   * Get an instance of this singleton.
   * @return ForumEntrySingleton
   */
  public static ForumEntrySingleton getInstance()
  {
    if(forumEntrySingleton == null)
    {
      forumEntrySingleton = new ForumEntrySingleton();
    }
    return forumEntrySingleton;
  }
  
  /**
   * Set the ForumEntry in this singleton.
   * @param forumEntry
   */
  public void setForumEntry(ForumEntry forumEntry)
  {
    this.forumEntry = forumEntry;
  }
  
  
  /**
   * Get the ForumEntry in this singleton. 
   * @return ForumEntry Will return null if a call to setForumEntry has not been made yet.
   */
  public ForumEntry getForumEntry()
  {
    return this.forumEntry;
  }

  /**
   * Set a flag. This is used by QuestionActivity to tell AskActivity
   * it should set up its screen to add a reply to the question.
   */
  public void setReplyFlag()
  {
    this.replyFlag = true;
  }
  /**
   * Clear a flag. This is used by QuestionActivity to tell AskActivity
   * it should not set up its screen to add a reply to the question.
   */
  public void clearReplyFlag()
  {
    this.replyFlag = false;
  }
  
  /**
   * This is used by AskActivity to see if it should set up the 
   * screen for a reply or not.
   * @return true if setting up for a reply, false otherwise.
   */
  public boolean isReplyFlagSet()
  {
    return this.replyFlag;
  }
}




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