Skip to content

Commit

Permalink
Renaming and deprecated methods removed
Browse files Browse the repository at this point in the history
  • Loading branch information
kirill committed Jan 17, 2019
1 parent f18ff49 commit 2a4a594
Show file tree
Hide file tree
Showing 31 changed files with 119 additions and 114 deletions.

This file was deleted.

2 changes: 1 addition & 1 deletion sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ dependencies {
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'

implementation project(":kalendar")
implementation project(':vishnu')

testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
Expand Down
2 changes: 1 addition & 1 deletion sample/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
android:layout_marginStart="16dp"/>


<com.yalantis.kalendar.view.Kalendar
<com.yalantis.vishnu.view.Vishnu
android:id="@+id/kalendar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1 +1 @@
include ':kalendar', ':sample'
include ':vishnu', ':sample'
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.yalantis.kalendar">
package="com.yalantis.vishnu">

<application android:allowBackup="false"/>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.yalantis.kalendar
package com.yalantis.vishnu

import android.view.View
import java.util.*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
package com.yalantis.kalendar
package com.yalantis.vishnu

import android.util.SparseArray
import android.view.View
import android.view.ViewGroup
import androidx.viewpager.widget.PagerAdapter
import com.yalantis.kalendar.model.KalendarStylable
import com.yalantis.kalendar.view.MonthPage
import com.yalantis.vishnu.interfaces.VishnuListener
import com.yalantis.vishnu.model.VishnuStylable
import com.yalantis.vishnu.view.MonthPage
import java.util.*

class MonthPagerAdapter(private val listener: MonthPage.KalendarListener) : PagerAdapter() {
class MonthPagerAdapter(private val listener: VishnuListener) : PagerAdapter() {

private val months = mutableListOf<Date>()

private val pages = SparseArray<MonthPage>()

lateinit var stylable: KalendarStylable
lateinit var stylable: VishnuStylable

override fun isViewFromObject(p0: View, p1: Any) = p0 === p1

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.yalantis.kalendar.implementation
package com.yalantis.vishnu.implementation

import com.yalantis.kalendar.*
import com.yalantis.kalendar.interfaces.DateManager
import com.yalantis.kalendar.interfaces.DateView
import com.yalantis.vishnu.*
import com.yalantis.vishnu.interfaces.DateManager
import com.yalantis.vishnu.interfaces.DateView
import java.util.*
import java.util.Calendar.*

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.yalantis.kalendar.implementation
package com.yalantis.vishnu.implementation

import android.animation.Animator
import android.animation.ValueAnimator
import android.view.MotionEvent
import android.view.animation.DecelerateInterpolator
import com.yalantis.kalendar.*
import com.yalantis.kalendar.interfaces.MoveManager
import com.yalantis.kalendar.interfaces.ViewProvider
import com.yalantis.vishnu.*
import com.yalantis.vishnu.interfaces.MoveManager
import com.yalantis.vishnu.interfaces.ViewProvider

class MoveManagerImpl(private val viewProvider: ViewProvider) : MoveManager {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.yalantis.kalendar.interfaces
package com.yalantis.vishnu.interfaces

import java.util.*

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.yalantis.kalendar.interfaces
package com.yalantis.vishnu.interfaces

import java.util.*

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.yalantis.kalendar.interfaces
package com.yalantis.vishnu.interfaces

import android.view.MotionEvent

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.yalantis.kalendar.interfaces
package com.yalantis.vishnu.interfaces

interface ViewProvider {

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package com.yalantis.vishnu.interfaces

import com.yalantis.vishnu.view.MonthPage
import java.util.*

interface VishnuListener {
/**
* Invokes when user clicks on current page day view
*/
fun onDayClick(date: Date)

/**
* Invokes when current page collapsed/expanded state changed
*/

fun onStateChanged(isCollapsed: Boolean)

/**
* Invokes when current page height changed
*/

fun onHeightChanged(newHeight: Int)

/**
* Invokes when clicks on next/previous month
*/

fun onMonthChanged(forward: Boolean, date: Date? = null)

/**
* Invokes when current page size has been measured
*/

fun onSizeMeasured(monthPage: MonthPage, collapsedHeight: Int, totalHeight: Int)
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.yalantis.kalendar.model
package com.yalantis.vishnu.model

const val ACTION_NEXT_MONTH = 0
const val ACTION_PREV_MONTH = 1
Expand Down
34 changes: 34 additions & 0 deletions vishnu/src/main/java/com/yalantis/vishnu/model/VishnuStylable.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package com.yalantis.vishnu.model

import android.content.Context
import android.content.res.TypedArray
import android.graphics.Typeface
import androidx.core.content.ContextCompat
import com.yalantis.vishnu.EMPTY_STRING
import com.yalantis.vishnu.R

class VishnuStylable(private var context: Context?, attrs: TypedArray) {

val dragHeight = attrs.getDimensionPixelSize(R.styleable.Vishnu_dragHeight, attrs.resources.getDimensionPixelSize(R.dimen.default_drag_height))
var dragColor = attrs.getColor(R.styleable.Vishnu_dragColor, ContextCompat.getColor(requireNotNull(context), R.color.light_gray))
val dragText = attrs.getString(R.styleable.Vishnu_dragText) ?: EMPTY_STRING
var dragTextColor = attrs.getColor(R.styleable.Vishnu_dragTextColor, ContextCompat.getColor(requireNotNull(context),R.color.drag_text_color))
val dragTextSize = attrs.getDimensionPixelSize(R.styleable.Vishnu_dragTextSize, attrs.resources.getDimensionPixelSize(R.dimen.drag_text_size))
var selectedDayDrawable = attrs.getResourceId(R.styleable.Vishnu_selectedDayDrawable, R.drawable.day_background)
val pageBackground = attrs.getColor(R.styleable.Vishnu_pageBackground, ContextCompat.getColor(requireNotNull(context),android.R.color.white))

var dayTypeface: Typeface = Typeface.MONOSPACE
var weekDayTypeface: Typeface = Typeface.DEFAULT
var monthTypeface: Typeface = Typeface.DEFAULT_BOLD

var monthSwitchBackground = R.drawable.ic_cell
var weekDayNamesBackground = R.drawable.ic_cell_1_line

var selectedWeekBackground = R.drawable.selected_week_back
var unselectedWeekBackground = R.drawable.unselected_week

init {
attrs.recycle()
context = null
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.yalantis.kalendar.view
package com.yalantis.vishnu.view

import android.content.Context
import android.view.Gravity
import android.widget.LinearLayout
import android.widget.TextView
import androidx.appcompat.widget.AppCompatTextView
import com.yalantis.kalendar.EMPTY_INT
import com.yalantis.kalendar.EMPTY_STRING
import com.yalantis.vishnu.EMPTY_INT
import com.yalantis.vishnu.EMPTY_STRING
import java.util.*

class Day(context: Context) : AppCompatTextView(context) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.yalantis.kalendar.view
package com.yalantis.vishnu.view

import android.content.Context
import android.graphics.Typeface
import android.view.ViewGroup.LayoutParams.WRAP_CONTENT
import android.widget.LinearLayout
import android.widget.TextView
import androidx.appcompat.widget.AppCompatTextView
import com.yalantis.kalendar.EMPTY_STRING
import com.yalantis.vishnu.EMPTY_STRING

class Month(context: Context) : AppCompatTextView(context) {
companion object {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.yalantis.kalendar.view
package com.yalantis.vishnu.view

import android.animation.LayoutTransition
import android.annotation.SuppressLint
Expand All @@ -12,19 +12,16 @@ import android.view.ViewGroup.LayoutParams.MATCH_PARENT
import android.widget.LinearLayout
import android.widget.TextView
import androidx.core.content.ContextCompat
import com.yalantis.kalendar.*
import com.yalantis.kalendar.implementation.DateManagerImpl
import com.yalantis.kalendar.implementation.MoveManagerImpl
import com.yalantis.kalendar.interfaces.DateManager
import com.yalantis.kalendar.interfaces.DateView
import com.yalantis.kalendar.interfaces.MoveManager
import com.yalantis.kalendar.interfaces.ViewProvider
import com.yalantis.kalendar.model.*
import com.yalantis.vishnu.*
import com.yalantis.vishnu.implementation.DateManagerImpl
import com.yalantis.vishnu.implementation.MoveManagerImpl
import com.yalantis.vishnu.interfaces.*
import com.yalantis.vishnu.model.*
import java.util.*
import kotlin.collections.ArrayList

@SuppressLint("ViewConstructor")
class MonthPage(context: Context, stylable: KalendarStylable) : LinearLayout(context), ViewProvider,
class MonthPage(context: Context, stylable: VishnuStylable) : LinearLayout(context), ViewProvider,
Day.OnDayClickListener, DateView {

private var dragTextSize = EMPTY_INT
Expand Down Expand Up @@ -55,7 +52,7 @@ class MonthPage(context: Context, stylable: KalendarStylable) : LinearLayout(con

private var collapsedHeight = EMPTY_INT

var listener: KalendarListener? = null
var listener: VishnuListener? = null

lateinit var pageDate: Date

Expand Down Expand Up @@ -131,7 +128,7 @@ class MonthPage(context: Context, stylable: KalendarStylable) : LinearLayout(con
obtainStylable(stylable)
}

private fun obtainStylable(stylable: KalendarStylable) {
private fun obtainStylable(stylable: VishnuStylable) {
dragText = stylable.dragText
dragColor = stylable.dragColor
dragHeight = stylable.dragHeight
Expand Down Expand Up @@ -592,35 +589,4 @@ class MonthPage(context: Context, stylable: KalendarStylable) : LinearLayout(con
week.y = newTop - week.height
week.layoutParams = week.layoutParams.apply { height = week.height }
}

interface KalendarListener {
/**
* Invokes when user clicks on current page day view
*/
fun onDayClick(date: Date)

/**
* Invokes when current page collapsed/expanded state changed
*/

fun onStateChanged(isCollapsed: Boolean)

/**
* Invokes when current page height changed
*/

fun onHeightChanged(newHeight: Int)

/**
* Invokes when clicks on next/previous month
*/

fun onMonthChanged(forward: Boolean, date: Date? = null)

/**
* Invokes when current page size has been measured
*/

fun onSizeMeasured(monthPage: MonthPage, collapsedHeight: Int, totalHeight: Int)
}
}
Loading

0 comments on commit 2a4a594

Please sign in to comment.