-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feature/#27-signup-ui
- Loading branch information
Showing
75 changed files
with
2,137 additions
and
175 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
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
24 changes: 24 additions & 0 deletions
24
app/src/main/java/com/teumteum/teumteum/WebviewFragment.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,24 @@ | ||
package com.teumteum.teumteum | ||
|
||
import android.os.Bundle | ||
import androidx.fragment.app.Fragment | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import androidx.lifecycle.lifecycleScope | ||
import com.teumteum.base.BindingFragment | ||
import com.teumteum.teumteum.databinding.FragmentWebviewBinding | ||
|
||
|
||
class WebviewFragment : | ||
BindingFragment<FragmentWebviewBinding>(R.layout.fragment_webview){ | ||
|
||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||
super.onViewCreated(view, savedInstanceState) | ||
|
||
} | ||
|
||
companion object { | ||
|
||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
app/src/main/java/com/teumteum/teumteum/di/NetworkStatus.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,22 @@ | ||
package com.teumteum.teumteum.di | ||
|
||
import android.content.Context | ||
import android.net.ConnectivityManager | ||
import android.net.NetworkInfo | ||
|
||
object NetworkStatus { | ||
const val TYPE_WIFI = 1 | ||
const val TYPE_MOBILE = 2 | ||
const val TYPE_NOT_CONNECTED = 3 | ||
|
||
fun getConnectivityStatus(context: Context): Int { | ||
val manager = context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager | ||
val networkInfo: NetworkInfo? = manager.activeNetworkInfo | ||
|
||
return when { | ||
networkInfo?.type == ConnectivityManager.TYPE_MOBILE -> TYPE_MOBILE | ||
networkInfo?.type == ConnectivityManager.TYPE_WIFI -> TYPE_WIFI | ||
else -> TYPE_NOT_CONNECTED | ||
} | ||
} | ||
} |
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
49 changes: 13 additions & 36 deletions
49
app/src/main/java/com/teumteum/teumteum/presentation/MainActivity.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 |
---|---|---|
@@ -1,56 +1,33 @@ | ||
package com.teumteum.teumteum.presentation | ||
|
||
import android.os.Bundle | ||
import androidx.fragment.app.commit | ||
import android.view.View | ||
import androidx.navigation.fragment.NavHostFragment | ||
import androidx.navigation.ui.NavigationUI | ||
import androidx.navigation.ui.setupWithNavController | ||
import com.teumteum.base.BindingActivity | ||
import com.teumteum.teumteum.R | ||
import com.teumteum.teumteum.databinding.ActivityMainBinding | ||
import com.teumteum.teumteum.presentation.home.HomeFragment | ||
import com.teumteum.teumteum.presentation.mypage.MyPageFragment | ||
import com.teumteum.teumteum.presentation.teumteum.TeumTeumFragment | ||
import dagger.hilt.android.AndroidEntryPoint | ||
|
||
@AndroidEntryPoint | ||
class MainActivity : BindingActivity<ActivityMainBinding>(R.layout.activity_main) { | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
|
||
initView() | ||
setUpListener() | ||
} | ||
|
||
private fun initView() { | ||
val initialFragment = HomeFragment() | ||
supportFragmentManager.commit { | ||
add(R.id.fl_main, initialFragment) | ||
} | ||
val navHostFragment = supportFragmentManager.findFragmentById(R.id.fl_main) as NavHostFragment | ||
val navController = navHostFragment.navController | ||
binding.btmNavi.setupWithNavController(navController) | ||
} | ||
|
||
private fun setUpListener() { | ||
binding.btmNavi.setOnItemSelectedListener { | ||
replaceFragment(it.itemId) | ||
true | ||
} | ||
fun hideBottomNavi() { | ||
binding.btmNavi.visibility = View.GONE | ||
} | ||
|
||
private fun replaceFragment(menuItemId: Int) { | ||
try { | ||
supportFragmentManager.commit { | ||
replace( | ||
R.id.fl_main, when (menuItemId) { | ||
R.id.bottom_menu_home -> HomeFragment() | ||
R.id.bottom_menu_teum_teum -> TeumTeumFragment() | ||
R.id.bottom_menu_my_page -> MyPageFragment() | ||
else -> throw IllegalArgumentException("${this@MainActivity::class.java.simpleName} unkown menuItemId") | ||
} | ||
) | ||
} | ||
} catch (e: IllegalArgumentException) { | ||
supportFragmentManager.commit { | ||
replace(R.id.fl_main, HomeFragment()) | ||
} | ||
} | ||
fun showBottomNavi() { | ||
binding.btmNavi.visibility = View.VISIBLE | ||
} | ||
|
||
companion object {} | ||
} | ||
} |
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
44 changes: 44 additions & 0 deletions
44
app/src/main/java/com/teumteum/teumteum/presentation/group/search/KeywordAdapter.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,44 @@ | ||
package com.teumteum.teumteum.presentation.group.search | ||
|
||
import android.view.LayoutInflater | ||
import android.view.ViewGroup | ||
import androidx.recyclerview.widget.RecyclerView | ||
import com.teumteum.teumteum.databinding.ItemKeywordListBinding | ||
|
||
class KeywordAdapter(private val itemClick: (String) -> (Unit)) : | ||
RecyclerView.Adapter<KeywordAdapter.KeywordAdapter>() { | ||
private val keywordList = mutableListOf<String>() | ||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): KeywordAdapter { | ||
val binding = ItemKeywordListBinding.inflate( | ||
LayoutInflater.from(parent.context), | ||
parent, | ||
false, | ||
) | ||
return KeywordAdapter(binding, itemClick) | ||
} | ||
|
||
override fun onBindViewHolder(holder: KeywordAdapter, position: Int) { | ||
holder.onBind(keywordList[position]) | ||
} | ||
|
||
override fun getItemCount(): Int = keywordList.size | ||
|
||
fun setItems(newItems: List<String>) { | ||
keywordList.clear() | ||
keywordList.addAll(newItems) | ||
notifyDataSetChanged() | ||
} | ||
|
||
class KeywordAdapter( | ||
private val binding: ItemKeywordListBinding, | ||
private val itemClick: (String) -> (Unit) | ||
): RecyclerView.ViewHolder(binding.root) { | ||
fun onBind(keyword: String) { | ||
binding.tvKeyword.text = keyword | ||
|
||
binding.root.setOnClickListener { | ||
itemClick(keyword) | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.