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

Issue #14 #21

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 3 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ dependencies {
testImplementation(TestLibraries.jUnit)
androidTestImplementation(TestLibraries.runnner)
androidTestImplementation(TestLibraries.espressoCore)

//Third Party Libraries

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could delete this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets keep it. there are other comments like this in this file.

Copy link

@mertceyhan mertceyhan Jan 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can delete all comments in the file. naming is clear enough, we don't need to comments.

implementation(ThirdPartyLibraries.glide)
}

tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package com.gdgistanbul.attendence.ui.event_detail

import android.os.Bundle
import android.view.View
import androidx.fragment.app.Fragment
import androidx.navigation.fragment.navArgs
import com.gdgistanbul.attendence.extension.observe
import com.gdgistanbul.model.Event
import com.gdgistanbul.viewmodel.MeetupViewModel
import kotlinx.android.synthetic.main.fragment_event_detail.*
import org.koin.android.ext.android.inject

class EventDetailFragment : Fragment() {
private val viewModel: MeetupViewModel by inject()
private val args: EventDetailFragmentArgs by navArgs()

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
observe(viewModel.eventLiveData) { initUI(it) }

var eventID = args.eventID

viewModel.getEvent(eventID)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could delete unnecessary spaces.


}

fun initUI(event: Event) {
btnBack.setOnClickListener {
activity?.supportFragmentManager?.beginTransaction()?.remove(this)?.commit()
}

txtEventName.text = event.name
txtEventDate.text = event.localDate
txtEventVenue.text = event.venue?.name

txtAttendee.text = "${event.yesRsvpCount} Attendees"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use strings.xml


txtDetail.text = event.description

btnCheckIn.setOnClickListener {
//TODO attendees page
}
Comment on lines +41 to +43
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please do. navigate to UserListFragment and use safe args to pass eventid.


//TODO need event photo link
// Glide.with(context)
// .load(event.)
// .transition(DrawableTransitionOptions.withCrossFade())
// .skipMemoryCache(true)
// .into(ivImage)
Comment on lines +45 to +50
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm I checked the api and seems like we are not able to get the image from the api so we need to remove the image and move the rest of the page up

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import androidx.fragment.app.Fragment
import com.gdgistanbul.attendence.R
import com.gdgistanbul.attendence.extension.navigate
import com.gdgistanbul.attendence.extension.onClick
import com.gdgistanbul.model.Event
import kotlinx.android.synthetic.main.fragment_event_list.*

class EventListFragment : Fragment() {
Expand All @@ -28,5 +29,8 @@ class EventListFragment : Fragment() {
val eventID = (0..99999999).random()
navigate(EventListFragmentDirections.actionEventListFragmentToUserListFragment(eventID))
}

// val event:Event = Event()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could delete this if It's unnecessary

// navigate(EventListFragmentDirections.actionEventListFragmentToEventDetailFragment(event))
}
}
Binary file added app/src/main/res/drawable-v24/df18_home.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions app/src/main/res/drawable/back.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="11dp"
android:height="20dp"
android:viewportWidth="11"
android:viewportHeight="20">
<path
android:pathData="M10.699,18.228l-0.892,-0.895 -2.133,-2.14 -2.582,-2.587 -2.228,-2.236c-0.361,-0.362 -0.718,-0.73 -1.085,-1.088l-0.014,-0.015v1.47l0.891,-0.894 2.134,-2.14 2.579,-2.587L9.598,2.88c0.36,-0.362 0.725,-0.722 1.084,-1.088l0.015,-0.015c0.188,-0.19 0.302,-0.468 0.302,-0.736 0,-0.256 -0.112,-0.56 -0.302,-0.737 -0.197,-0.18 -0.457,-0.316 -0.734,-0.303a1.087,1.087 0,0 0,-0.734 0.303l-0.892,0.895 -2.133,2.14 -2.58,2.588 -2.228,2.236c-0.36,0.362 -0.726,0.721 -1.084,1.088l-0.015,0.014a1.059,1.059 0,0 0,0 1.47l0.892,0.895c0.71,0.714 1.422,1.427 2.133,2.14L5.9,16.358l2.229,2.236c0.36,0.362 0.72,0.728 1.084,1.088l0.015,0.014c0.188,0.19 0.466,0.304 0.734,0.304 0.255,0 0.557,-0.112 0.734,-0.304 0.18,-0.197 0.315,-0.457 0.302,-0.736a1.08,1.08 0,0 0,-0.3 -0.732z"
android:fillColor="#FFF"
android:fillType="nonZero"/>
</vector>
6 changes: 6 additions & 0 deletions app/src/main/res/drawable/bg_lipstick_10rd.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/lipstick"/>
<corners android:radius="4dp"/>
</shape>
6 changes: 6 additions & 0 deletions app/src/main/res/drawable/bg_lipstick_4rd.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/lipstick"/>
<corners android:radius="4dp"/>
</shape>
6 changes: 6 additions & 0 deletions app/src/main/res/drawable/bg_white_rd.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/white_three"/>
<corners android:radius="2dp"/>
</shape>
166 changes: 166 additions & 0 deletions app/src/main/res/layout/fragment_event_detail.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all dp values can coming from dimens folder

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">

<androidx.constraintlayout.widget.ConstraintLayout
Copy link

@mertceyhan mertceyhan Jan 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using ConstraintLayout in ConstraintLayout isn't recommended situation. Is there any better way?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If ConstrainsLayout is used somewhere, we shouldn't need another layout type. That's because you can position any view wherever you want. ConstraintLayout provides this functionality with its powerful attributes.

android:layout_width="match_parent"
android:layout_height="match_parent">

<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/btnBack"
android:layout_width="11dp"
android:layout_height="20dp"
android:layout_marginTop="65dp"
android:layout_marginStart="16dp"
android:background="@drawable/back"
android:elevation="1dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"/>

<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/ivImage"
android:layout_width="0dp"
android:layout_height="200dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:background="@drawable/df18_home"/>

<com.google.android.material.card.MaterialCardView
android:id="@+id/cvEventInfo"
android:layout_width="0dp"
android:layout_height="140dp"
android:layout_marginStart="32dp"
android:layout_marginTop="130dp"
android:layout_marginEnd="32dp"
app:cardBackgroundColor="@color/white_three"
app:cardCornerRadius="10dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">

<com.google.android.material.textview.MaterialTextView
android:id="@+id/txtEventName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="24dp"
android:fontFamily="@font/nunito_extrabold"
android:textColor="@color/dark_grey_blue"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="GDG DevFest Istanbul 2019" />

<com.google.android.material.textview.MaterialTextView
android:id="@+id/txtEventDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:fontFamily="@font/nunito_semibold"
android:textColor="@color/text_color"
android:textSize="12sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/txtEventName"
tools:text="24 Aug, 2pm" />

<com.google.android.material.textview.MaterialTextView
android:id="@+id/txtEventVenue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:fontFamily="@font/nunito_semibold"
android:textColor="@color/text_color"
android:textSize="12sp"
app:layout_constraintStart_toStartOf="@id/txtEventDate"
app:layout_constraintTop_toBottomOf="@id/txtEventDate"
tools:text="Kolektif House Maslak" />
Comment on lines +49 to +86
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use or add text styles defined in app/src/main/res/values/type.xml


<View
android:id="@+id/vAttendee"
android:layout_width="98dp"
android:layout_height="32dp"
android:layout_marginEnd="16dp"
android:alpha="0.15"
android:background="@drawable/bg_lipstick_4rd"
android:padding="8dp"
app:layout_constraintBottom_toBottomOf="@id/txtEventVenue"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@id/txtEventDate" />

<com.google.android.material.textview.MaterialTextView
android:id="@+id/txtAttendee"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/nunito_bold"
android:textColor="@color/lipstick"
android:textSize="12sp"
app:layout_constraintBottom_toBottomOf="@id/vAttendee"
app:layout_constraintEnd_toEndOf="@id/vAttendee"
app:layout_constraintStart_toStartOf="@id/vAttendee"
app:layout_constraintTop_toTopOf="@id/vAttendee"
tools:text="190 Attendees" />


</androidx.constraintlayout.widget.ConstraintLayout>

</com.google.android.material.card.MaterialCardView>

<com.google.android.material.button.MaterialButton
android:id="@+id/btnCheckIn"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="21dp"
android:layout_marginTop="43dp"
android:layout_marginEnd="21dp"
android:fontFamily="@font/nunito_extrabold"
android:textColor="@color/white_three"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="@+id/cvEventInfo"
app:layout_constraintStart_toStartOf="@+id/cvEventInfo"
app:layout_constraintTop_toBottomOf="@id/ivImage"
tools:text="Start Check-In" />


<com.google.android.material.textview.MaterialTextView
android:id="@+id/txtDetailTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="40dp"
android:fontFamily="@font/nunito_extrabold"
android:text="Detail"
android:textColor="@color/dark_grey_blue"
android:textSize="16sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/btnCheckIn"
tools:text="Details" />

<com.google.android.material.textview.MaterialTextView
android:id="@+id/txtDetail"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="62dp"
android:fontFamily="@font/nunito_regular"
android:textColor="@color/text_color"
android:textSize="14sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/txtDetailTitle"
tools:text="Merhabalar,\nGDG Istanbul olarak 24 Ağustos Cumartesi günü Google ve JetBrains'in desteklediği Kotlin/Everywhere etkinlik serisinin bir parçası olarak Kotlin/Everywhere Istanbul etkinliğini Kolektif House Maslak'ta gerçekleştiriyoruz. Bu etkinlikte Android, Google Cloud Platform ve Multi-platform alanlarında Kotlin temellerini ve best practise'lerini öğreneceğiz.\nEtkinlik programı konuşmacı başvuruları tamamlandıktan sonra hazırlanıp paylaşılacaktır. Eğer sizde bu etkinlikte konuşmacı olarak yer almak, Kotlin deneyimlerinizi bizlerle paylaşmak isterseniz CFP formunu hemen doldurabilirsiniz.\nCall For Paper 👉🏻 https://gdg.ist/cfp-kotlin-everywhere\nEtkinlik Programı; " />

</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>
13 changes: 13 additions & 0 deletions app/src/main/res/navigation/mobile_navigation.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
<action
android:id="@+id/action_eventListFragment_to_userListFragment"
app:destination="@id/userListFragment" />
<action
android:id="@+id/action_eventListFragment_to_eventDetailFragment"
app:destination="@id/eventDetailFragment"/>
</fragment>
<fragment
android:id="@+id/userListFragment"
Expand Down Expand Up @@ -43,4 +46,14 @@
android:id="@+id/action_loginWebViewFragment_to_eventListFragment"
app:destination="@id/eventListFragment" />
</fragment>

<fragment
android:id="@+id/eventDetailFragment"
android:name="com.gdgistanbul.attendence.ui.event_detail.EventDetailFragment"
android:label="fragment_event_detail"
tools:layout="@layout/fragment_event_detail">
<argument
android:name="eventID"
app:argType="string"/>
</fragment>
</navigation>
3 changes: 3 additions & 0 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,7 @@
<color name="lipstick_dark">#ab0011</color>
<color name="dusk">#3f3d56</color>
<color name="lynch">#60688a</color>
<color name="white_three">#ffffff</color>
selahattinkole marked this conversation as resolved.
Show resolved Hide resolved
<color name="dark_grey_blue">#262e52</color>
<color name="text_color">#60688a</color>
</resources>
1 change: 1 addition & 0 deletions buildSrc/src/main/java/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ object ThirdPartyLibraries {
const val moshi = "com.squareup.moshi:moshi-kotlin:${Versions.moshiVersion}"
const val moshiapt = "com.squareup.moshi:moshi-kotlin-codegen:${Versions.moshiVersion}"
const val moshiConverter = "com.squareup.retrofit2:converter-moshi:2.5.0"
const val glide = "com.github.bumptech.glide:glide:4.10.0"
selahattinkole marked this conversation as resolved.
Show resolved Hide resolved
Comment on lines 15 to +16
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Versions should be defined in the separated class.

}

object AndroidxLibraries {
Expand Down
6 changes: 6 additions & 0 deletions meetupapi/src/main/java/com/gdgistanbul/api/MeetupApi.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,10 @@ interface MeetupApi {
@Path("id") id: String,
@Path("url_name") urlName: String = "GDGIstanbul"
)

@GET("{url_name}/events/{id}")
suspend fun getEvent(
@Path("id") id: String,
@Path("url_name") urlName: String = "GDGIstanbul"
): Event
}
2 changes: 2 additions & 0 deletions meetuprepo/src/main/java/com/gdgistanbul/repo/MeetupRepo.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,6 @@ class MeetupRepo(
)
sharedPreferences.edit().putString("login", moshi.loginAdapter().toJson(login)).apply()
}

suspend fun getEvent(id: String): Event = meetupApi.getEvent(id)
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ class MeetupViewModel(private val meetupRepo: MeetupRepo) : ViewModel() {
private val _eventsLiveData = MutableLiveData<List<EventModel>>()
private val _toastLiveData = MutableLiveData<Event<String>>()
private val _loginLiveData = MutableLiveData<Event<Unit>>()
private val _eventLiveData = MutableLiveData<EventModel>()
val eventsLiveData: LiveData<List<EventModel>> = _eventsLiveData
val toastLiveData: LiveData<Event<String>> = _toastLiveData
val loginLiveData: LiveData<Event<Unit>> = _loginLiveData
val eventLiveData: LiveData<EventModel> = _eventLiveData

fun refreshEvents() = viewModelScope.launch {
try {
Expand All @@ -38,5 +40,14 @@ class MeetupViewModel(private val meetupRepo: MeetupRepo) : ViewModel() {
Log.d("meetupviewmodel", e.message, e)
}
}

fun getEvent(id: String) = viewModelScope.launch {
try {
_eventLiveData.postValue(meetupRepo.getEvent(id))
} catch (e: Exception) {
_toastLiveData.postValue(Event(e.message.toString()))
Log.d("meetupviewmodel", e.message, e)
}
}
}

2 changes: 2 additions & 0 deletions model/src/main/java/com/gdgistanbul/model/Model.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package com.gdgistanbul.model

import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
import com.sun.xml.internal.ws.developer.Serialization
import java.io.Serializable

@JsonClass(generateAdapter = true)
data class Event(
Expand Down