Skip to content
Merged
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
3 changes: 3 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
android:supportsRtl="true"
android:theme="@style/Theme.NoBet"
tools:targetApi="31">
<activity
android:name=".presentation.screen.allow.AllowActivity"
android:exported="false" />
<activity
android:name=".presentation.screen.login.LoginActivity"
android:exported="false" />
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package kr.hs.anu.nobet.domain.model

data class AllowSiteData(
val siteUrl: String
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package kr.hs.anu.nobet.presentation.screen.allow

import android.os.Bundle
import androidx.activity.enableEdgeToEdge
import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import androidx.recyclerview.widget.LinearLayoutManager
import kr.hs.anu.nobet.R
import kr.hs.anu.nobet.databinding.ActivityAllowBinding
import kr.hs.anu.nobet.utils.openPage

class AllowActivity : AppCompatActivity() {

private val viewModel: AllowViewModel by viewModels()
private lateinit var binding: ActivityAllowBinding
private lateinit var allowAdapter: AllowRecyclerAdapter

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
enableEdgeToEdge()
binding = ActivityAllowBinding.inflate(layoutInflater)
setContentView(binding.root)
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main)) { v, insets ->
val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
insets
}

binding.ivTopbarLogo.setOnClickListener {
finish()
}

binding.tvMobile.setOnClickListener {
this.openPage()
}

allowAdapter = AllowRecyclerAdapter()
binding.recyclerAllow.apply {
layoutManager = LinearLayoutManager(this@AllowActivity)
adapter = allowAdapter
}

viewModel.siteList.observe(this) { list ->
allowAdapter.submitList(list)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package kr.hs.anu.nobet.presentation.screen.allow

import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import kr.hs.anu.nobet.databinding.AllowItemBinding
import kr.hs.anu.nobet.domain.model.AllowSiteData

class AllowRecyclerAdapter : RecyclerView.Adapter<AllowRecyclerAdapter.AllowViewHolder>() {

private val itemList = mutableListOf<AllowSiteData>()

fun submitList(newList: List<AllowSiteData>) {
itemList.clear()
itemList.addAll(newList)
notifyDataSetChanged()
}

inner class AllowViewHolder(private val binding: AllowItemBinding) :
RecyclerView.ViewHolder(binding.root) {

fun bind(item: AllowSiteData) {
// TODO 데이터 넣어주기
binding.tvAllowSite.text = item.siteUrl

binding.btnDel.setOnClickListener {
// TODO 삭제
}
}
}

override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): AllowViewHolder {
val binding = AllowItemBinding.inflate(
LayoutInflater.from(parent.context),
parent,
false
)
return AllowViewHolder(binding)
}

override fun onBindViewHolder(holder: AllowViewHolder, position: Int) {
holder.bind(itemList[position])
}

override fun getItemCount(): Int = itemList.size
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package kr.hs.anu.nobet.presentation.screen.allow

import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import kr.hs.anu.nobet.domain.model.AllowSiteData

class AllowViewModel : ViewModel() {
private val _siteList = MutableLiveData<List<AllowSiteData>>()
val siteList: LiveData<List<AllowSiteData>> get() = _siteList

init {
loadAllowSites()
}

private fun loadAllowSites() {
// 임시 데이터
_siteList.value = listOf(
AllowSiteData("naver.com"),
AllowSiteData("google.com"),
AllowSiteData("youtube.com")
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import kr.hs.anu.nobet.R
import kr.hs.anu.nobet.databinding.ActivityMainBinding
import kr.hs.anu.nobet.presentation.screen.allow.AllowActivity
import kr.hs.anu.nobet.presentation.screen.login.LoginActivity
import kr.hs.anu.nobet.utils.openPage

class MainActivity : AppCompatActivity() {

Expand Down Expand Up @@ -73,6 +75,11 @@ class MainActivity : AppCompatActivity() {
binding.ivMenu.setOnClickListener {
showMenu(it)
}

// 온라인 상담 연결
binding.tvMobile.setOnClickListener {
this.openPage()
}
}

// 메뉴 커스텀 함수
Expand Down Expand Up @@ -104,7 +111,8 @@ class MainActivity : AppCompatActivity() {
}

popupMenu.findViewById<ConstraintLayout>(R.id.menu_block_pass).setOnClickListener {
Toast.makeText(anchor.context, "차단 제외 하기", Toast.LENGTH_SHORT).show()
val intent = Intent(this, AllowActivity::class.java)
startActivity(intent)
popupWindow.dismiss()
}

Expand Down
11 changes: 11 additions & 0 deletions app/src/main/res/drawable/add_btn.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">

<solid android:color="@color/red" />

<corners
android:bottomLeftRadius="0dp"
android:radius="@dimen/radius_1"
android:topLeftRadius="0dp" />
</shape>
12 changes: 12 additions & 0 deletions app/src/main/res/drawable/allow_del_btn.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners
android:bottomLeftRadius="0dp"
android:bottomRightRadius="@dimen/radius_1"
android:topLeftRadius="0dp"
android:topRightRadius="@dimen/radius_1" />
<stroke
android:width="1dp"
android:color="@color/orange" />
</shape>
8 changes: 8 additions & 0 deletions app/src/main/res/drawable/allow_list_background.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="@dimen/radius_1" />
<stroke
android:width="1dp"
android:color="@color/orange" />
</shape>
8 changes: 8 additions & 0 deletions app/src/main/res/drawable/allow_site_list_background.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">

<corners android:radius="@dimen/radius_1" />
<solid android:color="@color/white" />
<stroke android:color="@color/gray" android:width="1dp" />
</shape>
13 changes: 13 additions & 0 deletions app/src/main/res/drawable/et_site_background.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">

<solid android:color="@color/white" />
<stroke
android:width="1dp"
android:color="@color/gray" />
<corners
android:bottomRightRadius="0dp"
android:radius="@dimen/radius_1"
android:topRightRadius="0dp" />
</shape>
162 changes: 162 additions & 0 deletions app/src/main/res/layout/activity_allow.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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"
android:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
tools:context=".presentation.screen.allow.AllowActivity">

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/layout_topBar"
android:layout_width="match_parent"
android:layout_height="54dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">

<ImageView
android:id="@+id/iv_topbar_logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:src="@drawable/top_bar_logo"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>

<TextView
android:id="@+id/tv_top_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="60dp"
android:fontFamily="@font/pretendard_regular"
android:text="@string/top_title"
android:textColor="@color/gray"
android:textSize="@dimen/body_5"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/layout_topBar" />

<TextView
android:id="@+id/tv_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:fontFamily="@font/pretendard_medium"
android:text="접근 허용 사이트"
android:textColor="@color/black"
android:textSize="@dimen/body_1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_top_title" />

<EditText
android:id="@+id/et_allow_site"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="40dp"
android:layout_marginEnd="10dp"
android:background="@drawable/et_site_background"
android:fontFamily="@font/pretendard_regular"
android:hint="예 : example.com"
android:paddingHorizontal="10dp"
android:paddingVertical="13dp"
android:textColor="@color/black"
android:textSize="@dimen/body_5"
app:layout_constraintEnd_toStartOf="@id/btn_add"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_title" />

<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btn_add"
android:layout_width="60dp"
android:layout_height="wrap_content"
android:layout_marginEnd="20dp"
android:background="@drawable/add_btn"
android:fontFamily="@font/pretendard_regular"
android:text="추가"
android:textColor="@color/white"
android:textSize="@dimen/body_5"
app:layout_constraintBottom_toBottomOf="@id/et_allow_site"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@id/et_allow_site" />

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/layout_site_list"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginHorizontal="20dp"
android:layout_marginTop="25dp"
android:layout_marginBottom="31dp"
android:background="@drawable/allow_site_list_background"
app:layout_constraintBottom_toTopOf="@id/layout_gambling_prevent_info_box"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/et_allow_site">

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_allow"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="20dp"
tools:listitem="@layout/allow_item" />

</androidx.constraintlayout.widget.ConstraintLayout>

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/layout_gambling_prevent_info_box"
android:layout_width="0dp"
android:layout_height="30dp"
android:layout_marginHorizontal="20dp"
android:layout_marginBottom="20dp"
android:background="@drawable/gambling_prevent_info_box"
android:paddingHorizontal="10dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">

<TextView
android:id="@+id/tv_num_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:fontFamily="@font/pretendard_medium"
android:text="@string/num_info"
android:textColor="@color/black"
android:textSize="@dimen/body_6"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/line"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="|"
android:textColor="@color/gray"
android:textSize="@dimen/body_5"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/tv_mobile"
app:layout_constraintStart_toEndOf="@id/tv_num_info"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/tv_mobile"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:fontFamily="@font/pretendard_medium"
android:text="@string/mobile_info"
android:textColor="@color/blue"
android:textSize="@dimen/body_6"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

</androidx.constraintlayout.widget.ConstraintLayout>
Loading