<?xml version="1.0" encoding="utf-8"?>
<me.grishka.appkit.views.RecursiveSwipeRefreshLayout
	xmlns:android="http://schemas.android.com/apk/res/android"
	xmlns:tools="http://schemas.android.com/tools"
	xmlns:app="http://schemas.android.com/apk/res-auto"
	android:id="@+id/refresh_layout"
	android:layout_width="match_parent"
	android:layout_height="match_parent">

	<FrameLayout
		android:layout_width="match_parent"
		android:layout_height="match_parent">

		<org.joinmastodon.android.ui.views.NestedRecyclerScrollView
			android:id="@+id/scroller"
			android:layout_width="match_parent"
			android:layout_height="match_parent"
			android:nestedScrollingEnabled="true">
			<LinearLayout
				android:layout_width="match_parent"
				android:layout_height="wrap_content"
				android:orientation="vertical">
				<RelativeLayout
					android:layout_width="match_parent"
					android:layout_height="wrap_content"
					android:clipToPadding="false">

					<org.joinmastodon.android.ui.views.CoverImageView
						android:id="@+id/cover"
						android:layout_width="match_parent"
						android:layout_height="200dp"
						android:background="?profileHeaderBackground"
						android:contentDescription="@string/profile_header"
						android:scaleType="centerCrop" />

					<TextView
						android:id="@+id/follows_you"
						android:layout_width="wrap_content"
						android:layout_height="28dp"
						android:layout_alignEnd="@id/cover"
						android:layout_alignBottom="@id/cover"
						android:layout_margin="16dp"
						android:paddingRight="8dp"
						android:paddingLeft="8dp"
						android:textColor="?colorGray50t"
						android:textAllCaps="true"
						android:fontFamily="sans-serif-medium"
						android:textSize="14sp"
						android:gravity="center"
						android:background="@drawable/bg_profile_follows_you"
						android:visibility="gone"
						tools:visibility="visible"
						android:text="@string/follows_you"/>

					<FrameLayout
						android:id="@+id/avatar_border"
						android:layout_width="112dp"
						android:layout_height="112dp"
						android:layout_below="@id/cover"
						android:layout_alignParentStart="true"
						android:layout_marginTop="-56dp"
						android:layout_marginStart="14dp"
						android:outlineProvider="@null"
						android:background="@drawable/profile_ava_bg">

						<ImageView
							android:id="@+id/avatar"
							android:layout_width="108dp"
							android:layout_height="108dp"
							android:layout_gravity="center"
							android:scaleType="centerCrop"
							android:contentDescription="@string/profile_picture"
							tools:src="#0f0" />

					</FrameLayout>

					<LinearLayout
						android:id="@+id/profile_action_btn_wrap"
						android:layout_width="wrap_content"
						android:layout_height="wrap_content"
						android:layout_below="@id/cover"
						android:layout_alignParentEnd="true">

						<FrameLayout
							android:clipToPadding="false"
							android:paddingVertical="16dp"
							android:paddingStart="16dp"
							android:paddingEnd="4dp"
							android:layout_width="wrap_content"
							android:layout_height="wrap_content">
							<org.joinmastodon.android.ui.views.ProgressBarButton
								android:id="@+id/notify_btn"
								android:layout_width="wrap_content"
								android:layout_height="wrap_content"
								android:paddingHorizontal="8dp"
								android:drawableStart="@drawable/ic_fluent_alert_24_selector" />

							<ProgressBar
								android:id="@+id/notify_progress"
								style="?android:progressBarStyleSmall"
								android:layout_width="wrap_content"
								android:layout_height="wrap_content"
								android:layout_gravity="center"
								android:elevation="10dp"
								android:indeterminate="true"
								android:indeterminateTint="?colorButtonText"
								android:outlineProvider="none"
								android:visibility="gone" />
						</FrameLayout>

						<FrameLayout
							android:clipToPadding="false"
							android:paddingVertical="16dp"
							android:paddingEnd="16dp"
							android:paddingStart="4dp"
							android:layout_width="wrap_content"
							android:layout_height="wrap_content">
							<org.joinmastodon.android.ui.views.ProgressBarButton
								android:id="@+id/profile_action_btn"
								android:layout_width="wrap_content"
								android:layout_height="wrap_content"
								tools:text="Edit Profile" />

							<ProgressBar
								android:id="@+id/action_progress"
								style="?android:progressBarStyleSmall"
								android:layout_width="wrap_content"
								android:layout_height="wrap_content"
								android:layout_gravity="center"
								android:elevation="10dp"
								android:indeterminate="true"
								android:indeterminateTint="?colorButtonText"
								android:outlineProvider="none"
								android:visibility="gone" />
						</FrameLayout>
					</LinearLayout>

					<org.joinmastodon.android.ui.views.AutoOrientationLinearLayout
						android:id="@+id/name_wrap"
						android:layout_width="match_parent"
						android:layout_height="wrap_content"
						android:layout_below="@id/avatar_border"
						android:layout_alignParentStart="true"
						android:layout_marginHorizontal="16dp"
						android:layout_marginTop="12dp">

						<TextView
							android:id="@+id/name"
							android:layout_width="wrap_content"
							android:layout_height="wrap_content"
							android:textAlignment="viewStart"
							android:textAppearance="@style/m3_headline_small"
							tools:text="Eugen" />

						<LinearLayout
							android:id="@+id/roles"
							android:layout_width="wrap_content"
							android:layout_height="wrap_content"
							android:layout_gravity="bottom"
							android:orientation="horizontal"
							android:visibility="gone" />

					</org.joinmastodon.android.ui.views.AutoOrientationLinearLayout>

					<TextView
						android:id="@+id/username"
						android:layout_width="match_parent"
						android:layout_height="wrap_content"
						android:layout_marginHorizontal="16dp"
						android:layout_below="@id/name_wrap"
						android:paddingTop="4dp"
						android:paddingBottom="8dp"
						android:textAppearance="@style/m3_title_medium"
						android:textColor="?android:textColorSecondary"
						tools:text="\@Gargron" />

					<FrameLayout
						android:layout_width="match_parent"
						android:layout_height="wrap_content"
						android:layout_below="@id/username"
						android:id="@+id/note_edit_wrap"
						android:layout_marginTop="4dp"
						android:layout_marginBottom="16dp"
						android:layout_marginHorizontal="16dp"
						android:visibility="gone">

						<EditText
							android:id="@+id/note_edit"
							android:layout_width="match_parent"
							android:layout_height="wrap_content"
							android:paddingVertical="16dp"
							android:inputType="textMultiLine|textCapSentences"
							android:singleLine="false"
							android:drawableStart="@drawable/ic_fluent_notepad_20_regular"
							android:drawablePadding="12dp"
							android:drawableTint="?android:textColorSecondary"
							android:background="@drawable/bg_note_edit"
							android:paddingEnd="48dp"
							android:paddingHorizontal="16dp"
							android:elevation="0dp"
							android:visibility="gone"
							android:hint="@string/mo_personal_note"/>

						<Button
							android:id="@+id/note_edit_confirm"
							android:layout_width="wrap_content"
							android:layout_height="wrap_content"
							android:layout_marginEnd="8dp"
							android:paddingHorizontal="8dp"
							android:visibility="invisible"
							android:backgroundTint="?colorBackgroundLightest"
							android:layout_gravity="right|center_vertical"
							android:tooltipText="@string/mo_personal_note_confirm"
							android:contentDescription="@string/mo_personal_note_confirm"
							android:drawableStart="@drawable/ic_fluent_checkmark_24_regular"
							/>
					</FrameLayout>

<!--					<org.joinmastodon.android.ui.views.LinkedTextView-->
<!--						android:id="@+id/bio"-->
<!--						android:layout_width="match_parent"-->
<!--						android:layout_height="wrap_content"-->
<!--						android:layout_below="@id/note_edit_wrap"-->
<!--						android:layout_marginLeft="16dp"-->
<!--						android:layout_marginRight="16dp"-->
<!--						android:textAppearance="@style/m3_body_large"-->
<!--						android:textSize="16sp"-->
<!--						tools:text="Founder, CEO and lead developer @Mastodon, Germany." />-->

					<EditText
						android:id="@+id/name_edit"
						android:layout_width="match_parent"
						android:layout_height="wrap_content"
						android:layout_below="@id/avatar_border"
						android:layout_alignParentStart="true"
						android:layout_marginHorizontal="16dp"
						android:layout_marginTop="8dp"
						android:textAppearance="@style/m3_body_large"
						android:textSize="16sp"
						android:background="@drawable/edit_text_border"
						android:inputType="textPersonName|textCapWords"
						android:visibility="gone"
						android:elevation="0dp"
						tools:text="Eugen" />

					<FrameLayout
						android:id="@+id/bio_container"
						android:layout_width="match_parent"
						android:layout_height="wrap_content"
						android:layout_below="@id/note_edit_wrap"
						android:layout_marginHorizontal="16dp">

						<org.joinmastodon.android.ui.views.LinkedTextView
							android:id="@+id/bio"
							android:layout_width="match_parent"
							android:layout_height="wrap_content"
							android:textAppearance="@style/m3_body_large"
							android:textSize="16sp"
							tools:text="Founder, CEO and lead developer @Mastodon, Germany." />

						<EditText
							android:id="@+id/bio_edit"
							android:layout_width="match_parent"
							android:layout_height="wrap_content"
							android:textAppearance="@style/m3_body_large"
							android:textSize="16sp"
							android:background="@drawable/edit_text_border"
							android:inputType="textMultiLine|textCapSentences"
							android:visibility="gone"
							android:elevation="0dp"
							tools:text="Founder, CEO and lead developer @Mastodon, Germany." />

					</FrameLayout>

					<View
						android:id="@+id/border_top"
						android:layout_width="match_parent"
						android:layout_height="0.5dp"
						android:layout_below="@id/bio_container"
						android:layout_marginTop="16dp"
						android:background="?attr/colorPollVoted"/>

					<me.grishka.appkit.views.UsableRecyclerView
						android:id="@+id/metadata"
						android:background="?colorBackgroundLightest"
						android:layout_below="@id/border_top"
						android:layout_width="match_parent"
						android:layout_height="wrap_content"
						android:paddingTop="4dp" />

					<org.joinmastodon.android.ui.views.AutoOrientationLinearLayout
						android:id="@+id/profile_counters"
						android:background="?colorBackgroundLightest"
						android:layout_below="@id/metadata"
						android:layout_width="match_parent"
						android:layout_height="wrap_content"
						android:paddingTop="8dp"
						android:paddingHorizontal="8dp">

						<LinearLayout
							android:id="@+id/posts_btn"
							android:layout_width="wrap_content"
							android:layout_height="wrap_content"
							android:padding="8dp"
							android:minHeight="36dp"
							android:gravity="center_vertical"
							android:orientation="horizontal">
							<TextView
								android:id="@+id/posts_count"
								android:layout_width="wrap_content"
								android:layout_height="wrap_content"
								android:textAppearance="@style/m3_title_medium"
								android:singleLine="true"
								android:ellipsize="end"
								tools:text="123" />
							<TextView
								android:id="@+id/posts_label"
								android:layout_width="wrap_content"
								android:layout_height="wrap_content"
								android:layout_marginStart="4sp"
								android:textAppearance="@style/m3_body_large"
								android:singleLine="true"
								android:ellipsize="middle"
								tools:text="posts" />
						</LinearLayout>

						<LinearLayout
							android:id="@+id/following_btn"
							android:layout_width="wrap_content"
							android:layout_height="wrap_content"
							android:padding="8dp"
							android:orientation="horizontal"
							android:minHeight="36dp"
							android:gravity="center_vertical"
							android:background="@drawable/bg_text_button">
							<TextView
								android:id="@+id/following_count"
								android:layout_width="wrap_content"
								android:layout_height="wrap_content"
								android:textAppearance="@style/m3_title_medium"
								android:singleLine="true"
								android:ellipsize="end"
								tools:text="123"/>
							<TextView
								android:id="@+id/following_label"
								android:layout_width="wrap_content"
								android:layout_height="wrap_content"
								android:layout_marginStart="4sp"
								android:textAppearance="@style/m3_body_large"
								android:singleLine="true"
								android:ellipsize="middle"
								tools:text="following"/>
						</LinearLayout>

						<LinearLayout
							android:id="@+id/followers_btn"
							android:layout_width="wrap_content"
							android:layout_height="wrap_content"
							android:padding="8dp"
							android:orientation="horizontal"
							android:minHeight="36dp"
							android:gravity="center_vertical"
							android:background="@drawable/bg_text_button">
							<TextView
								android:id="@+id/followers_count"
								android:layout_width="wrap_content"
								android:layout_height="wrap_content"
								android:textAppearance="@style/m3_title_medium"
								android:singleLine="true"
								android:ellipsize="end"
								tools:text="123"/>
							<TextView
								android:id="@+id/followers_label"
								android:layout_width="wrap_content"
								android:layout_height="wrap_content"
								android:layout_marginStart="4sp"
								android:textAppearance="@style/m3_body_large"
								android:singleLine="true"
								android:ellipsize="middle"
								tools:text="followers"/>
						</LinearLayout>
					</org.joinmastodon.android.ui.views.AutoOrientationLinearLayout>

				</RelativeLayout>

				<org.joinmastodon.android.ui.tabs.TabLayout
					android:id="@+id/tabbar"
					android:layout_width="match_parent"
					android:layout_height="38dp"
					android:paddingHorizontal="4dp"
					android:background="?colorBackgroundLightest"
					app:tabPaddingStart="12dp"
					app:tabPaddingEnd="12dp"
					app:tabMinWidth="0dp"
					app:tabIndicator="@drawable/tab_indicator_inset"
					app:tabIndicatorAnimationMode="elastic"
					app:tabIndicatorColor="?android:textColorPrimary"
					app:tabMode="scrollable"
					app:tabGravity="start"/>

				<View
					android:id="@+id/border_bottom"
					android:layout_width="match_parent"
					android:layout_height="0.5dp"
					android:layout_marginTop="-0.5dp"
					android:background="?attr/colorPollVoted"/>

				<androidx.viewpager2.widget.ViewPager2
					android:id="@+id/pager"
					android:layout_width="match_parent"
					android:layout_height="wrap_content"/>
			</LinearLayout>
		</org.joinmastodon.android.ui.views.NestedRecyclerScrollView>

		<ImageButton
			android:tooltipText="@string/mo_fab_compose"
			android:contentDescription="@string/mo_fab_compose"
			android:id="@+id/fab"
			style="@style/Widget.Mastodon.Button.Compose"/>
	</FrameLayout>

</me.grishka.appkit.views.RecursiveSwipeRefreshLayout>