Skip to content

Commit

Permalink
conflict ์ˆ˜์ •
Browse files Browse the repository at this point in the history
  • Loading branch information
HJinhee committed Jul 8, 2021
2 parents 289a6e3 + ef24ceb commit 8c2953c
Show file tree
Hide file tree
Showing 43 changed files with 786 additions and 37 deletions.
4 changes: 2 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.ChaRoAndroid">


<activity android:name=".ui.search.SearchActivity" />
<activity android:name=".DetailActivity"/>
<activity android:name=".ui.write.WriteMapActivity"></activity>
<activity android:name=".ui.write.WriteActivity" />
<activity
android:name=".MainActivity"
android:label="@string/app_name">
Expand Down
31 changes: 22 additions & 9 deletions app/src/main/java/com/example/charo_android/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.example.charo_android

import android.content.Intent
import android.os.Bundle
import com.google.android.material.bottomnavigation.BottomNavigationView
import androidx.appcompat.app.AppCompatActivity
Expand All @@ -12,6 +13,7 @@ import com.example.charo_android.databinding.ActivityMainBinding
import com.example.charo_android.ui.home.HomeFragment
import com.example.charo_android.ui.home.HomeViewPagerAdapter

import com.example.charo_android.ui.write.WriteActivity

class MainActivity : AppCompatActivity() {

Expand All @@ -28,8 +30,7 @@ class MainActivity : AppCompatActivity() {
}



private fun initNavView(){
private fun initNavView() {
val navView: BottomNavigationView = binding.navView
val navController = findNavController(R.id.nav_host_fragment_activity_main)
val appBarConfiguration = AppBarConfiguration(
Expand All @@ -39,14 +40,26 @@ class MainActivity : AppCompatActivity() {
)
setupActionBarWithNavController(navController, appBarConfiguration)
navView.setupWithNavController(navController)


binding.btnWrite.setOnClickListener {
startActivityWrite()
}
}


fun AppCompatActivity.replaceFragment(fragment: Fragment) {
val fragmentManager = supportFragmentManager
val transaction = fragmentManager.beginTransaction()
transaction.replace(R.id.nav_host_fragment_activity_main, fragment)
transaction.addToBackStack(null)
transaction.commit()
}

fun startActivityWrite() {
val intent = Intent(this@MainActivity, WriteActivity::class.java)
startActivity(intent)
}

}

fun AppCompatActivity.replaceFragment(fragment: Fragment){
val fragmentManager = supportFragmentManager
val transaction = fragmentManager.beginTransaction()
transaction.replace(R.id.nav_host_fragment_activity_main, fragment)
transaction.addToBackStack(null)
transaction.commit()
}
147 changes: 147 additions & 0 deletions app/src/main/java/com/example/charo_android/ui/write/WriteActivity.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
package com.example.charo_android.ui.write

import android.os.Bundle
import android.view.MotionEvent
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import com.example.charo_android.R
import com.example.charo_android.databinding.ActivityWriteBinding
import com.google.android.material.dialog.MaterialAlertDialogBuilder


class WriteActivity : AppCompatActivity() {

private lateinit var binding : ActivityWriteBinding

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

binding = ActivityWriteBinding.inflate(layoutInflater)
setContentView(binding.root)

//๋ฒ„ํŠผ selected ์ƒํƒœ ๋ณ€ํ™” ํ•จ์ˆ˜
setButtonClickEvent()

//์ง€์—ญ
val ItemsDo = arrayOf("")


// ํ…Œ๋งˆ
val ItemsTheme = arrayOf("์‚ฐ", "๋ฐ”๋‹ค", "ํ˜ธ์ˆ˜","๊ฐ•","๋ด„","์—ฌ๋ฆ„","๊ฐ€์„","๊ฒจ์šธ","ํ•ด์•ˆ๋„๋กœ","๋ฒš๊ฝƒ","๋‹จํ’","์—ฌ์œ ","์Šคํ”ผ๋“œ","์•ผ๊ฒฝ","๋„์‹ฌ")


binding.btnWriteTheme1.setOnClickListener {
val checkedItem = 1
MaterialAlertDialogBuilder(this)
.setTitle(resources.getString(R.string.theme1))
.setNeutralButton("์ทจ์†Œ") { dialog, which ->
binding.btnWriteTheme1.setText(resources.getString(R.string.theme1))
it.isSelected = false
}
.setPositiveButton("ํ™•์ธ") { dialog, which ->
if(binding.btnWriteTheme1.text.toString() == resources.getString(R.string.theme1)) {
it.isSelected = false
}
it.isSelected = true
}
// Single-choice items (initialized with checked item)
.setSingleChoiceItems(ItemsTheme, checkedItem) { dialog, which ->
//which : index
//ํ…Œ๋งˆ ๊ณ ๋ฅด๋ฉด ํ…์ŠคํŠธ ๋ณ€๊ฒฝ
binding.btnWriteTheme1.setText(ItemsTheme[which])
}
.show()
}
binding.btnWriteTheme2.setOnClickListener {
val checkedItem = 1
MaterialAlertDialogBuilder(this)
.setTitle(resources.getString(R.string.theme2))
.setNeutralButton("์ทจ์†Œ") { dialog, which ->
binding.btnWriteTheme2.setText(resources.getString(R.string.theme2))
it.isSelected = false
}
.setPositiveButton("ํ™•์ธ") { dialog, which ->
if(binding.btnWriteTheme1.text.toString() == resources.getString(R.string.theme2)) {
it.isSelected = false
}
it.isSelected = true
}
// Single-choice items (initialized with checked item)
.setSingleChoiceItems(ItemsTheme, checkedItem) { dialog, which ->
//which : index
//ํ…Œ๋งˆ ๊ณ ๋ฅด๋ฉด ํ…์ŠคํŠธ ๋ณ€๊ฒฝ
binding.btnWriteTheme2.setText(ItemsTheme[which])
}
.show()
}
binding.btnWriteTheme3.setOnClickListener {
val checkedItem = 1
MaterialAlertDialogBuilder(this)
.setTitle(resources.getString(R.string.theme3))
.setNeutralButton("์ทจ์†Œ") { dialog, which ->
binding.btnWriteTheme3.setText(resources.getString(R.string.theme3))
it.isSelected = false
}
.setPositiveButton("ํ™•์ธ") { dialog, which ->
if(binding.btnWriteTheme3.text.toString() == resources.getString(R.string.theme3)) {
it.isSelected = false
}
it.isSelected = true
}
// Single-choice items (initialized with checked item)
.setSingleChoiceItems(ItemsTheme, checkedItem) { dialog, which ->
//which : index
//ํ…Œ๋งˆ ๊ณ ๋ฅด๋ฉด ํ…์ŠคํŠธ ๋ณ€๊ฒฝ
binding.btnWriteTheme3.setText(ItemsTheme[which])
}
.show()
}

//์ฃผ์ฐจ - ๋‘˜ ์ค‘ ํ•˜๋‚˜๋งŒ ์„ ํƒ ๊ฐ€๋Šฅํ•˜๋„๋ก ํ•˜๊ธฐ


}



fun setButtonClickEvent() {

binding.btnWriteCautionHighway.setOnClickListener {
it.isSelected = !it.isSelected
}
binding.btnWriteCautionPeople.setOnClickListener {
it.isSelected = !it.isSelected
}
binding.btnWriteCautionDiffi.setOnClickListener {
it.isSelected = !it.isSelected
}
binding.btnWriteCautionMoun.setOnClickListener {
it.isSelected = !it.isSelected
}
binding.btnWriteDo.setOnClickListener {
it.isSelected = !it.isSelected
}
binding.btnWriteSi.setOnClickListener {
it.isSelected = !it.isSelected
}
binding.btnWriteParkNo.setOnClickListener {
it.isSelected = !it.isSelected
}
binding.btnWriteParkYes.setOnClickListener {
it.isSelected = !it.isSelected
}
binding.btnWriteTheme1.setOnClickListener {
it.isSelected = !it.isSelected
}
binding.btnWriteTheme2.setOnClickListener {
it.isSelected = !it.isSelected
}
binding.btnWriteTheme3.setOnClickListener {
it.isSelected = !it.isSelected
}
}




}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.example.charo_android.ui.write

import android.content.Intent
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
Expand Down Expand Up @@ -30,10 +31,14 @@ class WriteFragment : Fragment() {
_binding = FragmentWriteBinding.inflate(inflater, container, false)
val root: View = binding.root

val textView: TextView = binding.textWrite
writeViewModel.text.observe(viewLifecycleOwner, Observer {
textView.text = it
})
// val textView: TextView = binding.textWrite
// writeViewModel.text.observe(viewLifecycleOwner, Observer {
// textView.text = it
// })

val intent = Intent(context, WriteActivity::class.java)
startActivity(intent)

return root
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.example.charo_android.ui.write

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import com.example.charo_android.databinding.ActivityWriteMapBinding

class WriteMapActivity : AppCompatActivity() {

private lateinit var binding : ActivityWriteMapBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

binding = ActivityWriteMapBinding.inflate(layoutInflater)
setContentView(binding.root)
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-hdpi/group_525.png
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.
Binary file added app/src/main/res/drawable-hdpi/rectangle_243.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-hdpi/rectangle_244.png
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 app/src/main/res/drawable-mdpi/btn_park_click.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/ui_write_btn_parking_select_android" android:state_selected="true" />
<item android:drawable="@drawable/ui_write_btn_parking_unselect_android" android:state_selected="false" />
</selector>
5 changes: 5 additions & 0 deletions app/src/main/res/drawable-mdpi/btn_warning_click.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/ui_write_btn_warning_unselect_android_2" android:state_selected="true" />
<item android:drawable="@drawable/ui_write_btn_warning_unselect_android" android:state_selected="false" />
</selector>
Binary file added app/src/main/res/drawable-mdpi/group_525.png
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.
Binary file added app/src/main/res/drawable-mdpi/rectangle_243.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-mdpi/rectangle_244.png
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.
Binary file added app/src/main/res/drawable-xhdpi/group_525.png
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.
Binary file added app/src/main/res/drawable-xhdpi/rectangle_243.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-xhdpi/rectangle_244.png
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.
Binary file added app/src/main/res/drawable-xxhdpi/group_525.png
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.
Binary file added app/src/main/res/drawable-xxhdpi/rectangle_244.png
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.
Binary file added app/src/main/res/drawable-xxxhdpi/group_525.png
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.
Binary file added app/src/main/res/drawable-xxxhdpi/rectangle_244.png
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 app/src/main/res/drawable/btn_dialog_click.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/ui_write_btn_select_android" android:state_selected="true" />
<item android:drawable="@drawable/ui_write_btn_unselect_android" android:state_selected="false" />
</selector>
11 changes: 6 additions & 5 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white">

android:background="@color/white"
android:paddingTop="?attr/actionBarSize"
tools:context=".MainActivity">

<!--๊ทธ๋ฆผ์ž ์žˆ๋Š”๊ฑด png ํŒŒ์ผ๋กœ ๋‹ค์šด ๋ฐ›์•„์•ผ ํ•จ-->
<!--BottomNavigation ํฌ๊ธฐ๋Š” 430์œผ๋กœ ํ•˜๋ฉด ๋งž์ง€๋งŒ, ํ™”๋ฉด ํฌ๊ธฐ ๋ณ€๊ฒฝ ์‹œ ์ด์ƒํ•ด์งˆ ์ˆ˜ ์žˆ์Œ-->
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/nav_view"
android:layout_width="0dp"
android:layout_height="88dp"
android:layout_marginStart="0dp"
android:layout_marginEnd="0dp"
android:background="@drawable/rectangle_62"
android:background="@drawable/background_bottom_navigation"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
Expand All @@ -39,11 +39,12 @@
android:id="@+id/btn_write"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="50dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:src="@drawable/tabbar_ic_write"
android:layout_margin="40dp"
android:elevation="20dp"
android:scaleType="fitXY"
android:clickable="true"
android:focusable="true"
Expand Down
Loading

0 comments on commit 8c2953c

Please sign in to comment.