Skip to content

utilities.DHC

Vikramaditya Kukreja edited this page Jan 29, 2017 · 1 revision

package com.csatimes.dojma.utilities.DHC
access public

##About A helper class that contains various constants used throughout the project. Also contains useful static functions.

###Functions

####1. log parameter - String logMessage
return - void

Notes - Used to print a message to the log with the tag com.csatimes.dojma. Can be called anywhere in the app.

   DHC.log("my Message");

####2. makeCustomSnackbar parameter - View view ,String message ,int bgColor ,int textColor
return - Snackbar mySnackbar

Notes - Returns a Snackbar object with the specified colors

   Snackbar mySnackbar = DHC.makeCustomSnackbar(myView,"My message",0xFF000000,0xFFFFFFFF);

####3. isOnline parameter - Context context
return - boolean isOnline

Notes - This method only checks whether the device is connected to a network or not. Not to be used for checking for active internet connection

   boolean isUserOnline;
   //For Activity/Service
   isUserOnline = DHC.isOnline(this);
   //For fragments
   isUserOnline = DHC.isOnline(getContext());
   //For inner classes inside an activity or a service
   isUserOnline = DHC.isOnline(MyActivity.this);
   //in general
   isUserOnline = DHC.isOnline(myContext);

###Constants All constants are public static and final

    public static final String USER_PREFERENCES = "USER_PREFS";

    public static final String DoJMA_FACEBOOK_URL = "https://www.facebook.com/DoJMABITSGoa";
    public static final String DoJMA_FACEBOOK_PAGE_ID = "DoJMABITSGoa";
    public static final String BITS_GOA_LCD_LINK = "http://cc.bits-goa.ac.in/enotice/Lcd.php";
    public static final String REALM_DOJMA_DATABASE = "DOJMA_DATABASE";

    public static final String UPDATE_SERVICE_DOWNLOAD_SUCCESS = "com.csatimes.dojma.update.service.dns";
    public static final String UPDATE_SERVICE_NO_SUCCESS = "com.csatimes.dojma.update.service.ns";
    public static final String UPDATE_SERVICE_DOJMA_JSON_ADDRESS_PREFIX = "http://csatimes.co.in/dojma/page/";
    public static final String UPDATE_SERVICE_DOJMA_JSON_ADDRESS_SUFFIX = "/?json=all";
    public static final String UPDATE_SERVICE_HERALD_PAGES = "HERALD_PAGES";
    public static final String UTILITIES_MISC_MESSAGE = "miscMessage";

    public static final int UPDATE_SERVICE_PENDING_INTENT_CODE = 243;
    public static final int UPDATE_SERVICE_NOTIFICATION_CODE = 42;
    public static final int UPDATE_SERVICE_HERALD_DEFAULT_PAGES = 16;

    public static final int SEARCH_ITEM_TYPE_TITLE = 0;
    public static final int SEARCH_ITEM_TYPE_HERALD_ARTICLES_FAVOURITE = 1;
    public static final int SEARCH_ITEM_TYPE_HERALD_ARTICLE = 2;
    public static final int SEARCH_ITEM_TYPE_GAZETTE = 3;
    public static final int SEARCH_ITEM_TYPE_EVENT = 4;
    public static final int SEARCH_ITEM_TYPE_CONTACT = 5;
    public static final int SEARCH_ITEM_TYPE_LINK = 6;
    public static final int SEARCH_ITEM_TYPE_MESS = 7;
    public static final int SEARCH_ITEM_TYPE_POSTER = 8;

    public static final int CONTACT_ITEM_TYPE_TITLE = 9;
    public static final int CONTACT_ITEM_TYPE_CONTACT = 10;

    public static final int UTILITIES_ITEM_TYPE_CONTACTS = 0;
    public static final int UTILITIES_ITEM_TYPE_CONTACTS_TAXI = 1;
    public static final int UTILITIES_ITEM_TYPE_MESS = 2;
    public static final int UTILITIES_ITEM_TYPE_LINKS = 3;
    public static final int UTILITIES_ITEM_TYPE_MISC = 4;
    public static final int UTILITIES_ITEM_TYPE_MAP = 5;

    public static final int MAIN_ACTIVITY_HERALD_POS = 0;
    public static final int MAIN_ACTIVITY_GAZETTES_POS = 1;
    public static final int MAIN_ACTIVITY_EVENTS_POS = 2;
    public static final int MAIN_ACTIVITY_UTILITIES_POS = 3;
Clone this wiki locally