Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,17 @@
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.content.res.Resources;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.net.ConnectivityManager;
import android.os.Bundle;
import android.os.Handler;
import android.text.Html;
import android.text.Spannable;
import android.text.SpannableStringBuilder;
import android.text.TextUtils;
import android.text.format.DateFormat;
import android.text.style.StyleSpan;
import android.util.Log;
import android.util.TimingLogger;
import android.view.Gravity;
Expand Down Expand Up @@ -86,6 +90,7 @@
import com.google.android.apps.forscience.whistlepunk.metadata.GoosciTextLabelValue.TextLabelValue;
import com.google.android.apps.forscience.whistlepunk.performance.PerfTrackerProvider;
import com.google.android.apps.forscience.whistlepunk.review.DeleteMetadataItemDialog;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.snackbar.Snackbar;
import com.google.common.base.Preconditions;
Expand Down Expand Up @@ -753,11 +758,18 @@ private void syncLater(String logMessage) {
}

private void confirmClaimUnclaimedExperiments() {
Context context = getContext();
final Context context = requireContext();
final String username = claimingAccount != null && claimingAccount.isSignedIn() ? claimingAccount.getAccountName() : "";
AlertDialog.Builder builder = new AlertDialog.Builder(context);
final AlertDialog.Builder builder = new MaterialAlertDialogBuilder(context, R.style.AlertDialogTheme);
final String message = getString(R.string.claim_experiments_confirm_all_message, username);
final SpannableStringBuilder messageBuilder = new SpannableStringBuilder(message);
messageBuilder.setSpan(new StyleSpan(Typeface.BOLD),
message.lastIndexOf(username),
message.length() - 1, // Don't apply bold to the question mark at the end.
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);

builder.setTitle(R.string.claim_experiments_confirm_all_title);
builder.setMessage(getString(R.string.claim_experiments_confirm_all_message, username));
builder.setMessage(messageBuilder);
builder.setNegativeButton(android.R.string.cancel, (dialog, which) -> dialog.cancel());
builder.setPositiveButton(
R.string.claim_experiments_action,
Expand Down Expand Up @@ -1359,16 +1371,24 @@ private void promptBeforeClaimExperiment(String experimentId) {
if (parentReference.get().claimProgressBarVisible) {
return;
}
AlertDialog.Builder builder = new AlertDialog.Builder(parentReference.get().getContext());
builder.setMessage(R.string.claim_experiments_confirm_one);
builder.setNegativeButton(android.R.string.cancel, (dialog, which) -> dialog.cancel());
builder.setPositiveButton(
R.string.claim_experiments_action,
(dialog, which) -> {

final String username = claimingAccount != null && claimingAccount.isSignedIn() ? claimingAccount.getAccountName() : "";
final String message = getString(R.string.claim_experiments_confirm_one_message, username);
final SpannableStringBuilder messageBuilder = new SpannableStringBuilder(message);
messageBuilder.setSpan(new StyleSpan(Typeface.BOLD),
message.lastIndexOf(username),
message.length() - 1, // Don't apply bold to the question mark at the end.
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);

final MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(parentReference.get().requireContext(), R.style.AlertDialogTheme)
.setTitle(R.string.claim_experiments_confirm_one)
.setMessage(messageBuilder)
.setNegativeButton(android.R.string.cancel, (dialog, which) -> dialog.cancel())
.setPositiveButton(R.string.claim_experiments_action, (dialog, which) -> {
claimExperiment(experimentId);
dialog.dismiss();
});
AlertDialog dialog = builder.create();
final AlertDialog dialog = builder.create();
dialog.show();
// Need to reset the content description so the button will be read correctly b/116869645
dialog
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginStart="18dp"
android:background="@null"
android:background="?selectableItemBackgroundBorderless"
android:contentDescription="@null"
android:scaleType="centerInside"
android:src="@drawable/ic_arduino_auth_close"
Expand All @@ -49,7 +49,7 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:layout_marginEnd="30dp"
android:layout_marginEnd="15dp"
android:ellipsize="end"
android:fontFamily="@font/open_sans_bold"
android:gravity="center"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,8 @@
<string name="sensor_desc_short_mkrsci_magnetometer">An instrument used to measure the intensity and direction of a magnetic field</string>
<string name="sensor_desc_short_mkrsci_resistance">The measure of the difficulty of current flow through an object or material</string>
<string name="sensor_desc_short_mkrsci_voltage">The difference in electric potential between two places that allows a current to flow</string>
<string name="claim_experiments_confirm_one">Collect experiment?</string>
<string name="claim_experiments_confirm_one">Collect experiment</string>
<string name="claim_experiments_confirm_one_message">Are you sure to collect this experiment and add it to your account’s lab: %1$s’s Lab?</string>
<string name="claim_experiments_title">المطالبة بملكية تَجارب سابقة</string>
<string name="color_ambient_light">Ambient Light</string>
<string name="color_ambient_light_units">lux</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,8 @@ g.co/sciencejournalactivities</string>
<string name="sensor_desc_short_mkrsci_magnetometer">An instrument used to measure the intensity and direction of a magnetic field</string>
<string name="sensor_desc_short_mkrsci_resistance">The measure of the difficulty of current flow through an object or material</string>
<string name="sensor_desc_short_mkrsci_voltage">The difference in electric potential between two places that allows a current to flow</string>
<string name="claim_experiments_confirm_one">Collect experiment?</string>
<string name="claim_experiments_confirm_one">Collect experiment</string>
<string name="claim_experiments_confirm_one_message">Are you sure to collect this experiment and add it to your account’s lab: %1$s’s Lab?</string>
<string name="claim_experiments_title">Заявяване на минали експерименти</string>
<string name="color_ambient_light">Ambient Light</string>
<string name="color_ambient_light_units">lux</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,8 @@ If you have existing data on this device, once signed in, you can save your exis
<string name="sensor_desc_short_mkrsci_magnetometer">An instrument used to measure the intensity and direction of a magnetic field</string>
<string name="sensor_desc_short_mkrsci_resistance">The measure of the difficulty of current flow through an object or material</string>
<string name="sensor_desc_short_mkrsci_voltage">The difference in electric potential between two places that allows a current to flow</string>
<string name="claim_experiments_confirm_one">Collect experiment?</string>
<string name="claim_experiments_confirm_one">Collect experiment</string>
<string name="claim_experiments_confirm_one_message">Are you sure to collect this experiment and add it to your account’s lab: %1$s’s Lab?</string>
<string name="claim_experiments_title">Polaganje prava na prošle eksperimente</string>
<string name="color_ambient_light">Ambient Light</string>
<string name="color_ambient_light_units">lux</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,8 @@ Si tens dades en aquest dispositiu, inicia la sessió per desar els teus experim
<string name="sensor_desc_short_mkrsci_magnetometer">An instrument used to measure the intensity and direction of a magnetic field</string>
<string name="sensor_desc_short_mkrsci_resistance">The measure of the difficulty of current flow through an object or material</string>
<string name="sensor_desc_short_mkrsci_voltage">The difference in electric potential between two places that allows a current to flow</string>
<string name="claim_experiments_confirm_one">Collect experiment?</string>
<string name="claim_experiments_confirm_one">Collect experiment</string>
<string name="claim_experiments_confirm_one_message">Are you sure to collect this experiment and add it to your account’s lab: %1$s’s Lab?</string>
<string name="claim_experiments_title">Reclama experiments anteriors</string>
<string name="color_ambient_light">Ambient Light</string>
<string name="color_ambient_light_units">lux</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,8 @@ experimentovat s okolním světem</string>
<string name="sensor_desc_short_mkrsci_magnetometer">An instrument used to measure the intensity and direction of a magnetic field</string>
<string name="sensor_desc_short_mkrsci_resistance">The measure of the difficulty of current flow through an object or material</string>
<string name="sensor_desc_short_mkrsci_voltage">The difference in electric potential between two places that allows a current to flow</string>
<string name="claim_experiments_confirm_one">Collect experiment?</string>
<string name="claim_experiments_confirm_one">Collect experiment</string>
<string name="claim_experiments_confirm_one_message">Are you sure to collect this experiment and add it to your account’s lab: %1$s’s Lab?</string>
<string name="claim_experiments_title">Nárokování starších experimentů</string>
<string name="color_ambient_light">Ambient Light</string>
<string name="color_ambient_light_units">lux</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,8 @@ Hvis du har eksisterende data på denne enhed, kan du, når du er logget ind, ge
<string name="sensor_desc_short_mkrsci_magnetometer">An instrument used to measure the intensity and direction of a magnetic field</string>
<string name="sensor_desc_short_mkrsci_resistance">The measure of the difficulty of current flow through an object or material</string>
<string name="sensor_desc_short_mkrsci_voltage">The difference in electric potential between two places that allows a current to flow</string>
<string name="claim_experiments_confirm_one">Collect experiment?</string>
<string name="claim_experiments_confirm_one">Collect experiment</string>
<string name="claim_experiments_confirm_one_message">Are you sure to collect this experiment and add it to your account’s lab: %1$s’s Lab?</string>
<string name="claim_experiments_title">Gør krav på tidligere eksperimenter</string>
<string name="color_ambient_light">Ambient Light</string>
<string name="color_ambient_light_units">lux</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,8 @@ If you have existing data on this device, once signed in, you can save your exis
<string name="sensor_desc_short_mkrsci_magnetometer">An instrument used to measure the intensity and direction of a magnetic field</string>
<string name="sensor_desc_short_mkrsci_resistance">The measure of the difficulty of current flow through an object or material</string>
<string name="sensor_desc_short_mkrsci_voltage">The difference in electric potential between two places that allows a current to flow</string>
<string name="claim_experiments_confirm_one">Collect experiment?</string>
<string name="claim_experiments_confirm_one">Collect experiment</string>
<string name="claim_experiments_confirm_one_message">Are you sure to collect this experiment and add it to your account’s lab: %1$s’s Lab?</string>
<string name="claim_experiments_title">Vorherige Experimente anfordern</string>
<string name="color_ambient_light">Ambient Light</string>
<string name="color_ambient_light_units">lux</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,8 @@ If you have existing data on this device, once signed in, you can save your exis
<string name="sensor_desc_short_mkrsci_magnetometer">An instrument used to measure the intensity and direction of a magnetic field</string>
<string name="sensor_desc_short_mkrsci_resistance">The measure of the difficulty of current flow through an object or material</string>
<string name="sensor_desc_short_mkrsci_voltage">The difference in electric potential between two places that allows a current to flow</string>
<string name="claim_experiments_confirm_one">Collect experiment?</string>
<string name="claim_experiments_confirm_one">Collect experiment</string>
<string name="claim_experiments_confirm_one_message">Are you sure to collect this experiment and add it to your account’s lab: %1$s’s Lab?</string>
<string name="claim_experiments_title">Vorherige Experimente anfordern</string>
<string name="color_ambient_light">Ambient Light</string>
<string name="color_ambient_light_units">lux</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,8 @@ Experimente in Ihrer Umgebung durchführen</string>
<string name="sensor_desc_short_mkrsci_magnetometer">An instrument used to measure the intensity and direction of a magnetic field</string>
<string name="sensor_desc_short_mkrsci_resistance">The measure of the difficulty of current flow through an object or material</string>
<string name="sensor_desc_short_mkrsci_voltage">The difference in electric potential between two places that allows a current to flow</string>
<string name="claim_experiments_confirm_one">Collect experiment?</string>
<string name="claim_experiments_confirm_one">Collect experiment</string>
<string name="claim_experiments_confirm_one_message">Are you sure to collect this experiment and add it to your account’s lab: %1$s’s Lab?</string>
<string name="claim_experiments_title">Vorherige Experimente anfordern</string>
<string name="color_ambient_light">Umgebungslicht</string>
<string name="color_ambient_light_units">lux</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,8 @@ g.co/sciencejournalactivities και δοκιμάστε τις</string>
<string name="sensor_desc_short_mkrsci_magnetometer">An instrument used to measure the intensity and direction of a magnetic field</string>
<string name="sensor_desc_short_mkrsci_resistance">The measure of the difficulty of current flow through an object or material</string>
<string name="sensor_desc_short_mkrsci_voltage">The difference in electric potential between two places that allows a current to flow</string>
<string name="claim_experiments_confirm_one">Collect experiment?</string>
<string name="claim_experiments_confirm_one">Collect experiment</string>
<string name="claim_experiments_confirm_one_message">Are you sure to collect this experiment and add it to your account’s lab: %1$s’s Lab?</string>
<string name="claim_experiments_title">Αξίωση παλιότερων πειραμάτων</string>
<string name="color_ambient_light">Ambient Light</string>
<string name="color_ambient_light_units">lux</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,8 @@ If you have existing data on this device, once signed in, you can save your exis
<string name="sensor_desc_short_mkrsci_magnetometer">An instrument used to measure the intensity and direction of a magnetic field</string>
<string name="sensor_desc_short_mkrsci_resistance">The measure of the difficulty of current flow through an object or material</string>
<string name="sensor_desc_short_mkrsci_voltage">The difference in electric potential between two places that allows a current to flow</string>
<string name="claim_experiments_confirm_one">Collect experiment?</string>
<string name="claim_experiments_confirm_one">Collect experiment</string>
<string name="claim_experiments_confirm_one_message">Are you sure to collect this experiment and add it to your account’s lab: %1$s’s Lab?</string>
<string name="claim_experiments_title">Claim past experiments</string>
<string name="color_ambient_light">Ambient Light</string>
<string name="color_ambient_light_units">lux</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,8 @@ If you have existing data on this device, once signed in, you can save your exis
<string name="sensor_desc_short_mkrsci_magnetometer">An instrument used to measure the intensity and direction of a magnetic field</string>
<string name="sensor_desc_short_mkrsci_resistance">The measure of the difficulty of current flow through an object or material</string>
<string name="sensor_desc_short_mkrsci_voltage">The difference in electric potential between two places that allows a current to flow</string>
<string name="claim_experiments_confirm_one">Collect experiment?</string>
<string name="claim_experiments_confirm_one">Collect experiment</string>
<string name="claim_experiments_confirm_one_message">Are you sure to collect this experiment and add it to your account’s lab: %1$s’s Lab?</string>
<string name="claim_experiments_title">Claim past experiments</string>
<string name="color_ambient_light">Ambient Light</string>
<string name="color_ambient_light_units">lux</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,8 @@ If you have existing data on this device, once signed in, you can save your exis
<string name="sensor_desc_short_mkrsci_magnetometer">An instrument used to measure the intensity and direction of a magnetic field</string>
<string name="sensor_desc_short_mkrsci_resistance">The measure of the difficulty of current flow through an object or material</string>
<string name="sensor_desc_short_mkrsci_voltage">The difference in electric potential between two places that allows a current to flow</string>
<string name="claim_experiments_confirm_one">Collect experiment?</string>
<string name="claim_experiments_confirm_one">Collect experiment</string>
<string name="claim_experiments_confirm_one_message">Are you sure to collect this experiment and add it to your account’s lab: %1$s’s Lab?</string>
<string name="claim_experiments_title">Claim past experiments</string>
<string name="color_ambient_light">Ambient Light</string>
<string name="color_ambient_light_units">lux</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,8 @@ If you have existing data on this device, once signed in, you can save your exis
<string name="sensor_desc_short_mkrsci_magnetometer">An instrument used to measure the intensity and direction of a magnetic field</string>
<string name="sensor_desc_short_mkrsci_resistance">The measure of the difficulty of current flow through an object or material</string>
<string name="sensor_desc_short_mkrsci_voltage">The difference in electric potential between two places that allows a current to flow</string>
<string name="claim_experiments_confirm_one">Collect experiment?</string>
<string name="claim_experiments_confirm_one">Collect experiment</string>
<string name="claim_experiments_confirm_one_message">Are you sure to collect this experiment and add it to your account’s lab: %1$s’s Lab?</string>
<string name="claim_experiments_title">Claim past experiments</string>
<string name="color_ambient_light">Ambient Light</string>
<string name="color_ambient_light_units">lux</string>
Expand Down
Loading