From 8b731be05944e65a2d5501fa934719164cb8a624 Mon Sep 17 00:00:00 2001 From: wu2018 <45372357+daguehw@users.noreply.github.com> Date: Mon, 23 Nov 2020 17:36:46 +0100 Subject: [PATCH] master --- .idea/codeStyles/Project.xml | 123 ++++++++++++++++++ .idea/codeStyles/codeStyleConfig.xml | 5 + .idea/gradle.xml | 1 + app/build.gradle | 4 +- .../clemhaowen/dm_td2/tasklist/TaskAdapter.kt | 31 +++++ app/src/main/res/layout/item_task.xml | 13 ++ gradle.properties | 3 +- 7 files changed, 177 insertions(+), 3 deletions(-) create mode 100644 .idea/codeStyles/Project.xml create mode 100644 .idea/codeStyles/codeStyleConfig.xml create mode 100644 app/src/main/java/com/clemhaowen/dm_td2/tasklist/TaskAdapter.kt create mode 100644 app/src/main/res/layout/item_task.xml diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml new file mode 100644 index 0000000..7643783 --- /dev/null +++ b/.idea/codeStyles/Project.xml @@ -0,0 +1,123 @@ +<component name="ProjectCodeStyleConfiguration"> + <code_scheme name="Project" version="173"> + <JetCodeStyleSettings> + <option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" /> + </JetCodeStyleSettings> + <codeStyleSettings language="XML"> + <option name="FORCE_REARRANGE_MODE" value="1" /> + <indentOptions> + <option name="CONTINUATION_INDENT_SIZE" value="4" /> + </indentOptions> + <arrangement> + <rules> + <section> + <rule> + <match> + <AND> + <NAME>xmlns:android</NAME> + <XML_ATTRIBUTE /> + <XML_NAMESPACE>^$</XML_NAMESPACE> + </AND> + </match> + </rule> + </section> + <section> + <rule> + <match> + <AND> + <NAME>xmlns:.*</NAME> + <XML_ATTRIBUTE /> + <XML_NAMESPACE>^$</XML_NAMESPACE> + </AND> + </match> + <order>BY_NAME</order> + </rule> + </section> + <section> + <rule> + <match> + <AND> + <NAME>.*:id</NAME> + <XML_ATTRIBUTE /> + <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE> + </AND> + </match> + </rule> + </section> + <section> + <rule> + <match> + <AND> + <NAME>.*:name</NAME> + <XML_ATTRIBUTE /> + <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE> + </AND> + </match> + </rule> + </section> + <section> + <rule> + <match> + <AND> + <NAME>name</NAME> + <XML_ATTRIBUTE /> + <XML_NAMESPACE>^$</XML_NAMESPACE> + </AND> + </match> + </rule> + </section> + <section> + <rule> + <match> + <AND> + <NAME>style</NAME> + <XML_ATTRIBUTE /> + <XML_NAMESPACE>^$</XML_NAMESPACE> + </AND> + </match> + </rule> + </section> + <section> + <rule> + <match> + <AND> + <NAME>.*</NAME> + <XML_ATTRIBUTE /> + <XML_NAMESPACE>^$</XML_NAMESPACE> + </AND> + </match> + <order>BY_NAME</order> + </rule> + </section> + <section> + <rule> + <match> + <AND> + <NAME>.*</NAME> + <XML_ATTRIBUTE /> + <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE> + </AND> + </match> + <order>ANDROID_ATTRIBUTE_ORDER</order> + </rule> + </section> + <section> + <rule> + <match> + <AND> + <NAME>.*</NAME> + <XML_ATTRIBUTE /> + <XML_NAMESPACE>.*</XML_NAMESPACE> + </AND> + </match> + <order>BY_NAME</order> + </rule> + </section> + </rules> + </arrangement> + </codeStyleSettings> + <codeStyleSettings language="kotlin"> + <option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" /> + </codeStyleSettings> + </code_scheme> +</component> \ No newline at end of file diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 0000000..79ee123 --- /dev/null +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ +<component name="ProjectCodeStyleConfiguration"> + <state> + <option name="USE_PER_PROJECT_SETTINGS" value="true" /> + </state> +</component> \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 18de3ac..23a89bb 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -1,5 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project version="4"> + <component name="GradleMigrationSettings" migrationVersion="1" /> <component name="GradleSettings"> <option name="linkedExternalProjectsSettings"> <GradleProjectSettings> diff --git a/app/build.gradle b/app/build.gradle index 9d02172..3c1e181 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -35,10 +35,10 @@ android { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - implementation 'com.android.support:appcompat-v7:28.0.0' + //implementation 'com.android.support:appcompat-v7:28.0.0' implementation 'com.android.support.constraint:constraint-layout:2.0.4' implementation "androidx.recyclerview:recyclerview:1.1.0" testImplementation 'junit:junit:4.+' - androidTestImplementation 'com.android.support.test:runner:1.0.2' + // androidTestImplementation 'com.android.support.test:runner:1.0.2' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' } \ No newline at end of file diff --git a/app/src/main/java/com/clemhaowen/dm_td2/tasklist/TaskAdapter.kt b/app/src/main/java/com/clemhaowen/dm_td2/tasklist/TaskAdapter.kt new file mode 100644 index 0000000..9299739 --- /dev/null +++ b/app/src/main/java/com/clemhaowen/dm_td2/tasklist/TaskAdapter.kt @@ -0,0 +1,31 @@ +package com.clemhaowen.dm_td2.tasklist + +import android.os.Bundle +import android.support.v4.app.Fragment +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import android.widget.TextView +import androidx.recyclerview.widget.RecyclerView +import com.clemhaowen.dm_td2.R + +class TaskListAdapter(private val taskList: List<String>) : RecyclerView.Adapter<TaskListAdapter.TaskViewHolder>() { + override fun getItemCount(): Int = taskList.size + + override fun onCreateViewHolder(parent: ViewGroup, position: Int): TaskViewHolder { + val itemView = + LayoutInflater.from(parent.context).inflate(R.layout.item_task, parent, false) + return TaskViewHolder(itemView) + } + + override fun onBindViewHolder(holder: TaskViewHolder, position: Int) = holder.bind(taskList[position]) + inner class TaskViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { + fun bind(taskTitle: String) { + itemView.apply { + val textView = findViewById<TextView>(R.id.task_title) + textView.text = taskTitle + } + + } + } +} \ No newline at end of file diff --git a/app/src/main/res/layout/item_task.xml b/app/src/main/res/layout/item_task.xml new file mode 100644 index 0000000..d4abe00 --- /dev/null +++ b/app/src/main/res/layout/item_task.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout + xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="vertical" + android:layout_width="match_parent" + android:layout_height="wrap_content"> + + <TextView + android:id="@+id/task_title" + android:background="@android:color/holo_blue_bright" + android:layout_width="match_parent" + android:layout_height="wrap_content" /> +</LinearLayout> \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 7c98564..4214b38 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,4 +12,5 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true # Kotlin code style for this project: "official" or "obsolete": -kotlin.code.style=official \ No newline at end of file +kotlin.code.style=official +android.useAndroidX=true \ No newline at end of file -- GitLab