-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
181 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
app/src/main/java/com/scentsnote/android/ui/detail/LowestPriceFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
package com.scentsnote.android.ui.detail | ||
|
||
import android.content.Context | ||
import android.os.Bundle | ||
import androidx.fragment.app.Fragment | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import android.webkit.WebViewClient | ||
import androidx.activity.OnBackPressedCallback | ||
import com.scentsnote.android.R | ||
import com.scentsnote.android.databinding.FragmentLowestPriceBinding | ||
import com.scentsnote.android.utils.extension.closeSelfWithAnimation | ||
import com.scentsnote.android.utils.extension.setOnSafeClickListener | ||
|
||
class LowestPriceFragment : Fragment() { | ||
private var _binding: FragmentLowestPriceBinding? = null | ||
private val binding get() = _binding!! | ||
|
||
private lateinit var onBackPressedCallback: OnBackPressedCallback | ||
|
||
override fun onCreateView( | ||
inflater: LayoutInflater, container: ViewGroup?, | ||
savedInstanceState: Bundle? | ||
): View? { | ||
super.onCreateView(inflater, container, savedInstanceState) | ||
_binding = FragmentLowestPriceBinding.inflate(inflater) | ||
return binding.root | ||
} | ||
|
||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||
super.onViewCreated(view, savedInstanceState) | ||
|
||
initView() | ||
} | ||
|
||
override fun onAttach(context: Context) { | ||
super.onAttach(context) | ||
|
||
onBackPressedCallback = object : OnBackPressedCallback(true) { | ||
override fun handleOnBackPressed() { | ||
closeSelfWithAnimation() | ||
} | ||
} | ||
requireActivity().onBackPressedDispatcher.addCallback(this, onBackPressedCallback) | ||
} | ||
|
||
override fun onDetach() { | ||
super.onDetach() | ||
onBackPressedCallback.remove() | ||
} | ||
|
||
override fun onDestroyView() { | ||
super.onDestroyView() | ||
_binding = null | ||
} | ||
|
||
private fun initView(){ | ||
binding.toolbarLowestPrice.apply { | ||
toolbar = R.drawable.icon_btn_cancel | ||
toolbartxt = "가격 비교" | ||
|
||
toolbarBtn.setOnSafeClickListener { | ||
closeSelfWithAnimation() | ||
} | ||
} | ||
|
||
binding.wvLowestPrice.apply { | ||
webViewClient = WebViewClient() | ||
loadUrl("https://www.naver.com/") | ||
} | ||
} | ||
|
||
companion object { | ||
fun newInstance(): LowestPriceFragment = LowestPriceFragment() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions
5
app/src/main/res/drawable/border_dark_gray_7d_line_square_2.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<shape xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:shape="rectangle"> | ||
<stroke android:width="1dp" android:color="@color/primary_black"/> | ||
</shape> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?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" | ||
xmlns:tools="http://schemas.android.com/tools"> | ||
|
||
<androidx.constraintlayout.widget.ConstraintLayout | ||
android:id="@+id/frameLayout" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
tools:context=".ui.detail.LowestPriceFragment"> | ||
|
||
<include | ||
android:id="@+id/toolbar_lowest_price" | ||
layout="@layout/toolbar_txt_with_btn" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" /> | ||
|
||
<WebView | ||
android:id="@+id/wv_lowest_price" | ||
android:layout_width="0dp" | ||
android:layout_height="0dp" | ||
app:layout_constraintBottom_toBottomOf="parent" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@+id/toolbar_lowest_price" /> | ||
|
||
</androidx.constraintlayout.widget.ConstraintLayout> | ||
</layout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters