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.blockList.BlockListActivity"
android:exported="false" />
<activity
android:name=".presentation.screen.allow.AllowActivity"
android:exported="false" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package kr.hs.anu.nobet.domain.model

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

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.ActivityBlockListBinding
import kr.hs.anu.nobet.utils.openPage

class BlockListActivity : AppCompatActivity() {

private val viewModel: BlockListViewModel by viewModels()
private lateinit var binding: ActivityBlockListBinding
private lateinit var blockAdapter: BlockRecyclerAdapter

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
enableEdgeToEdge()
binding = ActivityBlockListBinding.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()
}

// TODO 페이징 사용 예정

// Adapter
blockAdapter = BlockRecyclerAdapter()
binding.recyclerBlock.apply {
layoutManager = LinearLayoutManager(this@BlockListActivity)
adapter = blockAdapter
}

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

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

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

init {
loadBlockSites()
}

private fun loadBlockSites() {
// 임시 데이터
_siteList.value = listOf(
BlockSiteData("example.com"),
BlockSiteData("example.com"),
BlockSiteData("example.com")
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package kr.hs.anu.nobet.presentation.screen.blockList

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

class BlockRecyclerAdapter : RecyclerView.Adapter<BlockRecyclerAdapter.BlockViewHolder>() {

private val itemList = mutableListOf<BlockSiteData>()

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

inner class BlockViewHolder(private val binding: BlockItemBinding) :
RecyclerView.ViewHolder(binding.root) {
fun bind(item: BlockSiteData) {
binding.tvBlockSite.text = item.siteUrl
}
}

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

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

override fun getItemCount(): Int = itemList.size
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ 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.blockList.BlockListActivity
import kr.hs.anu.nobet.presentation.screen.login.LoginActivity
import kr.hs.anu.nobet.utils.openPage

Expand Down Expand Up @@ -117,7 +118,8 @@ class MainActivity : AppCompatActivity() {
}

popupMenu.findViewById<ConstraintLayout>(R.id.menu_log).setOnClickListener {
Toast.makeText(anchor.context, "필터링 로그", Toast.LENGTH_SHORT).show()
val intent = Intent(this, BlockListActivity::class.java)
startActivity(intent)
popupWindow.dismiss()
}

Expand Down
13 changes: 13 additions & 0 deletions app/src/main/res/drawable/ic_left_arrow.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<group>
<clip-path
android:pathData="M0,0h24v24h-24z"/>
<path
android:pathData="M14.71,15.88L10.83,12L14.71,8.12C14.803,8.027 14.876,7.918 14.926,7.797C14.976,7.676 15.002,7.546 15.002,7.415C15.002,7.284 14.976,7.154 14.926,7.033C14.876,6.912 14.803,6.803 14.71,6.71C14.618,6.617 14.508,6.544 14.387,6.494C14.266,6.444 14.136,6.418 14.005,6.418C13.874,6.418 13.745,6.444 13.623,6.494C13.502,6.544 13.393,6.617 13.3,6.71L8.71,11.3C8.617,11.392 8.544,11.502 8.494,11.623C8.443,11.744 8.418,11.874 8.418,12.005C8.418,12.136 8.443,12.266 8.494,12.387C8.544,12.508 8.617,12.618 8.71,12.71L13.3,17.3C13.69,17.69 14.32,17.69 14.71,17.3C15.09,16.91 15.1,16.27 14.71,15.88Z"
android:fillColor="#000000"/>
</group>
</vector>
13 changes: 13 additions & 0 deletions app/src/main/res/drawable/ic_right_arrow.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<group>
<clip-path
android:pathData="M0,0h24v24h-24z"/>
<path
android:pathData="M9.29,15.88L13.17,12L9.29,8.12C9.197,8.027 9.124,7.918 9.074,7.797C9.024,7.676 8.998,7.546 8.998,7.415C8.998,7.284 9.024,7.154 9.074,7.033C9.124,6.912 9.197,6.803 9.29,6.71C9.383,6.617 9.492,6.544 9.613,6.494C9.734,6.444 9.864,6.418 9.995,6.418C10.126,6.418 10.255,6.444 10.377,6.494C10.498,6.544 10.607,6.617 10.7,6.71L15.29,11.3C15.68,11.69 15.68,12.32 15.29,12.71L10.7,17.3C10.607,17.393 10.498,17.466 10.377,17.516C10.256,17.567 10.126,17.592 9.995,17.592C9.864,17.592 9.734,17.567 9.613,17.516C9.492,17.466 9.382,17.393 9.29,17.3C8.91,16.91 8.9,16.27 9.29,15.88Z"
android:fillColor="#000000"/>
</group>
</vector>
14 changes: 14 additions & 0 deletions app/src/main/res/layout/activity_allow.xml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,20 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/et_allow_site">

<TextView
android:id="@+id/tv_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/pretendard_regular"
android:text="차단 제외 사이트가 없습니다"
android:textColor="@color/gray"
android:textSize="@dimen/body_5"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_allow"
android:layout_width="match_parent"
Expand Down
174 changes: 174 additions & 0 deletions app/src/main/res/layout/activity_block_list.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
<?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.blockList.BlockListActivity">

<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" />

<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/tv_title">

<TextView
android:id="@+id/tv_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/pretendard_regular"
android:text="차단 된 사이트가 없습니다"
android:textColor="@color/gray"
android:textSize="@dimen/body_5"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

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

<ImageView
android:id="@+id/btn_left"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="100dp"
android:layout_marginBottom="20dp"
android:src="@drawable/ic_left_arrow"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" />

<TextView
android:id="@+id/tv_page"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Page 1/1"
app:layout_constraintBottom_toBottomOf="@id/btn_left"
app:layout_constraintEnd_toStartOf="@id/btn_right"
app:layout_constraintStart_toEndOf="@id/btn_left"
app:layout_constraintTop_toTopOf="@id/btn_left" />

<ImageView
android:id="@+id/btn_right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="100dp"
android:layout_marginBottom="20dp"
android:src="@drawable/ic_right_arrow"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />

</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