1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-12-25 01:55:50 +01:00

Sleep week fragment: resolve scroll issue

This commit is contained in:
a0z 2024-12-14 16:39:48 +01:00
parent d1e19df3fe
commit 624deee7bc

View File

@ -17,6 +17,7 @@
along with this program. If not, see <https://www.gnu.org/licenses/>. */ along with this program. If not, see <https://www.gnu.org/licenses/>. */
package nodomain.freeyourgadget.gadgetbridge.activities.charts; package nodomain.freeyourgadget.gadgetbridge.activities.charts;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
@ -117,6 +118,13 @@ public class WeekSleepChartFragment extends AbstractWeekChartFragment {
Bundle savedInstanceState) { Bundle savedInstanceState) {
mLocale = getResources().getConfiguration().locale; mLocale = getResources().getConfiguration().locale;
View rootView = inflater.inflate(R.layout.fragment_weeksleep_chart, container, false); View rootView = inflater.inflate(R.layout.fragment_weeksleep_chart, container, false);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
rootView.setOnScrollChangeListener((v, scrollX, scrollY, oldScrollX, oldScrollY) -> {
getChartsHost().enableSwipeRefresh(scrollY == 0);
});
}
final int goal = getGoal(); final int goal = getGoal();
if (goal >= 0) { if (goal >= 0) {
mTargetValue = goal; mTargetValue = goal;