[Panlingual] Add metric in Languages
Bug: 279915462 Test: manual Change-Id: I12dc7f8a0c594de88790e116c4b4f7ca9dc7253e
This commit is contained in:
@@ -164,15 +164,18 @@ public class LocaleDialogFragment extends InstrumentedDialogFragment {
|
|||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
if (mDialogType == DIALOG_CONFIRM_SYSTEM_DEFAULT) {
|
if (mDialogType == DIALOG_CONFIRM_SYSTEM_DEFAULT) {
|
||||||
int result = Activity.RESULT_CANCELED;
|
int result = Activity.RESULT_CANCELED;
|
||||||
|
boolean changed = false;
|
||||||
if (which == DialogInterface.BUTTON_POSITIVE) {
|
if (which == DialogInterface.BUTTON_POSITIVE) {
|
||||||
result = Activity.RESULT_OK;
|
result = Activity.RESULT_OK;
|
||||||
|
changed = true;
|
||||||
}
|
}
|
||||||
Intent intent = new Intent();
|
Intent intent = new Intent();
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putInt(ARG_DIALOG_TYPE, DIALOG_CONFIRM_SYSTEM_DEFAULT);
|
bundle.putInt(ARG_DIALOG_TYPE, DIALOG_CONFIRM_SYSTEM_DEFAULT);
|
||||||
intent.putExtras(bundle);
|
intent.putExtras(bundle);
|
||||||
mParent.onActivityResult(DIALOG_CONFIRM_SYSTEM_DEFAULT, result, intent);
|
mParent.onActivityResult(DIALOG_CONFIRM_SYSTEM_DEFAULT, result, intent);
|
||||||
mMetricsFeatureProvider.action(mContext, SettingsEnums.ACTION_CHANGE_LANGUAGE);
|
mMetricsFeatureProvider.action(mContext, SettingsEnums.ACTION_CHANGE_LANGUAGE,
|
||||||
|
changed);
|
||||||
}
|
}
|
||||||
mShouldKeepDialog = false;
|
mShouldKeepDialog = false;
|
||||||
}
|
}
|
||||||
|
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package com.android.settings.localepicker;
|
package com.android.settings.localepicker;
|
||||||
|
|
||||||
|
import android.app.settings.SettingsEnums;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@@ -37,6 +38,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
|||||||
import com.android.internal.app.LocalePicker;
|
import com.android.internal.app.LocalePicker;
|
||||||
import com.android.internal.app.LocaleStore;
|
import com.android.internal.app.LocaleStore;
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
|
import com.android.settings.overlay.FeatureFactory;
|
||||||
import com.android.settings.shortcut.ShortcutsUpdateTask;
|
import com.android.settings.shortcut.ShortcutsUpdateTask;
|
||||||
|
|
||||||
import java.text.NumberFormat;
|
import java.text.NumberFormat;
|
||||||
@@ -210,6 +212,13 @@ class LocaleDragAndDropAdapter
|
|||||||
Log.e(TAG, String.format(Locale.US,
|
Log.e(TAG, String.format(Locale.US,
|
||||||
"Negative position in onItemMove %d -> %d", fromPosition, toPosition));
|
"Negative position in onItemMove %d -> %d", fromPosition, toPosition));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fromPosition != toPosition) {
|
||||||
|
FeatureFactory.getFactory(mContext).getMetricsFeatureProvider()
|
||||||
|
.action(mContext, SettingsEnums.ACTION_REORDER_LANGUAGE,
|
||||||
|
mDragLocale.getLocale().getDisplayName() + " move to " + toPosition);
|
||||||
|
}
|
||||||
|
|
||||||
notifyItemChanged(fromPosition); // to update the numbers
|
notifyItemChanged(fromPosition); // to update the numbers
|
||||||
notifyItemChanged(toPosition);
|
notifyItemChanged(toPosition);
|
||||||
notifyItemMoved(fromPosition, toPosition);
|
notifyItemMoved(fromPosition, toPosition);
|
||||||
@@ -244,8 +253,13 @@ class LocaleDragAndDropAdapter
|
|||||||
|
|
||||||
void removeChecked() {
|
void removeChecked() {
|
||||||
int itemCount = mFeedItemList.size();
|
int itemCount = mFeedItemList.size();
|
||||||
|
LocaleStore.LocaleInfo localeInfo;
|
||||||
for (int i = itemCount - 1; i >= 0; i--) {
|
for (int i = itemCount - 1; i >= 0; i--) {
|
||||||
if (mFeedItemList.get(i).getChecked()) {
|
localeInfo = mFeedItemList.get(i);
|
||||||
|
if (localeInfo.getChecked()) {
|
||||||
|
FeatureFactory.getFactory(mContext).getMetricsFeatureProvider()
|
||||||
|
.action(mContext, SettingsEnums.ACTION_REMOVE_LANGUAGE,
|
||||||
|
localeInfo.getLocale().getDisplayName());
|
||||||
mFeedItemList.remove(i);
|
mFeedItemList.remove(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -199,9 +199,11 @@ public class LocaleListEditor extends RestrictedSettingsFragment implements View
|
|||||||
localeInfo = (LocaleStore.LocaleInfo) data.getSerializableExtra(INTENT_LOCALE_KEY);
|
localeInfo = (LocaleStore.LocaleInfo) data.getSerializableExtra(INTENT_LOCALE_KEY);
|
||||||
String preferencesTags = Settings.System.getString(
|
String preferencesTags = Settings.System.getString(
|
||||||
getContext().getContentResolver(), Settings.System.LOCALE_PREFERENCES);
|
getContext().getContentResolver(), Settings.System.LOCALE_PREFERENCES);
|
||||||
|
localeInfo = mayAppendUnicodeTags(localeInfo, preferencesTags);
|
||||||
mAdapter.addLocale(mayAppendUnicodeTags(localeInfo, preferencesTags));
|
mAdapter.addLocale(localeInfo);
|
||||||
updateVisibilityOfRemoveMenu();
|
updateVisibilityOfRemoveMenu();
|
||||||
|
mMetricsFeatureProvider.action(getContext(), SettingsEnums.ACTION_ADD_LANGUAGE,
|
||||||
|
localeInfo.getLocale().getDisplayName());
|
||||||
} else if (requestCode == DIALOG_CONFIRM_SYSTEM_DEFAULT) {
|
} else if (requestCode == DIALOG_CONFIRM_SYSTEM_DEFAULT) {
|
||||||
localeInfo = mAdapter.getFeedItemList().get(0);
|
localeInfo = mAdapter.getFeedItemList().get(0);
|
||||||
if (resultCode == Activity.RESULT_OK) {
|
if (resultCode == Activity.RESULT_OK) {
|
||||||
@@ -214,6 +216,9 @@ public class LocaleListEditor extends RestrictedSettingsFragment implements View
|
|||||||
LocaleDialogFragment localeDialogFragment = LocaleDialogFragment.newInstance();
|
LocaleDialogFragment localeDialogFragment = LocaleDialogFragment.newInstance();
|
||||||
localeDialogFragment.setArguments(args);
|
localeDialogFragment.setArguments(args);
|
||||||
localeDialogFragment.show(mFragmentManager, TAG_DIALOG_NOT_AVAILABLE);
|
localeDialogFragment.show(mFragmentManager, TAG_DIALOG_NOT_AVAILABLE);
|
||||||
|
mMetricsFeatureProvider.action(getContext(),
|
||||||
|
SettingsEnums.ACTION_NOT_SUPPORTED_SYSTEM_LANGUAGE,
|
||||||
|
localeInfo.getLocale().getDisplayName());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
mAdapter.notifyListChanged(localeInfo);
|
mAdapter.notifyListChanged(localeInfo);
|
||||||
|
Reference in New Issue
Block a user