Android Open Source - final_year_frontend Parent Preferences Fragment






From Project

Back to project page final_year_frontend.

License

The source code is released under:

MIT License

If you think the Android project final_year_frontend 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.james.erebus.core;
/*w w  w.  java2 s .c  o  m*/
import java.util.ArrayList;
import android.app.Activity;
import android.app.DialogFragment;

/**
 * Parent class for both PreferencesFragments that implements some common functionality
 */

public abstract class ParentPreferencesFragment extends DialogFragment {
  
  public interface NoticeDialogListener {
        public void onDialogPositiveClick(DialogFragment dialog);
        public void onDialogNegativeClick(DialogFragment dialog);
    }
    
    // Use this instance of the interface to deliver action events
  protected NoticeDialogListener mListener;
    
  protected boolean mIsLargeLayout;
  
  protected int filterPrefsNumber;
  protected int filterTitleNumber;
  
  
  /**
   * Converts the selected item ID to one of the enums in {@link com.james.erebus.core.TournyMatchOptions}
   * @param id the selected item ID
   * @return The enum entry that the id refers to
   */
  protected TournyMatchOptions idToEnum(int id)
  {
    switch(id)
    {
    case 0: return TournyMatchOptions.subbed;
    case 1: return TournyMatchOptions.unsubbed;
    case 2: return TournyMatchOptions.ongoing; 
    case 3: return TournyMatchOptions.past; 
    case 4: return TournyMatchOptions.future; 
    default: return null;
    }
  }
  
  /**
   * Makes sure that boxes that were previously ticked in the filtering Fragment stay ticked when it's re-opened
   * @param prefs The list of preferences to be used
   * @return An array of booleans representing ticked/unticked state of the options
   */
  public boolean[] generateTickedBoxes(ArrayList<TournyMatchOptions> prefs)
  {
    boolean[] bArr = new boolean[TournyMatchOptions.values().length];
    int i = 0;
    for(TournyMatchOptions mp : TournyMatchOptions.values())
    {
      bArr[i] = prefs.contains(mp);
      i++;
    }
    return bArr;
  }
  
  @Override
    public void onAttach(Activity activity) {
        super.onAttach(activity);
        // Verify that the host activity implements the callback interface
        try {
            // Instantiate the NoticeDialogListener so we can send events to the host
            mListener = (NoticeDialogListener) activity;
        } catch (ClassCastException e) {
            // The activity doesn't implement the interface, throw exception
            throw new ClassCastException(activity.toString()
                    + " must implement NoticeDialogListener");
        }
    }
}




Java Source Code List

com.james.erebus.GCMIntentService.java
com.james.erebus.JSONJava.CDL.java
com.james.erebus.JSONJava.CookieList.java
com.james.erebus.JSONJava.Cookie.java
com.james.erebus.JSONJava.HTTPTokener.java
com.james.erebus.JSONJava.HTTP.java
com.james.erebus.JSONJava.JSONArray.java
com.james.erebus.JSONJava.JSONException.java
com.james.erebus.JSONJava.JSONML.java
com.james.erebus.JSONJava.JSONObject.java
com.james.erebus.JSONJava.JSONString.java
com.james.erebus.JSONJava.JSONStringer.java
com.james.erebus.JSONJava.JSONTokener.java
com.james.erebus.JSONJava.JSONWriter.java
com.james.erebus.JSONJava.XMLTokener.java
com.james.erebus.JSONJava.XML.java
com.james.erebus.core.C2DMRegistrationReceiver.java
com.james.erebus.core.CustomOnItemSelectedListener.java
com.james.erebus.core.MainActivity.java
com.james.erebus.core.MatchActivity.java
com.james.erebus.core.MatchButtonActivity.java
com.james.erebus.core.MatchOptions.java
com.james.erebus.core.MatchPreferencesFragment.java
com.james.erebus.core.Match.java
com.james.erebus.core.NotificationActivity.java
com.james.erebus.core.Notification.java
com.james.erebus.core.ParentPreferencesFragment.java
com.james.erebus.core.TournamentActivity.java
com.james.erebus.core.TournamentButtonActivity.java
com.james.erebus.core.TournamentFactory.java
com.james.erebus.core.TournamentPreferencesFragment.java
com.james.erebus.core.Tournament.java
com.james.erebus.core.TournyMatchOptions.java
com.james.erebus.misc.AppConsts.java
com.james.erebus.misc.MiscJsonHelpers.java
com.james.erebus.misc.misc.java
com.james.erebus.networking.AddDeviceTask.java
com.james.erebus.networking.AddMatchSubscriptionTask.java
com.james.erebus.networking.AddTournamentSubscriptionToServerTask.java
com.james.erebus.networking.GcmRegisterDeviceTask.java
com.james.erebus.networking.GetMatchesTask.java
com.james.erebus.networking.GetTournamentsTask.java
com.james.erebus.networking.MatchRetriever.java
com.james.erebus.networking.MatchSubscriptionManager.java
com.james.erebus.networking.MiscNetworkingHelpers.java
com.james.erebus.networking.NotificationManager.java
com.james.erebus.networking.RemoveMatchSubscriptionFromServerTask.java
com.james.erebus.networking.RemoveTournamentSubscriptionFromServerTask.java
com.james.erebus.networking.Retriever.java
com.james.erebus.networking.SubscriptionManager.java
com.james.erebus.networking.SubscriptionRetriever.java
com.james.erebus.networking.TournamentRetriever.java
com.james.erebus.networking.TournamentSubscriptionManager.java