-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathTestTools.java
More file actions
34 lines (29 loc) · 1.09 KB
/
TestTools.java
File metadata and controls
34 lines (29 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package de.dotwee.micropinner.tools;
import androidx.test.rule.ActivityTestRule;
import de.dotwee.micropinner.view.MainDialog;
/**
* Created by lukas on 20.07.2016.
*/
public final class TestTools {
static final String TAG = "TestTools";
/**
* This method returns an instance of {@link PreferencesHandler}
* for an activity test rule.
*
* @param activityTestRule Source to get the PreferenceHandler.
* @return An instance of {@link PreferencesHandler}
*/
public static PreferencesHandler getPreferencesHandler(
ActivityTestRule<MainDialog> activityTestRule) {
return PreferencesHandler.getInstance(activityTestRule.getActivity());
}
/**
* This method recreates the main activity in order to apply
* themes or reload the preference cache.
*
* @param activityTestRule Source to get access to the activity.
*/
public static void recreateActivity(final ActivityTestRule<MainDialog> activityTestRule) {
activityTestRule.getActivity().runOnUiThread(() -> activityTestRule.getActivity().recreate());
}
}