@@ -3,7 +3,7 @@ package com.example.benjo.bil_app_kotlin.list.expandable
import android.support.v7.widget.RecyclerView
import android.view.View
import com.example.benjo.bil_app_kotlin.R
import com.example.benjo.bil_app_kotlin.list.Row
import com.example.benjo.bil_app_kotlin.list.model.Row
import io.github.luizgrp.sectionedrecyclerviewadapter.SectionParameters
import io.github.luizgrp.sectionedrecyclerviewadapter.SectionedRecyclerViewAdapter
import io.github.luizgrp.sectionedrecyclerviewadapter.StatelessSection
@@ -50,11 +50,11 @@ class ExpandableSection(private val title: String?,
sectionAdapter.notifyDataSetChanged()
}
}

}

override fun getHeaderViewHolder(view: View?): RecyclerView.ViewHolder {
return ParentViewHolder(view)
}
/* ------------------------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------------------------- */

}

This file was deleted.

@@ -0,0 +1,3 @@
package com.example.benjo.bil_app_kotlin.list.model

data class Row(var desc : String?, var data : String?)
@@ -0,0 +1,27 @@
package com.example.benjo.bil_app_kotlin.list.ordinary


import android.os.Bundle
import android.view.View
import com.example.benjo.bil_app_kotlin.BaseFragment
import com.example.benjo.bil_app_kotlin.list.model.Row
import kotlinx.android.synthetic.main.fragment_base.*


class BasicListFragment : BaseFragment() {
private val arrayList = arrayListOf<Row>()
private var listAdapter: ListAdapter? = null


override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
listAdapter = ListAdapter(arrayList)
list.adapter = listAdapter
}

fun updateList(list: ArrayList<Row>) {
listAdapter?.setList(list)
}


}
@@ -2,13 +2,11 @@ package com.example.benjo.bil_app_kotlin.list.ordinary

import android.support.v7.widget.RecyclerView
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.example.benjo.bil_app_kotlin.R
import com.example.benjo.bil_app_kotlin.list.Row
import kotlinx.android.synthetic.main.row_list.view.*
import com.example.benjo.bil_app_kotlin.list.model.Row

class ListAdapter(data: ArrayList<Row>?) : RecyclerView.Adapter<ListAdapter.ViewHolder>() {
class ListAdapter(data: ArrayList<Row>?) : RecyclerView.Adapter<ViewHolder>() {
private var data: ArrayList<Row>? = null

init {
@@ -39,8 +37,4 @@ class ListAdapter(data: ArrayList<Row>?) : RecyclerView.Adapter<ListAdapter.View
notifyDataSetChanged()
}

class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
val descRow = itemView.row_tv_desc
val dataRow = itemView.row_tv_data
}
}
@@ -0,0 +1,10 @@
package com.example.benjo.bil_app_kotlin.list.ordinary

import android.support.v7.widget.RecyclerView
import android.view.View
import kotlinx.android.synthetic.main.row_list.view.*

class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
val descRow = itemView.row_tv_desc
val dataRow = itemView.row_tv_data
}
@@ -3,11 +3,13 @@ package com.example.benjo.bil_app_kotlin.network.json_parsing
import com.example.benjo.bil_app_kotlin.Constants
import com.example.benjo.bil_app_kotlin.MainActivity
import com.example.benjo.bil_app_kotlin.R
import com.example.benjo.bil_app_kotlin.list.Row
import com.example.benjo.bil_app_kotlin.list.model.Row


class JsonMapping(private val activity: MainActivity) {

private fun row(id: Int, value: String?): Row = Row(desc(id), value)
private fun desc(id: Int): String = activity.resources.getString(id)

fun basicInfoMapping(key: String, value: String?): Row = when (key) {
Constants.MAKE -> row(R.string.api_make, value)
@@ -62,7 +64,4 @@ class JsonMapping(private val activity: MainActivity) {
else -> Row("", "")
}

private fun row(id: Int, value: String?): Row = Row(desc(id), value)
private fun desc(id: Int): String = activity.resources.getString(id)

}
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">

<!-- pressed -->
<item android:color="@color/colorBlack200" android:state_pressed="true"/>


</selector>
@@ -11,5 +11,4 @@
android:layout_height="match_parent"
android:scrollbars="vertical" />


</FrameLayout>
@@ -51,9 +51,13 @@
<string name="api_emission_class">Utsläppsklass</string>
<string name="api_euro_ncap">Euro NCAP</string>

<!-- TODO: Remove or change this placeholder text -->
<string name="hello_blank_fragment">Hello blank fragment</string>
<!-- ********************************************* -->
<!-- Errors -->
<string name="error_no_internet">Ingen internetanslutning</string>
<string name="error_api_failure">Kunde inte läsa in data från server</string>
<string name="error_http_code">Klientfel eller serverfel</string>
<string name="error_reg_limit">Antalet tecken måste vara mellan 2&#8211;7</string>




</resources>