|
@@ -5,10 +5,10 @@ import android.arch.lifecycle.MutableLiveData
|
|
import android.arch.lifecycle.ViewModel
|
|
import android.arch.lifecycle.ViewModel
|
|
import android.content.Context
|
|
import android.content.Context
|
|
import android.graphics.Color
|
|
import android.graphics.Color
|
|
-import android.graphics.Point
|
|
|
|
import android.net.Uri
|
|
import android.net.Uri
|
|
import android.os.Build
|
|
import android.os.Build
|
|
import android.support.v4.content.ContextCompat
|
|
import android.support.v4.content.ContextCompat
|
|
|
|
+import android.support.v7.widget.MyRoundRectDrawableWithShadow
|
|
import android.view.Gravity
|
|
import android.view.Gravity
|
|
import android.view.LayoutInflater
|
|
import android.view.LayoutInflater
|
|
import android.view.View
|
|
import android.view.View
|
|
@@ -535,6 +535,8 @@ class ReaderViewModel(private val readerModelManager: ReaderModelManager, val ur
|
|
|
|
|
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
|
popupWindow?.elevation = context.resources.getDimension(R.dimen.reader_context_menu_window_elevation)
|
|
popupWindow?.elevation = context.resources.getDimension(R.dimen.reader_context_menu_window_elevation)
|
|
|
|
+ } else {
|
|
|
|
+ setElevationBelowAndroidKitKat(context, contentView)
|
|
}
|
|
}
|
|
|
|
|
|
popupWindow?.isOutsideTouchable = false
|
|
popupWindow?.isOutsideTouchable = false
|
|
@@ -543,6 +545,16 @@ class ReaderViewModel(private val readerModelManager: ReaderModelManager, val ur
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private fun setElevationBelowAndroidKitKat(context: Context, view: View?) {
|
|
|
|
+ val elevation = context.resources.getDimension(R.dimen.reader_context_menu_window_elevation)
|
|
|
|
+ val drawable = MyRoundRectDrawableWithShadow(context.resources, 0x00000000, 0f, elevation, elevation)
|
|
|
|
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
|
|
|
|
+ view?.background = drawable
|
|
|
|
+ } else {
|
|
|
|
+ view?.setBackgroundDrawable(drawable)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
private fun createMarkupContextMenuView(context: Context): View {
|
|
private fun createMarkupContextMenuView(context: Context): View {
|
|
/** Just set HIGH_LIGHT then highlight, strike, underline will be triggered. **/
|
|
/** Just set HIGH_LIGHT then highlight, strike, underline will be triggered. **/
|
|
/** WTF !!!!!!!!!!! **/
|
|
/** WTF !!!!!!!!!!! **/
|