Skip to content

Instantly share code, notes, and snippets.

View maozgal's full-sized avatar

Gal Maoz maozgal

View GitHub Profile
<KeyCycle
motion:framePosition="0"
motion:target="@+id/button"
motion:wavePeriod="0"
motion:waveOffset="0dp"
motion:waveShape="bounce"
android:translationY="0dp"/>
<KeyCycle
motion:framePosition="50"
<KeyFrameSet>
<KeyCycle
motion:framePosition="0"
motion:target="@+id/button"
motion:wavePeriod="0"
motion:waveOffset="0"
motion:waveShape="sin"
android:rotation="20"/>
@maozgal
maozgal / keycycle.xml
Last active February 28, 2019 15:22
KeyCycle example
<KeyFrameSet>
<KeyCycle
motion:framePosition="0"
motion:target="@+id/button"
motion:wavePeriod="0"
motion:waveOffset="0"
motion:waveShape="sin"
android:rotation="0"/>
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/nsv"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.constraint.motion.MotionLayout
android:id="@+id/anchor"
@maozgal
maozgal / MainActivity.kt
Last active February 10, 2019 16:30
Div-like main activity
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val recyclerView = findViewById<RecyclerView>(R.id.recycler_view)
val layoutManager = FlexboxLayoutManager(this)
layoutManager.flexDirection = FlexDirection.ROW
layoutManager.justifyContent = JustifyContent.CENTER
@maozgal
maozgal / DivLikeAdapter.kt
Last active February 10, 2019 21:09
A simple String adapter
class DivLikeAdapter(private val mItems: ArrayList<String>) : RecyclerView.Adapter<DivLikeAdapter.DivItemViewHolder>() {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): DivLikeAdapter.DivItemViewHolder {
val view = LayoutInflater.from(parent.context)
.inflate(R.layout.item, parent, false)
return DivItemViewHolder(view)
}
override fun onBindViewHolder(holder: DivItemViewHolder, position: Int) {
holder.onBind(position)
@maozgal
maozgal / activity_main.xml
Last active January 10, 2019 08:36
Div-like main layout
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".MainActivity">
<androidx.recyclerview.widget.RecyclerView
@maozgal
maozgal / item_background.xml
Last active January 1, 2019 16:49
Background for flexbox items
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<stroke android:width="2dp" android:color="#ac5c23" />
<corners android:radius="12dp"/>
<solid android:color="#ffbb00" />
</shape>
@maozgal
maozgal / item.xml
Last active January 7, 2019 16:40
Item for flexbox layout
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:context=".MainActivity">
<TextView