Commit 4a640bb4 authored by 12people's avatar 12people

Adding missing files

parent 6a285f54
package com.enjoyingfoss.feeel.view
import android.content.Intent
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import android.support.v7.widget.LinearLayoutManager
import android.support.v7.widget.RecyclerView
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import com.enjoyingfoss.feeel.R
import com.enjoyingfoss.feeel.model.Workout
import com.enjoyingfoss.feeel.model.WorkoutRepository
import kotlinx.android.synthetic.main.activity_overview.*
import java.lang.ref.WeakReference
class OverviewActivity : AppCompatActivity() {
//todo make sure the exercise view loads back if service is in background
override fun onCreate(savedInstanceState: Bundle?) { //todo connect service and preload here
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_overview)
workoutRecycler.layoutManager = LinearLayoutManager(this)
workoutRecycler.adapter = WorkoutAdapter(WorkoutRepository.retrieveAll(), WeakReference(workoutRecycler))
workoutRecycler.addOnItemTouchListener(object: RecyclerView.SimpleOnItemTouchListener() {
})
}
internal class WorkoutAdapter(private val workouts: List<Workout>, private val recyclerView: WeakReference<RecyclerView>)
: RecyclerView.Adapter<WorkoutAdapter.ViewHolder>() {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
val view = LayoutInflater
.from(parent.context)
.inflate(R.layout.item_workout, parent, false)
view.setOnClickListener {
val recycler = recyclerView.get()
val itemPosition = recycler?.getChildAdapterPosition(view) ?: 0
val workout = workouts[itemPosition]
val startIntent = Intent(recycler?.context, CoverActivity::class.java)
startIntent.putExtra(CoverActivity.WORKOUT_KEY, workout)
recycler?.context?.startActivity(startIntent)
}
return ViewHolder(view)
}
override fun getItemCount() = workouts.size
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
holder.title.setText(workouts[position].titleResource)
}
internal class ViewHolder(item: View) : RecyclerView.ViewHolder(item) {
var title = item.findViewById<View>(R.id.title) as TextView
}
}
//todo consider creating service here, then just passing it onto the activity created
}
\ No newline at end of file
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
android:viewportHeight="24.0"
android:viewportWidth="24.0">
<path
android:fillColor="#FFFFFF"
android:pathData="M12,8l-6,6 1.41,1.41L12,10.83l4.59,4.58L18,14z"/>
......
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="32dp"
android:height="32dp"
android:viewportWidth="32"
android:viewportHeight="32">
<path
android:pathData="M26.6,2H5L13.1002,11.9355L26.6,2Z"
android:fillColor="#ffffff"/>
<path
android:pathData="M26.5993,11.9354H13.0995L8.5996,21.8709L26.5993,11.9354Z"
android:fillColor="#FFEFA1"/>
<path
android:pathData="M8.5999,21.871L5,2L13.0999,11.9355L8.5999,21.871Z"
android:fillColor="#FFDD9C"/>
<path
android:pathData="M8.5999,21.871L5,2V30L8.5999,21.871Z"
android:fillColor="#EDCC80"/>
</vector>
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="0dp"
android:background="?attr/colorPrimary"
android:minHeight="?attr/actionBarSize"
android:theme="?attr/actionBarTheme"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:contentDescription="@string/app_name"
app:srcCompat="@drawable/ic_logo"/>
</android.support.v7.widget.Toolbar>
<android.support.v7.widget.RecyclerView
android:id="@+id/workoutRecycler"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_margin="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/toolbar"/>
</android.support.constraint.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackground">
<TextView
android:id="@+id/title"
style="@style/ListTitle_DayNight"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
</android.support.constraint.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="text">#ffffff</color>
</resources>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment