Skip to content

Commit

Permalink
Merge pull request #326 from 1600094806/refactor/#324-image_license
Browse files Browse the repository at this point in the history
[REFACTOR] 이미지 라이선스 추가
  • Loading branch information
koggily authored Jan 28, 2022
2 parents f8eb918 + 2ae123c commit c45cdf6
Show file tree
Hide file tree
Showing 8 changed files with 226 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class SettingsFragment : BaseFragment<FragmentSettingsBinding>(R.layout.fragment
findNavController().navigate(R.id.action_settingsFragment_to_manageGroupFragment)
}
binding.tvOssLicense.setOnClickListener {
startActivity(Intent(requireActivity(), OssLicensesMenuActivity::class.java))
findNavController().navigate(R.id.action_settingsFragment_to_licenseFragment)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package com.ivyclub.contact.ui.main.settings.license

import android.content.Intent
import android.os.Bundle
import android.view.View
import androidx.navigation.fragment.findNavController
import com.google.android.gms.oss.licenses.OssLicensesMenuActivity
import com.ivyclub.contact.R
import com.ivyclub.contact.databinding.FragmentLicenseBinding
import com.ivyclub.contact.util.BaseFragment
import dagger.hilt.android.AndroidEntryPoint

@AndroidEntryPoint
class LicenseFragment : BaseFragment<FragmentLicenseBinding>(R.layout.fragment_license) {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
initBackIcon()
initSettingButton()
}

private fun initBackIcon() {
binding.ivBackIcon.setOnClickListener {
val navController = findNavController()
navController.popBackStack()
}
}

private fun initSettingButton() {
binding.tvImageLicense.setOnClickListener {
findNavController().navigate(R.id.action_licenseFragment_to_imageLicenseFragment)
}
binding.tvOssLicense.setOnClickListener {
startActivity(Intent(requireActivity(), OssLicensesMenuActivity::class.java))
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.ivyclub.contact.ui.main.settings.license.image_license

import android.os.Bundle
import android.view.View
import androidx.navigation.fragment.findNavController
import com.ivyclub.contact.R
import com.ivyclub.contact.databinding.FragmentImageLicenseBinding
import com.ivyclub.contact.util.BaseFragment
import dagger.hilt.android.AndroidEntryPoint

@AndroidEntryPoint
class ImageLicenseFragment :
BaseFragment<FragmentImageLicenseBinding>(R.layout.fragment_image_license) {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
initBackIcon()
}

private fun initBackIcon() {
binding.ivBackIcon.setOnClickListener {
val navController = findNavController()
navController.popBackStack()
}
}

}
10 changes: 10 additions & 0 deletions app/src/main/res/drawable/ic_baseline_image_24.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="@color/black">
<path
android:fillColor="@android:color/white"
android:pathData="M21,19V5c0,-1.1 -0.9,-2 -2,-2H5c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2zM8.5,13.5l2.5,3.01L14.5,12l4.5,6H5l3.5,-4.5z"/>
</vector>
50 changes: 50 additions & 0 deletions app/src/main/res/layout/fragment_image_license.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">

<data>

</data>

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">

<ImageView
android:id="@+id/iv_back_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:background="?attr/selectableItemBackground"
android:contentDescription="@string/fragment_settings_go_back"
android:padding="4dp"
android:src="@drawable/ic_baseline_arrow_back_24"
app:layout_constraintBottom_toBottomOf="@id/tv_settings"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@id/tv_settings" />

<TextView
android:id="@+id/tv_settings"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:text="@string/image_license"
android:textColor="@color/black"
android:textSize="20sp"
android:textStyle="bold"
app:layout_constraintStart_toEndOf="@id/iv_back_icon"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="16dp"
android:layout_marginTop="16dp"
android:text="@string/image_license_detail"
android:textColor="@color/black"
android:textSize="16sp"
app:layout_constraintTop_toBottomOf="@id/tv_settings" />


</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
69 changes: 69 additions & 0 deletions app/src/main/res/layout/fragment_license.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">

<data>

</data>

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">

<ImageView
android:id="@+id/iv_back_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:background="?attr/selectableItemBackground"
android:contentDescription="@string/fragment_settings_go_back"
android:padding="4dp"
android:src="@drawable/ic_baseline_arrow_back_24"
app:layout_constraintBottom_toBottomOf="@id/tv_settings"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@id/tv_settings" />

<TextView
android:id="@+id/tv_settings"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:text="@string/open_source_license"
android:textColor="@color/black"
android:textSize="20sp"
android:textStyle="bold"
app:layout_constraintStart_toEndOf="@id/iv_back_icon"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/tv_image_license"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:drawablePadding="20dp"
android:padding="12dp"
android:text="@string/image_license"
android:textColor="@color/black"
android:textSize="20sp"
app:drawableStartCompat="@drawable/ic_baseline_image_24"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/iv_back_icon" />

<TextView
android:id="@+id/tv_oss_license"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:drawablePadding="20dp"
android:padding="12dp"
android:text="@string/open_source_license"
android:textColor="@color/black"
android:textSize="20sp"
app:drawableStartCompat="@drawable/ic_baseline_library_books_24"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_image_license" />

</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
32 changes: 32 additions & 0 deletions app/src/main/res/navigation/main_nav_graph.xml
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,40 @@
app:exitAnim="@anim/exit_anim"
app:popEnterAnim="@anim/pop_enter_anim"
app:popExitAnim="@anim/pop_exit_anim" />
<action
android:id="@+id/action_settingsFragment_to_licenseFragment"
app:destination="@id/licenseFragment"
app:enterAnim="@anim/enter_anim"
app:exitAnim="@anim/exit_anim"
app:popEnterAnim="@anim/pop_enter_anim"
app:popExitAnim="@anim/pop_exit_anim"/>


</fragment>

<fragment
android:id="@+id/licenseFragment"
android:name="com.ivyclub.contact.ui.main.settings.license.LicenseFragment"
android:label="LicenseFragment"
tools:layout="@layout/fragment_license">

<action
android:id="@+id/action_licenseFragment_to_imageLicenseFragment"
app:destination="@id/imageLicenseFragment"
app:enterAnim="@anim/enter_anim"
app:exitAnim="@anim/exit_anim"
app:popEnterAnim="@anim/pop_enter_anim"
app:popExitAnim="@anim/pop_exit_anim"/>
</fragment>


<fragment
android:id="@+id/imageLicenseFragment"
android:name="com.ivyclub.contact.ui.main.settings.license.image_license.ImageLicenseFragment"
android:label="ImageLicenseFragment"
tools:layout="@layout/fragment_image_license"/>


<fragment
android:id="@+id/friendDetailFragment"
android:name="com.ivyclub.contact.ui.main.friend_detail.FriendDetailFragment"
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -174,4 +174,6 @@
<string name="password_wrong_ten_times">비밀번호를 10회 잘못 입력하셨습니다.</string>
<string name="format_password_try_after">%d분 후에 다시 시도해주세요.</string>
<string name="open_source_license">오픈소스 라이선스</string>
<string name="image_license" translatable="false">이미지 라이선스</string>
<string name="image_license_detail" translatable="false">Icon made by Freepik from www.flaticon.com/authors/freepik</string>
</resources>

0 comments on commit c45cdf6

Please sign in to comment.