// Path: app/src/main/java/se/oort/diplicity/apigen/FCMNotificationConfig.java
// public class FCMNotificationConfig implements java.io.Serializable {
//   public String ClickActionTemplate;
//   public String TitleTemplate;
//   public String BodyTemplate;
//   public Boolean DontSendData;
//   public Boolean DontSendNotification;
// }
// 
// Path: app/src/main/java/se/oort/diplicity/apigen/FCMToken.java
// public class FCMToken implements java.io.Serializable {
//   public String Value;
//   public Boolean Disabled;
//   public String Note;
//   public String App;
//   public FCMNotificationConfig MessageConfig;
//   public FCMNotificationConfig PhaseConfig;
//   public String ReplaceToken;
// }
// 
// Path: app/src/main/java/se/oort/diplicity/apigen/SingleContainer.java
// public class SingleContainer<T> implements java.io.Serializable {
//   public SingleContainer() {
//   }
//   public T Properties;
//   public java.util.List<Link> Links;
//   public String name;
//   public java.util.List<java.util.List<String>> Desc;
// }
// 
// Path: app/src/main/java/se/oort/diplicity/apigen/UserConfig.java
// public class UserConfig implements java.io.Serializable {
//   public String UserId;
//   public java.util.List<FCMToken> FCMTokens;
//   public MailConfig MailConfig;
//   public java.util.List<String> Colors;
//   public Long PhaseDeadlineWarningMinutesAhead;
// }


import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.os.Bundle;
import android.preference.CheckBoxPreference;
import android.preference.EditTextPreference;
import android.preference.Preference;
import android.preference.PreferenceCategory;
import android.preference.PreferenceFragment;
import android.preference.PreferenceManager;
import android.text.InputType;
import android.text.TextUtils;
import android.text.method.DigitsKeyListener;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
import com.google.firebase.iid.FirebaseInstanceId;
import java.math.BigInteger;
import java.security.SecureRandom;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import rx.Single;
import se.oort.diplicity.apigen.FCMNotificationConfig;
import se.oort.diplicity.apigen.FCMToken;
import se.oort.diplicity.apigen.SingleContainer;
import se.oort.diplicity.apigen.UserConfig;
                            @Override
                            public void send(final SingleContainer<UserConfig> userConfigSingleContainer) {
                                configs.put(retrofitActivity(), new FragmentAndConfig(Fragment.this, userConfigSingleContainer));

                                final SharedPreferences prefs = getPreferenceScreen().getSharedPreferences();

                                findPreference(getResources().getString(R.string.app_version_pref_key)).setSummary("" + BuildConfig.VERSION_CODE);

                                final CheckBoxPreference emailPreference = (CheckBoxPreference) findPreference(getResources().getString(R.string.email_notifications_pref_key));
                                emailPreference.setChecked(userConfigSingleContainer.Properties.MailConfig.Enabled);
                                emailPreference.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
                                    @Override
                                    public boolean onPreferenceChange(Preference preference, Object o) {
                                        if (retrofitActivity().getLoggedInUser() != null) {
                                            userConfigSingleContainer.Properties.MailConfig.Enabled = (Boolean) o;
                                            retrofitActivity().handleReq(
                                                    retrofitActivity().userConfigService.UserConfigUpdate(userConfigSingleContainer.Properties, retrofitActivity().getLoggedInUser().Id),
                                                    new Sendable<SingleContainer<UserConfig>>() {
                                                        @Override
                                                        public void send(SingleContainer<UserConfig> userConfigSingleContainer) {
                                                        }
                                                    },
                                                    getResources().getString(R.string.updating_settings));
                                        }
                                        return true;
                                    }
                                });

                                final CheckBoxPreference pushPreference = (CheckBoxPreference) findPreference(getResources().getString(R.string.push_notifications_pref_key));
                                if (FirebaseInstanceId.getInstance().getToken() != null) {
// Path: app/src/main/java/se/oort/diplicity/apigen/FCMNotificationConfig.java
// public class FCMNotificationConfig implements java.io.Serializable {
//   public String ClickActionTemplate;
//   public String TitleTemplate;
//   public String BodyTemplate;
//   public Boolean DontSendData;
//   public Boolean DontSendNotification;
// }
// 
// Path: app/src/main/java/se/oort/diplicity/apigen/FCMToken.java
// public class FCMToken implements java.io.Serializable {
//   public String Value;
//   public Boolean Disabled;
//   public String Note;
//   public String App;
//   public FCMNotificationConfig MessageConfig;
//   public FCMNotificationConfig PhaseConfig;
//   public String ReplaceToken;
// }
// 
// Path: app/src/main/java/se/oort/diplicity/apigen/SingleContainer.java
// public class SingleContainer<T> implements java.io.Serializable {
//   public SingleContainer() {
//   }
//   public T Properties;
//   public java.util.List<Link> Links;
//   public String name;
//   public java.util.List<java.util.List<String>> Desc;
// }
// 
// Path: app/src/main/java/se/oort/diplicity/apigen/UserConfig.java
// public class UserConfig implements java.io.Serializable {
//   public String UserId;
//   public java.util.List<FCMToken> FCMTokens;
//   public MailConfig MailConfig;
//   public java.util.List<String> Colors;
//   public Long PhaseDeadlineWarningMinutesAhead;
// }


// Path: app/src/main/java/se/oort/diplicity/PreferenceActivity.java
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.os.Bundle;
import android.preference.CheckBoxPreference;
import android.preference.EditTextPreference;
import android.preference.Preference;
import android.preference.PreferenceCategory;
import android.preference.PreferenceFragment;
import android.preference.PreferenceManager;
import android.text.InputType;
import android.text.TextUtils;
import android.text.method.DigitsKeyListener;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
import com.google.firebase.iid.FirebaseInstanceId;
import java.math.BigInteger;
import java.security.SecureRandom;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import rx.Single;
import se.oort.diplicity.apigen.FCMNotificationConfig;
import se.oort.diplicity.apigen.FCMToken;
import se.oort.diplicity.apigen.SingleContainer;
import se.oort.diplicity.apigen.UserConfig;

                            @Override
                            public void send(final SingleContainer<UserConfig> userConfigSingleContainer) {
                                configs.put(retrofitActivity(), new FragmentAndConfig(Fragment.this, userConfigSingleContainer));

                                final SharedPreferences prefs = getPreferenceScreen().getSharedPreferences();

                                findPreference(getResources().getString(R.string.app_version_pref_key)).setSummary("" + BuildConfig.VERSION_CODE);

                                final CheckBoxPreference emailPreference = (CheckBoxPreference) findPreference(getResources().getString(R.string.email_notifications_pref_key));
                                emailPreference.setChecked(userConfigSingleContainer.Properties.MailConfig.Enabled);
                                emailPreference.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
                                    @Override
                                    public boolean onPreferenceChange(Preference preference, Object o) {
                                        if (retrofitActivity().getLoggedInUser() != null) {
                                            userConfigSingleContainer.Properties.MailConfig.Enabled = (Boolean) o;
                                            retrofitActivity().handleReq(
                                                    retrofitActivity().userConfigService.UserConfigUpdate(userConfigSingleContainer.Properties, retrofitActivity().getLoggedInUser().Id),
                                                    new Sendable<SingleContainer<UserConfig>>() {
                                                        @Override
                                                        public void send(SingleContainer<UserConfig> userConfigSingleContainer) {
                                                        }
                                                    },
                                                    getResources().getString(R.string.updating_settings));
                                        }
                                        return true;
                                    }
                                });

                                final CheckBoxPreference pushPreference = (CheckBoxPreference) findPreference(getResources().getString(R.string.push_notifications_pref_key));
                                if (FirebaseInstanceId.getInstance().getToken() != null) {
                                    FCMToken pushToken = retrofitActivity().getFCMToken(userConfigSingleContainer.Properties);