use the viewpager from commons

This commit is contained in:
tibbi 2017-01-06 19:50:26 +01:00
parent f4b0a0e691
commit ba2cb16893
3 changed files with 5 additions and 40 deletions

View File

@ -13,16 +13,17 @@ import com.simplemobiletools.commons.extensions.toast
import com.simplemobiletools.commons.extensions.value import com.simplemobiletools.commons.extensions.value
import com.simplemobiletools.commons.helpers.LICENSE_AMBILWARNA import com.simplemobiletools.commons.helpers.LICENSE_AMBILWARNA
import com.simplemobiletools.commons.helpers.LICENSE_KOTLIN import com.simplemobiletools.commons.helpers.LICENSE_KOTLIN
import com.simplemobiletools.commons.helpers.LICENSE_RTL
import com.simplemobiletools.commons.helpers.LICENSE_STETHO import com.simplemobiletools.commons.helpers.LICENSE_STETHO
import com.simplemobiletools.notes.BuildConfig import com.simplemobiletools.notes.BuildConfig
import com.simplemobiletools.notes.R import com.simplemobiletools.notes.R
import com.simplemobiletools.notes.helpers.TYPE_NOTE
import com.simplemobiletools.notes.adapters.NotesPagerAdapter import com.simplemobiletools.notes.adapters.NotesPagerAdapter
import com.simplemobiletools.notes.databases.DBHelper import com.simplemobiletools.notes.databases.DBHelper
import com.simplemobiletools.notes.dialogs.NewNoteDialog import com.simplemobiletools.notes.dialogs.NewNoteDialog
import com.simplemobiletools.notes.dialogs.OpenNoteDialog import com.simplemobiletools.notes.dialogs.OpenNoteDialog
import com.simplemobiletools.notes.dialogs.RenameNoteDialog import com.simplemobiletools.notes.dialogs.RenameNoteDialog
import com.simplemobiletools.notes.extensions.getTextSize import com.simplemobiletools.notes.extensions.getTextSize
import com.simplemobiletools.notes.helpers.TYPE_NOTE
import com.simplemobiletools.notes.models.Note import com.simplemobiletools.notes.models.Note
import kotlinx.android.synthetic.main.activity_main.* import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.fragment_note.* import kotlinx.android.synthetic.main.fragment_note.*
@ -129,7 +130,7 @@ class MainActivity : SimpleActivity(), ViewPager.OnPageChangeListener {
} }
private fun launchAbout() { private fun launchAbout() {
startAboutActivity(R.string.app_name, LICENSE_KOTLIN or LICENSE_AMBILWARNA or LICENSE_STETHO, BuildConfig.VERSION_NAME) startAboutActivity(R.string.app_name, LICENSE_KOTLIN or LICENSE_AMBILWARNA or LICENSE_STETHO or LICENSE_RTL, BuildConfig.VERSION_NAME)
} }
private fun displayDeleteNotePrompt() { private fun displayDeleteNotePrompt() {

View File

@ -1,36 +0,0 @@
package com.simplemobiletools.notes.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,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<com.simplemobiletools.notes.views.MyViewPager <com.simplemobiletools.commons.views.MyViewPager
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/view_pager" android:id="@+id/view_pager"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -12,4 +12,4 @@
android:layout_gravity="top" android:layout_gravity="top"
android:paddingLeft="@dimen/activity_margin" android:paddingLeft="@dimen/activity_margin"
android:paddingRight="@dimen/activity_margin"/> android:paddingRight="@dimen/activity_margin"/>
</com.simplemobiletools.notes.views.MyViewPager> </com.simplemobiletools.commons.views.MyViewPager>