Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Final beta update #36

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Update dependencies and tools and re-organize
  • Loading branch information
robert-w-gries committed Dec 11, 2019
commit 14644f3afaeedacc9a9aba41fc75c41b8e3aa84a
116 changes: 116 additions & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ ext {
lifecycle_version = "1.1.1"
playServicesLocation = '17.0.0'
playServicesMaps = '17.0.0'
supportLibVersion = '28.0.0'
}

repositories {
Expand All @@ -63,14 +62,14 @@ repositories {

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.1.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime:${serialization_version}"
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation "com.google.android.gms:play-services-location:${playServicesLocation}"
implementation "com.google.android.gms:play-services-maps:${playServicesMaps}"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,49 +1,49 @@
package org.endhungerdurham.pantries
import android.os.Parcel
import android.os.Parcelable
import kotlinx.serialization.Serializable
@Serializable
data class PantryList(val pantries: List<Pantry>)
@Serializable
data class Pantry(val organizations: String, val address: String, val city: String,
val days: String?, val hours: String?,
val phone: String?, val info: String?, val prereq: String?,
val latitude: Double, val longitude: Double) : Parcelable {
constructor(parcel: Parcel) : this(
parcel.readString() ?: "",
parcel.readString() ?: "",
parcel.readString() ?: "",
parcel.readString(),
parcel.readString(),
parcel.readString(),
parcel.readString(),
parcel.readString(),
parcel.readDouble(),
parcel.readDouble())
override fun writeToParcel(parcel: Parcel, flags: Int) = with(parcel) {
writeString(organizations)
writeString(address)
writeString(city)
writeString(days)
writeString(hours)
writeString(phone)
writeString(info)
writeString(prereq)
writeDouble(latitude)
writeDouble(longitude)
}
override fun describeContents() = 0
companion object {
@Suppress("unused")
@JvmField val CREATOR = object : Parcelable.Creator<Pantry> {
override fun createFromParcel(parcel: Parcel) = Pantry(parcel)
override fun newArray(size: Int): Array<Pantry?> = arrayOfNulls(size)
}
}
package org.endhungerdurham.pantries.backend

import android.os.Parcel
import android.os.Parcelable
import kotlinx.serialization.Serializable

@Serializable
data class PantryList(val pantries: List<Pantry>)

@Serializable
data class Pantry(val organizations: String, val address: String, val city: String,
val days: String?, val hours: String?,
val phone: String?, val info: String?, val prereq: String?,
val latitude: Double, val longitude: Double) : Parcelable {
constructor(parcel: Parcel) : this(
parcel.readString() ?: "",
parcel.readString() ?: "",
parcel.readString() ?: "",
parcel.readString(),
parcel.readString(),
parcel.readString(),
parcel.readString(),
parcel.readString(),
parcel.readDouble(),
parcel.readDouble())

override fun writeToParcel(parcel: Parcel, flags: Int) = with(parcel) {
writeString(organizations)
writeString(address)
writeString(city)
writeString(days)
writeString(hours)
writeString(phone)
writeString(info)
writeString(prereq)
writeDouble(latitude)
writeDouble(longitude)
}

override fun describeContents() = 0

companion object {
@Suppress("unused")
@JvmField val CREATOR = object : Parcelable.Creator<Pantry> {
override fun createFromParcel(parcel: Parcel) = Pantry(parcel)
override fun newArray(size: Int): Array<Pantry?> = arrayOfNulls(size)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ import androidx.appcompat.widget.SearchView
import androidx.core.content.ContextCompat
import androidx.lifecycle.ViewModelProviders
import com.google.android.material.tabs.TabLayout
import org.endhungerdurham.pantries.Pantry
import org.endhungerdurham.pantries.R
import org.endhungerdurham.pantries.ui.ListFragment.OnListFragmentInteractionListener
import org.endhungerdurham.pantries.backend.Pantry
import org.endhungerdurham.pantries.ui.fragment.ListFragment.OnListFragmentInteractionListener
import org.endhungerdurham.pantries.ui.adapter.MyFragmentPagerAdapter
import org.endhungerdurham.pantries.ui.fragment.DetailsFragment
import org.endhungerdurham.pantries.ui.viewmodel.PantriesViewModel

private const val KEY_SEARCH_QUERY = "search_query"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const val MAP_PAGE = 0
const val LIST_PAGE = 1
const val PAGE_COUNT = 2

class MyFragmentPagerAdapter(fm: FragmentManager, context: Context) : androidx.fragment.app.FragmentPagerAdapter(fm) {
class MyFragmentPagerAdapter(fm: FragmentManager, context: Context) : androidx.fragment.app.FragmentPagerAdapter(fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT) {
private val tabTitles = mapOf(MAP_PAGE to context.getString(R.string.map), LIST_PAGE to context.getString(R.string.pantries))

override fun getCount(): Int {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import android.view.ViewGroup
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import kotlinx.android.synthetic.main.list_item.view.*
import org.endhungerdurham.pantries.Pantry
import org.endhungerdurham.pantries.backend.Pantry
import org.endhungerdurham.pantries.R
import org.endhungerdurham.pantries.ui.ListFragment.OnListFragmentInteractionListener
import org.endhungerdurham.pantries.ui.fragment.ListFragment.OnListFragmentInteractionListener

class MyItemRecyclerViewAdapter(
private val mPantries: List<Pantry>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import org.endhungerdurham.pantries.R
import org.endhungerdurham.pantries.ui.ListFragment
import org.endhungerdurham.pantries.ui.fragment.ListFragment

class RootListFragment : androidx.fragment.app.Fragment() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import org.endhungerdurham.pantries.R
import org.endhungerdurham.pantries.ui.MapFragment
import org.endhungerdurham.pantries.ui.fragment.MapFragment

class RootMapFragment : androidx.fragment.app.Fragment() {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.endhungerdurham.pantries.ui
package org.endhungerdurham.pantries.ui.fragment

import android.content.Intent
import android.net.Uri
Expand All @@ -15,8 +15,8 @@ import com.google.android.gms.maps.OnMapReadyCallback
import com.google.android.gms.maps.model.LatLng
import com.google.android.gms.maps.model.MarkerOptions
import com.google.android.material.tabs.TabLayout
import org.endhungerdurham.pantries.Pantry
import org.endhungerdurham.pantries.R
import org.endhungerdurham.pantries.backend.Pantry
import org.endhungerdurham.pantries.ui.viewmodel.PantriesViewModel

private const val ARG_PANTRY = "pantry"
Expand All @@ -26,7 +26,7 @@ class DetailsFragment : androidx.fragment.app.Fragment(), OnMapReadyCallback {

private lateinit var model: PantriesViewModel
private var mMapView: MapView ?= null
private var mPantry: Pantry ?= null
private var mPantry: Pantry?= null

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
Expand Down Expand Up @@ -74,9 +74,9 @@ class DetailsFragment : androidx.fragment.app.Fragment(), OnMapReadyCallback {
requireActivity().findViewById<TabLayout>(R.id.sliding_tabs).visibility = View.GONE
}

override fun onCreateOptionsMenu(menu: Menu?, inflater: MenuInflater?) {
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
super.onCreateOptionsMenu(menu, inflater)
menu?.clear()
menu.clear()
requireActivity().title = mPantry?.organizations ?: "Pantry"
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.endhungerdurham.pantries.ui
package org.endhungerdurham.pantries.ui.fragment

import android.content.Context
import android.os.Bundle
Expand All @@ -14,7 +14,7 @@ import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import org.endhungerdurham.pantries.Pantry
import org.endhungerdurham.pantries.backend.Pantry
import org.endhungerdurham.pantries.R
import org.endhungerdurham.pantries.ui.adapter.MyItemRecyclerViewAdapter
import org.endhungerdurham.pantries.ui.viewmodel.NetworkState
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.endhungerdurham.pantries.ui
package org.endhungerdurham.pantries.ui.fragment

import android.content.pm.PackageManager
import android.os.Bundle
Expand All @@ -23,7 +23,7 @@ import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import org.endhungerdurham.pantries.Pantry
import org.endhungerdurham.pantries.backend.Pantry
import org.endhungerdurham.pantries.R
import org.endhungerdurham.pantries.ui.viewmodel.NetworkState
import org.endhungerdurham.pantries.ui.viewmodel.PantriesViewModel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import android.app.Application
import androidx.lifecycle.*
import kotlinx.coroutines.*
import kotlinx.serialization.json.JSON
import org.endhungerdurham.pantries.Pantry
import org.endhungerdurham.pantries.PantryList
import org.endhungerdurham.pantries.R
import org.endhungerdurham.pantries.backend.Pantry
import org.endhungerdurham.pantries.backend.PantryList
import java.io.IOException
import java.net.URL

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout-land/fragment_details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.DetailsFragment">
tools:context=".ui.fragment.DetailsFragment">

<RelativeLayout
android:id="@+id/fragment_details_map_wrapper"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/fragment_details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.DetailsFragment">
tools:context=".ui.fragment.DetailsFragment">

<RelativeLayout
android:id="@+id/fragment_details_map_wrapper"
Expand Down
Loading