зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1380811 - Add telemetry to collect boolean state for toggle preference. r=francois,mcomella
MozReview-Commit-ID: DQUkuWQUouM --HG-- extra : rebase_source : 070a2872afc8c4163876cc00c347ea26ddd591c7
This commit is contained in:
Родитель
472220c52c
Коммит
3d73733afa
|
@ -14,8 +14,11 @@ import android.widget.CompoundButton;
|
|||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.mozilla.gecko.GeckoSharedPrefs;
|
||||
import org.mozilla.gecko.R;
|
||||
import org.mozilla.gecko.Telemetry;
|
||||
import org.mozilla.gecko.TelemetryContract;
|
||||
|
||||
/**
|
||||
* A toggle that controls a SharedPreference preference, and can be added outside of PreferenceScreen.
|
||||
|
@ -57,6 +60,11 @@ public class SwitchPreferenceView extends SwitchCompat {
|
|||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
|
||||
sharedPreferences.edit().putBoolean(preferenceKey, b).apply();
|
||||
|
||||
final JSONArray extras = new JSONArray();
|
||||
extras.put(preferenceKey);
|
||||
extras.put(b ? "1" : "0");
|
||||
Telemetry.sendUIEvent(TelemetryContract.Event.EDIT, TelemetryContract.Method.SETTINGS, extras.toString());
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче