Skip to content

Instantly share code, notes, and snippets.

@codeversed
Created July 19, 2017 12:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codeversed/4d8901b6a31db811730b33cfd3701068 to your computer and use it in GitHub Desktop.
Save codeversed/4d8901b6a31db811730b33cfd3701068 to your computer and use it in GitHub Desktop.
AndroidForums node hierarchy HELL!
/**
Channels 3546 (not shown)
Devices 3543
Carriers 3544
Manufacturers 3663 (not used)
Featured Forums 26 (not shown)
Android News 3146
Android Lounge 12
VIP Area 148
Team Forums 43
Discussion 1 (not shown)
Archived Threads 3659 (not used)
Apps & Games 4
Wear 2776
TV 224
Auto 2779
House and Home 2778
Fitness & Health 2666
Accessories 501
Media 23
Themes 6
Rooting 3030
Questions 2400
Development 310 (not shown)
Developer Forums 330 (not shown)
Application Development 28
ROM Development 2535
Theme Development 2536
System Mods, Scripts and Hacks 2199
Wearable Devices 2665
Other Devices 222
Manufacturers 283
Carriers 20 (not shown / should be migrated)
Android Forums Community 9 (not shown)
Introductions 27
The Lounge 2
Contests & Giveaways 886
FAQs 48
Site Updates & Announcements 10
Suggestion Box & Feedback 11
*/
public static final int DEVICES = 3543;
public static final int CARRIERS = 3544;
public static final int MANUFACTURERS = 3663;
public static final int NEWS = 3146;
public static final int ANDROID_LOUNGE = 12;
public static final int WDSIB = 1745;
public static final int VIP = 148;
public static final int TEAM_FORUMS = 43;
public static final int GUIDE_CENTRAL = 118;
public static final int GUEST_QUESTIONS = 2406;
public static final int ADMIN_CENTRAL = 42;
public static final int MOD_CENTRAL = 30;
public static final int ARCHIVE = 3659;
public static final int APPS_GAMES = 4;
public static final int WEAR = 2775;
public static final int TV = 224;
public static final int ANDROID_AUTO = 2779;
public static final int HOUSE_HOME = 2778;
public static final int FITNESS_HEALTH = 2666;
public static final int ACCESSORIES = 501;
public static final int MEDIA = 23;
public static final int THEMES = 6;
public static final int ROOTING = 3030;
public static final int QUESTIONS = 2400;
public static final int APP_DEV = 28;
public static final int APP_INVENTOR = 273;
public static final int APP_REQUESTS = 38;
public static final int ALPHA_BETA_TEST = 178;
public static final int ROM_DEV = 2535;
public static final int THEME_DEV = 2536;
public static final int MODS_SCRIPTS_HACKS = 2199;
public static final int LOUNGE = 2;
public static final int AUTO_TALK = 2077;
public static final int FUNNY_MEMES = 3662;
public static final int Computers_IT = 36;
public static final int FORUM_GAMES = 37;
public static final int FOOD_BEVERAGE = 2192;
public static final int GAMING = 41;
public static final int GOOGLE = 1006;
public static final int LITERATURE = 429;
public static final int MUSIC = 217;
public static final int POLITICS = 170;
public static final int SPORTS = 265;
public static final int TV_FILM = 216;
public static final int INTRODUCTIONS = 27;
public static final int CONTESTS = 886;
public static final int FAQS = 48;
public static final int UPDATES = 10;
public static final int SUGGESTION_BOX = 11;
//MANUFACTURERS removed
public static final Integer[] PARENT_NODE_IDS = new Integer[] {
DEVICES, CARRIERS, NEWS, ANDROID_LOUNGE, VIP, TEAM_FORUMS, LOUNGE,
APPS_GAMES, WEAR, TV, ANDROID_AUTO, HOUSE_HOME, FITNESS_HEALTH, ACCESSORIES, MEDIA, THEMES,
ROOTING, QUESTIONS, APP_DEV, ROM_DEV, THEME_DEV, MODS_SCRIPTS_HACKS};
public static final Integer[] CHANNEL_PARENT_NODE_IDS = new Integer[] {
DEVICES, CARRIERS, MANUFACTURERS, APPS_GAMES};
public static boolean isParentNode(int id) {
return Arrays.asList(PARENT_NODE_IDS).contains(id);
}
public static boolean isChannelParentNode(Node node) {
int id = node.isChannel() ? node.channelId : node.forumId;
return Arrays.asList(CHANNEL_PARENT_NODE_IDS).contains(id);
}
public static boolean isChannelForumParentNode(Node node) {
int id = node.forumId;
return Arrays.asList(CHANNEL_PARENT_NODE_IDS).contains(id);
}
public static String[] findNameIcon(int id, String displayName) {
// Initially had this setup as a switch but performance testing proves that
// if statements are faster when dealing with a bunch of conditions
String[] nameIcon = new String[2];
if (id == DEVICES) {
nameIcon[0] = "Devices";
nameIcon[1] = GENERIC_PREFIX + "device";
} else if (id == CARRIERS) {
nameIcon[0] = "Carriers";
nameIcon[1] = GENERIC_PREFIX + "carrier";
} else if (id == MANUFACTURERS) {
nameIcon[0] = "Manufacturers";
nameIcon[1] = GENERIC_PREFIX + "default";
} else if (id == NEWS) {
nameIcon[0] = "News";
nameIcon[1] = GENERIC_PREFIX + "news";
} else if (id == ANDROID_LOUNGE) {
nameIcon[0] = "Android Lounge";
nameIcon[1] = GENERIC_PREFIX + "android";
} else if (id == WDSIB) {
nameIcon[0] = "What Device Should I buy?";
nameIcon[1] = GENERIC_PREFIX + "wdsib";
} else if (id == VIP) {
nameIcon[0] = "VIP Area";
nameIcon[1] = GENERIC_PREFIX + "vip";
} else if (id == TEAM_FORUMS) {
nameIcon[0] = "Team Forums";
nameIcon[1] = GENERIC_PREFIX + "team";
} else if (id == GUIDE_CENTRAL) {
nameIcon[0] = "Guides Central";
nameIcon[1] = GENERIC_PREFIX + "team";
} else if (id == GUEST_QUESTIONS) {
nameIcon[0] = "Guest Questions";
nameIcon[1] = GENERIC_PREFIX + "team";
} else if (id == ADMIN_CENTRAL) {
nameIcon[0] = "Admin Central";
nameIcon[1] = GENERIC_PREFIX + "admin";
} else if (id == MOD_CENTRAL) {
nameIcon[0] = "Moderator Central";
nameIcon[1] = GENERIC_PREFIX + "moderator";
} else if (id == ARCHIVE) {
nameIcon[0] = "Archived Threads";
nameIcon[1] = GENERIC_PREFIX + "app";
} else if (id == APPS_GAMES) {
nameIcon[0] = "Apps & Games";
nameIcon[1] = GENERIC_PREFIX + "app";
} else if (id == WEAR) {
nameIcon[0] = "Android Wear";
nameIcon[1] = GENERIC_PREFIX + "wear";
} else if (id == TV) {
nameIcon[0] = "Android TV";
nameIcon[1] = GENERIC_PREFIX + "tv";
} else if (id == ANDROID_AUTO) {
nameIcon[0] = "Android Auto";
nameIcon[1] = GENERIC_PREFIX + "car";
} else if (id == HOUSE_HOME) {
nameIcon[0] = "House & Home";
nameIcon[1] = GENERIC_PREFIX + "home";
} else if (id == FITNESS_HEALTH) {
nameIcon[0] = "Fitness & Health";
nameIcon[1] = GENERIC_PREFIX + "health";
} else if (id == ACCESSORIES) {
nameIcon[0] = "Accessories";
nameIcon[1] = GENERIC_PREFIX + "power";
} else if (id == MEDIA) {
nameIcon[0] = "Media";
nameIcon[1] = GENERIC_PREFIX + "media";
} else if (id == THEMES) {
nameIcon[0] = "Themes";
nameIcon[1] = GENERIC_PREFIX + "theme";
} else if (id == ROOTING) {
nameIcon[0] = "Rooting";
nameIcon[1] = GENERIC_PREFIX + "root";
} else if (id == QUESTIONS) {
nameIcon[0] = "Help";
nameIcon[1] = GENERIC_PREFIX + "help";
} else if (id == APP_DEV) {
nameIcon[0] = "Development";
nameIcon[1] = GENERIC_PREFIX + "android_dev";
} else if (id == APP_INVENTOR) {
nameIcon[0] = "App Inventor";
nameIcon[1] = GENERIC_PREFIX + "android_dev";
} else if (id == APP_REQUESTS) {
nameIcon[0] = "App Requests";
nameIcon[1] = GENERIC_PREFIX + "android_dev";
} else if (id == ALPHA_BETA_TEST) {
nameIcon[0] = "Alpha & Beta Testing";
nameIcon[1] = GENERIC_PREFIX + "android_dev";
} else if (id == ROM_DEV) {
nameIcon[0] = "Roms Development";
nameIcon[1] = GENERIC_PREFIX + "rom";
} else if (id == THEME_DEV) {
nameIcon[0] = "Theme Development";
nameIcon[1] = GENERIC_PREFIX + "theme_code";
} else if (id == MODS_SCRIPTS_HACKS) {
nameIcon[0] = "Mods, Scripts & Hacks";
nameIcon[1] = GENERIC_PREFIX + "mods";
} else if (id == LOUNGE) {
nameIcon[0] = "The Lounge";
nameIcon[1] = GENERIC_PREFIX + "lounge";
} else if (id == AUTO_TALK) {
nameIcon[0] = "Automotive Talk";
nameIcon[1] = GENERIC_PREFIX + "auto";
} else if (id == FUNNY_MEMES) {
nameIcon[0] = "Funny & Memes";
nameIcon[1] = GENERIC_PREFIX + "funny";
} else if (id == Computers_IT) {
nameIcon[0] = "Computers & IT";
nameIcon[1] = GENERIC_PREFIX + "computer";
} else if (id == FORUM_GAMES) {
nameIcon[0] = "Forum Games";
nameIcon[1] = GENERIC_PREFIX + "forum_games";
} else if (id == FOOD_BEVERAGE) {
nameIcon[0] = "Food & Beverage";
nameIcon[1] = GENERIC_PREFIX + "food_beverage";
} else if (id == GAMING) {
nameIcon[0] = "Gaming";
nameIcon[1] = GENERIC_PREFIX + "gaming";
} else if (id == GOOGLE) {
nameIcon[0] = "Google";
nameIcon[1] = GENERIC_PREFIX + "google";
} else if (id == LITERATURE) {
nameIcon[0] = "Literature";
nameIcon[1] = GENERIC_PREFIX + "book";
} else if (id == MUSIC) {
nameIcon[0] = "Music";
nameIcon[1] = GENERIC_PREFIX + "music";
} else if (id == POLITICS) {
nameIcon[0] = "Politics & Current Affairs";
nameIcon[1] = GENERIC_PREFIX + "newspaper";
} else if (id == SPORTS) {
nameIcon[0] = "Sports";
nameIcon[1] = GENERIC_PREFIX + "sports";
} else if (id == TV_FILM) {
nameIcon[0] = "TV & Film";
nameIcon[1] = GENERIC_PREFIX + "film";
} else if (id == INTRODUCTIONS) {
nameIcon[0] = "Introductions";
nameIcon[1] = GENERIC_PREFIX + "people";
} else if (id == CONTESTS) {
nameIcon[0] = "Contests & Giveaways";
nameIcon[1] = GENERIC_PREFIX + "giveaway";
} else if (id == FAQS) {
nameIcon[0] = "Frequently Asked Questions";
nameIcon[1] = GENERIC_PREFIX + "faq";
} else if (id == UPDATES) {
nameIcon[0] = "Updates & Announcements";
nameIcon[1] = GENERIC_PREFIX + "announcement";
} else if (id == SUGGESTION_BOX) {
nameIcon[0] = "Suggestion Box & Feedback";
nameIcon[1] = GENERIC_PREFIX + "feedback";
} else {
nameIcon[0] = displayName;
nameIcon[1] = GENERIC_PREFIX + "default";
}
return nameIcon;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment