Skip to content

Commit 9ce1534

Browse files
committed
Login Activity 수정 중
1 parent c4605a0 commit 9ce1534

12 files changed

Lines changed: 145 additions & 12 deletions

File tree

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,7 @@ fastlane/readme.md
6868

6969
# mac
7070
.DS_Store
71-
.idea/runConfigurations.xml
71+
.idea/runConfigurations.xml
72+
73+
# font
74+
spoqa_han_sans_*.ttf

app/src/main/java/com/seok/gfd/retrofit/RetrofitClient.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class RetrofitClient {
2929
fun gUserService() : GUserService{
3030
val gson = GsonBuilder().setLenient().create()
3131
retrofit = Retrofit.Builder()
32-
.baseUrl(BuildConfig.GFD_API_URL)
32+
.baseUrl("http://10.0.2.2:8080/api/v1/")
3333
.addConverterFactory(GsonConverterFactory.create(gson))
3434
.build()
3535
return retrofit.create(GUserService::class.java)

app/src/main/java/com/seok/gfd/retrofit/service/GUserService.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,9 @@ interface GUserService {
1818
@Header("Authorization") authKey: String,
1919
@Body gUser: GUser
2020
): Call<GUser>
21+
22+
@GET("users/count")
23+
fun getUsersCount(
24+
@Header("Authorization") authKey: String
25+
): Call<Int>
2126
}

app/src/main/java/com/seok/gfd/views/LoginActivity.kt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package com.seok.gfd.views
33
import android.content.Intent
44
import android.net.Uri
55
import android.os.Bundle
6+
import android.util.Log
67
import androidx.appcompat.app.AppCompatActivity
78
import com.seok.gfd.BuildConfig
89
import com.seok.gfd.R
@@ -12,10 +13,13 @@ import java.net.HttpURLConnection
1213

1314
import androidx.lifecycle.Observer
1415
import androidx.lifecycle.ViewModelProviders
16+
import com.seok.gfd.retrofit.RetrofitClient
1517
import com.seok.gfd.utils.AuthUserToken
1618
import com.seok.gfd.utils.ProgressbarDialog
1719
import com.seok.gfd.viewmodel.LoginViewModel
1820
import org.jetbrains.anko.longToast
21+
import retrofit2.Call
22+
import retrofit2.Response
1923

2024
@Suppress("NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS", "RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS")
2125
class LoginActivity : AppCompatActivity() {
@@ -34,6 +38,24 @@ class LoginActivity : AppCompatActivity() {
3438
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(authToken.buildHttpUrl(BuildConfig.GITHUB_CLIENT_ID)))
3539
startActivityForResult(intent, HttpURLConnection.HTTP_OK)
3640
}
41+
42+
val userService = RetrofitClient.gUserService()
43+
val call = userService.getUsersCount(BuildConfig.BASIC_AUTH_KEY)
44+
call.enqueue(object : retrofit2.Callback<Int>{
45+
override fun onFailure(call: Call<Int>, t: Throwable) {
46+
Log.d("testtest", t.message)
47+
}
48+
49+
override fun onResponse(call: Call<Int>, response: Response<Int>) {
50+
if(response.isSuccessful){
51+
val body = response.body()
52+
login_tv_users_count.text = body.toString()
53+
}else{
54+
Log.d("testest", "t")
55+
}
56+
}
57+
58+
})
3759
}
3860

3961
private fun init() {
-18.7 KB
Binary file not shown.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<shape xmlns:android="http://schemas.android.com/apk/res/android">
3+
<corners android:radius="40dip"/>
4+
<gradient
5+
android:startColor="@color/pastel_1"
6+
android:endColor="@color/pastel_2"
7+
/>
8+
</shape>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<shape xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:shape="oval">
4+
5+
<size
6+
android:width="300dp"
7+
android:height="300dp" />
8+
9+
<solid android:color="@android:color/transparent" />
10+
11+
<stroke
12+
android:width="5dp"
13+
android:color="@color/colorText" />
14+
</shape>

app/src/main/res/font/font.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<font-family xmlns:tools="http://schemas.android.com/tools"
3+
xmlns:android="http://schemas.android.com/apk/res/android">
4+
<font
5+
android:fontStyle="normal"
6+
android:fontWeight="400"
7+
android:font="@font/spoqa_han_sans_regular"
8+
tools:ignore="UnusedAttribute" />
9+
</font-family>

app/src/main/res/layout/activity_login.xml

Lines changed: 73 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,84 @@
66
android:layout_height="match_parent"
77
tools:context=".views.LoginActivity" android:orientation="vertical">
88

9-
<LinearLayout
10-
android:layout_width="wrap_content"
11-
android:layout_height="wrap_content"
9+
<androidx.constraintlayout.widget.ConstraintLayout
10+
android:layout_width="250dp"
11+
android:layout_height="250dp"
12+
android:layout_marginBottom="32dp"
13+
android:background="@drawable/github_login_users_background"
1214
android:orientation="vertical"
13-
app:layout_constraintBottom_toBottomOf="parent"
15+
app:layout_constraintBottom_toBottomOf="@+id/login_img_login"
1416
app:layout_constraintEnd_toEndOf="parent"
1517
app:layout_constraintStart_toStartOf="parent"
1618
app:layout_constraintTop_toTopOf="parent">
1719

18-
<ImageView
19-
android:id="@+id/login_img_login"
20-
android:layout_width="300sp"
21-
android:layout_height="100sp"
22-
app:srcCompat="@drawable/btn_github_login" />
20+
<TextView
21+
android:id="@+id/login_tv_users_count"
22+
android:layout_width="wrap_content"
23+
android:layout_height="wrap_content"
24+
android:fontFamily="@font/spoqa_han_sans_regular"
25+
android:text="@string/rank_view_sample_commit"
26+
android:textColor="@color/colorText"
27+
android:textSize="50sp"
28+
app:layout_constraintBottom_toBottomOf="parent"
29+
app:layout_constraintEnd_toEndOf="parent"
30+
app:layout_constraintStart_toStartOf="parent"
31+
app:layout_constraintTop_toTopOf="parent" />
32+
33+
<TextView
34+
android:id="@+id/textView11"
35+
android:layout_width="wrap_content"
36+
android:layout_height="wrap_content"
37+
android:layout_marginBottom="24dp"
38+
android:fontFamily="@font/spoqa_han_sans_thin"
39+
android:text="@string/app_tv_count_users"
40+
android:textColor="@color/colorText"
41+
android:textSize="20sp"
42+
app:layout_constraintBottom_toBottomOf="parent"
43+
app:layout_constraintEnd_toEndOf="parent"
44+
app:layout_constraintStart_toStartOf="parent"
45+
app:layout_constraintTop_toBottomOf="@+id/login_tv_users_count" />
46+
</androidx.constraintlayout.widget.ConstraintLayout>
47+
48+
<LinearLayout
49+
android:id="@+id/login_img_login"
50+
android:layout_width="300dp"
51+
android:layout_height="80dp"
52+
android:background="@drawable/github_login_background"
53+
android:gravity="center"
54+
android:orientation="horizontal"
55+
app:layout_constraintBottom_toBottomOf="parent"
56+
app:layout_constraintEnd_toEndOf="parent"
57+
app:layout_constraintHorizontal_bias="0.495"
58+
app:layout_constraintStart_toStartOf="parent"
59+
app:layout_constraintTop_toTopOf="parent"
60+
app:layout_constraintVertical_bias="0.803">
61+
62+
<TextView
63+
android:id="@+id/login_tv_1"
64+
android:layout_width="wrap_content"
65+
android:layout_height="wrap_content"
66+
android:fontFamily="@font/spoqa_han_sans_thin"
67+
android:shadowColor="#A8A8A8"
68+
android:shadowDx="0"
69+
android:shadowDy="0"
70+
android:shadowRadius="5"
71+
android:text="@string/text_github"
72+
android:textColor="@color/userRankPos"
73+
android:textSize="30sp" />
74+
75+
<TextView
76+
android:id="@+id/login_tv_2"
77+
android:layout_width="wrap_content"
78+
android:layout_height="wrap_content"
79+
android:fontFamily="@font/spoqa_han_sans_regular"
80+
android:shadowColor="#A8A8A8"
81+
android:shadowDx="0"
82+
android:shadowDy="0"
83+
android:shadowRadius="5"
84+
android:text="@string/text_login"
85+
android:textColor="@color/userRankPos"
86+
android:textSize="35sp" />
2387
</LinearLayout>
2488

2589
</androidx.constraintlayout.widget.ConstraintLayout>

app/src/main/res/values/colors.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,8 @@
1616
<color name="colorTopBar">#444444</color>
1717
<color name="userRankPos">#e5e1e1</color>
1818
<color name="iconText">#e4f9f5</color>
19+
20+
<!-- Gradation Color -->
21+
<color name="pastel_1">#00b1e5</color>
22+
<color name="pastel_2">#08e68d</color>
1923
</resources>

0 commit comments

Comments
 (0)