-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Apply the new design for List-detail sample (#15)
* Start the new design for list detail * Update the detail page * Update UI * Switch to the new control to support full screen portrait mode * Add back button * Update
- Loading branch information
Showing
33 changed files
with
338 additions
and
240 deletions.
There are no files selected for viewing
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
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
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
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
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
38 changes: 38 additions & 0 deletions
38
...etail/src/main/java/com/microsoft/device/display/samples/listdetail/model/ImageAdapter.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package com.microsoft.device.display.samples.listdetail.model | ||
|
||
import android.content.Context | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import android.widget.ImageView | ||
import androidx.recyclerview.widget.RecyclerView | ||
import com.microsoft.device.display.samples.listdetail.R | ||
|
||
class ImageAdapter( | ||
context: Context, | ||
private val images: List<Int>, | ||
private val onClick: (image: Int) -> Unit | ||
) : RecyclerView.Adapter<ImageAdapter.ImageViewHolder>() { | ||
|
||
private val layoutInflater = LayoutInflater.from(context) | ||
|
||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = | ||
ImageViewHolder( | ||
layoutInflater.inflate(R.layout.layout_image_item, parent, false) | ||
) | ||
|
||
override fun onBindViewHolder(holder: ImageViewHolder, position: Int) { | ||
holder.bind(images[position], onClick) | ||
} | ||
|
||
override fun getItemCount() = images.size | ||
|
||
class ImageViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { | ||
private val imageView = itemView.findViewById(R.id.image_item) as ImageView | ||
|
||
fun bind(image: Int, onClick: (image: Int) -> Unit) { | ||
imageView.setImageResource(image) | ||
itemView.setOnClickListener { onClick(image) } | ||
} | ||
} | ||
} |
20 changes: 0 additions & 20 deletions
20
ListDetail/src/main/java/com/microsoft/device/display/samples/listdetail/model/MovieMock.kt
This file was deleted.
Oops, something went wrong.
17 changes: 17 additions & 0 deletions
17
...src/main/java/com/microsoft/device/display/samples/listdetail/model/SelectionViewModel.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.microsoft.device.display.samples.listdetail.model | ||
|
||
import androidx.lifecycle.LiveData | ||
import androidx.lifecycle.MutableLiveData | ||
import androidx.lifecycle.ViewModel | ||
|
||
class SelectionViewModel : ViewModel() { | ||
private val selectedItemLiveData: MutableLiveData<Int?> = MutableLiveData(0) | ||
|
||
fun getSelectedItemLiveData(): LiveData<Int?> { | ||
return this.selectedItemLiveData | ||
} | ||
|
||
fun setSelectedItemLiveData(selectedItem: Int?) { | ||
selectedItemLiveData.value = selectedItem | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="24dp" | ||
android:height="24dp" | ||
android:viewportWidth="24" | ||
android:viewportHeight="24"> | ||
<path | ||
android:pathData="M20,11H7.83l5.59,-5.59L12,4l-8,8 8,8 1.41,-1.41L7.83,13H20v-2z" | ||
android:fillColor="@color/white"/> | ||
</vector> |
Oops, something went wrong.