This file contains 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
public class Movie { | |
private String title; | |
private String genre; | |
private int year; | |
// State of the item | |
private boolean expanded; | |
public Movie(String title, String genre, int year) { | |
this.title = title; |
This file contains 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
@Override | |
public void onBindViewHolder(RecViewHolder holder, int position) { | |
Movie movie = list.get(position); | |
// Set movie data | |
holder.bind(movie); | |
holder.itemView.setOnClickListener(v -> { | |
// Get the current state of the item | |
boolean expanded = movie.isExpanded(); | |
// Change the state |
This file contains 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
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
movieList = setupList(); | |
RecAdapter adapter = new RecAdapter(movieList); | |
RecyclerView recyclerView = findViewById(R.id.recview); |
This file contains 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
<LinearLayout | |
android:orientation="vertical"> | |
<View | |
android:background="#D3D3D3" | |
android:id="@+id/item_divider" /> | |
<TextView | |
android:id="@+id/item_title" | |
tools:text="Léon: The Professional" /> | |
<LinearLayout | |
android:id="@+id/sub_item" |
This file contains 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
import io.ktor.application.Application | |
import io.ktor.application.call | |
import io.ktor.application.install | |
import io.ktor.features.ContentNegotiation | |
import io.ktor.gson.gson | |
import io.ktor.request.receive | |
import io.ktor.routing.post | |
import io.ktor.routing.routing | |
fun Application.module() { |
This file contains 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
java.lang.ClassCastException: com.google.gson.internal.LinkedTreeMap cannot be cast to Item | |
at AppKt$module$2$1.doResume(app.kt:18) | |
at AppKt$module$2$1.invoke(app.kt) | |
at AppKt$module$2$1.invoke(app.kt) | |
at io.ktor.pipeline.PipelineContext.proceed(PipelineContext.kt:49) | |
at io.ktor.pipeline.Pipeline.execute(Pipeline.kt:22) | |
at io.ktor.routing.Routing.executeResult(Routing.kt:100) | |
at io.ktor.routing.Routing.interceptor(Routing.kt:25) | |
at io.ktor.routing.Routing$Feature$install$1.doResume(Routing.kt:66) | |
at io.ktor.routing.Routing$Feature$install$1.invoke(Routing.kt) |