Log visibility change for all fragments.
Bug: 30681771 Test: SettingsUnitTests Refactor visibility logging from InstrumentedFragment into a mixin. And apply mixin in remaining fragments. Change-Id: Ibbb59904336254a3e4bb9e8c7d0b36e5a6bc2622
This commit is contained in:
@@ -37,13 +37,15 @@ import android.widget.SectionIndexer;
|
||||
import android.widget.SimpleCursorAdapter;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.android.internal.logging.MetricsProto;
|
||||
import com.android.settings.core.instrumentation.VisibilityLoggerMixin;
|
||||
import com.android.settings.inputmethod.UserDictionaryAddWordContents;
|
||||
import com.android.settings.inputmethod.UserDictionarySettingsUtils;
|
||||
import com.android.settings.core.instrumentation.Instrumentable;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public class UserDictionarySettings extends ListFragment {
|
||||
private static final String TAG = "UserDictionarySettings";
|
||||
public class UserDictionarySettings extends ListFragment implements Instrumentable {
|
||||
|
||||
private static final String[] QUERY_PROJECTION = {
|
||||
UserDictionary.Words._ID, UserDictionary.Words.WORD, UserDictionary.Words.SHORTCUT
|
||||
@@ -67,10 +69,17 @@ public class UserDictionarySettings extends ListFragment {
|
||||
|
||||
private static final int OPTIONS_MENU_ADD = Menu.FIRST;
|
||||
|
||||
private Cursor mCursor;
|
||||
private final VisibilityLoggerMixin mVisibilityLoggerMixin =
|
||||
new VisibilityLoggerMixin(this);
|
||||
|
||||
private Cursor mCursor;
|
||||
protected String mLocale;
|
||||
|
||||
@Override
|
||||
public int getMetricsCategory() {
|
||||
return MetricsProto.MetricsEvent.USER_DICTIONARY_SETTINGS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(
|
||||
LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
@@ -116,6 +125,12 @@ public class UserDictionarySettings extends ListFragment {
|
||||
UserDictionarySettingsUtils.getLocaleDisplayName(getActivity(), mLocale));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
mVisibilityLoggerMixin.onResume(getActivity());
|
||||
}
|
||||
|
||||
private Cursor createCursor(final String locale) {
|
||||
// Locale can be any of:
|
||||
// - The string representation of a locale, as returned by Locale#toString()
|
||||
@@ -174,6 +189,12 @@ public class UserDictionarySettings extends ListFragment {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
mVisibilityLoggerMixin.onPause(getActivity());
|
||||
}
|
||||
|
||||
/**
|
||||
* Add or edit a word. If editingWord is null, it's an add; otherwise, it's an edit.
|
||||
* @param editingWord the word to edit, or null if it's an add.
|
||||
|
Reference in New Issue
Block a user