use some views from the Commons library

This commit is contained in:
tibbi 2017-01-02 19:27:36 +01:00
parent 392c269787
commit 4034cbd59d
12 changed files with 5 additions and 116 deletions

View File

@ -32,7 +32,7 @@ android {
}
dependencies {
compile 'com.simplemobiletools:commons:2.0.9'
compile 'com.simplemobiletools:commons:2.0.10'
compile 'joda-time:joda-time:2.9.1'
compile 'com.facebook.stetho:stetho:1.4.1'
compile 'com.bignerdranch.android:recyclerview-multiselect:0.2'

View File

@ -20,8 +20,8 @@ import com.simplemobiletools.calendar.helpers.*
import com.simplemobiletools.calendar.helpers.Formatter
import com.simplemobiletools.calendar.interfaces.NavigationListener
import com.simplemobiletools.calendar.models.Event
import com.simplemobiletools.calendar.views.RecyclerViewDivider
import com.simplemobiletools.commons.extensions.adjustAlpha
import com.simplemobiletools.commons.views.RecyclerViewDivider
import kotlinx.android.synthetic.main.fragment_day.view.*
import kotlinx.android.synthetic.main.top_navigation.view.*
import java.util.*

View File

@ -1,36 +0,0 @@
package com.simplemobiletools.calendar.views
import android.content.Context
import android.support.v4.view.ViewPager
import android.util.AttributeSet
import android.view.MotionEvent
// we are creating a custom viewpager just to fix "pointerIndex out of range" exception at onInterceptTouchEvent
class MyViewPager : ViewPager {
constructor(context: Context) : super(context) {
}
constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {
}
override fun onInterceptTouchEvent(ev: MotionEvent): Boolean {
try {
return super.onInterceptTouchEvent(ev)
} catch (ex: IllegalArgumentException) {
ex.printStackTrace()
}
return false
}
override fun onTouchEvent(ev: MotionEvent): Boolean {
try {
return super.onTouchEvent(ev)
} catch (ex: IllegalArgumentException) {
ex.printStackTrace()
}
return false
}
}

View File

@ -1,33 +0,0 @@
package com.simplemobiletools.calendar.views
import android.content.Context
import android.graphics.Canvas
import android.graphics.drawable.Drawable
import android.support.v7.widget.RecyclerView
import com.simplemobiletools.calendar.R
class RecyclerViewDivider(context: Context) : RecyclerView.ItemDecoration() {
private val mDivider: Drawable
init {
mDivider = context.resources.getDrawable(R.drawable.divider)
}
override fun onDrawOver(c: Canvas, parent: RecyclerView, state: RecyclerView.State) {
val left = parent.paddingLeft
val right = parent.width - parent.paddingRight
val childCount = parent.childCount
for (i in 0..childCount - 1) {
val child = parent.getChildAt(i)
val params = child.layoutParams as RecyclerView.LayoutParams
val top = child.bottom + params.bottomMargin
val bottom = top + mDivider.intrinsicHeight
mDivider.setBounds(left, top, right, bottom)
mDivider.draw(c)
}
}
}

View File

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<selector>
<item
android:drawable="@color/activated_item_foreground"
android:state_selected="true"/>
</selector>
</item>
<item>
<ripple android:color="@color/pressed_item_foreground">
<item android:id="@android:id/mask">
<color android:color="@android:color/white"/>
</item>
</ripple>
</item>
</layer-list>

View File

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<size
android:width="1dp"
android:height="1dp"/>
<solid android:color="@color/divider_grey"/>
</shape>

View File

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/activated_item_foreground" android:state_activated="true"/>
<item android:drawable="@android:color/transparent"/>
</selector>

View File

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/pressed_item_foreground" android:state_pressed="true"/>
<item android:drawable="@color/activated_item_foreground" android:state_selected="true"/>
</selector>

View File

@ -6,7 +6,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.simplemobiletools.calendar.views.MyViewPager
<com.simplemobiletools.commons.views.MyViewPager
android:id="@+id/view_pager"
android:layout_width="match_parent"
android:layout_height="match_parent"

View File

@ -6,7 +6,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.simplemobiletools.calendar.views.MyViewPager
<com.simplemobiletools.commons.views.MyViewPager
android:id="@+id/main_view_pager"
android:layout_width="match_parent"
android:layout_height="match_parent"/>

View File

@ -11,7 +11,7 @@
android:id="@+id/event_item_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/event_item_background"
android:background="@drawable/selector"
android:paddingBottom="@dimen/medium_margin"
android:paddingLeft="@dimen/activity_margin"
android:paddingRight="@dimen/activity_margin"

View File

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="dark_theme_dialog_background">#ff333333</color>
</resources>