package net.ilexiconn.hipster.fragment;

import net.ilexiconn.hipster.R;
import net.ilexiconn.hipster.fragment.main.DashboardFragment;
import net.ilexiconn.hipster.fragment.main.GradesFragment;
import net.ilexiconn.hipster.fragment.main.SettingsFragment;
import net.ilexiconn.hipster.fragment.main.TimetableFragment;

public enum Fragments {
    DASHBOARD(R.id.nav_dashboard,  DashboardFragment.class, R.drawable.ic_class_black_24dp),
    GRADES(R.id.nav_grades, GradesFragment.class, R.drawable.ic_done_all_black_24dp),
    TIMETABLE(R.id.nav_timetable, TimetableFragment.class, R.drawable.ic_watch_later_black_24dp),
    SETTINGS(R.id.nav_settings, SettingsFragment.class, R.drawable.ic_settings_black_24dp);

    private int id;
    private Class fragment;
    private int icon;

    Fragments(int id, Class fragment, int icon) {
        this.id = id;
        this.fragment = fragment;
        this.icon = icon;
    }

    public int getId() {
        return id;
    }

    public IFragment getFragment() {
        try {
            return (IFragment) fragment.newInstance();
        }catch (Exception e){
            return null;
        }
    }

    public int getIcon() {
        return icon;
    }

    public static Fragments getFragmentFromID(int id) {
        for (Fragments fragments : values()) {
            if (fragments.id == id) {
                return fragments;
            }
        }
        return null;
    }
}

@@ -369,16 +369,19 @@
 hboard, 
+new
  Dashboa
@@ -382,38 +382,34 @@
 ashboardFragment
-.class
+()
 , R.drawable.ic_
@@ -454,16 +454,20 @@
 _grades,
+ new
  GradesF
@@ -465,38 +465,34 @@
 w GradesFragment
-.class
+()
 , R.drawable.ic_
@@ -546,16 +546,20 @@
 metable,
+ new
  Timetab
@@ -560,38 +560,34 @@
 imetableFragment
-.class
+()
 , R.drawable.ic_
@@ -642,16 +642,20 @@
 ettings,
+ new
  Setting
@@ -667,14 +667,10 @@
 ment
-.class
+()
 , R.
@@ -736,21 +736,25 @@
 private 
-Class
+IFragment
  fragmen
@@ -805,13 +805,17 @@
 id, 
-Class
+IFragment
  fra
@@ -1022,133 +1022,24 @@
     
-try %7B%0A            return (IFragment) fragment.newInstance();%0A        %7Dcatch (Exception e)%7B%0A            return null;%0A        %7D
+return fragment;
 %0A   

Revert "Update Fragments.java"