use relativelayouts in weekly view for easier overlap handling
This commit is contained in:
parent
b8d71620aa
commit
5dacb916ca
|
@ -8,7 +8,7 @@ import android.view.LayoutInflater
|
|||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.ViewTreeObserver
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.RelativeLayout
|
||||
import android.widget.TextView
|
||||
import com.simplemobiletools.calendar.R
|
||||
import com.simplemobiletools.calendar.activities.MainActivity
|
||||
|
@ -103,9 +103,10 @@ class WeekFragment : Fragment(), WeeklyCalendar {
|
|||
background = ColorDrawable(eventColor)
|
||||
activity.runOnUiThread {
|
||||
layout.addView(this)
|
||||
(layoutParams as LinearLayout.LayoutParams).apply {
|
||||
(layoutParams as RelativeLayout.LayoutParams).apply {
|
||||
rightMargin = sideMargin
|
||||
topMargin = (startMinutes * minuteHeight).toInt()
|
||||
width = layout.width
|
||||
height = (duration * minuteHeight).toInt() - sideMargin
|
||||
}
|
||||
}
|
||||
|
@ -113,7 +114,7 @@ class WeekFragment : Fragment(), WeeklyCalendar {
|
|||
}
|
||||
}
|
||||
|
||||
private fun getColumnWithId(id: Int) = mView.findViewById(mRes.getIdentifier("week_column_$id", "id", context.packageName)) as LinearLayout
|
||||
private fun getColumnWithId(id: Int) = mView.findViewById(mRes.getIdentifier("week_column_$id", "id", context.packageName)) as RelativeLayout
|
||||
|
||||
fun setListener(listener: WeekScrollListener) {
|
||||
mListener = listener
|
||||
|
|
|
@ -102,61 +102,54 @@
|
|||
android:background="@android:color/transparent"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
<RelativeLayout
|
||||
android:id="@+id/week_column_0"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="@android:color/transparent"
|
||||
android:orientation="vertical"/>
|
||||
android:background="@android:color/transparent"/>
|
||||
|
||||
<LinearLayout
|
||||
<RelativeLayout
|
||||
android:id="@+id/week_column_1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="@android:color/transparent"
|
||||
android:orientation="vertical"/>
|
||||
android:background="@android:color/transparent"/>
|
||||
|
||||
<LinearLayout
|
||||
<RelativeLayout
|
||||
android:id="@+id/week_column_2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="@android:color/transparent"
|
||||
android:orientation="vertical"/>
|
||||
android:background="@android:color/transparent"/>
|
||||
|
||||
<LinearLayout
|
||||
<RelativeLayout
|
||||
android:id="@+id/week_column_3"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="@android:color/transparent"
|
||||
android:orientation="vertical"/>
|
||||
android:background="@android:color/transparent"/>
|
||||
|
||||
<LinearLayout
|
||||
<RelativeLayout
|
||||
android:id="@+id/week_column_4"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="@android:color/transparent"
|
||||
android:orientation="vertical"/>
|
||||
android:background="@android:color/transparent"/>
|
||||
|
||||
<LinearLayout
|
||||
<RelativeLayout
|
||||
android:id="@+id/week_column_5"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="@android:color/transparent"
|
||||
android:orientation="vertical"/>
|
||||
android:background="@android:color/transparent"/>
|
||||
|
||||
<LinearLayout
|
||||
<RelativeLayout
|
||||
android:id="@+id/week_column_6"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="@android:color/transparent"
|
||||
android:orientation="vertical"/>
|
||||
android:background="@android:color/transparent"/>
|
||||
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
|
Loading…
Reference in New Issue