Skip to content

Commit 3798dda

Browse files
committed
study:
- SwipeRefreshLayout 연습 1
1 parent 4d89647 commit 3798dda

5 files changed

Lines changed: 71 additions & 6 deletions

File tree

app/src/main/AndroidManifest.xml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,18 @@
1010
android:fullBackupContent="@xml/backup_descriptor"
1111
android:icon="@drawable/gfd_app_logo"
1212
android:label="@string/app_name"
13+
android:networkSecurityConfig="@xml/network_security_config"
1314
android:supportsRtl="true"
1415
android:theme="@style/AppTheme"
15-
android:networkSecurityConfig="@xml/network_security_config"
1616
tools:ignore="GoogleAppIndexingWarning">
17+
<activity android:name=".views.GuestMain"></activity>
1718

1819
<meta-data
1920
android:name="com.google.android.gms.ads.APPLICATION_ID"
20-
android:value="@string/admob_app_id"/>
21+
android:value="@string/admob_app_id" />
2122

2223
<activity
23-
android:name="com.seok.gfd.views.LoginActivity"
24+
android:name=".views.LoginActivity"
2425
android:launchMode="singleTask">
2526
<intent-filter>
2627
<action android:name="android.intent.action.VIEW" />
@@ -31,14 +32,14 @@
3132
<data android:scheme="gfd" />
3233
</intent-filter>
3334
</activity>
34-
<activity android:name="com.seok.gfd.views.LauncherActivity">
35+
<activity android:name=".views.LauncherActivity">
3536
<intent-filter>
3637
<action android:name="android.intent.action.MAIN" />
3738

3839
<category android:name="android.intent.category.LAUNCHER" />
3940
</intent-filter>
4041
</activity>
41-
<activity android:name="com.seok.gfd.views.MainActivity" />
42+
<activity android:name=".views.MainActivity" />
4243
</application>
4344

4445
</manifest>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.seok.gfd.views
2+
3+
import android.os.Bundle
4+
import android.os.Handler
5+
import androidx.appcompat.app.AppCompatActivity
6+
import com.seok.gfd.R
7+
import kotlinx.android.synthetic.main.activity_guest_main.*
8+
import java.util.*
9+
10+
class GuestMain : AppCompatActivity() {
11+
12+
override fun onCreate(savedInstanceState: Bundle?) {
13+
super.onCreate(savedInstanceState)
14+
setContentView(R.layout.activity_guest_main)
15+
16+
simpleSwipeRefreshLayout.setOnRefreshListener {
17+
Handler().postDelayed({
18+
simpleSwipeRefreshLayout.isRefreshing = false
19+
val r = Random()
20+
val i1 : Int = r.nextInt(100)
21+
guestTextView.text = i1.toString()
22+
}, 3000)
23+
}
24+
}
25+
26+
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class LauncherActivity : AppCompatActivity() {
3030
startActivity(intent)
3131
overridePendingTransition(R.anim.fade_in, R.anim.fade_out)
3232
finish()
33-
}, 1500)
33+
}, 100)
3434
}
3535

3636
private fun initSetUI(){

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ class LoginActivity : AppCompatActivity() {
8181
// Guest 로그인 버튼을 눌렀을 경우
8282
login_img_guest.setOnClickListener {
8383
syncUI()
84+
startActivity(Intent(this, GuestMain::class.java))
85+
overridePendingTransition(R.anim.fade_in, R.anim.fade_out)
8486
}
8587

8688
// 로그인 버튼 눌렀을 경우 Github login 창으로 넘김
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:app="http://schemas.android.com/apk/res-auto"
4+
xmlns:tools="http://schemas.android.com/tools"
5+
android:layout_width="match_parent"
6+
android:layout_height="match_parent"
7+
tools:context=".views.GuestMain">
8+
9+
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
10+
android:id="@+id/simpleSwipeRefreshLayout"
11+
android:layout_width="match_parent"
12+
android:layout_height="match_parent">
13+
14+
<LinearLayout
15+
android:layout_width="match_parent"
16+
android:layout_height="match_parent"
17+
android:orientation="horizontal"
18+
android:padding="20dp">
19+
20+
<TextView
21+
android:layout_width="wrap_content"
22+
android:layout_height="wrap_content"
23+
android:text="Random Number : "
24+
android:textColor="#000"
25+
android:textSize="20sp" />
26+
27+
<TextView
28+
android:id="@+id/guestTextView"
29+
android:layout_width="wrap_content"
30+
android:layout_height="wrap_content"
31+
android:textColor="#000"
32+
android:textSize="20sp" />
33+
34+
</LinearLayout>
35+
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
36+
</androidx.constraintlayout.widget.ConstraintLayout>

0 commit comments

Comments
 (0)