@DebugLog public static void checkDownloadedLanguage(Context context,ServerUtil serverUtil,boolean forceDownload,boolean fromService){
  SharedPrefUtil mSharedPrefs=new SharedPrefUtil(context);
  String downloadedLanguage=mSharedPrefs.getDownloadedLanguage();
  String activeLanguage=UsefulBits.getActiveLanguage(context);
  if (serverUtil == null)   serverUtil=new ServerUtil(context);
  if (mSharedPrefs.getSavedLanguage() == null || forceDownload) {
    Log.d(TAG,"Downloading language files. Forced: " + forceDownload);
    mSharedPrefs.getLanguageStringsFromServer(activeLanguage.toLowerCase(),serverUtil);
    if (mSharedPrefs.isDebugEnabled()) {
      if (forceDownload && !fromService) {
        showSimpleToast(context,"Language files downloaded because it was forced",Toast.LENGTH_SHORT);
      }
 else       if (!fromService)       showSimpleToast(context,"Language files downloaded because there were none",Toast.LENGTH_SHORT);
    }
  }
 else {
    long dateMillis=mSharedPrefs.getSavedLanguageDate();
    String dateStr=UsefulBits.getFormattedDate(context,dateMillis);
    Log.d(TAG,"Language files are dated: " + dateStr);
    if (mSharedPrefs.isDebugEnabled() && !fromService)     showSimpleToast(context,"Language files are dated: " + dateStr,Toast.LENGTH_SHORT);
    if (!downloadedLanguage.equalsIgnoreCase(activeLanguage)) {
      if (mSharedPrefs.isDebugEnabled() && !fromService)       showSimpleToast(context,"Downloaded language files did not match the preferred language",Toast.LENGTH_SHORT);
      Log.d(TAG,"Downloaded language files did not match the preferred language:" + newLine() + "Current downloaded language: "+ downloadedLanguage+ newLine()+ "Active language: "+ activeLanguage+ newLine()+ "Downloading the correct language");
      mSharedPrefs.getLanguageStringsFromServer(activeLanguage.toLowerCase(),serverUtil);
    }
  }
}

@ DebugLog public static void checkDownloadedLanguage ( Context context , ServerUtil serverUtil , boolean forceDownload , boolean fromService ) { SharedPrefUtil mSharedPrefs = new SharedPrefUtil ( context ) ; String downloadedLanguage = mSharedPrefs . getDownloadedLanguage ( ) ; String activeLanguage = UsefulBits . getActiveLanguage ( context ) ; if ( serverUtil == null ) serverUtil = new ServerUtil ( context ) ; if ( mSharedPrefs . getSavedLanguage ( ) == null || forceDownload ) { Log . d ( TAG , "Downloading language files. Forced: " + forceDownload ) ; mSharedPrefs . getLanguageStringsFromServer ( activeLanguage . toLowerCase ( ) , serverUtil ) ; if ( mSharedPrefs . isDebugEnabled ( ) ) { if ( forceDownload && ! fromService ) { showSimpleToast ( context , "Language files downloaded because it was forced" , Toast . LENGTH_SHORT ) ; } else if ( ! fromService ) showSimpleToast ( context , "Language files downloaded because there were none" , Toast . LENGTH_SHORT ) ; } } else { long dateMillis = mSharedPrefs . getSavedLanguageDate ( ) ; String dateStr = UsefulBits . getFormattedDate ( context , dateMillis ) ; Log . d ( TAG , "Language files are dated: " + dateStr ) ; if ( mSharedPrefs . isDebugEnabled ( ) && ! fromService ) showSimpleToast ( context , "Language files are dated: " + dateStr , Toast . LENGTH_SHORT ) ; if ( ! downloadedLanguage . equalsIgnoreCase ( activeLanguage ) ) { if ( mSharedPrefs . isDebugEnabled ( ) && ! fromService ) showSimpleToast ( context , "Downloaded language files did not match the preferred language" , Toast . LENGTH_SHORT ) ; Log . d ( TAG , "Downloaded language files did not match the preferred language:" + newLine ( ) + "Current downloaded language: " + downloadedLanguage + newLine ( ) + "Active language: " + activeLanguage + newLine ( ) + "Downloading the correct language" ) ; mSharedPrefs . getLanguageStringsFromServer ( activeLanguage . toLowerCase ( ) , serverUtil ) ; } } }
checks the already downloaded languages if they are the correct ones if not downloaded it will download them
