1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-12-01 14:32:54 +01:00

Hide battery status label view if empty

This commit is contained in:
José Rebelo 2021-12-18 22:45:49 +00:00
parent 055511945b
commit 7e349213a5

View File

@ -26,6 +26,7 @@ import android.content.SharedPreferences;
import android.graphics.Color;
import android.graphics.drawable.GradientDrawable;
import android.text.InputType;
import android.text.TextUtils;
import android.transition.TransitionManager;
import android.util.Pair;
import android.view.LayoutInflater;
@ -225,6 +226,12 @@ public class GBDeviceAdapterv2 extends RecyclerView.Adapter<GBDeviceAdapterv2.Vi
}
);
// Hide the battery status level, if it has no text
if (TextUtils.isEmpty(batteryStatusLabels[batteryIndex].getText())) {
batteryStatusLabels[batteryIndex].setVisibility(View.GONE);
} else {
batteryStatusLabels[batteryIndex].setVisibility(View.VISIBLE);
}
}
holder.heartRateStatusBox.setVisibility((device.isInitialized() && coordinator.supportsRealtimeData() && coordinator.supportsHeartRateMeasurement(device)) ? View.VISIBLE : View.GONE);
if (parent.getContext() instanceof ControlCenterv2) {