Skip to content

Commit

Permalink
Merge pull request #13 from seoulsanta/eumiing
Browse files Browse the repository at this point in the history
Eumiing
  • Loading branch information
Eumiing authored Sep 28, 2019
2 parents 1af1733 + 7b291d2 commit c88a120
Show file tree
Hide file tree
Showing 17 changed files with 215 additions and 167 deletions.
2 changes: 1 addition & 1 deletion SeoulSantaAndroid/.idea/misc.xml

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

4 changes: 4 additions & 0 deletions SeoulSantaAndroid/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'org.jetbrains.anko:anko:0.10.8'



//Design, Layout, etc.
Expand All @@ -66,6 +68,8 @@ dependencies {
implementation files('libs/libDaumMapAndroid.jar')

implementation group: project.KAKAO_SDK_GROUP, name: 'usermgmt', version: project.KAKAO_SDK_VERSION
implementation 'com.kakao.sdk:kakaotalk:1.13.0'



}
12 changes: 7 additions & 5 deletions SeoulSantaAndroid/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,13 @@
android:theme="@style/AppTheme.NoActionBar"
android:usesCleartextTraffic="true">

<activity android:name=".ui.login.LoginActivity"></activity>
<activity android:name=".ui.login.LoginActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>

<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>

<activity android:name=".ui.MyActivity">

Expand All @@ -32,11 +38,7 @@
<activity android:name=".ui.map.detail.CourseDetailActivity">
</activity>
<activity android:name=".ui.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>

<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.yamgang.seoulsantaandroid.model.post

data class PostKakaoLoginResponse(
val status: Int,
val message: String,
val data: LoginData
)

data class LoginData(
val authorization: String,
val refreshtoken: String
)
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ package com.yamgang.seoulsantaandroid.ui
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import com.yamgang.seoulsantaandroid.R
import com.yamgang.seoulsantaandroid.ui.login.LoginActivity
import com.yamgang.seoulsantaandroid.util.User
import kotlinx.android.synthetic.main.activity_my.*
import org.jetbrains.anko.startActivity

class MyActivity : AppCompatActivity() {

Expand All @@ -16,16 +19,20 @@ class MyActivity : AppCompatActivity() {

private fun viewInit() {
tv_act_my_name.text = "으밍"
tv_act_my_id.text = "eumiing"
tv_act_my_version.text = "최신 "+"1.0.0"+" 사용중"
}

private fun setOnClickListener() {
btn_act_my_profile_modify.setOnClickListener {
//프로필 수정
}
btn_act_my_login_info.setOnClickListener {
//로그인 정보
btn_act_my_logout.setOnClickListener {
User.authorization = null
User.refreshtoken = null
startActivity<LoginActivity>()
finish()
val mainActivity = MainActivity()
mainActivity.finish()
}
btn_act_my_setting.setOnClickListener {
//설정
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,40 +11,30 @@ import com.yamgang.seoulsantaandroid.R
import com.yamgang.seoulsantaandroid.model.get.BadgeData
import com.yamgang.seoulsantaandroid.model.get.BadgeListData
import com.yamgang.seoulsantaandroid.model.get.GetBadgeResponse
import com.yamgang.seoulsantaandroid.ui.badge.current.BadgeCurrentFragment
import com.yamgang.seoulsantaandroid.ui.badge.current.BadgeCurrentRecyclerViewAdapter
import com.yamgang.seoulsantaandroid.ui.badge.finish.BadgeFinishFragment
import com.yamgang.seoulsantaandroid.util.ApplicationController
import com.yamgang.seoulsantaandroid.util.User
import kotlinx.android.synthetic.main.fragment_badge.*
import kotlinx.android.synthetic.main.fragment_badge.view.*
import retrofit2.Call
import retrofit2.Callback
import retrofit2.Response
import java.lang.Exception

class BadgeFragment : Fragment() {
lateinit var inflater: LayoutInflater
val networkService = ApplicationController.networkService

//lateinit var data: BadgeData
var data: BadgeData = BadgeData(
4, 10,
arrayListOf(
BadgeListData(1, 1, "댕댕이코스", "몇월몇일"),
BadgeListData(1, 1, "댕댕이코스", "몇월몇일"),
BadgeListData(1, 1, "댕댕이코스", "몇월몇일"),
BadgeListData(1, 1, "댕댕이코스", "몇월몇일")
)
)

var data: BadgeData = BadgeData(-1,-1,ArrayList())
companion object{
var instance: BadgeFragment = BadgeFragment()
}

override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
this.inflater = inflater
var view: View = inflater.inflate(R.layout.fragment_badge, container, false)
viewInit(view)

//getBadgeResponse()
instance.data = data

getBadgeResponse(view)
Log.e("BadgeFragment-success", instance.data.toString())
return view
}

Expand All @@ -54,22 +44,23 @@ class BadgeFragment : Fragment() {
view.indicator_frag_badge.setViewPager(view.vp_frag_badge)
}

private fun getBadgeResponse() {
val getBadgeResponse = networkService.getBadgeResponse("application/json","")
private fun getBadgeResponse(view:View) {
val getBadgeResponse = networkService.getBadgeResponse("application/json", User.authorization)
getBadgeResponse.enqueue(object : Callback<GetBadgeResponse> {
override fun onFailure(call: Call<GetBadgeResponse>, t: Throwable) {
Log.e("HomeFragment-fail", t.toString())
Log.e("BadgeFragment-fail", t.toString())
}

override fun onResponse(call: Call<GetBadgeResponse>, response: Response<GetBadgeResponse>) {
if(response.isSuccessful) {
try{
instance.data = response.body()!!.data
Log.e("BadgeFragment-success1", instance.data.toString())
(view.vp_frag_badge.adapter as BadgeFragmentStatePagerAdapter).notifyDataSetChanged()
} catch (e: Exception) {
}
}
}
})
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.yamgang.seoulsantaandroid.ui.badge
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentStatePagerAdapter
import androidx.viewpager.widget.PagerAdapter
import com.yamgang.seoulsantaandroid.ui.badge.current.BadgeCurrentFragment
import com.yamgang.seoulsantaandroid.ui.badge.finish.BadgeFinishFragment

Expand All @@ -16,4 +17,8 @@ class BadgeFragmentStatePagerAdapter(fm: FragmentManager, private val fragmentCo
}
}
override fun getCount(): Int = fragmentCount

override fun getItemPosition(`object`: Any): Int {
return PagerAdapter.POSITION_NONE
}
}
Original file line number Diff line number Diff line change
@@ -1,39 +1,50 @@
package com.yamgang.seoulsantaandroid.ui.badge.current

import android.os.Bundle
import android.util.Log
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.yamgang.seoulsantaandroid.R
import com.yamgang.seoulsantaandroid.model.get.BadgeData
import com.yamgang.seoulsantaandroid.ui.MainActivity
import com.yamgang.seoulsantaandroid.ui.badge.BadgeFragment
import com.yamgang.seoulsantaandroid.util.User
import kotlinx.android.synthetic.*
import kotlinx.android.synthetic.main.fragment_badge_current.*
import kotlinx.android.synthetic.main.fragment_badge_current.view.*
import org.jetbrains.anko.support.v4.ctx

class BadgeCurrentFragment : Fragment() {

var course_name: String = "코스"
var date: String="날짜"

companion object{
var instance: BadgeCurrentFragment = BadgeCurrentFragment()
}
lateinit var inflater: LayoutInflater
//BadgeFragment에서 통신해서 넘어온 데이타리스트 사용하기
val data: BadgeData = BadgeFragment.instance.data
lateinit var badgeCurrentRecyclerViewAdapter: BadgeCurrentRecyclerViewAdapter
var data :BadgeData = BadgeFragment.instance.data

override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
this.inflater = inflater
var view: View = inflater.inflate(R.layout.fragment_badge_current, container, false)
setRecyclerView(view)
return view
return inflater.inflate(R.layout.fragment_badge_current, container, false)
}

override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState)
setRecyclerView()
}

private fun setRecyclerView() {
badgeCurrentRecyclerViewAdapter = BadgeCurrentRecyclerViewAdapter(activity!!, data!!.badge, data!!.total)
rv_frag_badge_current_list.adapter = badgeCurrentRecyclerViewAdapter
rv_frag_badge_current_list.layoutManager = GridLayoutManager(activity,3)
}

private fun setRecyclerView(view:View) {
badgeCurrentRecyclerViewAdapter = BadgeCurrentRecyclerViewAdapter(activity!!, data.badge,data.total)
view.rv_frag_badge_current_list.adapter = badgeCurrentRecyclerViewAdapter
view.rv_frag_badge_current_list.layoutManager = GridLayoutManager(activity,3)
fun refresh() {
badgeCurrentRecyclerViewAdapter.notifyDataSetChanged()
setRecyclerView()
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.yamgang.seoulsantaandroid.ui.badge.current

import android.content.Context
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
Expand All @@ -10,6 +11,7 @@ import com.bumptech.glide.Glide
import com.yamgang.seoulsantaandroid.R
import com.yamgang.seoulsantaandroid.ui.MainActivity
import com.yamgang.seoulsantaandroid.model.get.BadgeListData
import com.yamgang.seoulsantaandroid.ui.badge.BadgeFragment

class BadgeCurrentRecyclerViewAdapter(val ctx: Context, var dataList: ArrayList<BadgeListData>, var total: Int): RecyclerView.Adapter<BadgeCurrentRecyclerViewAdapter.Holder>() {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): Holder {
Expand All @@ -30,11 +32,14 @@ class BadgeCurrentRecyclerViewAdapter(val ctx: Context, var dataList: ArrayList<
dialog.show((ctx as MainActivity).supportFragmentManager,dialog.tag)
BadgeCurrentFragment.instance.course_name = dataList[position].course_name
BadgeCurrentFragment.instance.date = dataList[position].date
Log.e("BadgeCurrentRV", "Badge")
}
} else{
Glide.with(ctx)
.load(R.drawable.badge_default)
.into(holder.img)
Log.e("BadgeCurrentRV", "BadgeIn")

}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,31 @@ import androidx.recyclerview.widget.LinearLayoutManager
import com.yamgang.seoulsantaandroid.R
import com.yamgang.seoulsantaandroid.model.get.BadgeData
import com.yamgang.seoulsantaandroid.ui.badge.BadgeFragment
import com.yamgang.seoulsantaandroid.util.User
import kotlinx.android.synthetic.main.fragment_badge_finish.*
import kotlinx.android.synthetic.main.fragment_badge_finish.view.*

class BadgeFinishFragment : Fragment() {

lateinit var inflater: LayoutInflater
//BadgeFragment에서 통신해서 넘어온 데이타리스트 사용하기
val data: BadgeData = BadgeFragment.instance.data
lateinit var badgeFinishRecyclerViewAdapter: BadgeFinishRecyclerViewAdapter
var data :BadgeData = BadgeFragment.instance.data

override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
this.inflater = inflater
var view: View = inflater.inflate(R.layout.fragment_badge_finish, container, false)
val view: View = inflater.inflate(R.layout.fragment_badge_finish, container, false)
setRecyclerView(view)
return view
}

private fun setRecyclerView(view:View) {
if(data.badge.size == 0) {
if(data!!.badge.size == 0) {
view.rl_frag_badge_finish_default_page.visibility = View.VISIBLE
view.rl_frag_badge_finish_exist_page.visibility = View.GONE
} else{
view.rl_frag_badge_finish_default_page.visibility = View.GONE
view.rl_frag_badge_finish_exist_page.visibility = View.VISIBLE
badgeFinishRecyclerViewAdapter = BadgeFinishRecyclerViewAdapter(activity!!, data.badge)
view.rv_frag_badge_finish_list.adapter = badgeFinishRecyclerViewAdapter
view.rv_frag_badge_finish_list.layoutManager = LinearLayoutManager(activity)
}
badgeFinishRecyclerViewAdapter = BadgeFinishRecyclerViewAdapter(activity!!, data!!.badge)
view.rv_frag_badge_finish_list.adapter = badgeFinishRecyclerViewAdapter
view.rv_frag_badge_finish_list.layoutManager = LinearLayoutManager(activity)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,28 @@ package com.yamgang.seoulsantaandroid.ui.login

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import com.kakao.auth.AuthType
import com.kakao.auth.Session
import com.yamgang.seoulsantaandroid.R
import com.yamgang.seoulsantaandroid.util.SessionCallback
import kotlinx.android.synthetic.main.activity_login.*

class LoginActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_login)

setOnClickListener()
}

private fun setOnClickListener() {
btn_login_kakao.setOnClickListener {
val session = Session.getCurrentSession()
Log.e("Tag","kakaoLogin")
session.addCallback(SessionCallback(this))
session.open(AuthType.KAKAO_ACCOUNT,this)
}
}
}
Loading

0 comments on commit c88a120

Please sign in to comment.