summaryrefslogtreecommitdiffstats
path: root/examples/android/catalog/qml/ModelView.qml
blob: ef42437c08d516e5d6e95c47b675407256aeb7c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import android.view 0.21
import android.widget 0.21
import android.graphics 0.21
import android.graphics.drawable 0.21
import android.support.v4.widget 0.21
import android.support.v7.widget 0.21

import QtQml 2.1

TabHost {
    LinearLayout {
        orientation: LinearLayout.VERTICAL
        TabWidget { }
        FrameLayout {
            LinearLayout.weight: 1
            LinearLayout.height: Layout.WRAP_CONTENT
            SwipeRefreshLayout {
                id: layout
                TabSpec.label: "ListView"
                ListView {
                    adapter: ArrayAdapter {
                        array: ["1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19"]
                    }
                }
                Timer {
                    interval: 2000
                    running: layout.refreshing
                    onTriggered: layout.refreshing = false
                }
            }
            RecyclerView {
                TabSpec.label: "RecyclerView"
                adapter: RecyclerAdapter {
                    count: 50
                    delegate: FrameLayout {
                        CardView {
                            RelativeLayout {
                                padding: 48
                                ImageView {
                                    imageResource: 2130837556 // TODO: R.drawable.logo
                                    RelativeLayout.centerVertical: true
                                    RelativeLayout.alignParentLeft: true
                                }
                                TextView {
                                    text: position
                                    RelativeLayout.alignParentRight: true
                                    RelativeLayout.alignParentBottom: true
                                }
                            }
                            FrameLayout.margin: 48
                            FrameLayout.topMargin: position == 0 ? 48 : 0
                            FrameLayout.width: Layout.MATCH_PARENT
                        }
                    }
                }
            }
        }
    }
}