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

main merge #39

Merged
merged 5 commits into from
Aug 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import android.widget.Toast
import androidx.fragment.app.DialogFragment
import com.github.peep.DB.UserDB
import com.github.peep.databinding.ActivityProfileBinding
import com.github.peep.fragments.HomeFragment
import com.peep.githubapitest.githubpapi.ApiClient
import com.peep.githubapitest.githubpapi.GithubInterface
import com.peep.githubapitest.model.User
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import android.view.View
import android.view.ViewGroup
import android.view.animation.AnimationUtils
import android.widget.Toast
import androidx.annotation.RequiresApi
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentTransaction
Expand All @@ -24,6 +25,7 @@ import com.github.peep.SettingActivity
import com.github.peep.databinding.FragmentHomeBinding
import com.github.peep.model.EventResponse
import com.github.peep.model.EventResponseItem
import com.github.peep.model.Events
import com.peep.githubapitest.githubpapi.ApiClient
import com.peep.githubapitest.githubpapi.GithubInterface
import com.peep.githubapitest.model.Repo
Expand All @@ -39,14 +41,15 @@ class HomeFragment : Fragment() {
companion object{
var username:String=""
var id : String = ""
var repos:List<Repo>? = null
var events:EventResponse?=null
var events:Events?=null
var count:Int=0
}

private var mBinding : FragmentHomeBinding?=null
private var userDb : UserDB? = null
private lateinit var yPeepHome: AnimationDrawable

@RequiresApi(Build.VERSION_CODES.O)
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
Expand Down Expand Up @@ -130,6 +133,7 @@ class HomeFragment : Fragment() {
})
}

@RequiresApi(Build.VERSION_CODES.O)
fun getEvents(username:String){
count=0
var GithubService=ApiClient.client.create((GithubInterface::class.java))
Expand Down Expand Up @@ -167,27 +171,6 @@ class HomeFragment : Fragment() {
}
ft.detach(this).attach(this).commit()
}

fun getUserEvents(username:String){
var GithubService=ApiClient.client.create(GithubInterface::class.java)
val call=GithubService.getUserEvents(prefs.getString("username",""))
call.enqueue(object :Callback<EventResponse>{
override fun onResponse(call: Call<EventResponse>, response: Response<EventResponse>) {
Log.d("fullresponse", response.toString())
if (response.code() == 200) {
events=response.body()
Toast.makeText(getActivity(), events!![1].created_at, Toast.LENGTH_SHORT).show()
} else {
Log.e("err",response.code().toString())
}
}

override fun onFailure(call: Call<EventResponse>, t: Throwable) {
TODO("Not yet implemented")
}
})

}

override fun onDestroyView() {
mBinding = null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.peep.githubapitest.githubpapi

import com.github.peep.model.CommitRoot
import com.github.peep.model.EventResponse
import com.github.peep.model.Events
import com.github.peep.model.RepoCommitsResponse
import com.peep.githubapitest.model.Repo
import com.peep.githubapitest.model.User
Expand Down Expand Up @@ -29,4 +30,7 @@ interface GithubInterface {
// Events older than 90 days will not be included (even if the total number of events in the timeline is less than 300).
@GET("users/{username}/events")
fun getUserEvents(@Path("username") username:String):Call<EventResponse>

@GET("users/{username}/events")
fun getEvents(@Path("username")username:String):Call<Events>?
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.github.peep.model

data class EventItem(
val actor: Actor,
val created_at: String,
val id: String,
val org: Org,
val payload: Payload,
val `public`: Boolean,
val repo: Repo,
val type: String
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package com.github.peep.model

class Events : ArrayList<EventItem>()
88 changes: 49 additions & 39 deletions MyApplication2/app/src/main/res/layout/activity_profile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,45 +18,55 @@
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_baseline_arrow_back_24" />

<LinearLayout

<TextView
android:id="@+id/peep_logo_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:fontFamily="@font/font_title"
android:text="PeepPeep"
android:textSize="50sp"
app:layout_constraintBottom_toTopOf="@+id/git_profile_iv"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<ImageView
android:id="@+id/git_profile_iv"
android:layout_width="200dp"
android:layout_height="200dp"
app:layout_constraintBottom_toTopOf="@+id/git_username_tv"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/peep_logo_tv"
app:srcCompat="@drawable/ic_baseline_emoji_emotions_24" />

<TextView
android:id="@+id/git_username_tv"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_margin="30dp"
android:gravity="center">

<TextView
android:id="@+id/peep_logo_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/font_title"
android:text="PeepPeep"
android:textSize="50dp" />

<ImageView
android:id="@+id/git_profile_iv"
android:layout_width="200dp"
android:layout_height="200dp"
android:layout_marginTop="30dp"
app:srcCompat="@drawable/ic_baseline_emoji_emotions_24" />

<TextView
android:id="@+id/git_username_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginBottom="60dp"
android:fontFamily="@font/font_choice"
android:text="userName"
android:textSize="30dp" />
<Button
android:id="@+id/startButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/button_round"
android:fontFamily="@font/font_choice"
android:padding="20dp"
android:text="Start Peep" />
</LinearLayout>
android:layout_height="wrap_content"
android:fontFamily="@font/font_choice"
android:text="userName"
android:textSize="30sp"
android:gravity="center"
app:layout_constraintBottom_toTopOf="@+id/startButton"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/git_profile_iv" />

<Button
android:id="@+id/startButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="44dp"
android:background="@drawable/button_round"
android:fontFamily="@font/font_choice"
android:padding="20dp"
android:text="시작하기"
app:layout_constraintTop_toBottomOf="@id/git_username_tv"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/constraintLayout"
android:layout_marginTop="20dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
Expand Down
4 changes: 3 additions & 1 deletion MyApplication2/app/src/main/res/layout/error_popup.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:background="@drawable/button_round_outline">

<TextView
android:id="@+id/error_title"
android:fontFamily="@font/font_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
Expand Down