...
This commit is contained in:
parent
87ded0bda5
commit
0a77bd69d7
@ -109,6 +109,16 @@
|
||||
<action android:name="android.intent.action.APPLICATION_PREFERENCES" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".behavior.Behavior"
|
||||
android:label="@string/lunar_settings"
|
||||
android:launchMode="singleTask"
|
||||
android:excludeFromRecents="true"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.APPLICATION_PREFERENCES" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<service
|
||||
android:name=".feeds.rss.RssService"
|
||||
|
||||
143
app/src/main/kotlin/bums/lunatic/launcher/behavior/Behavior.kt
Normal file
143
app/src/main/kotlin/bums/lunatic/launcher/behavior/Behavior.kt
Normal file
@ -0,0 +1,143 @@
|
||||
package bums.lunatic.launcher.behavior
|
||||
|
||||
import android.content.Intent
|
||||
import android.graphics.Color
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.animation.AnimationUtils
|
||||
import android.widget.ImageView
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.view.WindowCompat
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import bums.lunatic.launcher.R
|
||||
import bums.lunatic.launcher.behavior.calendar.CalendarAdapter
|
||||
import bums.lunatic.launcher.behavior.calendar.CalendarBean
|
||||
import bums.lunatic.launcher.behavior.calendar.CalendarDateView
|
||||
import bums.lunatic.launcher.behavior.calendar.CalendarFactory.getMonthOfDayList
|
||||
import bums.lunatic.launcher.behavior.calendar.CalendarUtil
|
||||
import bums.lunatic.launcher.behavior.calendar.CalendarView
|
||||
import bums.lunatic.launcher.databinding.ItemCalendarBinding
|
||||
import com.google.android.material.appbar.AppBarLayout
|
||||
import java.util.Date
|
||||
import kotlin.math.abs
|
||||
|
||||
class Behavior: AppCompatActivity() {
|
||||
|
||||
private val sampleAdapter by lazy { SampleAdapter() }
|
||||
|
||||
private val getYMax by lazy {
|
||||
resources.getDimension(R.dimen.appbar_height) - resources.getDimension(
|
||||
R.dimen.toolbar_height
|
||||
)
|
||||
}
|
||||
|
||||
private val fadeIn by lazy { AnimationUtils.loadAnimation(this, R.anim.fade_in) }
|
||||
|
||||
private val fadeOut by lazy { AnimationUtils.loadAnimation(this, R.anim.fade_out) }
|
||||
val dateArr: IntArray = CalendarUtil.getYMD(Date())
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
WindowCompat.setDecorFitsSystemWindows(window, false)
|
||||
setContentView(R.layout.behavior)
|
||||
|
||||
|
||||
|
||||
initTopBarAnimation()
|
||||
initRecyclerView()
|
||||
loadSample()
|
||||
}
|
||||
|
||||
private fun initTopBarAnimation() {
|
||||
val appBarLayout = findViewById<AppBarLayout>(R.id.app_bar_layout)
|
||||
|
||||
val back = findViewById<ImageView>(R.id.iv_back)
|
||||
val del = findViewById<ImageView>(R.id.iv_del)
|
||||
val share = findViewById<ImageView>(R.id.iv_share)
|
||||
val cal = findViewById<RecyclerView>(R.id.calendarDateView)
|
||||
appBarLayout.addOnOffsetChangedListener(
|
||||
AppBarLayout.OnOffsetChangedListener { _, verticalOffset ->
|
||||
if (abs(verticalOffset) >= getYMax / 2) {
|
||||
if (back.visibility != View.GONE) {
|
||||
back.startAnimation(fadeOut)
|
||||
del.startAnimation(fadeOut)
|
||||
share.startAnimation(fadeOut)
|
||||
|
||||
back.visibility = View.GONE
|
||||
del.visibility = View.GONE
|
||||
share.visibility = View.GONE
|
||||
var lp = cal.layoutParams
|
||||
lp.height = resources.getDimension(R.dimen.toolbar_height).toInt()
|
||||
cal.layoutParams = lp
|
||||
}
|
||||
} else {
|
||||
if (back.visibility != View.VISIBLE) {
|
||||
back.startAnimation(fadeIn)
|
||||
del.startAnimation(fadeIn)
|
||||
share.startAnimation(fadeIn)
|
||||
|
||||
back.visibility = View.VISIBLE
|
||||
del.visibility = View.VISIBLE
|
||||
share.visibility = View.VISIBLE
|
||||
var lp = cal.layoutParams
|
||||
lp.height = resources.getDimension(R.dimen.appbar_height).toInt()
|
||||
cal.layoutParams = lp
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
private fun initRecyclerView() {
|
||||
with(findViewById<RecyclerView>(R.id.rv_main)) {
|
||||
adapter = sampleAdapter
|
||||
}
|
||||
with(findViewById<RecyclerView>(R.id.calendarDateView)) {
|
||||
adapter = CalAdapter().apply {
|
||||
items.clear()
|
||||
items.addAll(getMonthOfDayList(
|
||||
dateArr[0],
|
||||
dateArr[1]
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun loadSample() {
|
||||
sampleAdapter.notifySample()
|
||||
}
|
||||
}
|
||||
|
||||
class CalAdapter : RecyclerView.Adapter<CalAdapter.CalViewHolder>() {
|
||||
|
||||
val items = mutableListOf<CalendarBean>()
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = CalViewHolder(ItemCalendarBinding.inflate(LayoutInflater.from(parent.context)))
|
||||
|
||||
override fun onBindViewHolder(holder: CalViewHolder, position: Int) {
|
||||
holder.bind.day.apply {
|
||||
val bean = items[position]
|
||||
this.text = bean?.day.toString()
|
||||
if (bean?.monthFlag != 0) {
|
||||
this.setTextColor(Color.WHITE)
|
||||
} else {
|
||||
this.setTextColor(Color.BLACK)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun getItemCount() = items.size
|
||||
|
||||
// fun notifySample() {
|
||||
// items.clear()
|
||||
// (1..10).forEach {
|
||||
// items.add(it)
|
||||
// }
|
||||
// notifyDataSetChanged()
|
||||
// }
|
||||
|
||||
class CalViewHolder(val bind: ItemCalendarBinding) : RecyclerView.ViewHolder(bind.root)
|
||||
}
|
||||
@ -0,0 +1,31 @@
|
||||
package bums.lunatic.launcher.behavior
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import bums.lunatic.launcher.R
|
||||
|
||||
class SampleAdapter : RecyclerView.Adapter<SampleAdapter.SampleViewHolder>() {
|
||||
|
||||
private val items = mutableListOf<Int>()
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = SampleViewHolder(parent)
|
||||
|
||||
override fun onBindViewHolder(holder: SampleViewHolder, position: Int) {
|
||||
//..
|
||||
}
|
||||
|
||||
override fun getItemCount() = items.size
|
||||
|
||||
fun notifySample() {
|
||||
items.clear()
|
||||
(1..10).forEach {
|
||||
items.add(it)
|
||||
}
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
|
||||
class SampleViewHolder(parent: ViewGroup) : RecyclerView.ViewHolder(
|
||||
LayoutInflater.from(parent.context).inflate(R.layout.item_sample, parent, false),
|
||||
)
|
||||
}
|
||||
@ -0,0 +1,82 @@
|
||||
package bums.lunatic.launcher.behavior.behaviorimpl
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.util.DisplayMetrics
|
||||
import android.util.TypedValue
|
||||
import android.view.View
|
||||
import android.widget.TextView
|
||||
import androidx.annotation.NonNull
|
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
import bums.lunatic.launcher.R
|
||||
import com.google.android.material.appbar.AppBarLayout
|
||||
import kotlin.math.abs
|
||||
|
||||
|
||||
class BehaviorBlackJin(context: Context, attrs: AttributeSet?) :
|
||||
CoordinatorLayout.Behavior<TextView>(context, attrs) {
|
||||
private val mContext: Context = context
|
||||
|
||||
private val marginTop: Float
|
||||
private val marginTopAfter: Float
|
||||
|
||||
private val getYMax: Float =
|
||||
context.getResources().getDimension(R.dimen.appbar_height) - context.getResources()
|
||||
.getDimension(R.dimen.toolbar_height)
|
||||
|
||||
init {
|
||||
marginTop = dpToPx(getYMax / 4)
|
||||
marginTopAfter = dpToPx(getYMax / 8)
|
||||
}
|
||||
|
||||
override fun layoutDependsOn(
|
||||
@NonNull parent: CoordinatorLayout,
|
||||
@NonNull child: TextView,
|
||||
@NonNull dependency: View
|
||||
): Boolean {
|
||||
return dependency is AppBarLayout
|
||||
}
|
||||
|
||||
/**
|
||||
* dependency 의 View 의 변화가 있을때 이벤트가 들어옵니다.
|
||||
*/
|
||||
override fun onDependentViewChanged(
|
||||
@NonNull parent: CoordinatorLayout,
|
||||
@NonNull child: TextView,
|
||||
@NonNull dependency: View
|
||||
): Boolean {
|
||||
child.alpha = getRatioValue(
|
||||
1f, 0f,
|
||||
abs(dependency.y.toDouble()).toFloat(), getYMax
|
||||
)
|
||||
child.alpha = getRatioValue(
|
||||
1f, 0f,
|
||||
abs(dependency.y.toDouble()).toFloat(), getYMax
|
||||
)
|
||||
|
||||
child.x = (dependency.width / 2 - (child.width / 2)).toFloat()
|
||||
|
||||
child.y = getRatioValue(
|
||||
marginTop, marginTopAfter,
|
||||
abs(dependency.y.toDouble()).toFloat(), getYMax
|
||||
)
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
private fun dpToPx(dp: Float): Float {
|
||||
val dm: DisplayMetrics = mContext.getResources().getDisplayMetrics()
|
||||
return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, dm).toInt()
|
||||
.toFloat()
|
||||
}
|
||||
|
||||
private fun getRatioValue(
|
||||
firstValue: Float,
|
||||
lastValue: Float,
|
||||
getY: Float,
|
||||
getYMax: Float
|
||||
): Float {
|
||||
val temp = -(firstValue - lastValue) * getY / getYMax
|
||||
return firstValue + temp
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,84 @@
|
||||
package bums.lunatic.launcher.behavior.behaviorimpl
|
||||
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.util.DisplayMetrics
|
||||
import android.util.TypedValue
|
||||
import android.view.View
|
||||
import android.widget.TextView
|
||||
import androidx.annotation.NonNull
|
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
import bums.lunatic.launcher.R
|
||||
import com.google.android.material.appbar.AppBarLayout
|
||||
import kotlin.math.abs
|
||||
|
||||
|
||||
class BehaviorTistory(context: Context, attrs: AttributeSet?) :
|
||||
CoordinatorLayout.Behavior<TextView>(context, attrs) {
|
||||
private val mContext: Context = context
|
||||
|
||||
private val marginLeft: Float
|
||||
private val marginTop: Float
|
||||
private val marginTopAfter: Float
|
||||
|
||||
private val getYMax: Float =
|
||||
context.getResources().getDimension(R.dimen.appbar_height) - context.getResources()
|
||||
.getDimension(R.dimen.toolbar_height)
|
||||
|
||||
init {
|
||||
marginLeft = dpToPx(70f)
|
||||
marginTop = dpToPx(70f)
|
||||
marginTopAfter = dpToPx(53f)
|
||||
}
|
||||
|
||||
override fun layoutDependsOn(
|
||||
@NonNull parent: CoordinatorLayout,
|
||||
@NonNull child: TextView,
|
||||
@NonNull dependency: View
|
||||
): Boolean {
|
||||
return dependency is AppBarLayout
|
||||
}
|
||||
|
||||
/**
|
||||
* dependency 의 View 의 변화가 있을때 이벤트가 들어옵니다.
|
||||
*/
|
||||
override fun onDependentViewChanged(
|
||||
@NonNull parent: CoordinatorLayout,
|
||||
@NonNull child: TextView,
|
||||
@NonNull dependency: View
|
||||
): Boolean {
|
||||
child.scaleX = getRatioValue(
|
||||
1f, 0.8f,
|
||||
abs(dependency.y.toDouble()).toFloat(), getYMax
|
||||
)
|
||||
|
||||
child.x = getRatioValue(
|
||||
marginLeft, ((dependency.width - child.width) / 2).toFloat(),
|
||||
abs(dependency.y.toDouble()).toFloat(), getYMax
|
||||
)
|
||||
|
||||
child.y = getRatioValue(
|
||||
marginTop, marginTopAfter,
|
||||
abs(dependency.y.toDouble()).toFloat(), getYMax
|
||||
)
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
private fun dpToPx(dp: Float): Float {
|
||||
val dm: DisplayMetrics = mContext.getResources().getDisplayMetrics()
|
||||
return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, dm).toInt()
|
||||
.toFloat()
|
||||
}
|
||||
|
||||
private fun getRatioValue(
|
||||
firstValue: Float,
|
||||
lastValue: Float,
|
||||
getY: Float,
|
||||
getYMax: Float
|
||||
): Float {
|
||||
val temp = -(firstValue - lastValue) * getY / getYMax
|
||||
return firstValue + temp
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,91 @@
|
||||
package bums.lunatic.launcher.behavior.behaviorimpl
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.util.DisplayMetrics
|
||||
import android.util.TypedValue
|
||||
import android.view.View
|
||||
import android.widget.ImageView
|
||||
import androidx.annotation.NonNull
|
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
import bums.lunatic.launcher.R
|
||||
import com.google.android.material.appbar.AppBarLayout
|
||||
import kotlin.math.abs
|
||||
|
||||
|
||||
class BehaviorTopBall(context: Context, attrs: AttributeSet?) :
|
||||
CoordinatorLayout.Behavior<ImageView>(context, attrs) {
|
||||
private val mContext: Context = context
|
||||
|
||||
private val iconMarginLeft: Float
|
||||
private val iconMarginTop: Float
|
||||
private val iconMarginTopAfter: Float
|
||||
|
||||
private val getYMax: Float =
|
||||
context.getResources().getDimension(R.dimen.appbar_height) - context.getResources()
|
||||
.getDimension(R.dimen.toolbar_height)
|
||||
|
||||
init {
|
||||
iconMarginLeft = dpToPx(30f)
|
||||
iconMarginTop = dpToPx(72f)
|
||||
iconMarginTopAfter = dpToPx(20f)
|
||||
}
|
||||
|
||||
override fun layoutDependsOn(
|
||||
@NonNull parent: CoordinatorLayout,
|
||||
@NonNull child: ImageView,
|
||||
@NonNull dependency: View
|
||||
): Boolean {
|
||||
return dependency is AppBarLayout
|
||||
}
|
||||
|
||||
/**
|
||||
* dependency 의 View 의 변화가 있을때 이벤트가 들어옵니다.
|
||||
*/
|
||||
override fun onDependentViewChanged(
|
||||
@NonNull parent: CoordinatorLayout,
|
||||
@NonNull child: ImageView,
|
||||
@NonNull dependency: View
|
||||
): Boolean {
|
||||
// child icon scale [1 , 0.8]
|
||||
|
||||
child.scaleX = getRatioValue(
|
||||
1f, 0.8f,
|
||||
abs(dependency.y.toDouble()).toFloat(), getYMax
|
||||
)
|
||||
child.scaleY = getRatioValue(
|
||||
1f, 0.8f,
|
||||
abs(dependency.y.toDouble()).toFloat(), getYMax
|
||||
)
|
||||
|
||||
// child icon set x [iconMarginLeft , (dependency.getWidth() - child.getWidth())/2]
|
||||
child.x = getRatioValue(
|
||||
iconMarginLeft, ((dependency.width - child.width) / 2).toFloat(),
|
||||
abs(dependency.y.toDouble()).toFloat(), getYMax
|
||||
)
|
||||
|
||||
// child icon set y [iconMarginTop, iconMarginTopAfter]
|
||||
child.y = getRatioValue(
|
||||
iconMarginTop, iconMarginTopAfter,
|
||||
abs(dependency.y.toDouble()).toFloat(), getYMax
|
||||
)
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
private fun dpToPx(dp: Float): Float {
|
||||
val dm: DisplayMetrics = mContext.getResources().getDisplayMetrics()
|
||||
return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, dm).toInt()
|
||||
.toFloat()
|
||||
}
|
||||
|
||||
private fun getRatioValue(
|
||||
firstValue: Float,
|
||||
lastValue: Float,
|
||||
getY: Float,
|
||||
getYMax: Float
|
||||
): Float {
|
||||
val temp = -(firstValue - lastValue) * getY / getYMax
|
||||
return firstValue + temp
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
package bums.lunatic.launcher.behavior.calendar
|
||||
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
|
||||
|
||||
interface CalendarAdapter {
|
||||
fun getView(convertView: View?, parentView: ViewGroup?, bean: CalendarBean?): View
|
||||
// fun hasChildView() : Boolean
|
||||
}
|
||||
@ -0,0 +1,54 @@
|
||||
//package bums.lunatic.launcher.behavior.calendar;
|
||||
//
|
||||
//public class CalendarBean {
|
||||
// public int year;
|
||||
// public int month;
|
||||
// public int day;
|
||||
// public int week;
|
||||
//
|
||||
// //-1,0,1
|
||||
// public int monthFlag;
|
||||
//
|
||||
// //显示
|
||||
//
|
||||
// public CalendarBean(int year, int month, int day) {
|
||||
// this.year = year;
|
||||
// this.month = month;
|
||||
// this.day = day;
|
||||
// }
|
||||
//
|
||||
// public String getDisplayWeek(){
|
||||
// String s="";
|
||||
// switch(week){
|
||||
// case 1:
|
||||
// s="星期日";
|
||||
// break;
|
||||
// case 2:
|
||||
// s="星期一";
|
||||
// break;
|
||||
// case 3:
|
||||
// s="星期二";
|
||||
// break;
|
||||
// case 4:
|
||||
// s="星期三";
|
||||
// break;
|
||||
// case 5:
|
||||
// s="星期四";
|
||||
// break;
|
||||
// case 6:
|
||||
// s="星期五";
|
||||
// break;
|
||||
// case 7:
|
||||
// s="星期六";
|
||||
// break;
|
||||
//
|
||||
// }
|
||||
// return s ;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String toString() {
|
||||
// String s=year+"/"+month+"/"+day;
|
||||
// return s;
|
||||
// }
|
||||
//}
|
||||
@ -0,0 +1,29 @@
|
||||
package bums.lunatic.launcher.behavior.calendar
|
||||
|
||||
class CalendarBean //显示
|
||||
(var year: Int, var month: Int, var day: Int) {
|
||||
var week: Int = 0
|
||||
|
||||
//-1,0,1
|
||||
var monthFlag: Int = 0
|
||||
|
||||
val displayWeek: String
|
||||
get() {
|
||||
var s = ""
|
||||
when (week) {
|
||||
1 -> s = "星期日"
|
||||
2 -> s = "星期一"
|
||||
3 -> s = "星期二"
|
||||
4 -> s = "星期三"
|
||||
5 -> s = "星期四"
|
||||
6 -> s = "星期五"
|
||||
7 -> s = "星期六"
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
val s = "$year/$month/$day"
|
||||
return s
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,152 @@
|
||||
package bums.lunatic.launcher.behavior.calendar
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.viewpager.widget.PagerAdapter
|
||||
import androidx.viewpager.widget.ViewPager
|
||||
import bums.lunatic.launcher.R
|
||||
import bums.lunatic.launcher.behavior.calendar.CalendarFactory.getMonthOfDayList
|
||||
import com.example.accountbook.calendar.CalendarTopView
|
||||
import com.example.accountbook.calendar.CalendarTopViewChangeListener
|
||||
import java.util.Date
|
||||
import java.util.LinkedList
|
||||
|
||||
|
||||
class CalendarDateView(context: Context, attrs: AttributeSet?):
|
||||
ViewPager(context, attrs), CalendarTopView {
|
||||
var views = HashMap<Int, CalendarView>()
|
||||
private var mCaledarLayoutChangeListener: CalendarTopViewChangeListener? = null
|
||||
private var onItemClickListener: CalendarView.OnItemClickListener? = null
|
||||
private val cache: LinkedList<CalendarView?> = LinkedList<CalendarView?>()
|
||||
private val MAXCOUNT = 6
|
||||
private var row = 6
|
||||
|
||||
fun setCalrow(row : Int) {
|
||||
this.row = row
|
||||
}
|
||||
private var mAdapter: CalendarAdapter? = null
|
||||
override var itemHeight = 0
|
||||
private set
|
||||
|
||||
|
||||
fun setAdapter(adapter: CalendarAdapter?) {
|
||||
mAdapter = adapter
|
||||
initialize()
|
||||
initData()
|
||||
}
|
||||
|
||||
|
||||
fun reload() {
|
||||
Log.i(this@CalendarDateView.javaClass.simpleName , "reload()")
|
||||
sss.notifyDataSetChanged()
|
||||
}
|
||||
|
||||
fun setOnItemClickListener(onItemClickListener: CalendarView.OnItemClickListener?) {
|
||||
this.onItemClickListener = onItemClickListener
|
||||
}
|
||||
|
||||
init {
|
||||
val a = context.obtainStyledAttributes(attrs, R.styleable.CalendarDateView)
|
||||
row = a.getInteger(R.styleable.CalendarDateView_cbd_calendar_row, 6)
|
||||
a.recycle()
|
||||
|
||||
}
|
||||
|
||||
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
|
||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec)
|
||||
// var calendarHeight = 0
|
||||
if (adapter != null) {
|
||||
(getChildAt(0) as CalendarView)?.let {
|
||||
// calendarHeight = it.measuredHeight
|
||||
itemHeight = it.itemHeight
|
||||
}
|
||||
}
|
||||
setMeasuredDimension(
|
||||
widthMeasureSpec,
|
||||
MeasureSpec.makeMeasureSpec(heightMeasureSpec, MeasureSpec.EXACTLY)
|
||||
)
|
||||
}
|
||||
val dateArr: IntArray = CalendarUtil.getYMD(Date())
|
||||
var sss = object : PagerAdapter() {
|
||||
override fun getCount(): Int {
|
||||
// Log.i(this@CalendarDateView::class.java.simpleName, "container >>> setAdapter getCount")
|
||||
return Int.MAX_VALUE
|
||||
}
|
||||
|
||||
override fun isViewFromObject(view: View, `object`: Any): Boolean {
|
||||
return view === `object`
|
||||
}
|
||||
|
||||
override fun instantiateItem(container: ViewGroup, position: Int): Any {
|
||||
|
||||
Log.i(this@CalendarDateView::class.java.simpleName, "container >>> ${container} position >> ${position}")
|
||||
val view: CalendarView = if (!cache.isEmpty()) {
|
||||
cache.removeFirst()!!
|
||||
} else {
|
||||
CalendarView(container.context, row)
|
||||
}
|
||||
view.setOnItemClickListener(onItemClickListener)
|
||||
view.setAdapter(mAdapter)
|
||||
|
||||
container.addView(view)
|
||||
views[position] = view
|
||||
view.apply {
|
||||
setData(
|
||||
getMonthOfDayList(
|
||||
dateArr[0],
|
||||
dateArr[1] + position - Int.MAX_VALUE / 2
|
||||
), position == Int.MAX_VALUE / 2
|
||||
)
|
||||
}
|
||||
return view
|
||||
}
|
||||
|
||||
override fun destroyItem(container: ViewGroup, position: Int, `object`: Any) {
|
||||
Log.i(this@CalendarDateView.javaClass.simpleName , "destroyItem >>> position ${position}")
|
||||
container.removeView(`object` as View)
|
||||
cache.addLast(`object` as CalendarView)
|
||||
views.remove(position)
|
||||
}
|
||||
}
|
||||
|
||||
private fun initialize() {
|
||||
setAdapter(sss)
|
||||
addOnPageChangeListener(object: SimpleOnPageChangeListener() {
|
||||
override fun onPageSelected(position: Int) {
|
||||
super.onPageSelected(position)
|
||||
onItemClickListener?.let{
|
||||
views[position]?.let {v ->
|
||||
val obs: Array<Any> = v.select
|
||||
it.onItemClick(
|
||||
obs[0] as View,
|
||||
obs[1] as Int,
|
||||
obs[2] as CalendarBean
|
||||
)
|
||||
}
|
||||
}
|
||||
mCaledarLayoutChangeListener?.onLayoutChange(this@CalendarDateView)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private fun initData() {
|
||||
setCurrentItem(Int.MAX_VALUE / 2, false)
|
||||
adapter!!.notifyDataSetChanged()
|
||||
}
|
||||
|
||||
override val currentSelectPositon: IntArray
|
||||
get() {
|
||||
var view = views[currentItem]
|
||||
if (view == null) {
|
||||
view = getChildAt(0) as? CalendarView
|
||||
}
|
||||
return view?.getSelectPosition() ?: IntArray(4)
|
||||
}
|
||||
|
||||
override fun setCalendarTopViewChangeListener(listener: CalendarTopViewChangeListener?) {
|
||||
mCaledarLayoutChangeListener = listener
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,66 @@
|
||||
package bums.lunatic.launcher.behavior.calendar
|
||||
|
||||
import android.util.Log
|
||||
import bums.lunatic.launcher.behavior.calendar.CalendarUtil.getDayOfWeek
|
||||
import java.util.Calendar
|
||||
|
||||
|
||||
object CalendarFactory {
|
||||
private val cache = HashMap<String, List<CalendarBean>>()
|
||||
|
||||
fun getMonthOfDayList(y: Int, m: Int): List<CalendarBean> {
|
||||
Log.e("TIME CHECK" , "fun getMonthOfDayList Start")
|
||||
val key = y.toString() + "" + m
|
||||
if (cache.containsKey(key)) {
|
||||
val list = cache[key]
|
||||
if (list == null) {
|
||||
cache.remove(key)
|
||||
} else {
|
||||
return list
|
||||
}
|
||||
}
|
||||
val list: MutableList<CalendarBean> = ArrayList()
|
||||
cache[key] = list
|
||||
|
||||
val fweek: Int = getDayOfWeek(y, m, 1)
|
||||
val total: Int = CalendarUtil.getDayOfMaonth(y, m)
|
||||
|
||||
for (i in fweek - 1 downTo 1) {
|
||||
val bean = getCalendarBean(y, m, 1 - i)
|
||||
bean.monthFlag = -1
|
||||
list.add(bean)
|
||||
}
|
||||
|
||||
for (i in 0 until total) {
|
||||
val bean = getCalendarBean(y, m, i + 1)
|
||||
list.add(bean)
|
||||
}
|
||||
|
||||
for (i in 0 until 42 - (fweek - 1) - total) {
|
||||
val bean = getCalendarBean(y, m, total + i + 1)
|
||||
bean.monthFlag = 1
|
||||
list.add(bean)
|
||||
}
|
||||
Log.e("TIME CHECK" , "fun getMonthOfDayList END")
|
||||
return list
|
||||
}
|
||||
|
||||
fun getCalendarBean(year: Int, month: Int, day: Int): CalendarBean {
|
||||
|
||||
val calendar: Calendar = Calendar.getInstance()
|
||||
.apply { this.set(year, month - 1, day) }
|
||||
val year = calendar.get(Calendar.YEAR)
|
||||
val month = calendar.get(Calendar.MONTH) + 1
|
||||
val day = calendar.get(Calendar.DATE)
|
||||
val bean = CalendarBean(year, month, day)
|
||||
bean.week = CalendarUtil.getDayOfWeek(year, month, day)
|
||||
// val chinaDate: Array<String> = ChinaDate.getChinaDate(year, month, day)
|
||||
// bean.chinaMonth = chinaDate[0]
|
||||
// bean.chinaDay = chinaDate[1]
|
||||
return bean
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun main(args: Array<String>) {
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
package com.example.accountbook.calendar
|
||||
|
||||
|
||||
interface CalendarTopView {
|
||||
val currentSelectPositon: IntArray?
|
||||
val itemHeight: Int
|
||||
|
||||
fun setCalendarTopViewChangeListener(listener: CalendarTopViewChangeListener?)
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
package com.example.accountbook.calendar
|
||||
|
||||
interface CalendarTopViewChangeListener {
|
||||
fun onLayoutChange(topView: CalendarTopView) {
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,37 @@
|
||||
package bums.lunatic.launcher.behavior.calendar
|
||||
|
||||
import java.util.Calendar
|
||||
import java.util.Date
|
||||
|
||||
|
||||
object CalendarUtil {
|
||||
fun getDayOfWeek(y: Int, m: Int, day: Int): Int {
|
||||
val calendar: Calendar = Calendar.getInstance()
|
||||
calendar.set(y, m - 1, day)
|
||||
return calendar.get(Calendar.DAY_OF_WEEK)
|
||||
}
|
||||
|
||||
//获取一月最大天数
|
||||
fun getDayOfMaonth(y: Int, m: Int): Int {
|
||||
val cal: Calendar = Calendar.getInstance()
|
||||
cal.set(y, m - 1, 1)
|
||||
return cal.getActualMaximum(Calendar.DATE)
|
||||
}
|
||||
|
||||
fun getMothOfMonth(y: Int, m: Int): Int {
|
||||
val cal: Calendar = Calendar.getInstance()
|
||||
cal.set(y, m - 1, 1)
|
||||
val dateOfMonth: Int = cal.get(Calendar.MONTH)
|
||||
return dateOfMonth + 1
|
||||
}
|
||||
|
||||
fun getYMD(date: Date?): IntArray {
|
||||
val cal: Calendar = Calendar.getInstance()
|
||||
date?.let { cal.setTime(it) }
|
||||
return intArrayOf(
|
||||
cal.get(Calendar.YEAR),
|
||||
cal.get(Calendar.MONTH) + 1,
|
||||
cal.get(Calendar.DATE)
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,201 @@
|
||||
package bums.lunatic.launcher.behavior.calendar
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Rect
|
||||
import android.util.AttributeSet
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import bums.lunatic.launcher.behavior.calendar.CalendarUtil.getYMD
|
||||
|
||||
import java.util.Date
|
||||
|
||||
|
||||
class CalendarView : ViewGroup {
|
||||
private var selectPosition = -1
|
||||
private var adapter: CalendarAdapter? = null
|
||||
private var data: List<CalendarBean>? = null
|
||||
private var onItemClickListener: OnItemClickListener? = null
|
||||
private var row = 6
|
||||
private val column = 7
|
||||
private var itemWidth = 0
|
||||
var itemHeight = 0
|
||||
private set
|
||||
private var isToday = false
|
||||
|
||||
interface OnItemClickListener {
|
||||
fun onItemClick(view: View?, position: Int, bean: CalendarBean?)
|
||||
}
|
||||
|
||||
constructor(context: Context?, row: Int) : super(context) {
|
||||
this.row = row
|
||||
}
|
||||
|
||||
fun setOnItemClickListener(onItemClickListener: OnItemClickListener?) {
|
||||
this.onItemClickListener = onItemClickListener
|
||||
}
|
||||
|
||||
constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs) {
|
||||
setWillNotDraw(false)
|
||||
}
|
||||
|
||||
fun setAdapter(adapter: CalendarAdapter?) {
|
||||
this.adapter = adapter
|
||||
}
|
||||
fun setCalrow(row : Int) {
|
||||
if (this.row != row) {
|
||||
this.row = row
|
||||
removeAllViews()
|
||||
}
|
||||
}
|
||||
fun setData(data: List<CalendarBean>?, isToday: Boolean) {
|
||||
this.data = data
|
||||
this.isToday = isToday
|
||||
setItem()
|
||||
requestLayout()
|
||||
}
|
||||
|
||||
private fun setItem() {
|
||||
selectPosition = -1
|
||||
if (adapter == null) {
|
||||
throw RuntimeException("adapter is null,please setadapter")
|
||||
}
|
||||
Log.i("data >>> ","data ${data}")
|
||||
for (i in data!!.indices) {
|
||||
val bean = data!![i]
|
||||
val chidView: View? = adapter?.getView(
|
||||
getChildAt(i).also { v -> Log.i("data >>> ", "view $v") },
|
||||
this,
|
||||
bean
|
||||
).also { v -> Log.i("data >>> ", "chidView $v") }
|
||||
if (chidView != null && chidView != getChildAt(i)) {
|
||||
addViewInLayout(chidView, i, chidView.layoutParams, true)
|
||||
}
|
||||
if (isToday && selectPosition == -1) {
|
||||
val date = getYMD(Date())
|
||||
if (bean.year == date[0] && bean.month == date[1] && bean.day == date[2]) {
|
||||
selectPosition = i
|
||||
}
|
||||
} else {
|
||||
if (selectPosition == -1 && bean.day == 1) {
|
||||
selectPosition = i
|
||||
}
|
||||
}
|
||||
chidView?.isSelected = selectPosition == i
|
||||
setItemClick(chidView, i, bean)
|
||||
}
|
||||
}
|
||||
|
||||
val select: Array<Any>
|
||||
get() = arrayOf(
|
||||
getChildAt(selectPosition), selectPosition,
|
||||
data!![selectPosition]
|
||||
)
|
||||
|
||||
fun setItemClick(view: View?, potsion: Int, bean: CalendarBean?) {
|
||||
view?.setOnClickListener {
|
||||
if (selectPosition != -1) {
|
||||
getChildAt(selectPosition).isSelected = false
|
||||
getChildAt(potsion).isSelected = true
|
||||
}
|
||||
selectPosition = potsion
|
||||
if (onItemClickListener != null) {
|
||||
onItemClickListener!!.onItemClick(view, potsion, bean)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun getSelectPosition(): IntArray {
|
||||
val rect = Rect()
|
||||
try {
|
||||
getChildAt(selectPosition).getHitRect(rect)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
return intArrayOf(rect.left, rect.top, rect.right, rect.top)
|
||||
}
|
||||
|
||||
|
||||
var lastwidthMeasureSpec = 0
|
||||
var lastheightMeasureSpec = 0
|
||||
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
|
||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec)
|
||||
Log.e(this.javaClass::class.java.simpleName , "this count check ${this}")
|
||||
if (widthMeasureSpec != lastwidthMeasureSpec || heightMeasureSpec != lastheightMeasureSpec) {
|
||||
val parentWidth =
|
||||
MeasureSpec.getSize(
|
||||
MeasureSpec.makeMeasureSpec(
|
||||
widthMeasureSpec,
|
||||
MeasureSpec.EXACTLY
|
||||
)
|
||||
)
|
||||
val parentH =
|
||||
MeasureSpec.getSize(
|
||||
MeasureSpec.makeMeasureSpec(
|
||||
heightMeasureSpec,
|
||||
MeasureSpec.EXACTLY
|
||||
)
|
||||
)
|
||||
itemWidth = parentWidth / column
|
||||
itemHeight = parentH / row
|
||||
// itemWidth
|
||||
val view = getChildAt(0) ?: return
|
||||
val params = view.layoutParams
|
||||
if (params != null && params.height > 0) {
|
||||
itemHeight = params.height
|
||||
}
|
||||
setMeasuredDimension(parentWidth, itemHeight * row)
|
||||
if (childCount.equals(row*column))
|
||||
for (i in 0 until childCount) {
|
||||
val childView = getChildAt(i)
|
||||
childView.measure(
|
||||
MeasureSpec.makeMeasureSpec(itemWidth, MeasureSpec.EXACTLY),
|
||||
MeasureSpec.makeMeasureSpec(itemHeight, MeasureSpec.EXACTLY)
|
||||
)
|
||||
}
|
||||
}
|
||||
Log.i(
|
||||
TAG,
|
||||
"onMeasure() called with: itemHeight = [$itemHeight], itemWidth = [$itemWidth]"
|
||||
)
|
||||
lastwidthMeasureSpec = widthMeasureSpec
|
||||
lastheightMeasureSpec = heightMeasureSpec
|
||||
}
|
||||
|
||||
override fun onLayout(changed: Boolean, l: Int, t: Int, r: Int, b: Int) {
|
||||
if (changed && childCount.equals(row*column))
|
||||
for (i in 0 until childCount) {
|
||||
layoutChild(getChildAt(i), i, l, t, r, b)
|
||||
}
|
||||
}
|
||||
|
||||
override fun addViewInLayout(
|
||||
child: View?,
|
||||
index: Int,
|
||||
params: LayoutParams?,
|
||||
preventRequestLayout: Boolean
|
||||
): Boolean {
|
||||
Log.d("CalendarView, time","time")
|
||||
return super.addViewInLayout(child, index, params, preventRequestLayout)
|
||||
}
|
||||
|
||||
private fun layoutChild(view: View, position: Int, l: Int, t: Int, r: Int, b: Int) {
|
||||
var l = l
|
||||
var t = t
|
||||
var r = r
|
||||
var b = b
|
||||
val cc = position % column
|
||||
val cr = position / column
|
||||
val itemWidth = view.measuredWidth
|
||||
val itemHeight = view.measuredHeight
|
||||
l = cc * itemWidth
|
||||
t = cr * itemHeight
|
||||
r = l + itemWidth
|
||||
b = t + itemHeight
|
||||
view.layout(l, t, r, b)
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val TAG = "CalendarView"
|
||||
}
|
||||
}
|
||||
@ -267,10 +267,10 @@ internal class Feeds : Fragment() , CommadCallabck {
|
||||
// consoleLog("${cmd[0]} END ${cmd[1]}")
|
||||
// }
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
consoleLog("on Cmd JF with SO")
|
||||
consoleLog("on Cmd JF with MOST")
|
||||
consoleLog("${cmd[0]} Start ${cmd[1]}")
|
||||
String.format(String(Base64.getMimeDecoder().decode("aHR0cHM6Ly9rcjcwLnNvZ2lybC5zby8/cz0lcw==".toByteArray())),cmd[1]).getJ().let { doc -> FeedParseManager.parse(doc){consoleLog(it)} }
|
||||
consoleLog("current j req() ${WorkersDb.getRealm().query<RssData>("category == $0", RssDataType.GURU.name).find().size}")
|
||||
consoleLog("current j req() ${WorkersDb.getRealm().query<RssData>("category == $0", RssDataType.MOST.name).find().size}")
|
||||
consoleLog("${cmd[0]} END ${cmd[1]}")
|
||||
}
|
||||
}
|
||||
|
||||
@ -56,6 +56,7 @@ import androidx.recyclerview.widget.RecyclerView
|
||||
import androidx.viewpager2.widget.ViewPager2
|
||||
import bums.lunatic.launcher.LauncherActivity.Companion.lActivity
|
||||
import bums.lunatic.launcher.R
|
||||
import bums.lunatic.launcher.behavior.Behavior
|
||||
import bums.lunatic.launcher.databinding.LauncherHomeBinding
|
||||
import bums.lunatic.launcher.helpers.Constants.Companion.BOTTOM_SHEET_TAG
|
||||
import bums.lunatic.launcher.helpers.Constants.Companion.KEY_LOCK_METHOD
|
||||
@ -162,7 +163,6 @@ internal class LauncherHome : Fragment() {
|
||||
|
||||
|
||||
val infoUpdate = Runnable {
|
||||
BLog.LOGE("swipeToDeleteCallback data called infoUpdate ")
|
||||
chooseAdpater()
|
||||
}
|
||||
|
||||
@ -198,11 +198,8 @@ internal class LauncherHome : Fragment() {
|
||||
|
||||
var weatherPages = arrayListOf<Int>()
|
||||
var weatherAdapter = arrayListOf<RecyclerView.Adapter<out RecyclerView.ViewHolder>?>()
|
||||
PrefBoolean.weatherDress.get(false).letTrue {
|
||||
weatherPages.add(R.layout.hourly_weather)
|
||||
weatherAdapter.add(weatherDressAdapter!!)}
|
||||
PrefBoolean.weatherState.get(false).letTrue { weatherPages.add(R.layout.recommended_hourly_dress)
|
||||
weatherAdapter.add(weatherHourlyAdapter!!)}
|
||||
PrefBoolean.weatherDress.get(false).letTrue { weatherPages.add(R.layout.hourly_weather); weatherAdapter.add(weatherDressAdapter!!)}
|
||||
PrefBoolean.weatherState.get(false).letTrue { weatherPages.add(R.layout.recommended_hourly_dress); weatherAdapter.add(weatherHourlyAdapter!!)}
|
||||
if (weatherPages.size > 0) {
|
||||
mWeatherAdapter = WeatherAdapter(
|
||||
weatherPages,
|
||||
@ -213,11 +210,6 @@ internal class LauncherHome : Fragment() {
|
||||
} else {
|
||||
binding.noticeSummary.root.visibility = View.GONE
|
||||
}
|
||||
// mWeatherAdapter = WeatherAdapter(arrayListOf(),binding.noticeSummary)
|
||||
// WorkersDb.getRealm().query<WeatherForcast>().first().find()?.forecast?.let {
|
||||
// mWeatherAdapter?.update(it.forecastday)
|
||||
// BLog.LOGE("saved weatherForcast >>> ${it.forecastday}")
|
||||
// }
|
||||
|
||||
val decoration = DividerItemDecoration(requireContext(), DividerItemDecoration.VERTICAL)
|
||||
|
||||
@ -543,11 +535,12 @@ internal class LauncherHome : Fragment() {
|
||||
}
|
||||
infosJob?.start()
|
||||
}
|
||||
|
||||
var rssStateVote = false
|
||||
fun queryVotes() {
|
||||
beforeQuery()
|
||||
var rQ = WorkersDb.getRealm().query<RssData>().query("vote == $0",true)
|
||||
updateQuery(rQ)
|
||||
rssStateVote = true
|
||||
}
|
||||
|
||||
fun queryInfos(filter: Collection<RssDataType>? = arrayListOf(RssDataType.GURU,RssDataType.MOST,RssDataType.REDDIT_NSFW), noLimit : Boolean = false) {
|
||||
@ -559,6 +552,7 @@ internal class LauncherHome : Fragment() {
|
||||
}
|
||||
|
||||
updateQuery(rQ)
|
||||
rssStateVote = false
|
||||
}
|
||||
|
||||
fun queryInfos(keyword : String, category : ArrayList<String> = arrayListOf(), noLimit : Boolean = false) {
|
||||
@ -600,6 +594,7 @@ internal class LauncherHome : Fragment() {
|
||||
rQ = rQ.query(queryString)
|
||||
}
|
||||
updateQuery(rQ)
|
||||
rssStateVote = false
|
||||
}
|
||||
|
||||
var infosJob : Job? = null
|
||||
@ -676,8 +671,11 @@ internal class LauncherHome : Fragment() {
|
||||
}
|
||||
binding.otherCheck -> {
|
||||
if (binding.otherCheck.isSelected ) {
|
||||
if (rssStateVote) {
|
||||
queryInfos()
|
||||
} else {
|
||||
binding.otherCheck.isSelected = false
|
||||
|
||||
}
|
||||
} else {
|
||||
queryInfos()
|
||||
binding.otherCheck.isSelected = true
|
||||
@ -850,22 +848,19 @@ internal class LauncherHome : Fragment() {
|
||||
private fun enableSwipeToDeleteAndUndo() {
|
||||
val swipeToDeleteCallback: SwipeToDeleteCallback = object : SwipeToDeleteCallback(requireContext()) {
|
||||
override fun onSwiped(@NonNull viewHolder: RecyclerView.ViewHolder, i: Int) {
|
||||
BLog.LOGE("swipeToDeleteCallback start")
|
||||
(viewHolder.itemView.getTag() as? RssData)?.let { rss ->
|
||||
WorkersDb.getRealm().apply {
|
||||
writeBlocking {
|
||||
if (rss.vote) {
|
||||
if (rssStateVote && rss.vote) {
|
||||
rss.vote = false
|
||||
rss.read = 0
|
||||
} else {
|
||||
rss.read += nomoreShowCount
|
||||
}
|
||||
copyToRealm(rss, UpdatePolicy.ALL)
|
||||
BLog.LOGE("swipeToDeleteCallback data update ")
|
||||
}
|
||||
}
|
||||
}
|
||||
BLog.LOGE("swipeToDeleteCallback endEvent")
|
||||
}
|
||||
}
|
||||
|
||||
@ -916,6 +911,9 @@ internal class LauncherHome : Fragment() {
|
||||
gestureDistance: Double
|
||||
): Boolean {
|
||||
when(fingers) {
|
||||
4->{
|
||||
lActivity!!.startActivity(Intent(requireContext(), Behavior::class.java))
|
||||
}
|
||||
3 -> QuickAccess().show(fragManager, BOTTOM_SHEET_TAG)
|
||||
2->{
|
||||
var startIntene = Intent(Intent.ACTION_MAIN)
|
||||
|
||||
@ -158,8 +158,6 @@ internal class RssItemAdapter (
|
||||
|
||||
fun updateData(newList: List<RssDataInterface>) {
|
||||
try {
|
||||
BLog.LOGE("swipeToDeleteCallback data called updateData ${newList} ")
|
||||
// BLog.LOGE("newList >> ${newList}")
|
||||
DiffUtil.calculateDiff(RssItemDiffUtil(rssDataItemLis, newList)).apply {
|
||||
|
||||
}.dispatchUpdatesTo(this).apply {
|
||||
|
||||
@ -27,7 +27,7 @@ abstract class SwipeToDeleteCallback internal constructor(context: Context) :
|
||||
|
||||
|
||||
init {
|
||||
mClearPaint.setXfermode(PorterDuffXfermode(PorterDuff.Mode.CLEAR))
|
||||
mClearPaint.setXfermode(PorterDuffXfermode(PorterDuff.Mode.DARKEN))
|
||||
deleteDrawable = ContextCompat.getDrawable(mContext, R.drawable.ic_delete)
|
||||
intrinsicWidth = deleteDrawable!!.intrinsicWidth
|
||||
intrinsicHeight = deleteDrawable.intrinsicHeight
|
||||
|
||||
@ -16,6 +16,7 @@ import android.text.style.ClickableSpan
|
||||
import android.util.AttributeSet
|
||||
import android.view.View
|
||||
import androidx.appcompat.widget.AppCompatTextView
|
||||
import bums.lunatic.launcher.R
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Date
|
||||
|
||||
@ -77,12 +78,12 @@ class DateTimeView : AppCompatTextView {
|
||||
}
|
||||
|
||||
spannableBuilder.append(time)
|
||||
spannableBuilder.setSpan(AbsoluteSizeSpan(48,true), 0, time.length , Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
|
||||
spannableBuilder.setSpan(AbsoluteSizeSpan(resources.getDimensionPixelSize(R.dimen._26sp),false), 0, time.length , Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
|
||||
spannableBuilder.setSpan(mClickableSpan, 0, time.length , Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
|
||||
spannableBuilder.append("\n")
|
||||
spannableBuilder.append(date)
|
||||
var start = time.length + "\n".length
|
||||
spannableBuilder.setSpan(AbsoluteSizeSpan(30,true), start , start+date.length , Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
|
||||
spannableBuilder.setSpan(AbsoluteSizeSpan(resources.getDimensionPixelSize(R.dimen._20sp),false), start , start+date.length , Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
|
||||
spannableBuilder.setSpan(mClickableSpan2, start , start+date.length , Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
|
||||
mHandler.removeCallbacks(runable)
|
||||
setText(spannableBuilder)
|
||||
|
||||
6
app/src/main/res/anim/fade_in.xml
Normal file
6
app/src/main/res/anim/fade_in.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<alpha xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:duration="@android:integer/config_longAnimTime"
|
||||
android:fromAlpha="0.0"
|
||||
android:interpolator="@android:anim/accelerate_interpolator"
|
||||
android:toAlpha="1.0" />
|
||||
6
app/src/main/res/anim/fade_out.xml
Normal file
6
app/src/main/res/anim/fade_out.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<alpha xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:duration="@android:integer/config_longAnimTime"
|
||||
android:fromAlpha="1.0"
|
||||
android:interpolator="@android:anim/accelerate_interpolator"
|
||||
android:toAlpha="0.0" />
|
||||
9
app/src/main/res/drawable/bg_list_main.xml
Normal file
9
app/src/main/res/drawable/bg_list_main.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<corners android:topLeftRadius="30dp" />
|
||||
|
||||
<solid android:color="#fff" />
|
||||
|
||||
</shape>
|
||||
11
app/src/main/res/drawable/drawable_ball.xml
Normal file
11
app/src/main/res/drawable/drawable_ball.xml
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="oval">
|
||||
|
||||
<size
|
||||
android:width="30dp"
|
||||
android:height="30dp" />
|
||||
|
||||
<solid android:color="@color/purple_500" />
|
||||
|
||||
</shape>
|
||||
@ -14,7 +14,7 @@
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_width="0dp"
|
||||
android:layout_margin="10dp"
|
||||
android:layout_margin="@dimen/default_layout_margin"
|
||||
android:layout_height="0dp">
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:orientation="vertical"
|
||||
@ -207,7 +207,7 @@
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:background="@drawable/base_bg"
|
||||
android:layout_margin="10dp"
|
||||
android:layout_margin="@dimen/default_layout_margin"
|
||||
android:id="@+id/searchInput"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="50dp"
|
||||
|
||||
117
app/src/main/res/layout/behavior.xml
Normal file
117
app/src/main/res/layout/behavior.xml
Normal file
@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
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:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#ffbe00"
|
||||
android:fitsSystemWindows="true"
|
||||
tools:context=".behavior.Behavior">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/app_bar_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/appbar_height"
|
||||
app:elevation="0dp">
|
||||
|
||||
<com.google.android.material.appbar.CollapsingToolbarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#ffbe00"
|
||||
app:layout_scrollFlags="scroll|exitUntilCollapsed">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/toolbar_height"
|
||||
app:contentInsetStart="0dp"
|
||||
app:layout_collapseMode="pin">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_back"
|
||||
android:layout_width="25dp"
|
||||
android:layout_height="25dp"
|
||||
android:layout_margin="15dp"
|
||||
android:src="@drawable/ic_up" />
|
||||
|
||||
<Space
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_del"
|
||||
android:layout_width="25dp"
|
||||
android:layout_height="25dp"
|
||||
android:layout_margin="15dp"
|
||||
android:src="@drawable/ic_delete" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_share"
|
||||
android:layout_width="25dp"
|
||||
android:layout_height="25dp"
|
||||
android:layout_margin="15dp"
|
||||
android:src="@drawable/ic_link" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.appcompat.widget.Toolbar>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:layout_gravity="bottom|center_horizontal"
|
||||
android:id="@+id/calendarDateView"
|
||||
android:background="#ddd000"
|
||||
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
|
||||
android:orientation="vertical"
|
||||
app:spanCount="7"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
</com.google.android.material.appbar.CollapsingToolbarLayout>
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/bg_list_main"
|
||||
android:clipToPadding="false"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginTop="5dp"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||
tools:listitem="@layout/item_sample" />
|
||||
|
||||
<!-- ball -->
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/drawable_ball"
|
||||
app:layout_behavior="bums.lunatic.launcher.behavior.behaviorimpl.BehaviorTopBall" />
|
||||
|
||||
<!-- blackjin -->
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="BlackJin"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="45sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_behavior="bums.lunatic.launcher.behavior.behaviorimpl.BehaviorBlackJin" />
|
||||
|
||||
<!-- tistory -->
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Tistory"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="22sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_behavior="bums.lunatic.launcher.behavior.behaviorimpl.BehaviorTistory" />
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
@ -12,7 +12,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:singleSelection="true"
|
||||
android:layout_margin="10dp"
|
||||
android:layout_margin="@dimen/default_layout_margin"
|
||||
>
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/expandRss"
|
||||
@ -43,7 +43,7 @@
|
||||
android:id="@+id/explayer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="10dp">
|
||||
android:layout_margin="@dimen/default_layout_margin">
|
||||
<include
|
||||
android:id="@+id/feedsRss"
|
||||
android:background="@drawable/base_bg"
|
||||
@ -60,7 +60,7 @@
|
||||
|
||||
<ScrollView
|
||||
app:layout_constraintTop_toBottomOf="@id/explayer"
|
||||
android:layout_margin="10dp"
|
||||
android:layout_margin="@dimen/default_layout_margin"
|
||||
android:background="@drawable/base_bg"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
|
||||
54
app/src/main/res/layout/item_calendar.xml
Normal file
54
app/src/main/res/layout/item_calendar.xml
Normal file
@ -0,0 +1,54 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
<TextView
|
||||
android:id="@+id/day"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="날짜"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_plus"
|
||||
android:layout_width="10dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="+"
|
||||
android:textColor="#ff0000"
|
||||
app:layout_constraintTop_toBottomOf="@id/day"
|
||||
app:layout_constraintStart_toStartOf="parent"/>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="당일소득"
|
||||
android:textColor="#ff0000"
|
||||
app:layout_constraintTop_toTopOf="@id/text_plus"
|
||||
app:layout_constraintStart_toEndOf="@id/text_plus"
|
||||
app:layout_constraintBottom_toBottomOf="@id/text_plus"/>
|
||||
<TextView
|
||||
android:id="@+id/text_minus"
|
||||
android:layout_width="10dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="-"
|
||||
android:textColor="#0000ff"
|
||||
app:layout_constraintTop_toBottomOf="@id/text_plus"
|
||||
app:layout_constraintStart_toStartOf="parent"/>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="당일지출"
|
||||
android:textColor="#0000ff"
|
||||
app:layout_constraintTop_toTopOf="@id/text_minus"
|
||||
app:layout_constraintStart_toEndOf="@id/text_minus"
|
||||
app:layout_constraintBottom_toBottomOf="@id/text_minus"/>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@ -3,55 +3,75 @@
|
||||
<data>
|
||||
<variable name="info" type="bums.lunatic.launcher.model.ShowingWeatherInfo"/>
|
||||
</data>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="80dp"
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="vertical"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center">
|
||||
|
||||
<TextView
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
style="@style/normal"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/amOrPm"
|
||||
android:gravity="center"
|
||||
android:text="@{info.amOrPm}"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
android:textSize="14sp" />
|
||||
/>
|
||||
|
||||
<TextView
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/amOrPm"
|
||||
style="@style/normal"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/hour"
|
||||
android:background="@drawable/date_bg"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
android:gravity="center"
|
||||
android:textSize="14sp"
|
||||
android:text="@{info.textHour}"
|
||||
android:textAlignment="center"/>
|
||||
<ImageView
|
||||
android:padding="8dp"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/hour"
|
||||
android:id="@+id/imgWeather"
|
||||
android:layout_width="40dp"
|
||||
android:layout_width="70dp"
|
||||
android:scaleType="fitCenter"
|
||||
android:adjustViewBounds="true"
|
||||
android:src="@drawable/level_dress_img"
|
||||
android:layout_height="40dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="온도별 옷차림"
|
||||
app:tint="@android:color/white"/>
|
||||
<TextView
|
||||
app:layout_constraintBottom_toBottomOf="@id/imgWeather"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
android:includeFontPadding="false"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/textDress"
|
||||
android:fontFamily="sans-serif-light"
|
||||
android:textSize="11sp"
|
||||
style="@style/small"
|
||||
android:text="@{info.textCondition}"
|
||||
android:gravity="center"
|
||||
android:textAlignment="center"/>
|
||||
<TextView
|
||||
app:layout_constraintTop_toBottomOf="@id/textDress"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
style="@style/normal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/temperature"
|
||||
android:textColor="@android:color/white"
|
||||
android:text="@{info.temp}"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
android:textSize="14sp"
|
||||
|
||||
android:gravity="center"
|
||||
android:textAlignment="center"/>
|
||||
</LinearLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</layout>
|
||||
@ -12,21 +12,24 @@
|
||||
android:id="@+id/weather_item">
|
||||
|
||||
<TextView
|
||||
style="@style/normal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/amOrPm"
|
||||
android:gravity="center"
|
||||
android:text="@{info.amOrPm}"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
android:textSize="14sp" />
|
||||
|
||||
/>
|
||||
<TextView
|
||||
style="@style/normal"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/hour"
|
||||
android:background="@drawable/date_bg"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
android:gravity="center"
|
||||
android:textSize="14sp"
|
||||
|
||||
android:text="@{info.textHour}"
|
||||
android:textAlignment="center"/>
|
||||
<ImageView
|
||||
@ -40,18 +43,18 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/textDress"
|
||||
android:fontFamily="sans-serif-light"
|
||||
android:textSize="11sp"
|
||||
style="@style/small"
|
||||
android:text="@{info.dress}"
|
||||
android:gravity="center"
|
||||
android:textAlignment="center"/>
|
||||
<TextView
|
||||
style="@style/normal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/temperature"
|
||||
android:textColor="@android:color/white"
|
||||
android:text="@{info.temp}"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
android:textSize="14sp"
|
||||
android:gravity="center"
|
||||
android:textAlignment="center"/>
|
||||
</LinearLayout>
|
||||
|
||||
15
app/src/main/res/layout/item_sample.xml
Normal file
15
app/src/main/res/layout/item_sample.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="100dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="SAMPLE"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
</FrameLayout>
|
||||
@ -8,7 +8,7 @@
|
||||
android:fitsSystemWindows="true">
|
||||
|
||||
<WebView
|
||||
android:layout_margin="10dp"
|
||||
android:layout_margin="@dimen/default_layout_margin"
|
||||
android:id="@+id/searcher_01"
|
||||
android:layout_width="match_parent"
|
||||
android:alpha="0"
|
||||
|
||||
@ -13,16 +13,15 @@
|
||||
android:id="@+id/batteryProgress"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/twelve"
|
||||
android:layout_marginRight="12dp"
|
||||
android:layout_margin="@dimen/default_layout_margin"
|
||||
android:indeterminate="false"
|
||||
android:textSize="18sp"
|
||||
style="@style/normal"
|
||||
android:text="빠떼뤼 ~> 0%"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<bums.lunatic.launcher.view.DateTimeView
|
||||
android:layout_margin="10dp"
|
||||
android:layout_margin="@dimen/default_layout_margin"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/base_bg"
|
||||
@ -32,7 +31,6 @@
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/batteryProgress"
|
||||
android:textSize="16sp"
|
||||
tools:ignore="MissingConstraints" />
|
||||
|
||||
<ImageView
|
||||
@ -42,17 +40,14 @@
|
||||
app:layout_constraintTop_toTopOf="@id/time"
|
||||
app:layout_constraintBottom_toBottomOf="@id/time"
|
||||
android:layout_width="40dp"
|
||||
android:layout_margin="5dp"
|
||||
android:layout_margin="@dimen/default_layout_margin"
|
||||
android:layout_height="40dp"/>
|
||||
|
||||
<bums.lunatic.launcher.view.CircleImageView
|
||||
app:layout_constraintLeft_toLeftOf="@id/time"
|
||||
app:layout_constraintTop_toTopOf="@id/time"
|
||||
app:layout_constraintBottom_toBottomOf="@id/time"
|
||||
android:layout_marginTop="2.5dp"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginRight="5dp"
|
||||
android:layout_marginBottom="2.5dp"
|
||||
android:layout_margin="@dimen/default_layout_margin"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="fitCenter"
|
||||
android:background="@null"
|
||||
@ -60,32 +55,33 @@
|
||||
app:civ_border_width="1dp"
|
||||
app:civ_border_color="#000000"
|
||||
app:civ_label="택시"
|
||||
|
||||
android:layout_margin="5dp"
|
||||
android:visibility="gone"
|
||||
android:layout_height="0dp"
|
||||
android:src="@drawable/kakaot"
|
||||
android:id="@+id/alchol_katalkT"/>
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/weather"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:maxLines="1"
|
||||
android:textIsSelectable="false"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/time"
|
||||
/>
|
||||
<!-- <com.google.android.material.textview.MaterialTextView-->
|
||||
<!-- android:id="@+id/weather"-->
|
||||
<!-- app:layout_goneMarginBottom="0dp"-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:gravity="center"-->
|
||||
<!-- android:maxLines="1"-->
|
||||
<!-- android:textIsSelectable="false"-->
|
||||
<!-- app:layout_constraintLeft_toLeftOf="parent"-->
|
||||
<!-- app:layout_constraintRight_toRightOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toBottomOf="@+id/time"-->
|
||||
<!-- />-->
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/current_music"
|
||||
app:layout_constraintTop_toBottomOf="@id/weather"
|
||||
app:layout_constraintTop_toBottomOf="@id/time"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
android:background="@drawable/base_bg"
|
||||
android:layout_margin="10dp"
|
||||
android:padding="5dp"
|
||||
android:layout_margin="@dimen/default_layout_margin"
|
||||
app:layout_goneMarginTop="0dp"
|
||||
app:layout_goneMarginBottom="0dp"
|
||||
android:padding="@dimen/default_padding"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
android:layout_width="match_parent"
|
||||
@ -130,9 +126,9 @@
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<include
|
||||
android:layout_margin="@dimen/default_layout_margin"
|
||||
android:id="@+id/noticeSummary"
|
||||
layout="@layout/weather_book"
|
||||
android:layout_margin="10dp"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/current_music"
|
||||
@ -141,8 +137,7 @@
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_margin="10dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_margin="@dimen/default_layout_margin"
|
||||
android:id="@+id/summaryChoose"
|
||||
android:layout_width="0dp"
|
||||
android:gravity="center"
|
||||
@ -155,6 +150,7 @@
|
||||
>
|
||||
|
||||
<TextView
|
||||
style="@style/normal"
|
||||
android:id="@+id/missedCalls"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/tabs"
|
||||
@ -166,6 +162,7 @@
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<TextView
|
||||
style="@style/normal"
|
||||
android:id="@+id/otherCheck"
|
||||
android:gravity="center"
|
||||
android:background="@null"
|
||||
@ -177,6 +174,7 @@
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<TextView
|
||||
style="@style/normal"
|
||||
android:id="@+id/recentSms"
|
||||
android:gravity="center"
|
||||
android:background="@null"
|
||||
@ -188,6 +186,7 @@
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<TextView
|
||||
style="@style/normal"
|
||||
android:id="@+id/notice"
|
||||
android:gravity="center"
|
||||
android:background="@null"
|
||||
@ -207,12 +206,12 @@
|
||||
>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:layout_margin="10dp"
|
||||
android:layout_margin="@dimen/default_layout_margin"
|
||||
android:id="@+id/mainList"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:overScrollMode="never"
|
||||
android:padding="5dp"
|
||||
android:padding="@dimen/default_padding"
|
||||
android:visibility="gone"
|
||||
android:background="@drawable/base_bg"
|
||||
android:scrollbars="none"
|
||||
@ -222,12 +221,12 @@
|
||||
android:layout_alignParentBottom="true"
|
||||
/>
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:layout_margin="10dp"
|
||||
android:layout_margin="@dimen/default_layout_margin"
|
||||
android:id="@+id/smsList"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:overScrollMode="never"
|
||||
android:padding="5dp"
|
||||
android:padding="@dimen/default_padding"
|
||||
android:scrollbars="none"
|
||||
android:visibility="gone"
|
||||
android:background="@drawable/base_bg"
|
||||
@ -239,12 +238,12 @@
|
||||
/>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:layout_margin="10dp"
|
||||
android:layout_margin="@dimen/default_layout_margin"
|
||||
android:id="@+id/infoList"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:overScrollMode="never"
|
||||
android:padding="5dp"
|
||||
android:padding="@dimen/default_padding"
|
||||
android:scrollbars="none"
|
||||
android:visibility="gone"
|
||||
android:background="@drawable/base_bg"
|
||||
@ -256,12 +255,12 @@
|
||||
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:layout_margin="10dp"
|
||||
android:layout_margin="@dimen/default_layout_margin"
|
||||
android:id="@+id/notiList"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:overScrollMode="never"
|
||||
android:padding="5dp"
|
||||
android:padding="@dimen/default_padding"
|
||||
android:scrollbars="none"
|
||||
android:visibility="gone"
|
||||
android:background="@drawable/base_bg"
|
||||
@ -274,16 +273,18 @@
|
||||
</RelativeLayout>
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_margin="10dp"
|
||||
android:layout_margin="@dimen/default_layout_margin"
|
||||
android:id="@+id/favAppsGroup"
|
||||
android:layout_width="@dimen/zero"
|
||||
android:layout_height="60dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginTop="@dimen/twentyTwo"
|
||||
android:layout_marginBottom="@dimen/twelve"
|
||||
android:background="@drawable/base_bg"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent" />
|
||||
app:layout_constraintBottom_toBottomOf="parent" >
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@ -21,10 +21,9 @@
|
||||
android:id="@+id/title"
|
||||
android:layout_width="@dimen/zero"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="24sp"
|
||||
style="@style/normal"
|
||||
android:maxLines="2"
|
||||
android:gravity="center_vertical|right"
|
||||
android:includeFontPadding="false"
|
||||
android:ellipsize="middle"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintLeft_toRightOf="@id/circle_preview"
|
||||
@ -34,9 +33,8 @@
|
||||
android:id="@+id/desc"
|
||||
android:layout_width="@dimen/zero"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="16sp"
|
||||
style="@style/small"
|
||||
android:maxLines="2"
|
||||
android:includeFontPadding="false"
|
||||
android:gravity="center_vertical|right"
|
||||
android:ellipsize="middle"
|
||||
app:layout_constraintTop_toBottomOf="@id/title"
|
||||
@ -48,10 +46,9 @@
|
||||
android:id="@+id/date"
|
||||
android:layout_width="@dimen/zero"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="16sp"
|
||||
style="@style/small"
|
||||
android:lines="1"
|
||||
android:gravity="center_vertical|right"
|
||||
android:includeFontPadding="false"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toRightOf="@id/circle_preview"
|
||||
app:layout_constraintRight_toRightOf="parent"/>
|
||||
|
||||
@ -6,60 +6,56 @@
|
||||
<variable name="textLocation" type="String"/>
|
||||
</data>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:padding="@dimen/default_padding"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAlignment="center">
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:id="@+id/header"
|
||||
android:paddingVertical="5dp">
|
||||
android:layout_height="0dp">
|
||||
<ImageView
|
||||
android:adjustViewBounds="true"
|
||||
android:padding="0dp"
|
||||
android:id="@+id/imageView"
|
||||
android:layout_width="25dp"
|
||||
android:layout_height="25dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="시계 아이콘"
|
||||
app:srcCompat="@drawable/ico_time"
|
||||
tools:ignore="ImageContrastCheck"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginStart="@dimen/default_layout_margin"
|
||||
app:tint="@android:color/white"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/textView2"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView2"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/default_layout_margin"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
android:gravity="left|center_vertical"
|
||||
android:text="시간별 예보"
|
||||
android:gravity="left"
|
||||
android:textSize="14sp"
|
||||
android:layout_marginLeft="10dp"
|
||||
app:layout_constraintStart_toEndOf="@id/imageView"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/_14sp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/imageView"
|
||||
app:layout_constraintEnd_toStartOf="@id/textViewLocation"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintWidth_default="spread"/>
|
||||
app:layout_constraintStart_toEndOf="@id/imageView"
|
||||
app:layout_constraintTop_toTopOf="@id/imageView" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textViewLocation"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
android:text="@{textLocation}"
|
||||
android:textAlignment="center"
|
||||
android:textSize="11sp"
|
||||
android:layout_marginRight="20dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
android:textColor="@android:color/white"
|
||||
android:gravity="center_vertical|right"
|
||||
android:textSize="@dimen/_12sp"
|
||||
android:layout_marginEnd="@dimen/default_layout_margin"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/imageView"
|
||||
app:layout_constraintBottom_toBottomOf="@id/imageView"/>
|
||||
|
||||
<androidx.viewpager2.widget.ViewPager2
|
||||
android:id="@+id/weatherViewPager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="130dp"
|
||||
app:layout_constraintTop_toBottomOf="@+id/header"
|
||||
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toBottomOf="@+id/imageView" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</layout>
|
||||
|
||||
@ -1,11 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<declare-styleable name="CircleImageView">
|
||||
<declare-styleable name="CircleImageView">
|
||||
<attr name="civ_border_width" format="dimension" />
|
||||
<attr name="civ_border_color" format="color" />
|
||||
<attr name="civ_border_overlay" format="boolean" />
|
||||
<attr name="civ_circle_background_color" format="color" />
|
||||
<attr name="civ_label" format="string" />
|
||||
<attr name="civ_ts" format="dimension" />
|
||||
</declare-styleable>
|
||||
</declare-styleable>
|
||||
|
||||
<attr name="cbd_calendar_row" format="integer"/>
|
||||
<declare-styleable name="CalendarDateView">
|
||||
<attr name="cbd_calendar_row"/>
|
||||
</declare-styleable>
|
||||
|
||||
</resources>
|
||||
@ -7,4 +7,14 @@
|
||||
<color name="red">#FFFF0000</color>
|
||||
<color name="green">#FF00FF00</color>
|
||||
<color name="blue">#FF0000FF</color>
|
||||
|
||||
|
||||
|
||||
<color name="purple_200">#FFBB86FC</color>
|
||||
<color name="purple_500">#FF6200EE</color>
|
||||
<color name="purple_700">#FF3700B3</color>
|
||||
<color name="teal_200">#FF03DAC5</color>
|
||||
<color name="teal_700">#FF018786</color>
|
||||
<color name="black">#FF000000</color>
|
||||
<color name="white">#FFFFFFFF</color>
|
||||
</resources>
|
||||
@ -20,4 +20,19 @@
|
||||
<dimen name="normalText">16sp</dimen>
|
||||
<dimen name="clockText">48sp</dimen>
|
||||
<dimen name="appsCountText">216sp</dimen>
|
||||
|
||||
<dimen name="default_layout_margin">7dp</dimen>
|
||||
<dimen name="default_padding">5dp</dimen>
|
||||
<dimen name="_26sp">28sp</dimen>
|
||||
<dimen name="_20sp">23sp</dimen>
|
||||
<dimen name="_14sp">17sp</dimen>
|
||||
<dimen name="_12sp">14sp</dimen>
|
||||
|
||||
|
||||
<!-- toolbar height -->
|
||||
<dimen name="toolbar_height">100dp</dimen>
|
||||
|
||||
<!-- appbar height -->
|
||||
<dimen name="appbar_height">329dp</dimen>
|
||||
|
||||
</resources>
|
||||
@ -70,5 +70,22 @@
|
||||
<item name="android:layout_weight">1</item>
|
||||
</style>
|
||||
|
||||
<style name="defaultTextView">
|
||||
<item name="android:includeFontPadding">false</item>
|
||||
<item name="android:textColor">@android:color/white</item>
|
||||
|
||||
</style>
|
||||
|
||||
<style name="normal" parent="defaultTextView">
|
||||
<item name="android:includeFontPadding">false</item>
|
||||
<item name="android:textSize">@dimen/_14sp</item>
|
||||
<item name="fontFamily">sans-serif-medium</item>
|
||||
</style>
|
||||
|
||||
<style name="small" parent="defaultTextView">
|
||||
<item name="android:includeFontPadding">false</item>
|
||||
<item name="android:textSize">@dimen/_12sp</item>
|
||||
<item name="fontFamily">sans-serif-light</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
Loading…
x
Reference in New Issue
Block a user