// Path: app/src/main/java/com/referendum/uoctubre/UOctubreApplication.java
// public class UOctubreApplication extends Application {
// 
//     private static UOctubreApplication sInstance;
// 
//     @Override
//     public void onCreate() {
//         super.onCreate();
// 
//         sInstance = this;
// 
//         Fabric.with(this, new Crashlytics());
// 
//         StringsManager.initialize();
// 
//         TwitterConfig config = new TwitterConfig.Builder(this)
//                 .logger(new DefaultLogger(Log.DEBUG))
//                 .twitterAuthConfig(new TwitterAuthConfig(Constants.TWITTER_CONSUMER_KEY, Constants.TWITTER_CONSUMER_SECRET))
//                 .debug(true)
//                 .build();
//         Twitter.initialize(config);
// 
//         //Create Notification channel in Android O
//         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
//             NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
//             if (notificationManager != null) {
//                 NotificationChannel mChannel = new NotificationChannel("referendum",
//                         StringsManager.getString("notification_channel_name"), NotificationManager.IMPORTANCE_HIGH);
//                 mChannel.setDescription(StringsManager.getString("notification_channel_description"));
//                 mChannel.enableLights(true);
//                 mChannel.setLightColor(Color.RED);
//                 notificationManager.createNotificationChannel(mChannel);
//             }
//         }
//     }
// 
//     public static UOctubreApplication getInstance() {
//         return sInstance;
//     }
// }


import android.content.res.Resources;
import android.util.Log;
import android.util.Xml;
import com.crashlytics.android.Crashlytics;
import com.referendum.uoctubre.UOctubreApplication;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.IllegalFormatException;
        mStrings = new HashMap<>();
        refreshLiterals();
    }

    public static String getString(String id, Object... args) {
        synchronized (lock) {
            if (mStrings.containsKey(id)) {
                try {
                    return String.format(mStrings.get(id).toString(), args);
                } catch (IllegalFormatException e) {
                    Log.e(TAG, "A string was found with wrong format parameters! The string is: " + id);
                    return mStrings.get(id).toString();
                }
            } else {
                Crashlytics.logException(new RuntimeException("String not found: " + id));
                return "";
            }
        }

    }

    private static void refreshLiterals() {
        synchronized (lock) {
            mStrings.clear();
            loadStringsFromResourceFile();
        }
    }

    private static void loadStringsFromResourceFile() {
        try {
// Path: app/src/main/java/com/referendum/uoctubre/UOctubreApplication.java
// public class UOctubreApplication extends Application {
// 
//     private static UOctubreApplication sInstance;
// 
//     @Override
//     public void onCreate() {
//         super.onCreate();
// 
//         sInstance = this;
// 
//         Fabric.with(this, new Crashlytics());
// 
//         StringsManager.initialize();
// 
//         TwitterConfig config = new TwitterConfig.Builder(this)
//                 .logger(new DefaultLogger(Log.DEBUG))
//                 .twitterAuthConfig(new TwitterAuthConfig(Constants.TWITTER_CONSUMER_KEY, Constants.TWITTER_CONSUMER_SECRET))
//                 .debug(true)
//                 .build();
//         Twitter.initialize(config);
// 
//         //Create Notification channel in Android O
//         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
//             NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
//             if (notificationManager != null) {
//                 NotificationChannel mChannel = new NotificationChannel("referendum",
//                         StringsManager.getString("notification_channel_name"), NotificationManager.IMPORTANCE_HIGH);
//                 mChannel.setDescription(StringsManager.getString("notification_channel_description"));
//                 mChannel.enableLights(true);
//                 mChannel.setLightColor(Color.RED);
//                 notificationManager.createNotificationChannel(mChannel);
//             }
//         }
//     }
// 
//     public static UOctubreApplication getInstance() {
//         return sInstance;
//     }
// }


// Path: app/src/main/java/com/referendum/uoctubre/utils/StringsManager.java
import android.content.res.Resources;
import android.util.Log;
import android.util.Xml;
import com.crashlytics.android.Crashlytics;
import com.referendum.uoctubre.UOctubreApplication;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.IllegalFormatException;

        mStrings = new HashMap<>();
        refreshLiterals();
    }

    public static String getString(String id, Object... args) {
        synchronized (lock) {
            if (mStrings.containsKey(id)) {
                try {
                    return String.format(mStrings.get(id).toString(), args);
                } catch (IllegalFormatException e) {
                    Log.e(TAG, "A string was found with wrong format parameters! The string is: " + id);
                    return mStrings.get(id).toString();
                }
            } else {
                Crashlytics.logException(new RuntimeException("String not found: " + id));
                return "";
            }
        }

    }

    private static void refreshLiterals() {
        synchronized (lock) {
            mStrings.clear();
            loadStringsFromResourceFile();
        }
    }

    private static void loadStringsFromResourceFile() {
        try {
            Resources res = UOctubreApplication.getInstance().getResources();