Created
December 7, 2020 07:42
-
-
Save AbGhost-cyber/a5c2170b08b8dcbb3ad570a9805685f6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:background="@android:color/transparent"> | |
<androidx.constraintlayout.widget.ConstraintLayout | |
android:id="@+id/actionsLayout" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:layout_centerInParent="true" | |
android:background="@drawable/delete_course_bg" | |
android:visibility="gone"> | |
<LinearLayout | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:layout_marginEnd="8dp" | |
android:orientation="horizontal" | |
app:layout_constraintBottom_toBottomOf="parent" | |
app:layout_constraintEnd_toEndOf="parent" | |
app:layout_constraintHorizontal_bias="1.0" | |
app:layout_constraintStart_toStartOf="parent" | |
app:layout_constraintTop_toTopOf="parent"> | |
<ImageView | |
android:id="@+id/close_view" | |
android:layout_width="0dp" | |
android:layout_height="wrap_content" | |
android:layout_weight="1" | |
android:padding="10dp" | |
android:src="@drawable/ic_clear4" | |
app:layout_constraintBottom_toBottomOf="parent" | |
app:layout_constraintEnd_toEndOf="parent" | |
app:layout_constraintHorizontal_bias="1.0" | |
app:layout_constraintStart_toEndOf="@+id/tvGrade" | |
app:layout_constraintTop_toTopOf="parent" | |
app:tint="@android:color/white" /> | |
<ImageView | |
android:id="@+id/edit_item" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:padding="10dp" | |
android:src="@drawable/ic_create_semester4" | |
app:layout_constraintBottom_toBottomOf="parent" | |
app:layout_constraintEnd_toEndOf="parent" | |
app:layout_constraintHorizontal_bias="1.0" | |
app:layout_constraintStart_toEndOf="@+id/tvGrade" | |
app:layout_constraintTop_toTopOf="parent" | |
app:tint="@android:color/white" /> | |
<ImageView | |
android:id="@+id/delete_item" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:padding="10dp" | |
android:src="@drawable/ic_baseline_delete_24" | |
app:layout_constraintBottom_toBottomOf="parent" | |
app:layout_constraintEnd_toEndOf="parent" | |
app:layout_constraintHorizontal_bias="1.0" | |
app:layout_constraintStart_toEndOf="@+id/tvGrade" | |
app:layout_constraintTop_toTopOf="parent" | |
app:tint="@android:color/white" /> | |
</LinearLayout> | |
</androidx.constraintlayout.widget.ConstraintLayout> | |
<androidx.constraintlayout.widget.ConstraintLayout | |
android:id="@+id/itemsLayout" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:layout_centerInParent="true"> | |
<androidx.constraintlayout.widget.ConstraintLayout | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:layout_margin="2dp" | |
android:background="@drawable/course_bg" | |
android:clickable="false" | |
app:layout_constraintBottom_toBottomOf="parent" | |
app:layout_constraintEnd_toEndOf="parent" | |
app:layout_constraintStart_toStartOf="parent" | |
app:layout_constraintTop_toTopOf="parent"> | |
<com.google.android.material.textview.MaterialTextView | |
android:id="@+id/PrimaryText" | |
android:layout_width="250dp" | |
android:layout_height="wrap_content" | |
android:layout_marginStart="16dp" | |
android:layout_marginTop="10dp" | |
android:layout_marginEnd="10dp" | |
android:ellipsize="end" | |
android:fontFamily="@font/capriola" | |
android:textColor="@color/colorPrimary" | |
android:textSize="20sp" | |
android:textStyle="bold" | |
app:layout_constraintBottom_toBottomOf="parent" | |
app:layout_constraintStart_toStartOf="parent" | |
app:layout_constraintTop_toTopOf="parent" | |
app:layout_constraintVertical_bias="0.06999999" /> | |
<com.google.android.material.textview.MaterialTextView | |
android:id="@+id/secondaryText" | |
android:layout_width="250dp" | |
android:layout_height="wrap_content" | |
android:layout_marginStart="16dp" | |
android:layout_marginTop="2dp" | |
android:layout_marginBottom="20dp" | |
android:fontFamily="@font/capriola" | |
android:textColor="@android:color/secondary_text_dark" | |
android:textSize="16sp" | |
app:layout_constraintBottom_toBottomOf="parent" | |
app:layout_constraintStart_toStartOf="parent" | |
app:layout_constraintTop_toBottomOf="@+id/PrimaryText" /> | |
<TextView | |
android:id="@+id/tvGrade" | |
android:layout_width="70dp" | |
android:layout_height="wrap_content" | |
android:fontFamily="@font/capriola" | |
android:textAllCaps="true" | |
android:textColor="@android:color/black" | |
android:textSize="34sp" | |
android:textStyle="bold" | |
app:layout_constraintBottom_toBottomOf="parent" | |
app:layout_constraintEnd_toEndOf="parent" | |
app:layout_constraintHorizontal_bias="0.91" | |
app:layout_constraintStart_toStartOf="parent" | |
app:layout_constraintTop_toTopOf="parent" /> | |
<ImageView | |
android:id="@+id/others_iv" | |
android:layout_width="30dp" | |
android:layout_height="wrap_content" | |
android:contentDescription="@string/course_other_actions" | |
android:src="@drawable/others_ic" | |
app:layout_constraintBottom_toBottomOf="parent" | |
app:layout_constraintEnd_toEndOf="parent" | |
app:layout_constraintHorizontal_bias="1.0" | |
app:layout_constraintStart_toEndOf="@+id/tvGrade" | |
app:layout_constraintTop_toTopOf="parent" /> | |
</androidx.constraintlayout.widget.ConstraintLayout> | |
</androidx.constraintlayout.widget.ConstraintLayout> | |
</RelativeLayout> | |
//for the items | |
//code below | |
//in recyclerview adapter | |
others_iv.setOnClickListener { | |
actionsLayout.visibility = View.VISIBLE | |
actionsLayout.layoutParams.height = itemsLayout.height / 2 | |
val margins = actionsLayout.layoutParams as ViewGroup.MarginLayoutParams | |
margins.setMargins(8, 8, 8, 8) | |
ObjectAnimator.ofFloat( | |
itemsLayout, "translationX", | |
-400F | |
).apply { | |
duration = 50 | |
start() | |
} | |
} | |
close_view.setOnClickListener { | |
actionsLayout.layoutParams.height = ConstraintLayout.LayoutParams.WRAP_CONTENT | |
val margins = actionsLayout.layoutParams as ViewGroup.MarginLayoutParams | |
margins.setMargins(8, 8, 8, 8) | |
ObjectAnimator.ofFloat(itemsLayout, "translationX", 0F).apply { | |
duration = 50 | |
start() | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment