diff options
Diffstat (limited to 'mobile/android/android-components/samples/glean/src/main/res')
11 files changed, 181 insertions, 0 deletions
diff --git a/mobile/android/android-components/samples/glean/src/main/res/layout/activity_main.xml b/mobile/android/android-components/samples/glean/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000000..87e3025d0f --- /dev/null +++ b/mobile/android/android-components/samples/glean/src/main/res/layout/activity_main.xml @@ -0,0 +1,75 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- This Source Code Form is subject to the terms of the Mozilla Public + - License, v. 2.0. If a copy of the MPL was not distributed with this + - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> + + +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + android:id="@+id/buttonList" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_alignParentStart="true" + android:layout_alignParentTop="true" + android:gravity="center" + android:orientation="vertical" + android:padding="10dp" + tools:context="org.mozilla.samples.glean.MainActivity"> + + <!-- This is a dummy linear layout to capture focus and prevent the keyboard from popping + when the app first launches. This is a known issue of linear layouts and a common + workaround. --> + <LinearLayout android:focusable="true" + android:focusableInTouchMode="true" + android:layout_width="0px" + android:layout_height="0px" > + <requestFocus /> + </LinearLayout> + + <EditText + android:id="@+id/etStringListInput" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:ems="10" + android:hint="@string/string_list_input_hint" + android:inputType="textPersonName" + android:autofillHints="" + tools:ignore="UnusedAttribute" /> + + <Button + android:id="@+id/buttonGenerateData" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="5dp" + android:text="@string/generate_data" + android:textAlignment="center" /> + + <TextView + android:id="@+id/textView" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="5dp" + android:text="@string/counter_metric_info" /> + + <Button + android:id="@+id/buttonCheckExperiments" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="@string/check_experiments" + android:textAlignment="center" /> + + <TextView + android:id="@+id/textViewExperimentStatus" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="@android:color/white" + android:text="@string/experiment_not_active" + android:textStyle="italic" /> + + <TextView + android:id="@+id/textView3" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="@string/check_experiments_btn_description" /> + +</LinearLayout> diff --git a/mobile/android/android-components/samples/glean/src/main/res/mipmap-hdpi/ic_launcher.png b/mobile/android/android-components/samples/glean/src/main/res/mipmap-hdpi/ic_launcher.png Binary files differnew file mode 100644 index 0000000000..a2f5908281 --- /dev/null +++ b/mobile/android/android-components/samples/glean/src/main/res/mipmap-hdpi/ic_launcher.png diff --git a/mobile/android/android-components/samples/glean/src/main/res/mipmap-mdpi/ic_launcher.png b/mobile/android/android-components/samples/glean/src/main/res/mipmap-mdpi/ic_launcher.png Binary files differnew file mode 100644 index 0000000000..ff10afd6e1 --- /dev/null +++ b/mobile/android/android-components/samples/glean/src/main/res/mipmap-mdpi/ic_launcher.png diff --git a/mobile/android/android-components/samples/glean/src/main/res/mipmap-xhdpi/ic_launcher.png b/mobile/android/android-components/samples/glean/src/main/res/mipmap-xhdpi/ic_launcher.png Binary files differnew file mode 100644 index 0000000000..dcd3cd8083 --- /dev/null +++ b/mobile/android/android-components/samples/glean/src/main/res/mipmap-xhdpi/ic_launcher.png diff --git a/mobile/android/android-components/samples/glean/src/main/res/mipmap-xxhdpi/ic_launcher.png b/mobile/android/android-components/samples/glean/src/main/res/mipmap-xxhdpi/ic_launcher.png Binary files differnew file mode 100644 index 0000000000..8ca12fe024 --- /dev/null +++ b/mobile/android/android-components/samples/glean/src/main/res/mipmap-xxhdpi/ic_launcher.png diff --git a/mobile/android/android-components/samples/glean/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/mobile/android/android-components/samples/glean/src/main/res/mipmap-xxxhdpi/ic_launcher.png Binary files differnew file mode 100644 index 0000000000..b824ebdd48 --- /dev/null +++ b/mobile/android/android-components/samples/glean/src/main/res/mipmap-xxxhdpi/ic_launcher.png diff --git a/mobile/android/android-components/samples/glean/src/main/res/raw/initial_experiments.json b/mobile/android/android-components/samples/glean/src/main/res/raw/initial_experiments.json new file mode 100644 index 0000000000..e4eadb052b --- /dev/null +++ b/mobile/android/android-components/samples/glean/src/main/res/raw/initial_experiments.json @@ -0,0 +1,60 @@ +{ + "data": [{ + "slug": "test-color", + "endDate": null, + "branches": [ + { + "slug": "control", + "ratio": 1, + "feature": { + "featureId": "sample-experiment-feature", + "enabled": true, + "value": null + } + }, + { + "slug": "red", + "ratio": 1, + "feature": { + "featureId": "sample-experiment-feature", + "enabled": true, + "value": null + } + }, + { + "slug": "blue", + "ratio": 1, + "feature": { + "featureId": "sample-experiment-feature", + "enabled": true, + "value": null + } + } + ], + "featureIds": [ + "sample-experiment-feature" + ], + "probeSets": [], + "startDate": null, + "targeting": "true", + "appName": "samples-glean", + "appId": "org.mozilla.samples.glean.debug", + "channel": "samples", + "bucketConfig": { + "count": 10000, + "start": 0, + "total": 10000, + "namespace": "test-color-1", + "randomizationUnit": "nimbus_id" + }, + "schemaVersion": "1.1.0", + "userFacingName": "Button color sample experiment", + "referenceBranch": "control", + "proposedDuration": null, + "isEnrollmentPaused": false, + "proposedEnrollment": 7, + "userFacingDescription": "A sample experiment to determine the color of a button", + "id": "test-color", + "last_modified": 1607613885917 + }] +} diff --git a/mobile/android/android-components/samples/glean/src/main/res/values/endpoints.xml b/mobile/android/android-components/samples/glean/src/main/res/values/endpoints.xml new file mode 100644 index 0000000000..1a6c4363ca --- /dev/null +++ b/mobile/android/android-components/samples/glean/src/main/res/values/endpoints.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- This Source Code Form is subject to the terms of the Mozilla Public + - License, v. 2.0. If a copy of the MPL was not distributed with this + - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> + +<resources> + <string name="nimbus_default_endpoint" translatable="false">https://settings.stage.mozaws.net</string> +</resources> diff --git a/mobile/android/android-components/samples/glean/src/main/res/values/strings.xml b/mobile/android/android-components/samples/glean/src/main/res/values/strings.xml new file mode 100644 index 0000000000..ed86142323 --- /dev/null +++ b/mobile/android/android-components/samples/glean/src/main/res/values/strings.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- This Source Code Form is subject to the terms of the Mozilla Public + - License, v. 2.0. If a copy of the MPL was not distributed with this + - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> +<resources> + <string name="app_name">Glean - Metrics Demo</string> + <string name="generate_data">Record Text</string> + <string name="string_list_input_hint">Enter some text here</string> + <string name="counter_metric_info"> + Every time you click on the button above, the text is added to the test_string_list metric + and a counter metric type called testCounter is incremented. Both of these will be included + when the ping is sent. The counter and the string list are utilizing the `user` lifetime + and should persist from launch to launch of the app.\n\nAn event metric is also being used + to attach a dictionary of values to the extras of the event ping. See MainActivity for + where all of this is happening. + </string> + <string name="experiment_not_active">Experiment not active</string> + <string name="experiment_active_branch">Experiment active, branch: %1$s</string> + <string name="check_experiments">Check experiments</string> + <string name="check_experiments_btn_description">The CHECK EXPERIMENTS button checks the experiments status of the test-colorexperiment and sets the color accordingly.</string> +</resources> diff --git a/mobile/android/android-components/samples/glean/src/main/res/xml/backup_rules.xml b/mobile/android/android-components/samples/glean/src/main/res/xml/backup_rules.xml new file mode 100644 index 0000000000..820ae61afa --- /dev/null +++ b/mobile/android/android-components/samples/glean/src/main/res/xml/backup_rules.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- This Source Code Form is subject to the terms of the Mozilla Public + - License, v. 2.0. If a copy of the MPL was not distributed with this + - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> + +<full-backup-content> + <include domain="sharedpref" path="."/> +</full-backup-content>
\ No newline at end of file diff --git a/mobile/android/android-components/samples/glean/src/main/res/xml/data_extraction_rules.xml b/mobile/android/android-components/samples/glean/src/main/res/xml/data_extraction_rules.xml new file mode 100644 index 0000000000..55da967560 --- /dev/null +++ b/mobile/android/android-components/samples/glean/src/main/res/xml/data_extraction_rules.xml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- This Source Code Form is subject to the terms of the Mozilla Public + - License, v. 2.0. If a copy of the MPL was not distributed with this + - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> +<data-extraction-rules> + <cloud-backup> + <include domain="sharedpref" path="."/> + </cloud-backup> +</data-extraction-rules>
\ No newline at end of file |