// Path: app/src/main/java/com/ToxicBakery/app/screenshot_redaction/ActivityLicenses.java
// public class ActivityLicenses extends AppCompatActivity {
// 
//     @Override
//     protected void onCreate(Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
//         setContentView(R.layout.activity_licenses);
// 
//         if (savedInstanceState == null) {
//             getSupportFragmentManager().beginTransaction()
//                     .replace(R.id.container, new FragmentLicenseList(), FragmentLicenseList.TAG)
//                     .commit();
//         }
//     }
// 
//     @Override
//     public boolean onOptionsItemSelected(MenuItem item) {
//         switch (item.getItemId()) {
//             case android.R.id.home:
//                 if (getSupportFragmentManager().getBackStackEntryCount() > 0) {
//                     getSupportFragmentManager().popBackStackImmediate();
//                 } else {
//                     finish();
//                 }
//                 return true;
//         }
//         return super.onOptionsItemSelected(item);
//     }
// 
// }
// 
// Path: app/src/main/java/com/ToxicBakery/app/screenshot_redaction/widget/DictionarySelectionDialog.java
// public class DictionarySelectionDialog extends DialogFragment implements DialogInterface.OnMultiChoiceClickListener {
// 
//     public static final String TAG = "DictionarySelectionDialog";
// 
//     private DictionaryProvider dictionaryProvider;
//     private CharSequence[] displayValues;
//     private String[] entryValues;
//     private boolean[] states;
// 
//     @Override
//     public void onCreate(Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
// 
//         dictionaryProvider = DictionaryProvider.getInstance(getActivity());
// 
//         dictionaryProvider.getDictionaries()
//                 .subscribe(new DictionaryAction());
//     }
// 
//     @NonNull
//     @Override
//     public Dialog onCreateDialog(Bundle savedInstanceState) {
//         return new AlertDialog.Builder(getActivity())
//                 .setTitle(R.string.pref_dictionaries)
//                 .setMultiChoiceItems(displayValues, states, this)
//                 .setPositiveButton(android.R.string.ok, null)
//                 .create();
//     }
// 
//     @Override
//     public void onClick(DialogInterface dialog, int which, boolean isChecked) {
//         String uuid = entryValues[which];
//         dictionaryProvider.setDictionaryEnabled(uuid, isChecked)
//                 .subscribe();
//     }
// 
//     class DictionaryAction extends Subscriber<IDictionaryStatus> {
// 
//         final List<CharSequence> displayValuesList = new LinkedList<>();
//         final List<String> entryValuesList = new LinkedList<>();
//         final List<Boolean> statesList = new ArrayList<>();
// 
//         @Override
//         public void onCompleted() {
//             displayValues = displayValuesList.toArray(new CharSequence[displayValuesList.size()]);
//             entryValues = entryValuesList.toArray(new String[entryValuesList.size()]);
//             states = new boolean[statesList.size()];
// 
//             for (int i = 0; i < statesList.size(); i++) {
//                 states[i] = statesList.get(i);
//             }
//         }
// 
//         @Override
//         public void onError(Throwable e) {
//             throw new IllegalStateException(e);
//         }
// 
//         @Override
//         public void onNext(IDictionaryStatus dictionaryStatus) {
//             IDictionary dictionary = dictionaryStatus.getDictionary();
//             String displayName = dictionaryStatus.getName();
//             String entryValue = dictionary.getUUID();
//             boolean enabled = dictionaryStatus.isEnabled();
// 
//             displayValuesList.add(displayName);
//             entryValuesList.add(entryValue);
//             statesList.add(enabled);
//         }
// 
//     }
// 
// }


import android.content.Intent;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.PreferenceFragment;
import com.ToxicBakery.app.screenshot_redaction.ActivityLicenses;
import com.ToxicBakery.app.screenshot_redaction.R;
import com.ToxicBakery.app.screenshot_redaction.widget.DictionarySelectionDialog;
package com.ToxicBakery.app.screenshot_redaction.fragment;



public class FragmentSettings extends PreferenceFragment implements Preference.OnPreferenceClickListener {

    public static final String TAG = "FragmentSettings";
    public static final String PREF_LICENSES = "pref_licenses";
    public static final String PREF_DICTIONARIES = "pref_dictionaries";

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        addPreferencesFromResource(R.xml.settings);

        findPreference(PREF_LICENSES).setOnPreferenceClickListener(this);
        findPreference(PREF_DICTIONARIES).setOnPreferenceClickListener(this);
    }

    @Override
    public boolean onPreferenceClick(Preference preference) {
        switch (preference.getKey()) {
            case PREF_LICENSES:
// Path: app/src/main/java/com/ToxicBakery/app/screenshot_redaction/ActivityLicenses.java
// public class ActivityLicenses extends AppCompatActivity {
// 
//     @Override
//     protected void onCreate(Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
//         setContentView(R.layout.activity_licenses);
// 
//         if (savedInstanceState == null) {
//             getSupportFragmentManager().beginTransaction()
//                     .replace(R.id.container, new FragmentLicenseList(), FragmentLicenseList.TAG)
//                     .commit();
//         }
//     }
// 
//     @Override
//     public boolean onOptionsItemSelected(MenuItem item) {
//         switch (item.getItemId()) {
//             case android.R.id.home:
//                 if (getSupportFragmentManager().getBackStackEntryCount() > 0) {
//                     getSupportFragmentManager().popBackStackImmediate();
//                 } else {
//                     finish();
//                 }
//                 return true;
//         }
//         return super.onOptionsItemSelected(item);
//     }
// 
// }
// 
// Path: app/src/main/java/com/ToxicBakery/app/screenshot_redaction/widget/DictionarySelectionDialog.java
// public class DictionarySelectionDialog extends DialogFragment implements DialogInterface.OnMultiChoiceClickListener {
// 
//     public static final String TAG = "DictionarySelectionDialog";
// 
//     private DictionaryProvider dictionaryProvider;
//     private CharSequence[] displayValues;
//     private String[] entryValues;
//     private boolean[] states;
// 
//     @Override
//     public void onCreate(Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
// 
//         dictionaryProvider = DictionaryProvider.getInstance(getActivity());
// 
//         dictionaryProvider.getDictionaries()
//                 .subscribe(new DictionaryAction());
//     }
// 
//     @NonNull
//     @Override
//     public Dialog onCreateDialog(Bundle savedInstanceState) {
//         return new AlertDialog.Builder(getActivity())
//                 .setTitle(R.string.pref_dictionaries)
//                 .setMultiChoiceItems(displayValues, states, this)
//                 .setPositiveButton(android.R.string.ok, null)
//                 .create();
//     }
// 
//     @Override
//     public void onClick(DialogInterface dialog, int which, boolean isChecked) {
//         String uuid = entryValues[which];
//         dictionaryProvider.setDictionaryEnabled(uuid, isChecked)
//                 .subscribe();
//     }
// 
//     class DictionaryAction extends Subscriber<IDictionaryStatus> {
// 
//         final List<CharSequence> displayValuesList = new LinkedList<>();
//         final List<String> entryValuesList = new LinkedList<>();
//         final List<Boolean> statesList = new ArrayList<>();
// 
//         @Override
//         public void onCompleted() {
//             displayValues = displayValuesList.toArray(new CharSequence[displayValuesList.size()]);
//             entryValues = entryValuesList.toArray(new String[entryValuesList.size()]);
//             states = new boolean[statesList.size()];
// 
//             for (int i = 0; i < statesList.size(); i++) {
//                 states[i] = statesList.get(i);
//             }
//         }
// 
//         @Override
//         public void onError(Throwable e) {
//             throw new IllegalStateException(e);
//         }
// 
//         @Override
//         public void onNext(IDictionaryStatus dictionaryStatus) {
//             IDictionary dictionary = dictionaryStatus.getDictionary();
//             String displayName = dictionaryStatus.getName();
//             String entryValue = dictionary.getUUID();
//             boolean enabled = dictionaryStatus.isEnabled();
// 
//             displayValuesList.add(displayName);
//             entryValuesList.add(entryValue);
//             statesList.add(enabled);
//         }
// 
//     }
// 
// }


// Path: app/src/main/java/com/ToxicBakery/app/screenshot_redaction/fragment/FragmentSettings.java
import android.content.Intent;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.PreferenceFragment;
import com.ToxicBakery.app.screenshot_redaction.ActivityLicenses;
import com.ToxicBakery.app.screenshot_redaction.R;
import com.ToxicBakery.app.screenshot_redaction.widget.DictionarySelectionDialog;

package com.ToxicBakery.app.screenshot_redaction.fragment;



public class FragmentSettings extends PreferenceFragment implements Preference.OnPreferenceClickListener {

    public static final String TAG = "FragmentSettings";
    public static final String PREF_LICENSES = "pref_licenses";
    public static final String PREF_DICTIONARIES = "pref_dictionaries";

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        addPreferencesFromResource(R.xml.settings);

        findPreference(PREF_LICENSES).setOnPreferenceClickListener(this);
        findPreference(PREF_DICTIONARIES).setOnPreferenceClickListener(this);
    }

    @Override
    public boolean onPreferenceClick(Preference preference) {
        switch (preference.getKey()) {
            case PREF_LICENSES:
                Intent intent = new Intent(getActivity(), ActivityLicenses.class);