OSDN Git Service

Add Input & Gesture/Language & Region pages under System.
authorFan Zhang <zhfan@google.com>
Mon, 7 Nov 2016 23:12:52 +0000 (15:12 -0800)
committerFan Zhang <zhfan@google.com>
Tue, 8 Nov 2016 01:05:22 +0000 (17:05 -0800)
- Removed LanguageAndInputDashboardAlias because now the contents are
  moved to new pages.

Bug: 32637613
Bug: 32643833
Test: RunSettingsRoboTests
Change-Id: Ia66a942a449a07b9cbba53bdc97738148aafadb4

12 files changed:
AndroidManifest.xml
res/values/strings.xml
res/xml/input_and_gesture.xml [new file with mode: 0644]
res/xml/language_and_region.xml [new file with mode: 0644]
src/com/android/settings/Settings.java
src/com/android/settings/SettingsActivity.java
src/com/android/settings/core/InstrumentedFragment.java
src/com/android/settings/inputmethod/InputAndGestureSettings.java [new file with mode: 0644]
src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java
src/com/android/settings/language/LanguageAndRegionSettings.java [new file with mode: 0644]
tests/robotests/src/com/android/settings/inputmethod/InputAndGestureSettingsTest.java [new file with mode: 0644]
tests/robotests/src/com/android/settings/language/LanguageAndRegionSettingsTest.java [new file with mode: 0644]

index 713ba42..acff8f4 100644 (file)
         </activity>
 
         <!-- Alias for IME & Language in new IA. Should merge into TargetActivity when launch -->
-        <activity-alias android:name="LanguageAndInputDashboardAlias"
-            android:targetActivity="Settings$InputMethodAndLanguageSettingsActivity">
-            <intent-filter android:priority="250">
-                <action android:name="com.android.settings.action.SETTINGS" />
+        <activity android:name=".Settings$LanguageAndRegionSettingsActivity"
+                  android:label="@string/language_and_region_settings_title"
+                  android:icon="@drawable/ic_settings_language">
+            <intent-filter android:priority="260">
+                <action android:name="com.android.settings.action.SETTINGS"/>
             </intent-filter>
+            <meta-data android:name="com.android.settings.category"
+                       android:value="com.android.settings.category.ia.system"/>
             <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
-                       android:value="com.android.settings.inputmethod.InputMethodAndLanguageSettings" />
+                       android:value="com.android.settings.language.LanguageAndRegionSettings"/>
+            <meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
+                       android:value="true"/>
+            <!-- Inherit intent-filter from LanguageSettingsActivity -->
+        </activity>
+
+        <activity android:name=".Settings$InputAndGestureSettingsActivity"
+                  android:label="@string/input_gesture_settings_title"
+                  android:icon="@drawable/ic_settings_language">
+            <intent-filter android:priority="255">
+                <action android:name="com.android.settings.action.SETTINGS" />
+            </intent-filter>
             <meta-data android:name="com.android.settings.category"
                        android:value="com.android.settings.category.ia.system" />
+            <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
+                       android:value="com.android.settings.inputmethod.InputAndGestureSettings" />
             <meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
                        android:value="true" />
-        </activity-alias>
+            <!-- Inherit intent-filter from LanguageSettingsActivity -->
+        </activity>
 
         <!-- Alias for Date & Time in new IA. Should merge into TargetActivity when launch -->
         <activity-alias android:name="DateTimeDashboardAlias"
index 699a0c3..ae40bf9 100644 (file)
     <string name="language_settings">Languages&#160;&amp; input</string>
     <!-- Title of Languages & input settings screen -->
     <string name="language_keyboard_settings_title">Languages&#160;&amp; input</string>
+    <!-- Title of Languages & region settings screen -->
+    <string name="language_and_region_settings_title">Languages&#160;&amp; region</string>
+    <!-- Title of Input & gesture settings screen -->
+    <string name="input_gesture_settings_title">Input&#160;&amp; gestures</string>
     <!-- On Languages & input settings screen, heading. Inside the "Languages & input settings" screen, this is the header for settings that relate to keyboard (enable/disable each keyboard, settings for each keyboard). -->
     <string name="keyboard_settings_category">Keyboard &amp; input methods</string>
     <!-- On Text & language settings screen, setting option name. title of the setting to take the user to a screen to select the locale. -->
diff --git a/res/xml/input_and_gesture.xml b/res/xml/input_and_gesture.xml
new file mode 100644 (file)
index 0000000..fb89589
--- /dev/null
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  Copyright (C) 2016 The Android Open Source Project
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+  -->
+
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
+
+    <PreferenceCategory
+        android:title="@string/keyboard_and_input_methods_category">
+        <Preference
+            android:title="@string/virtual_keyboard_category"
+            android:fragment="com.android.settings.inputmethod.VirtualKeyboardFragment"/>
+        <Preference
+            android:title="@string/physical_keyboard_title"
+            android:fragment="com.android.settings.inputmethod.PhysicalKeyboardFragment"/>
+    </PreferenceCategory>
+
+    <PreferenceCategory
+        android:key="pointer_settings_category"
+        android:title="@string/pointer_settings_category">
+
+        <com.android.settings.PointerSpeedPreference
+            android:key="pointer_speed"
+            android:title="@string/pointer_speed"
+            android:dialogTitle="@string/pointer_speed"/>
+
+    </PreferenceCategory>
+
+    <PreferenceCategory
+        android:key="game_controller_settings_category"
+        android:title="@string/game_controller_settings_category">
+
+        <SwitchPreference
+            android:key="vibrate_input_devices"
+            android:title="@string/vibrate_input_devices"
+            android:summaryOn="@string/vibrate_input_devices_summary"
+            android:summaryOff="@string/vibrate_input_devices_summary"/>
+
+    </PreferenceCategory>
+
+</PreferenceScreen>
\ No newline at end of file
diff --git a/res/xml/language_and_region.xml b/res/xml/language_and_region.xml
new file mode 100644 (file)
index 0000000..62179c9
--- /dev/null
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  Copyright (C) 2016 The Android Open Source Project
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+  -->
+
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
+
+    <Preference
+        android:key="phone_language"
+        android:title="@string/phone_language"
+        android:fragment="com.android.settings.localepicker.LocaleListEditor"/>
+
+    <!-- Spell checker preference title, summary and fragment will be set programmatically. -->
+    <!-- Note: Mark this as persistent="false" to remove unnecessarily saved shared preference.
+         See: InputMethodAndSubtypeUtil.removeUnnecessaryNonPersistentPreference. -->
+    <Preference
+        android:key="spellcheckers_settings"
+        android:title="@string/spellcheckers_settings_title"
+        android:persistent="false"/>
+
+    <!-- User dictionary preference title and fragment will be set programmatically. -->
+    <Preference
+        android:key="key_user_dictionary_settings"
+        android:title="@string/user_dict_settings_title"/>
+
+    <!-- TTS -->
+    <PreferenceCategory
+        android:key="voice_category"
+        android:title="@string/voice_category">
+
+        <Preference
+            android:key="tts_settings"
+            android:title="@string/tts_settings_title"
+            android:fragment="com.android.settings.tts.TextToSpeechSettings"/>
+
+    </PreferenceCategory>
+
+</PreferenceScreen>
\ No newline at end of file
index 451c7e3..85fb334 100644 (file)
@@ -41,12 +41,14 @@ public class Settings extends SettingsActivity {
     public static class WifiSettingsActivity extends SettingsActivity { /* empty */ }
     public static class WifiP2pSettingsActivity extends SettingsActivity { /* empty */ }
     public static class InputMethodAndLanguageSettingsActivity extends SettingsActivity { /* empty */ }
+    public static class InputAndGestureSettingsActivity extends SettingsActivity { /* empty */ }
     public static class AvailableVirtualKeyboardActivity extends SettingsActivity { /* empty */ }
     public static class KeyboardLayoutPickerActivity extends SettingsActivity { /* empty */ }
     public static class PhysicalKeyboardActivity extends SettingsActivity { /* empty */ }
     public static class InputMethodAndSubtypeEnablerActivity extends SettingsActivity { /* empty */ }
     public static class SpellCheckersSettingsActivity extends SettingsActivity { /* empty */ }
     public static class LocalePickerActivity extends SettingsActivity { /* empty */ }
+    public static class LanguageAndRegionSettingsActivity extends SettingsActivity { /* empty */ }
     public static class UserDictionarySettingsActivity extends SettingsActivity { /* empty */ }
     public static class HomeSettingsActivity extends SettingsActivity { /* empty */ }
     public static class DisplaySettingsActivity extends SettingsActivity { /* empty */ }
index bd00085..d1c7266 100644 (file)
@@ -99,11 +99,13 @@ import com.android.settings.fuelgauge.PowerUsageDetail;
 import com.android.settings.fuelgauge.PowerUsageSummary;
 import com.android.settings.gestures.GestureSettings;
 import com.android.settings.inputmethod.AvailableVirtualKeyboardFragment;
+import com.android.settings.inputmethod.InputAndGestureSettings;
 import com.android.settings.inputmethod.InputMethodAndLanguageSettings;
 import com.android.settings.inputmethod.KeyboardLayoutPickerFragment;
 import com.android.settings.inputmethod.PhysicalKeyboardFragment;
 import com.android.settings.inputmethod.SpellCheckersSettings;
 import com.android.settings.inputmethod.UserDictionaryList;
+import com.android.settings.language.LanguageAndRegionSettings;
 import com.android.settings.localepicker.LocaleListEditor;
 import com.android.settings.location.LocationSettings;
 import com.android.settings.network.NetworkDashboardFragment;
@@ -291,7 +293,8 @@ public class SettingsActivity extends SettingsDrawerActivity
             // Home page > Security
             "com.android.settings.Settings.LocationDashboardAlias",
             // Home page > System
-            "com.android.settings.Settings.LanguageAndInputDashboardAlias",
+            Settings.LanguageAndRegionSettingsActivity.class.getName(),
+            Settings.InputAndGestureSettingsActivity.class.getName(),
             "com.android.settings.Settings.DateTimeDashboardAlias",
             "com.android.settings.Settings.AccessibilityDashboardAlias",
             "com.android.settings.Settings.AboutDeviceDashboardAlias",
@@ -311,6 +314,8 @@ public class SettingsActivity extends SettingsDrawerActivity
             LocaleListEditor.class.getName(),
             InputMethodAndLanguageSettings.class.getName(),
             AvailableVirtualKeyboardFragment.class.getName(),
+            InputAndGestureSettings.class.getName(),
+            LanguageAndRegionSettings.class.getName(),
             SpellCheckersSettings.class.getName(),
             UserDictionaryList.class.getName(),
             UserDictionarySettings.class.getName(),
index ca683e3..107fbab 100644 (file)
@@ -40,6 +40,8 @@ public abstract class InstrumentedFragment extends ObservablePreferenceFragment
     protected final int NETWORK_CATEGORY_FRAGMENT = PLACEHOLDER_METRIC + 3;
     protected final int CONNECTED_DEVICE_CATEGORY_FRAGMENT = PLACEHOLDER_METRIC + 4;
     protected final int APP_AND_NOTIFICATION_CATEGORY_FRAGMENT = PLACEHOLDER_METRIC + 5;
+    protected final int INPUT_AND_GESTURE_CATEGORY_FRAGMENT = PLACEHOLDER_METRIC + 6;
+    protected final int LANGUAGE_AND_REGION_CATEGORY_FRAGMENT = PLACEHOLDER_METRIC + 7;
 
     public InstrumentedFragment() {
         // Mixin that logs visibility change for activity.
diff --git a/src/com/android/settings/inputmethod/InputAndGestureSettings.java b/src/com/android/settings/inputmethod/InputAndGestureSettings.java
new file mode 100644 (file)
index 0000000..874fc0b
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.inputmethod;
+
+import android.content.Context;
+
+import com.android.settings.R;
+import com.android.settings.core.PreferenceController;
+import com.android.settings.dashboard.DashboardFragment;
+import com.android.settingslib.drawer.CategoryKey;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class InputAndGestureSettings extends DashboardFragment {
+
+    private static final String TAG = "InputAndGestureSettings";
+
+    @Override
+    public int getMetricsCategory() {
+        return INPUT_AND_GESTURE_CATEGORY_FRAGMENT;
+    }
+
+    @Override
+    protected String getCategoryKey() {
+        return CategoryKey.CATEGORY_SYSTEM_INPUT;
+    }
+
+    @Override
+    protected String getLogTag() {
+        return TAG;
+    }
+
+    @Override
+    protected int getPreferenceScreenResId() {
+        return R.xml.input_and_gesture;
+    }
+
+    @Override
+    protected List<PreferenceController> getPreferenceControllers(Context context) {
+        final GameControllerPreferenceController gameControllerPreferenceController
+                = new GameControllerPreferenceController(context);
+        getLifecycle().addObserver(gameControllerPreferenceController);
+
+        final List<PreferenceController> controllers = new ArrayList<>();
+        controllers.add(gameControllerPreferenceController);
+
+        return controllers;
+    }
+}
index 351f6b5..2c12139 100644 (file)
@@ -51,6 +51,11 @@ import com.android.settingslib.drawer.CategoryKey;
 import java.util.ArrayList;
 import java.util.List;
 
+/**
+ * @deprecated New features should use {@code InputAndGestureSettings} and
+ * {@code LanguageAndRegionSettings} instead.
+ */
+@Deprecated
 public class InputMethodAndLanguageSettings extends DashboardFragment
         implements KeyboardLayoutDialogFragment.OnSetupKeyboardLayoutsListener, Indexable {
 
diff --git a/src/com/android/settings/language/LanguageAndRegionSettings.java b/src/com/android/settings/language/LanguageAndRegionSettings.java
new file mode 100644 (file)
index 0000000..5741255
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.language;
+
+import android.content.Context;
+import android.speech.tts.TtsEngines;
+
+import com.android.settings.R;
+import com.android.settings.core.PreferenceController;
+import com.android.settings.dashboard.DashboardFragment;
+import com.android.settings.inputmethod.SpellCheckerPreferenceController;
+import com.android.settingslib.drawer.CategoryKey;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class LanguageAndRegionSettings extends DashboardFragment {
+
+    private static final String TAG = "LangAndRegionSettings";
+
+    @Override
+    public int getMetricsCategory() {
+        return LANGUAGE_AND_REGION_CATEGORY_FRAGMENT;
+    }
+
+    @Override
+    protected String getCategoryKey() {
+        return CategoryKey.CATEGORY_SYSTEM_LANGUAGE;
+    }
+
+    @Override
+    protected String getLogTag() {
+        return TAG;
+    }
+
+    @Override
+    protected int getPreferenceScreenResId() {
+        return R.xml.language_and_region;
+    }
+
+    @Override
+    protected List<PreferenceController> getPreferenceControllers(Context context) {
+        final List<PreferenceController> controllers = new ArrayList<>();
+        controllers.add(new PhoneLanguagePreferenceController(context));
+        controllers.add(new SpellCheckerPreferenceController(context));
+        controllers.add(new UserDictionaryPreferenceController(context));
+        controllers.add(new TtsPreferenceController(context, new TtsEngines(context)));
+        return controllers;
+    }
+
+}
diff --git a/tests/robotests/src/com/android/settings/inputmethod/InputAndGestureSettingsTest.java b/tests/robotests/src/com/android/settings/inputmethod/InputAndGestureSettingsTest.java
new file mode 100644 (file)
index 0000000..f51ee56
--- /dev/null
@@ -0,0 +1,102 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.inputmethod;
+
+import android.content.Context;
+import android.hardware.input.InputManager;
+
+import com.android.settings.R;
+import com.android.settings.SettingsRobolectricTestRunner;
+import com.android.settings.TestConfig;
+import com.android.settings.core.PreferenceController;
+import com.android.settings.core.lifecycle.Lifecycle;
+import com.android.settings.core.lifecycle.LifecycleObserver;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Answers;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.robolectric.annotation.Config;
+
+import java.util.List;
+
+import static com.google.common.truth.Truth.assertThat;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+@RunWith(SettingsRobolectricTestRunner.class)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+public class InputAndGestureSettingsTest {
+
+    @Mock(answer = Answers.RETURNS_DEEP_STUBS)
+    private Context mContext;
+    private TestFragment mFragment;
+
+    @Before
+    public void setUp() {
+        MockitoAnnotations.initMocks(this);
+        when(mContext.getSystemService(Context.INPUT_SERVICE)).thenReturn(mock(InputManager.class));
+        mFragment = new TestFragment(mContext);
+    }
+
+    @Test
+    public void testGetPreferenceScreenResId() {
+        assertThat(mFragment.getPreferenceScreenResId()).isEqualTo(R.xml.input_and_gesture);
+    }
+
+    @Test
+    public void testGetPreferenceControllers_shouldRegisterLifecycleObservers() {
+        final List<PreferenceController> controllers = mFragment.getPreferenceControllers(mContext);
+        int lifecycleObserverCount = 0;
+        for (PreferenceController controller : controllers) {
+            if (controller instanceof LifecycleObserver) {
+                lifecycleObserverCount++;
+            }
+        }
+        verify(mFragment.getLifecycle(), times(lifecycleObserverCount))
+                .addObserver(any(LifecycleObserver.class));
+    }
+
+    public static class TestFragment extends InputAndGestureSettings {
+
+        private Lifecycle mLifecycle;
+        private Context mContext;
+
+        public TestFragment(Context context) {
+            mContext = context;
+            mLifecycle = mock(Lifecycle.class);
+        }
+
+        @Override
+        public Context getContext() {
+            return mContext;
+        }
+
+        @Override
+        protected Lifecycle getLifecycle() {
+            if (mLifecycle == null) {
+                return super.getLifecycle();
+            }
+            return mLifecycle;
+        }
+    }
+}
diff --git a/tests/robotests/src/com/android/settings/language/LanguageAndRegionSettingsTest.java b/tests/robotests/src/com/android/settings/language/LanguageAndRegionSettingsTest.java
new file mode 100644 (file)
index 0000000..7efdc9d
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.language;
+
+import android.content.Context;
+import android.view.textservice.TextServicesManager;
+
+import com.android.settings.R;
+import com.android.settings.SettingsRobolectricTestRunner;
+import com.android.settings.TestConfig;
+import com.android.settings.core.PreferenceController;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Answers;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.robolectric.annotation.Config;
+
+import java.util.List;
+
+import static com.google.common.truth.Truth.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+@RunWith(SettingsRobolectricTestRunner.class)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+public class LanguageAndRegionSettingsTest {
+
+    @Mock(answer = Answers.RETURNS_DEEP_STUBS)
+    private Context mContext;
+    private TestFragment mFragment;
+
+    @Before
+    public void setUp() {
+        MockitoAnnotations.initMocks(this);
+        when(mContext.getSystemService(Context.TEXT_SERVICES_MANAGER_SERVICE))
+                .thenReturn(mock(TextServicesManager.class));
+        mFragment = new TestFragment(mContext);
+    }
+
+    @Test
+    public void testGetPreferenceScreenResId() {
+        assertThat(mFragment.getPreferenceScreenResId()).isEqualTo(R.xml.language_and_region);
+    }
+
+    @Test
+    public void testGetPreferenceControllers_shouldAllBeCreated() {
+        final List<PreferenceController> controllers = mFragment.getPreferenceControllers(mContext);
+
+        assertThat(controllers.isEmpty()).isFalse();
+    }
+
+    public static class TestFragment extends LanguageAndRegionSettings {
+
+        private Context mContext;
+
+        public TestFragment(Context context) {
+            mContext = context;
+        }
+
+        @Override
+        public Context getContext() {
+            return mContext;
+        }
+    }
+
+}