mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2025-06-05 21:59:17 +02:00
use relativelayouts in weekly view for easier overlap handling
This commit is contained in:
@@ -8,7 +8,7 @@ import android.view.LayoutInflater
|
|||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.view.ViewTreeObserver
|
import android.view.ViewTreeObserver
|
||||||
import android.widget.LinearLayout
|
import android.widget.RelativeLayout
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import com.simplemobiletools.calendar.R
|
import com.simplemobiletools.calendar.R
|
||||||
import com.simplemobiletools.calendar.activities.MainActivity
|
import com.simplemobiletools.calendar.activities.MainActivity
|
||||||
@@ -103,9 +103,10 @@ class WeekFragment : Fragment(), WeeklyCalendar {
|
|||||||
background = ColorDrawable(eventColor)
|
background = ColorDrawable(eventColor)
|
||||||
activity.runOnUiThread {
|
activity.runOnUiThread {
|
||||||
layout.addView(this)
|
layout.addView(this)
|
||||||
(layoutParams as LinearLayout.LayoutParams).apply {
|
(layoutParams as RelativeLayout.LayoutParams).apply {
|
||||||
rightMargin = sideMargin
|
rightMargin = sideMargin
|
||||||
topMargin = (startMinutes * minuteHeight).toInt()
|
topMargin = (startMinutes * minuteHeight).toInt()
|
||||||
|
width = layout.width
|
||||||
height = (duration * minuteHeight).toInt() - sideMargin
|
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) {
|
fun setListener(listener: WeekScrollListener) {
|
||||||
mListener = listener
|
mListener = listener
|
||||||
|
@@ -102,61 +102,54 @@
|
|||||||
android:background="@android:color/transparent"
|
android:background="@android:color/transparent"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<LinearLayout
|
<RelativeLayout
|
||||||
android:id="@+id/week_column_0"
|
android:id="@+id/week_column_0"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:background="@android:color/transparent"
|
android:background="@android:color/transparent"/>
|
||||||
android:orientation="vertical"/>
|
|
||||||
|
|
||||||
<LinearLayout
|
<RelativeLayout
|
||||||
android:id="@+id/week_column_1"
|
android:id="@+id/week_column_1"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:background="@android:color/transparent"
|
android:background="@android:color/transparent"/>
|
||||||
android:orientation="vertical"/>
|
|
||||||
|
|
||||||
<LinearLayout
|
<RelativeLayout
|
||||||
android:id="@+id/week_column_2"
|
android:id="@+id/week_column_2"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:background="@android:color/transparent"
|
android:background="@android:color/transparent"/>
|
||||||
android:orientation="vertical"/>
|
|
||||||
|
|
||||||
<LinearLayout
|
<RelativeLayout
|
||||||
android:id="@+id/week_column_3"
|
android:id="@+id/week_column_3"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:background="@android:color/transparent"
|
android:background="@android:color/transparent"/>
|
||||||
android:orientation="vertical"/>
|
|
||||||
|
|
||||||
<LinearLayout
|
<RelativeLayout
|
||||||
android:id="@+id/week_column_4"
|
android:id="@+id/week_column_4"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:background="@android:color/transparent"
|
android:background="@android:color/transparent"/>
|
||||||
android:orientation="vertical"/>
|
|
||||||
|
|
||||||
<LinearLayout
|
<RelativeLayout
|
||||||
android:id="@+id/week_column_5"
|
android:id="@+id/week_column_5"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:background="@android:color/transparent"
|
android:background="@android:color/transparent"/>
|
||||||
android:orientation="vertical"/>
|
|
||||||
|
|
||||||
<LinearLayout
|
<RelativeLayout
|
||||||
android:id="@+id/week_column_6"
|
android:id="@+id/week_column_6"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:background="@android:color/transparent"
|
android:background="@android:color/transparent"/>
|
||||||
android:orientation="vertical"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
Reference in New Issue
Block a user