package me.devsaki.hentoid.enums;

import android.support.v7.app.AppCompatActivity;

import java.util.List;

import me.devsaki.hentoid.R;
import me.devsaki.hentoid.activities.AboutActivity;
import me.devsaki.hentoid.activities.DownloadsActivity;
import me.devsaki.hentoid.activities.PrefsActivity;
import me.devsaki.hentoid.activities.QueueActivity;
import me.devsaki.hentoid.activities.sources.ASMHentaiActivity;
import me.devsaki.hentoid.activities.sources.EHentaiActivity;
import me.devsaki.hentoid.activities.sources.FakkuActivity;
import me.devsaki.hentoid.activities.sources.HentaiCafeActivity;
import me.devsaki.hentoid.activities.sources.HitomiActivity;
import me.devsaki.hentoid.activities.sources.NexusActivity;
import me.devsaki.hentoid.activities.sources.NhentaiActivity;
import me.devsaki.hentoid.activities.sources.PururinActivity;
import me.devsaki.hentoid.activities.sources.TsuminoActivity;

public enum DrawerItem {

    NHENTAI("NHENTAI", R.drawable.ic_menu_nhentai, NhentaiActivity.class),
    HCAFE("HENTAI CAFE", R.drawable.ic_menu_hentaicafe, HentaiCafeActivity.class),
    HITOMI("HITOMI", R.drawable.ic_menu_hitomi, HitomiActivity.class),
    ASM("ASMHENTAI", R.drawable.ic_menu_asmhentai, ASMHentaiActivity.class),
    TSUMINO("TSUMINO", R.drawable.ic_menu_tsumino, TsuminoActivity.class),
    PURURIN("PURURIN", R.drawable.ic_menu_pururin, PururinActivity.class),
    EHENTAI("E-HENTAI", R.drawable.ic_menu_ehentai, EHentaiActivity.class),
    FAKKU("FAKKU", R.drawable.ic_menu_fakku, FakkuActivity.class),
    NEXUS("NEXUS", R.drawable.ic_menu_nexus, NexusActivity.class),
    //    MIKAN("MIKAN SEARCH", R.drawable.ic_menu_mikan, MikanSearchActivity.class),
    HOME("HOME", R.drawable.ic_menu_home, DownloadsActivity.class),
    QUEUE("QUEUE", R.drawable.ic_menu_queue, QueueActivity.class),
    PREFS("PREFERENCES", R.drawable.ic_menu_prefs, PrefsActivity.class),
    ABOUT("ABOUT", R.drawable.ic_menu_about, AboutActivity.class);

    public static List<Class<? extends AppCompatActivity>> activityClasses;

    public final String label;
    public final int icon;
    public final Class<? extends AppCompatActivity> activityClass;

    DrawerItem(String label, int icon, Class<? extends AppCompatActivity> activityClass) {
        this.label = label;
        this.icon = icon;
        this.activityClass = activityClass;
    }

    public static Class<? extends AppCompatActivity> getActivity(int position) {
        return activityClasses.get(position);
    }

    public static int getPosition(Class<? extends AppCompatActivity> activityClass) {
        return activityClasses.indexOf(activityClass);
    }
}

@@ -93,18 +93,62 @@
 java
-.util.List
+x.annotation.Nonnull;%0Aimport javax.annotation.Nullable
 ;%0A%0Ai
@@ -2004,85 +2004,8 @@
 );%0A%0A
-    public static List%3CClass%3C? extends AppCompatActivity%3E%3E activityClasses;%0A%0A
     
@@ -2314,32 +2314,46 @@
 tyClass;%0A    %7D%0A%0A
+    @Nullable%0A
     public stati
@@ -2420,32 +2420,138 @@
 n) %7B%0A       
+ int result = 0;%0A        for (DrawerItem item : DrawerItem.values()) %7B%0A            if (position == result)
  return 
 activityClas
@@ -2530,32 +2530,37 @@
  result) return 
+item.
 activityClasses.
@@ -2560,24 +2560,61 @@
 lass
-es.get(position)
+;%0A            result++;%0A        %7D%0A        return null
 ;%0A  
@@ -2652,16 +2652,25 @@
 osition(
+@Nonnull 
 Class%3C? 
@@ -2721,23 +2721,107 @@
         
-return 
+int result = 0;%0A        for (DrawerItem item : DrawerItem.values()) %7B%0A            if (item.
 activity
@@ -2829,18 +2829,15 @@
 lass
-es.indexOf
+.equals
 (act
@@ -2847,16 +2847,82 @@
 tyClass)
+) return result;%0A            result++;%0A        %7D%0A        return -1
 ;%0A    %7D%0A

Fix init issue