1 /*
2  * Copyright (C) 2013 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.inputmethod.latin.utils;
18 
19 import com.android.inputmethod.dictionarypack.DictionarySettingsFragment;
20 import com.android.inputmethod.latin.about.AboutPreferences;
21 import com.android.inputmethod.latin.settings.AccountsSettingsFragment;
22 import com.android.inputmethod.latin.settings.AdvancedSettingsFragment;
23 import com.android.inputmethod.latin.settings.AppearanceSettingsFragment;
24 import com.android.inputmethod.latin.settings.CorrectionSettingsFragment;
25 import com.android.inputmethod.latin.settings.CustomInputStyleSettingsFragment;
26 import com.android.inputmethod.latin.settings.DebugSettingsFragment;
27 import com.android.inputmethod.latin.settings.GestureSettingsFragment;
28 import com.android.inputmethod.latin.settings.PreferencesSettingsFragment;
29 import com.android.inputmethod.latin.settings.SettingsFragment;
30 import com.android.inputmethod.latin.settings.ThemeSettingsFragment;
31 import com.android.inputmethod.latin.spellcheck.SpellCheckerSettingsFragment;
32 import com.android.inputmethod.latin.userdictionary.UserDictionaryAddWordFragment;
33 import com.android.inputmethod.latin.userdictionary.UserDictionaryList;
34 import com.android.inputmethod.latin.userdictionary.UserDictionaryLocalePicker;
35 import com.android.inputmethod.latin.userdictionary.UserDictionarySettings;
36 
37 import java.util.HashSet;
38 
39 public class FragmentUtils {
40     private static final HashSet<String> sLatinImeFragments = new HashSet<>();
41     static {
DictionarySettingsFragment.class.getName()42         sLatinImeFragments.add(DictionarySettingsFragment.class.getName());
AboutPreferences.class.getName()43         sLatinImeFragments.add(AboutPreferences.class.getName());
PreferencesSettingsFragment.class.getName()44         sLatinImeFragments.add(PreferencesSettingsFragment.class.getName());
AccountsSettingsFragment.class.getName()45         sLatinImeFragments.add(AccountsSettingsFragment.class.getName());
AppearanceSettingsFragment.class.getName()46         sLatinImeFragments.add(AppearanceSettingsFragment.class.getName());
ThemeSettingsFragment.class.getName()47         sLatinImeFragments.add(ThemeSettingsFragment.class.getName());
CustomInputStyleSettingsFragment.class.getName()48         sLatinImeFragments.add(CustomInputStyleSettingsFragment.class.getName());
GestureSettingsFragment.class.getName()49         sLatinImeFragments.add(GestureSettingsFragment.class.getName());
CorrectionSettingsFragment.class.getName()50         sLatinImeFragments.add(CorrectionSettingsFragment.class.getName());
AdvancedSettingsFragment.class.getName()51         sLatinImeFragments.add(AdvancedSettingsFragment.class.getName());
DebugSettingsFragment.class.getName()52         sLatinImeFragments.add(DebugSettingsFragment.class.getName());
SettingsFragment.class.getName()53         sLatinImeFragments.add(SettingsFragment.class.getName());
SpellCheckerSettingsFragment.class.getName()54         sLatinImeFragments.add(SpellCheckerSettingsFragment.class.getName());
UserDictionaryAddWordFragment.class.getName()55         sLatinImeFragments.add(UserDictionaryAddWordFragment.class.getName());
UserDictionaryList.class.getName()56         sLatinImeFragments.add(UserDictionaryList.class.getName());
UserDictionaryLocalePicker.class.getName()57         sLatinImeFragments.add(UserDictionaryLocalePicker.class.getName());
UserDictionarySettings.class.getName()58         sLatinImeFragments.add(UserDictionarySettings.class.getName());
59     }
60 
isValidFragment(String fragmentName)61     public static boolean isValidFragment(String fragmentName) {
62         return sLatinImeFragments.contains(fragmentName);
63     }
64 }
65