Compare commits

..

No commits in common. 'a9acbd6cabd6da33d2f0b8363f9651d7e75c2d37' and 'e608c6ea623a9bc4483fe502952d00d9faf92f26' have entirely different histories.

@ -26,7 +26,6 @@ import org.isoron.uhabits.BuildConfig
import org.isoron.uhabits.R import org.isoron.uhabits.R
import org.isoron.uhabits.core.models.PaletteColor import org.isoron.uhabits.core.models.PaletteColor
import org.isoron.uhabits.databinding.AboutBinding import org.isoron.uhabits.databinding.AboutBinding
import org.isoron.uhabits.utils.applyBottomInset
import org.isoron.uhabits.utils.applyRootViewInsets import org.isoron.uhabits.utils.applyRootViewInsets
import org.isoron.uhabits.utils.currentTheme import org.isoron.uhabits.utils.currentTheme
import org.isoron.uhabits.utils.setupToolbar import org.isoron.uhabits.utils.setupToolbar
@ -56,7 +55,6 @@ class AboutView(
binding.tvTranslate.setOnClickListener { screen.showTranslationWebsite() } binding.tvTranslate.setOnClickListener { screen.showTranslationWebsite() }
binding.tvVersion.setOnClickListener { screen.onPressDeveloperCountdown() } binding.tvVersion.setOnClickListener { screen.onPressDeveloperCountdown() }
binding.tvVersion.text = String.format(version, BuildConfig.VERSION_NAME) binding.tvVersion.text = String.format(version, BuildConfig.VERSION_NAME)
binding.outerLinearLayout.applyBottomInset()
applyRootViewInsets() applyRootViewInsets()
} }
} }

@ -20,14 +20,11 @@
package org.isoron.uhabits.activities.habits.list.views package org.isoron.uhabits.activities.habits.list.views
import android.content.Context import android.content.Context
import android.graphics.Rect
import android.os.Bundle import android.os.Bundle
import android.os.Parcelable import android.os.Parcelable
import android.view.GestureDetector import android.view.GestureDetector
import android.view.MotionEvent import android.view.MotionEvent
import android.view.View import android.view.View
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import androidx.recyclerview.widget.ItemTouchHelper import androidx.recyclerview.widget.ItemTouchHelper
import androidx.recyclerview.widget.ItemTouchHelper.DOWN import androidx.recyclerview.widget.ItemTouchHelper.DOWN
import androidx.recyclerview.widget.ItemTouchHelper.END import androidx.recyclerview.widget.ItemTouchHelper.END
@ -60,7 +57,6 @@ class HabitCardListView(
) : RecyclerView(context, null, R.attr.scrollableRecyclerViewStyle) { ) : RecyclerView(context, null, R.attr.scrollableRecyclerViewStyle) {
var checkmarkCount: Int = 0 var checkmarkCount: Int = 0
private var insetDecorationsAdded: Boolean = false
var dataOffset: Int = 0 var dataOffset: Int = 0
set(value) { set(value) {
@ -79,32 +75,9 @@ class HabitCardListView(
setHasFixedSize(true) setHasFixedSize(true)
isLongClickable = true isLongClickable = true
layoutManager = LinearLayoutManager(context) layoutManager = LinearLayoutManager(context)
applyBottomInset()
super.setAdapter(adapter) super.setAdapter(adapter)
} }
private fun applyBottomInset() {
ViewCompat.setOnApplyWindowInsetsListener(this) { _, insets ->
if (insetDecorationsAdded) return@setOnApplyWindowInsetsListener insets
insetDecorationsAdded = true
val systemBarsInsets = insets.getInsets(WindowInsetsCompat.Type.systemBars())
addItemDecoration(object : ItemDecoration() {
override fun getItemOffsets(
outRect: Rect,
view: View,
parent: RecyclerView,
state: State
) {
val itemCount = parent.adapter?.itemCount
if (parent.getChildAdapterPosition(view) == itemCount?.minus(1)) {
outRect.bottom = systemBarsInsets.bottom
}
}
})
insets
}
}
fun createHabitCardView(): HabitCardView { fun createHabitCardView(): HabitCardView {
return cardViewFactory.create() return cardViewFactory.create()
} }

@ -238,18 +238,17 @@ class HabitCardView(
private fun getAbsoluteButtonLocation(timestamp: Timestamp): PointF { private fun getAbsoluteButtonLocation(timestamp: Timestamp): PointF {
val containerLocation = IntArray(2) val containerLocation = IntArray(2)
this.getLocationInWindow(containerLocation) this.getLocationOnScreen(containerLocation)
val relButtonLocation = getRelativeButtonLocation(timestamp) val relButtonLocation = getRelativeButtonLocation(timestamp)
val windowInsets = rootWindowInsets val windowInsets = rootWindowInsets
val xInset = windowInsets?.displayCutout?.safeInsetLeft ?: 0 val statusBarHeight = if (SDK_INT <= Build.VERSION_CODES.VANILLA_ICE_CREAM) {
val yInset = if (SDK_INT <= Build.VERSION_CODES.VANILLA_ICE_CREAM) {
windowInsets?.systemWindowInsetTop ?: 0 windowInsets?.systemWindowInsetTop ?: 0
} else { } else {
0 0
} }
return PointF( return PointF(
containerLocation[0].toFloat() + relButtonLocation.x - xInset, containerLocation[0].toFloat() + relButtonLocation.x,
containerLocation[1].toFloat() + relButtonLocation.y - yInset containerLocation[1].toFloat() + relButtonLocation.y - statusBarHeight
) )
} }

@ -25,7 +25,6 @@ import android.widget.FrameLayout
import org.isoron.uhabits.core.ui.screens.habits.show.ShowHabitPresenter import org.isoron.uhabits.core.ui.screens.habits.show.ShowHabitPresenter
import org.isoron.uhabits.core.ui.screens.habits.show.ShowHabitState import org.isoron.uhabits.core.ui.screens.habits.show.ShowHabitState
import org.isoron.uhabits.databinding.ShowHabitBinding import org.isoron.uhabits.databinding.ShowHabitBinding
import org.isoron.uhabits.utils.applyBottomInset
import org.isoron.uhabits.utils.applyToolbarInsets import org.isoron.uhabits.utils.applyToolbarInsets
import org.isoron.uhabits.utils.setupToolbar import org.isoron.uhabits.utils.setupToolbar
@ -58,7 +57,6 @@ class ShowHabitView(context: Context) : FrameLayout(context) {
} else { } else {
binding.targetCard.visibility = GONE binding.targetCard.visibility = GONE
} }
binding.linearLayout.applyBottomInset()
} }
fun setListener(presenter: ShowHabitPresenter) { fun setListener(presenter: ShowHabitPresenter) {

@ -26,7 +26,6 @@ import org.isoron.uhabits.R
import org.isoron.uhabits.activities.AndroidThemeSwitcher import org.isoron.uhabits.activities.AndroidThemeSwitcher
import org.isoron.uhabits.core.models.PaletteColor import org.isoron.uhabits.core.models.PaletteColor
import org.isoron.uhabits.databinding.SettingsActivityBinding import org.isoron.uhabits.databinding.SettingsActivityBinding
import org.isoron.uhabits.utils.applyBottomInset
import org.isoron.uhabits.utils.applyRootViewInsets import org.isoron.uhabits.utils.applyRootViewInsets
import org.isoron.uhabits.utils.setupToolbar import org.isoron.uhabits.utils.setupToolbar
@ -45,7 +44,6 @@ class SettingsActivity : AppCompatActivity() {
theme = themeSwitcher.currentTheme theme = themeSwitcher.currentTheme
) )
binding.root.applyRootViewInsets() binding.root.applyRootViewInsets()
binding.root.applyBottomInset()
setContentView(binding.root) setContentView(binding.root)
} }
} }

@ -260,14 +260,6 @@ fun View.applyRootViewInsets() {
} }
} }
fun View.applyBottomInset() {
ViewCompat.setOnApplyWindowInsetsListener(this) { view, insets ->
val systemBarsInsets = insets.getInsets(WindowInsetsCompat.Type.systemBars())
view.setPadding(0, 0, 0, systemBarsInsets.bottom)
insets
}
}
fun View.applyToolbarInsets() { fun View.applyToolbarInsets() {
ViewCompat.setOnApplyWindowInsetsListener(this) { view, insets -> ViewCompat.setOnApplyWindowInsetsListener(this) { view, insets ->
val systemBarsInsets = insets.getInsets(WindowInsetsCompat.Type.systemBars()) val systemBarsInsets = insets.getInsets(WindowInsetsCompat.Type.systemBars())

@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?><!-- <?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2016-2021 Álinson Santos Xavier <git@axavier.org> ~ Copyright (C) 2016-2021 Álinson Santos Xavier <git@axavier.org>
~ ~
~ This file is part of Loop Habit Tracker. ~ This file is part of Loop Habit Tracker.
@ -27,7 +28,7 @@
<androidx.appcompat.widget.Toolbar <androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar" android:id="@+id/toolbar"
app:popupTheme="?toolbarPopupTheme" app:popupTheme="?toolbarPopupTheme"
style="@style/Toolbar" /> style="@style/Toolbar"/>
<ScrollView <ScrollView
android:id="@+id/scrollView" android:id="@+id/scrollView"
@ -36,7 +37,6 @@
android:layout_below="@id/toolbar"> android:layout_below="@id/toolbar">
<LinearLayout <LinearLayout
android:id="@+id/outerLinearLayout"
style="@style/CardList"> style="@style/CardList">
<LinearLayout <LinearLayout
@ -47,7 +47,7 @@
android:layout_width="100dp" android:layout_width="100dp"
android:layout_height="100dp" android:layout_height="100dp"
android:layout_margin="6dp" android:layout_margin="6dp"
android:src="@drawable/intro_icon_1" /> android:src="@drawable/intro_icon_1"/>
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -57,14 +57,14 @@
android:textSize="16sp" android:textSize="16sp"
android:layout_margin="6dp" android:layout_margin="6dp"
android:textColor="?aboutScreenColor" android:textColor="?aboutScreenColor"
android:text="@string/app_name" /> android:text="@string/app_name"/>
<TextView <TextView
android:id="@+id/tvVersion" android:id="@+id/tvVersion"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center" android:gravity="center"
android:text="" /> android:text=""/>
</LinearLayout> </LinearLayout>
@ -75,32 +75,32 @@
<TextView <TextView
style="@style/CardHeader" style="@style/CardHeader"
android:text="@string/links" android:text="@string/links"
android:textColor="?aboutScreenColor" /> android:textColor="?aboutScreenColor"/>
<TextView <TextView
android:id="@+id/tvRate" android:id="@+id/tvRate"
style="@style/About.Item.Clickable" style="@style/About.Item.Clickable"
android:text="@string/pref_rate_this_app" /> android:text="@string/pref_rate_this_app"/>
<TextView <TextView
android:id="@+id/tvFeedback" android:id="@+id/tvFeedback"
style="@style/About.Item.Clickable" style="@style/About.Item.Clickable"
android:text="@string/pref_send_feedback" /> android:text="@string/pref_send_feedback"/>
<TextView <TextView
android:id="@+id/tvTranslate" android:id="@+id/tvTranslate"
style="@style/About.Item.Clickable" style="@style/About.Item.Clickable"
android:text="@string/help_translate" /> android:text="@string/help_translate"/>
<TextView <TextView
android:id="@+id/tvSource" android:id="@+id/tvSource"
style="@style/About.Item.Clickable" style="@style/About.Item.Clickable"
android:text="@string/pref_view_source_code" /> android:text="@string/pref_view_source_code"/>
<TextView <TextView
android:id="@+id/tvPrivacy" android:id="@+id/tvPrivacy"
style="@style/About.Item.Clickable" style="@style/About.Item.Clickable"
android:text="@string/pref_view_privacy" /> android:text="@string/pref_view_privacy"/>
</LinearLayout> </LinearLayout>
@ -111,7 +111,7 @@
<TextView <TextView
style="@style/CardHeader" style="@style/CardHeader"
android:text="@string/developers" android:text="@string/developers"
android:textColor="?aboutScreenColor" /> android:textColor="?aboutScreenColor"/>
<!-- <!--
This file lists developers who contributed with at least 100 lines This file lists developers who contributed with at least 100 lines
@ -120,76 +120,31 @@
linked at the bottom of the list. If you qualify, please feel free to linked at the bottom of the list. If you qualify, please feel free to
submit a pull request adding yourself here. submit a pull request adding yourself here.
--> -->
<TextView <TextView style="@style/About.Item" android:text="Álinson S. Xavier (@iSoron)"/>
style="@style/About.Item" <TextView style="@style/About.Item" android:text="Quentin Hibon (@hiqua)"/>
android:text="Álinson S. Xavier (@iSoron)" /> <TextView style="@style/About.Item" android:text="Oleg Ivashchenko (@olegivo)"/>
<TextView style="@style/About.Item" android:text="Kristian Tashkov (@KristianTashkov)"/>
<TextView <TextView style="@style/About.Item" android:text="Jakub Kalinowski (@kalina559)"/>
style="@style/About.Item" <TextView style="@style/About.Item" android:text="Rechee Jozil (@recheej)"/>
android:text="Quentin Hibon (@hiqua)" /> <TextView style="@style/About.Item" android:text="Sebastian Gallese (@sgallese)"/>
<TextView style="@style/About.Item" android:text="Luboš Luňák (@llunak)"/>
<TextView <TextView style="@style/About.Item" android:text="Bindu (@vbh)"/>
style="@style/About.Item" <TextView style="@style/About.Item" android:text="Victor Yu (@vyu1)"/>
android:text="Oleg Ivashchenko (@olegivo)" /> <TextView style="@style/About.Item" android:text="Christoph Hennemann (@chennemann)"/>
<TextView style="@style/About.Item" android:text="Денис (@sciamano)"/>
<TextView <TextView style="@style/About.Item" android:text="Joseph Tran (@JotraN)"/>
style="@style/About.Item" <TextView style="@style/About.Item" android:text="Nikhil (@regularcoder)"/>
android:text="Kristian Tashkov (@KristianTashkov)" /> <TextView style="@style/About.Item" android:text="JanetQC"/>
<TextView
style="@style/About.Item"
android:text="Jakub Kalinowski (@kalina559)" />
<TextView
style="@style/About.Item"
android:text="Rechee Jozil (@recheej)" />
<TextView
style="@style/About.Item"
android:text="Sebastian Gallese (@sgallese)" />
<TextView
style="@style/About.Item"
android:text="Luboš Luňák (@llunak)" />
<TextView
style="@style/About.Item"
android:text="Bindu (@vbh)" />
<TextView
style="@style/About.Item"
android:text="Victor Yu (@vyu1)" />
<TextView
style="@style/About.Item"
android:text="Christoph Hennemann (@chennemann)" />
<TextView
style="@style/About.Item"
android:text="Денис (@sciamano)" />
<TextView
style="@style/About.Item"
android:text="Joseph Tran (@JotraN)" />
<TextView
style="@style/About.Item"
android:text="Nikhil (@regularcoder)" />
<TextView
style="@style/About.Item"
android:text="JanetQC" />
<TextView <TextView
android:id="@+id/tvContributors" android:id="@+id/tvContributors"
style="@style/About.Item.Clickable" style="@style/About.Item.Clickable"
android:text="@string/view_all_contributors" /> android:text="@string/view_all_contributors"/>
</LinearLayout> </LinearLayout>
<include layout="@layout/about_translators" /> <include layout="@layout/about_translators"/>
> >
</LinearLayout> </LinearLayout>
</ScrollView> </ScrollView>

@ -17,7 +17,8 @@
~ with this program. If not, see <http://www.gnu.org/licenses/>. ~ with this program. If not, see <http://www.gnu.org/licenses/>.
--> -->
<RelativeLayout android:id="@+id/container" <RelativeLayout
android:id="@+id/container"
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -28,7 +29,7 @@
android:id="@+id/toolbar" android:id="@+id/toolbar"
style="@style/Toolbar" style="@style/Toolbar"
app:popupTheme="?toolbarPopupTheme" app:popupTheme="?toolbarPopupTheme"
android:layout_alignParentTop="true" /> android:layout_alignParentTop="true"/>
<ScrollView <ScrollView
android:id="@+id/scrollView" android:id="@+id/scrollView"
@ -40,12 +41,11 @@
<LinearLayout <LinearLayout
style="@style/CardList" style="@style/CardList"
android:id="@+id/linearLayout"
android:clipToPadding="false"> android:clipToPadding="false">
<org.isoron.uhabits.activities.habits.show.views.SubtitleCardView <org.isoron.uhabits.activities.habits.show.views.SubtitleCardView
android:id="@+id/subtitleCard" android:id="@+id/subtitleCard"
style="@style/ShowHabit.Subtitle" /> style="@style/ShowHabit.Subtitle"/>
<org.isoron.uhabits.activities.habits.show.views.NotesCardView <org.isoron.uhabits.activities.habits.show.views.NotesCardView
android:id="@+id/notesCard" android:id="@+id/notesCard"
@ -55,36 +55,36 @@
<org.isoron.uhabits.activities.habits.show.views.OverviewCardView <org.isoron.uhabits.activities.habits.show.views.OverviewCardView
android:id="@+id/overviewCard" android:id="@+id/overviewCard"
style="@style/Card" style="@style/Card"
android:paddingTop="12dp" /> android:paddingTop="12dp"/>
<org.isoron.uhabits.activities.habits.show.views.TargetCardView <org.isoron.uhabits.activities.habits.show.views.TargetCardView
android:id="@+id/targetCard" android:id="@+id/targetCard"
style="@style/Card" style="@style/Card"
android:paddingTop="12dp" /> android:paddingTop="12dp"/>
<org.isoron.uhabits.activities.habits.show.views.ScoreCardView <org.isoron.uhabits.activities.habits.show.views.ScoreCardView
android:id="@+id/scoreCard" android:id="@+id/scoreCard"
style="@style/Card" style="@style/Card"
android:gravity="center" /> android:gravity="center"/>
<org.isoron.uhabits.activities.habits.show.views.BarCardView <org.isoron.uhabits.activities.habits.show.views.BarCardView
android:id="@+id/barCard" android:id="@+id/barCard"
style="@style/Card" style="@style/Card"
android:gravity="center" /> android:gravity="center"/>
<org.isoron.uhabits.activities.habits.show.views.HistoryCardView <org.isoron.uhabits.activities.habits.show.views.HistoryCardView
android:id="@+id/historyCard" android:id="@+id/historyCard"
style="@style/Card" style="@style/Card"
android:gravity="center" android:gravity="center"
android:paddingBottom="0dp" /> android:paddingBottom="0dp"/>
<org.isoron.uhabits.activities.habits.show.views.StreakCardView <org.isoron.uhabits.activities.habits.show.views.StreakCardView
android:id="@+id/streakCard" android:id="@+id/streakCard"
style="@style/Card" /> style="@style/Card"/>
<org.isoron.uhabits.activities.habits.show.views.FrequencyCardView <org.isoron.uhabits.activities.habits.show.views.FrequencyCardView
android:id="@+id/frequencyCard" android:id="@+id/frequencyCard"
style="@style/Card" /> style="@style/Card"/>
</LinearLayout> </LinearLayout>
</ScrollView> </ScrollView>

Loading…
Cancel
Save