Skip to content

Commit 50345f4

Browse files
authored
1.2.0
1.2.0
2 parents 7e39336 + a41477c commit 50345f4

14 files changed

Lines changed: 265 additions & 144 deletions

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Sangle_Android
22

33
### **하루의 3분 생각나는 것을 글로 쓰기 프로젝트**
4-
<img src="https://img.shields.io/badge/Language-Kotlin-0095d5?style=flat-square&logo=kotlin&logoColor=white"> <img src="https://img.shields.io/badge/Release-v1.1.1-0095d5?style=flat-square&">
4+
<img src="https://img.shields.io/badge/Language-Kotlin-0095d5?style=flat-square&logo=kotlin&logoColor=white"> <img src="https://img.shields.io/badge/Release-v1.2.0-0095d5?style=flat-square&">
55

66
- 다운로드 받으러 가기 : [링크](https://play.google.com/store/apps/details?id=org.three.minutes)
77

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ android {
2525
applicationId "org.three.minutes"
2626
minSdkVersion 23
2727
targetSdkVersion 30
28-
versionCode 202108250
29-
versionName "1.1.2"
28+
versionCode 202109081
29+
versionName "1.2.0"
3030

3131
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
3232
}

app/src/main/java/org/three/minutes/home/ui/HomeActivity.kt

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ package org.three.minutes.home.ui
22

33
import android.annotation.SuppressLint
44
import android.app.Dialog
5+
import android.content.ActivityNotFoundException
56
import android.content.Intent
7+
import android.net.Uri
68
import androidx.appcompat.app.AppCompatActivity
79
import android.os.Bundle
810
import android.util.Log
@@ -19,6 +21,7 @@ import androidx.viewpager.widget.ViewPager
1921
import kotlinx.android.synthetic.main.activity_home.*
2022
import kotlinx.android.synthetic.main.home_navigation.view.*
2123
import kotlinx.coroutines.*
24+
import min.dev.singleclick.mingSingleClickListener
2225
import org.three.minutes.LogOutPopUp
2326
import org.three.minutes.R
2427
import org.three.minutes.ThreeApplication
@@ -55,6 +58,8 @@ class HomeActivity : AppCompatActivity(), CoroutineScope {
5558

5659
private val PROFILE_CODE = 100
5760

61+
private var closeTime: Long = 0
62+
5863
override fun onCreate(savedInstanceState: Bundle?) {
5964
super.onCreate(savedInstanceState)
6065
Log.e("Home", "HomeActivity onCreate()")
@@ -201,6 +206,11 @@ class HomeActivity : AppCompatActivity(), CoroutineScope {
201206
}
202207
startActivityForResult(intent,3000)
203208
}
209+
210+
// 생글 인스타그램 페이지로 이동
211+
mBinding.homeDrawer.navi_go_to_instagram.mingSingleClickListener {
212+
goToInstagram()
213+
}
204214
}
205215

206216

@@ -242,12 +252,32 @@ class HomeActivity : AppCompatActivity(), CoroutineScope {
242252
mBinding.swipe.isEnabled = isEnable
243253
}
244254

255+
private fun goToInstagram() {
256+
val instagramPageID = "sangle_official/"
257+
val uri = Uri.parse("https://instagram.com/_u/$instagramPageID")
258+
259+
val instagramIntent = Intent(Intent.ACTION_VIEW, uri).apply {
260+
`package` = "com.instagram.android"
261+
}
262+
263+
try {
264+
startActivity(instagramIntent)
265+
} catch(e: ActivityNotFoundException) {
266+
e.printStackTrace()
267+
startActivity(Intent(Intent.ACTION_VIEW, uri))
268+
}
269+
}
270+
245271
override fun onBackPressed() {
246272
if (mBinding.homeDrawer.isDrawerOpen(GravityCompat.START)) {
247273
mBinding.homeDrawer.closeDrawer(GravityCompat.START)
248274
} else {
249-
super.onBackPressed()
250-
ActivityCompat.finishAffinity(this)
275+
if (System.currentTimeMillis() <= closeTime + 2000) {
276+
ActivityCompat.finishAffinity(this)
277+
} else {
278+
showToast("'뒤로'버튼을 한번 더 누르시면 앱이 종료됩니다.")
279+
closeTime = System.currentTimeMillis()
280+
}
251281
}
252282
}
253283

app/src/main/java/org/three/minutes/home/ui/ProfileFragment.kt

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,14 @@ import androidx.databinding.DataBindingUtil
1010
import androidx.fragment.app.Fragment
1111
import androidx.fragment.app.activityViewModels
1212
import kotlinx.coroutines.*
13+
import min.dev.singleclick.mingSingleClickListener
1314
import org.three.minutes.R
1415
import org.three.minutes.databinding.FragmentProfileBinding
1516
import org.three.minutes.home.viewmodel.HomeViewModel
17+
import org.three.minutes.mypage.ui.MyPageActivity
1618
import org.three.minutes.singleton.PopUpObject
1719
import org.three.minutes.util.showToast
20+
import org.three.minutes.word.ui.WordActivity
1821
import org.three.minutes.writing.ui.WritingReadyActivity
1922
import kotlin.coroutines.CoroutineContext
2023

@@ -68,9 +71,44 @@ class ProfileFragment : Fragment(),CoroutineScope {
6871
}
6972
})
7073

74+
mViewModel.remaining.observe(viewLifecycleOwner) {
75+
it?.let { remainCount ->
76+
mBinding.txtMainTitle.text = when(remainCount) {
77+
3 -> {
78+
"글쓰기로\n구름이를 채워볼까요?"
79+
}
80+
2 -> {
81+
"구름이가 조금씩\n채워지기 시작했어요!"
82+
}
83+
1 -> {
84+
"오늘의 글쓰기,\n딱! 한 번 남았어요."
85+
}
86+
0 -> {
87+
"글쓰기 완료!\n다른 글도 둘러볼까요?"
88+
}
89+
else -> {
90+
""
91+
}
92+
}
93+
}
94+
}
95+
96+
setClickEvent()
7197
return mBinding.root
7298
}
7399

100+
private fun setClickEvent() {
101+
mBinding.layoutWritingTopic.mingSingleClickListener {
102+
val intent = Intent(mBinding.root.context, MyPageActivity::class.java)
103+
startActivity(intent)
104+
}
105+
106+
mBinding.txtGoToTopic.mingSingleClickListener {
107+
val intent = Intent(mBinding.root.context, WordActivity::class.java)
108+
startActivity(intent)
109+
}
110+
}
111+
74112
fun goToWriting(){
75113
if (mViewModel.remaining.value == 0){
76114
mContext.showToast("이런! 오늘 글감을 모두 썼어요!")

app/src/main/java/org/three/minutes/word/ui/WordFragment.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class WordFragment : Fragment() {
6565
rcvAdapter.setOnItemClickListener(object : PastWritingRcvAdapter.OnItemClickListener {
6666
override fun onItemClick(v: View, data: ResponseLastTopicData) {
6767
mViewModel.callPastDetailPopular(data.topic)
68-
mViewModel.filter.value = "최신순"
68+
mViewModel.filter.value = "인기순"
6969
wordActivity.replaceDetailFragment()
7070
}
7171
})

app/src/main/java/org/three/minutes/word/viewholder/SearchPastWritingViewHolder.kt

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,11 @@ class SearchPastWritingViewHolder (val binding : OtherWritingItemListBinding)
2525
binding.itemFavorite.text = data.likes.formatCount()
2626
binding.itemDateTxt.text = "${data.date} (${data.day}) ${data.time}"
2727
Glide.with(itemView).load(data.profileImg).into(binding.itemUserImg)
28-
binding.itemContents.setLines(10)
28+
binding.itemContents.maxLines = 10
2929
binding.itemFavorite.isChecked = data.liked
3030

3131
itemView.setOnClickListener {
3232
listener?.onPastSearchItemClick(itemView,data)
33-
34-
// val intent : Intent = if (data.myNickName == data.nickName){
35-
// Intent(itemView.context, DetailMyActivity::class.java)
36-
// } else{
37-
// Intent(itemView.context, DetailActivity::class.java)
38-
// }
39-
//
40-
// intent.putExtra("postIdx",data.postIdx)
41-
// itemView.context.startActivity(intent)
4233
}
4334
}
4435
}

app/src/main/java/org/three/minutes/word/viewholder/SearchResultViewHolder.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class SearchResultViewHolder(val binding : OtherWritingItemListBinding) : Recycl
2424
binding.itemFavorite.isChecked = data.liked
2525
binding.itemDateTxt.text = "${data.date} (${data.day}) ${data.time}"
2626
Glide.with(itemView).load(data.profileImg).into(binding.itemUserImg)
27-
binding.itemContents.setLines(3)
27+
binding.itemContents.maxLines = 7
2828

2929
itemView.setOnClickListener {
3030
listener?.onSearchTopicItemClick(itemView,data)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
android:width="44dp"
3+
android:height="44dp"
4+
android:viewportWidth="44"
5+
android:viewportHeight="44">
6+
<path
7+
android:pathData="M22,22m-22,0a22,22 0,1 1,44 0a22,22 0,1 1,-44 0"
8+
android:fillColor="#ECF4FF"/>
9+
<path
10+
android:pathData="M18.7839,32.8377L36.0698,12.2139L31.116,8.0618L13.83,28.6856L18.7839,32.8377Z"
11+
android:fillColor="#98F3FF"/>
12+
<path
13+
android:pathData="M13.8078,28.7347L10.9999,37.1262L18.7706,32.8855L13.8078,28.7347Z"
14+
android:fillColor="#ffffff"/>
15+
<path
16+
android:pathData="M12.8506,36.1171L11.0007,37.1261L11.6654,35.1256C11.6654,35.1256 12.5005,35.0261 12.8506,36.1171Z"
17+
android:fillColor="#282559"/>
18+
<path
19+
android:pathData="M16.8879,31.2509L34.1699,10.6318L32.9932,9.6456L15.7113,30.2647L16.8879,31.2509Z"
20+
android:fillColor="#57D7FF"/>
21+
</vector>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<shape xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:shape="rectangle">
4+
5+
<solid android:color="@color/light_gray"/>
6+
<corners android:radius="8dp"/>
7+
8+
</shape>

0 commit comments

Comments
 (0)