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

[CHORE] : git test #5

Open
wants to merge 6 commits into
base: main
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
134 changes: 58 additions & 76 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,98 +1,80 @@
# week3
# week7

![](../../../../../../Downloads/ezgif.com-gif-maker.gif)
---

## level1
### GIF

---

### 로그인 화면

#### SignInActivity
### level 1-1

- editText, Button selector 적용한 모습
![ezgif com-gif-maker (1)](https://user-images.githubusercontent.com/72330632/146235660-57d12c96-fa3e-4853-8f8a-5f88aa316f35.gif)

![img.png](img.png)

- editText
NavigationComponent를 활용하여 다음과 같이 구현했습니다.

~~~xml
<img width="694" alt="스크린샷 2021-12-10 오후 8 54 53" src="https://user-images.githubusercontent.com/72330632/145570481-64080401-d4f5-40e6-8265-91cca00d0dfa.png">

<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_focused="true"
android:drawable="@drawable/edit_text_true"/>
<item android:drawable="@drawable/edit_text_false"/>
</selector>
~~~
마지막 fragment 에 시작하기 버튼을 누르면 finish()이후 Intent을 사용하여 SignInActivity로 이동합니다.

~~~xml
```kotlin
private fun initIntent() {
binding.btnNext.setOnClickListener {
requireActivity().finish()
startActivity(Intent(requireActivity(), SignInActivity::class.java))
}
}
```

<item android:color="@color/week3_pink" android:state_checked="true"/>
<item android:color="@color/week3_gray" android:state_checked="false"/>
~~~
### level 1-2

- Button
![ezgif com-gif-maker (2)](https://user-images.githubusercontent.com/72330632/146236742-9f5805b8-a28e-4e39-a91c-60e4ea8e4fe3.gif)

~~~xml

<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="5dp"/>
<solid android:color="@color/week3_pink"/>
</shape>
~~~
remove()를 사용하여 자동로그인 해제 한 다음 apply()로 적용한 모습입니다.

---
```kotlin
fun setLogout(context: Context) {
val preferences = context.getSharedPreferences(USER_AUTH, Context.MODE_PRIVATE)
preferences.edit()
.remove(AUTO_LOGIN)
.apply()
}
```

#### SignUpActivity
### level 1-3

- 회원 가입 화면도 동일하게 적용
<img width="166" alt="스크린샷 2021-12-15 오후 11 13 53" src="https://user-images.githubusercontent.com/72330632/146202311-da2f3d7b-0918-462d-aabb-b6cd8f7b558b.png">

![img_1.png](img_1.png)
- adapter : 공용으로 사용될 adapter 정의 (현재는 adapter 와 관련된 모든 클래스를 넣어놓고는 있다....)
- data : data 클래스 등등
- util : Util과 같은 클래스가 있다. -> Util 클래스로 만든 이유는 자주사용하는 코드, 공용으로 사용해야 할 코드를 Util로 묶어두면 유용하기 때문에 만들었습니다.
- view : view 폴더 안에 activity, fragment, adapter 등으로 나뉘어 한눈에 보기 쉽다. (현재는 fragment, activity 로만 나뉨 )

---
해당 방식으로 패키징한 이유는 봤을 때 직관적으로 어느 패키지에 뭐가 있는지 알 수 있다는 장점이 있으며 , 검색을 해보니 MVP, MVVM 을 적용해 보면서
만들어진 구조라고 한다.

#### HomeActivity

![img_2.png](img_2.png)
![img_3.png](img_3.png)
- BottomNavigationView에 selector 적용

~~~xml

<com.google.android.material.bottomnavigation.BottomNavigationView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:menu="@menu/menu"
app:itemTextColor="@color/color"
app:itemRippleColor="#FFBEBE"
app:itemIconTint="@color/color"
android:id="@+id/bnv_sample"
/>
~~~

- Button selector 적용
~~~xml

<androidx.appcompat.widget.AppCompatButton
android:layout_width="0dp"
android:layout_height="wrap_content"
android:id="@+id/bt_repository"
android:textColor="@color/profile_button_text"
android:background="@drawable/profile_button"
tools:textColor="@color/profile_button_text"
tools:background="@color/profile_button"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/bt_follower"
app:layout_constraintTop_toBottomOf="@+id/layout_profile"
android:layout_margin="12dp"
android:text="repository"
/>
~~~
[comment]: <> (### level 2-1)

---
[comment]: <> (- gif 2-1)

[comment]: <> (- popUpTo : destination이 나올 때 까지 백스택을 팝업한다.)

[comment]: <> (- popUpInclusive : 지정되지 않거나 false 값인 경우 지정된 destination 경로는 백스택에 저장되어있고 나머지 도착점들을 모두 제거한다. )

[comment]: <> (true 값인 경우 지정된 경로를 포함하여 제거한다.)

[comment]: <> (- popUpInclusive 값이 true 이고, popUpTo 값이 시작점인 경우 백 버튼을 누르면 앱이 종료된다.)


[comment]: <> (### level 2-2)

[comment]: <> (- gif 2-2)

### 배운 점

- Navigation Component 사용법
- SharedPreference remove, clear 사용법
- 안드로이드 패키징 해야하는 이유
- popUpTo, popUpInclusive 사용법
- Toolbar, Appbar 사용법
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ object SharedPreferences {
val preferences = context.getSharedPreferences(USER_AUTH, Context.MODE_PRIVATE)
preferences.edit()
.remove(AUTO_LOGIN)
.clear()
.apply()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.bumptech.glide.Glide
import com.example.myapplication.R
import com.example.myapplication.view.Activity.SignInActivity
import com.example.myapplication.databinding.FragmentNavigationComponent3Binding

Expand All @@ -18,12 +20,22 @@ class NavigationComponent3 : Fragment() {
): View? {
_binding = FragmentNavigationComponent3Binding.inflate(layoutInflater)
binding.tvAbout.text = "SOPTHub를\n시작해볼까요?"
onClickBtnNext()
Glide.with(this)
.load(R.drawable.dodogi)
.override(1000, 400)
.into(binding.ivImage)

return binding.root
}

private fun onClickBtnNext() {
binding.btnNext.setOnClickListener {
requireActivity().finish()
startActivity(Intent(requireActivity(), SignInActivity::class.java))
}
return binding.root
}

Choose a reason for hiding this comment

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

이 리뷰 확인해보면 좋을 것 같습니다!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

좋은 자료 감사합니다~~~

override fun onDestroyView() {
super.onDestroyView()
_binding = null
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/layout/fragment_navigation_component2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="5dp"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".view.fragment.NavigationComponent2">

Expand Down
8 changes: 5 additions & 3 deletions app/src/main/res/layout/fragment_navigation_component3.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,21 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="5dp"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".view.fragment.NavigationComponent3">

<!-- TODO: Update blank fragment layout -->
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/iv_image"
android:scaleType="fitStart"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="30dp"/>
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginBottom="100dp"
/>

<TextView
android:layout_width="wrap_content"
Expand All @@ -23,7 +26,6 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/iv_image"
android:layout_marginTop="30dp"
android:textColor="@color/week3_pink"
android:textSize="22sp"
android:fontFamily="@font/noto_sans_kr_bold"
Expand Down
10 changes: 5 additions & 5 deletions app/src/main/res/navigation/navigation_component.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
android:id="@+id/fragment_nav_comp1"
android:name="com.example.myapplication.view.fragment.NavigationComponent1"
android:label="첫 번째 화면"
>
tools:layout="@layout/fragment_navigation_component1">
<action
android:id="@+id/navComp1_to_navComp2"
app:destination="@id/fragment_nav_comp2" />
Expand All @@ -17,7 +17,7 @@
android:id="@+id/fragment_nav_comp2"
android:name="com.example.myapplication.view.fragment.NavigationComponent2"
android:label="두 번째 화면"
>
tools:layout="@layout/fragment_navigation_component2">
<action
android:id="@+id/navComp2_to_navComp3"
app:popUpTo="@id/fragment_nav_comp1"
Expand All @@ -26,10 +26,10 @@
<fragment
android:id="@+id/fragment_nav_comp3"
android:name="com.example.myapplication.view.fragment.NavigationComponent3"
android:label="세 번째 화면">
android:label="세 번째 화면"
tools:layout="@layout/fragment_navigation_component3">
<action
android:id="@+id/navComp3"
app:popUpTo="@id/fragment_nav_comp2" />
android:id="@+id/navComp3"/>
</fragment>
<activity
android:id="@+id/onBodingActivity"
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.3'
classpath 'com.android.tools.build:gradle:7.0.4'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.0"

// NOTE: Do not place your application dependencies here; they belong
Expand Down