mirror of
https://github.com/TwidereProject/Twidere-Android
synced 2025-02-01 01:06:53 +01:00
fixed toolbar background in transparent theme
improved user profile shortcuts
This commit is contained in:
parent
20d014e370
commit
aeeb1a0e75
10
build.gradle
10
build.gradle
@ -14,7 +14,7 @@ buildscript {
|
||||
|
||||
allprojects {
|
||||
|
||||
ext{
|
||||
ext {
|
||||
projectGroupId = 'org.mariotaku.twidere'
|
||||
projectVersionCode = 385
|
||||
projectVersionName = '3.6.25'
|
||||
@ -23,8 +23,8 @@ allprojects {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
jcenter()
|
||||
maven { url 'https://jitpack.io' }
|
||||
maven { url 'https://maven.google.com' }
|
||||
maven { url 'https://jitpack.io' }
|
||||
}
|
||||
|
||||
}
|
||||
@ -32,7 +32,7 @@ allprojects {
|
||||
subprojects {
|
||||
buildscript {
|
||||
ext {
|
||||
kotlinVersion = '1.1.4-2'
|
||||
kotlinVersion = '1.1.4-3'
|
||||
pluginVersions = [
|
||||
AndroidSvgDrawable: '3.0.0',
|
||||
Fabric : '1.22.1',
|
||||
@ -40,7 +40,7 @@ subprojects {
|
||||
PlayServices : '3.1.0',
|
||||
]
|
||||
libVersions = [
|
||||
Kotlin : '1.1.4-2',
|
||||
Kotlin : "${kotlinVersion}",
|
||||
SupportLib : '26.0.1',
|
||||
SupportTest : '1.0.0',
|
||||
MariotakuCommons : '0.9.17',
|
||||
@ -68,7 +68,7 @@ subprojects {
|
||||
KPreferences : '0.9.7',
|
||||
Kovenant : '3.3.0',
|
||||
ParcelablePlease : '1.0.2',
|
||||
Chameleon : '0.9.18',
|
||||
Chameleon : '0.9.19-SNAPSHOT',
|
||||
UniqR : '0.9.4',
|
||||
SQLiteQB : '0.9.15',
|
||||
Glide : '3.7.0',
|
||||
|
@ -47,19 +47,23 @@ fun Menu.setItemChecked(id: Int, checked: Boolean) {
|
||||
findItem(id)?.isChecked = checked
|
||||
}
|
||||
|
||||
fun Menu.setMenuItemIcon(id: Int, icon: Int) {
|
||||
fun Menu.setItemIcon(id: Int, icon: Int) {
|
||||
findItem(id)?.setIcon(icon)
|
||||
}
|
||||
|
||||
fun Menu.setMenuItemIcon(id: Int, icon: Drawable) {
|
||||
fun Menu.setItemIcon(id: Int, icon: Drawable) {
|
||||
findItem(id)?.icon = icon
|
||||
}
|
||||
|
||||
fun Menu.setMenuItemTitle(id: Int, title: Int) {
|
||||
fun Menu.setItemTitle(id: Int, title: Int) {
|
||||
findItem(id)?.setTitle(title)
|
||||
}
|
||||
|
||||
fun Menu.setMenuItemShowAsActionFlags(id: Int, flags: Int) {
|
||||
fun Menu.setItemTitle(id: Int, title: CharSequence?) {
|
||||
findItem(id)?.title = title
|
||||
}
|
||||
|
||||
fun Menu.setItemShowAsActionFlags(id: Int, flags: Int) {
|
||||
val item = findItem(id) ?: return
|
||||
item.setShowAsActionFlags(flags)
|
||||
}
|
||||
|
@ -115,6 +115,7 @@ import javax.inject.Inject
|
||||
import kotlin.collections.ArrayList
|
||||
import android.Manifest.permission as AndroidPermission
|
||||
|
||||
@SuppressLint("RestrictedApi")
|
||||
class ComposeActivity : BaseActivity(), OnMenuItemClickListener, OnClickListener, OnLongClickListener,
|
||||
ActionMode.Callback, PermissionRequestCancelCallback, EditAltTextDialogFragment.EditAltTextCallback {
|
||||
|
||||
@ -128,6 +129,7 @@ class ComposeActivity : BaseActivity(), OnMenuItemClickListener, OnClickListener
|
||||
|
||||
private lateinit var itemTouchHelper: ItemTouchHelper
|
||||
private lateinit var bottomMenuAnimator: ViewAnimator
|
||||
|
||||
private val supportMenuInflater by lazy { SupportMenuInflater(this) }
|
||||
|
||||
private val backTimeoutRunnable = Runnable { navigateBackPressed = false }
|
||||
@ -172,11 +174,12 @@ class ComposeActivity : BaseActivity(), OnMenuItemClickListener, OnClickListener
|
||||
// Listeners
|
||||
private var locationListener: LocationListener? = null
|
||||
|
||||
private val draftAction: String get() = draft?.action_type ?: when (intent.action) {
|
||||
INTENT_ACTION_REPLY -> Draft.Action.REPLY
|
||||
INTENT_ACTION_QUOTE -> Draft.Action.QUOTE
|
||||
else -> Draft.Action.UPDATE_STATUS
|
||||
}
|
||||
private val draftAction: String
|
||||
get() = draft?.action_type ?: when (intent.action) {
|
||||
INTENT_ACTION_REPLY -> Draft.Action.REPLY
|
||||
INTENT_ACTION_QUOTE -> Draft.Action.QUOTE
|
||||
else -> Draft.Action.UPDATE_STATUS
|
||||
}
|
||||
|
||||
private val media: Array<ParcelableMediaUpdate>
|
||||
get() = mediaList.toTypedArray()
|
||||
@ -1317,39 +1320,39 @@ class ComposeActivity : BaseActivity(), OnMenuItemClickListener, OnClickListener
|
||||
|
||||
if (!attachLocation) {
|
||||
menu.setItemChecked(R.id.location_off, true)
|
||||
menu.setMenuItemIcon(R.id.location_submenu, R.drawable.ic_action_location_off)
|
||||
menu.setItemIcon(R.id.location_submenu, R.drawable.ic_action_location_off)
|
||||
} else if (attachPreciseLocation) {
|
||||
menu.setItemChecked(R.id.location_precise, true)
|
||||
menu.setMenuItemIcon(R.id.location_submenu, R.drawable.ic_action_location)
|
||||
menu.setItemIcon(R.id.location_submenu, R.drawable.ic_action_location)
|
||||
} else {
|
||||
menu.setItemChecked(R.id.location_coarse, true)
|
||||
menu.setMenuItemIcon(R.id.location_submenu, R.drawable.ic_action_location)
|
||||
menu.setItemIcon(R.id.location_submenu, R.drawable.ic_action_location)
|
||||
}
|
||||
|
||||
when (statusVisibility) {
|
||||
StatusVisibility.UNLISTED -> {
|
||||
menu.setItemChecked(R.id.visibility_unlisted, true)
|
||||
menu.setMenuItemIcon(R.id.visibility_submenu, R.drawable.ic_action_web_lock)
|
||||
menu.setItemIcon(R.id.visibility_submenu, R.drawable.ic_action_web_lock)
|
||||
menu.setItemChecked(R.id.attachment_visibility_unlisted, true)
|
||||
menu.setMenuItemIcon(R.id.attachment_visibility_submenu, R.drawable.ic_action_web_lock)
|
||||
menu.setItemIcon(R.id.attachment_visibility_submenu, R.drawable.ic_action_web_lock)
|
||||
}
|
||||
StatusVisibility.PRIVATE -> {
|
||||
menu.setItemChecked(R.id.visibility_private, true)
|
||||
menu.setMenuItemIcon(R.id.visibility_submenu, R.drawable.ic_action_lock)
|
||||
menu.setItemIcon(R.id.visibility_submenu, R.drawable.ic_action_lock)
|
||||
menu.setItemChecked(R.id.attachment_visibility_private, true)
|
||||
menu.setMenuItemIcon(R.id.attachment_visibility_submenu, R.drawable.ic_action_lock)
|
||||
menu.setItemIcon(R.id.attachment_visibility_submenu, R.drawable.ic_action_lock)
|
||||
}
|
||||
StatusVisibility.DIRECT -> {
|
||||
menu.setItemChecked(R.id.visibility_direct, true)
|
||||
menu.setMenuItemIcon(R.id.visibility_submenu, R.drawable.ic_action_message)
|
||||
menu.setItemIcon(R.id.visibility_submenu, R.drawable.ic_action_message)
|
||||
menu.setItemChecked(R.id.attachment_visibility_direct, true)
|
||||
menu.setMenuItemIcon(R.id.attachment_visibility_submenu, R.drawable.ic_action_message)
|
||||
menu.setItemIcon(R.id.attachment_visibility_submenu, R.drawable.ic_action_message)
|
||||
}
|
||||
else -> { // Default to public
|
||||
menu.setItemChecked(R.id.visibility_public, true)
|
||||
menu.setMenuItemIcon(R.id.visibility_submenu, R.drawable.ic_action_web)
|
||||
menu.setItemIcon(R.id.visibility_submenu, R.drawable.ic_action_web)
|
||||
menu.setItemChecked(R.id.attachment_visibility_public, true)
|
||||
menu.setMenuItemIcon(R.id.attachment_visibility_submenu, R.drawable.ic_action_web)
|
||||
menu.setItemIcon(R.id.attachment_visibility_submenu, R.drawable.ic_action_web)
|
||||
}
|
||||
}
|
||||
|
||||
@ -1473,13 +1476,13 @@ class ComposeActivity : BaseActivity(), OnMenuItemClickListener, OnClickListener
|
||||
|
||||
val update = try {
|
||||
getStatusUpdate(true)
|
||||
} catch(e: NoAccountException) {
|
||||
} catch (e: NoAccountException) {
|
||||
editText.error = getString(R.string.message_toast_no_account_selected)
|
||||
return
|
||||
} catch(e: NoContentException) {
|
||||
} catch (e: NoContentException) {
|
||||
editText.error = getString(R.string.error_message_no_content)
|
||||
return
|
||||
} catch(e: StatusTooLongException) {
|
||||
} catch (e: StatusTooLongException) {
|
||||
editText.error = getString(R.string.error_message_status_too_long)
|
||||
editText.setSelection(e.exceededStartIndex, editText.length())
|
||||
return
|
||||
@ -1602,7 +1605,7 @@ class ComposeActivity : BaseActivity(), OnMenuItemClickListener, OnClickListener
|
||||
val mentionColor = ThemeUtils.getTextColorSecondary(this)
|
||||
editable.clearSpans(MentionColorSpan::class.java)
|
||||
editable.setSpan(MentionColorSpan(mentionColor), 0, textAndMentions.replyStartIndex,
|
||||
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
|
||||
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
|
||||
statusTextCount.textCount = summaryLength + validator.getTweetLength(textAndMentions.replyText)
|
||||
} else {
|
||||
hintLabel.visibility = View.VISIBLE
|
||||
@ -1675,7 +1678,7 @@ class ComposeActivity : BaseActivity(), OnMenuItemClickListener, OnClickListener
|
||||
private fun saveToDrafts(): Uri? {
|
||||
val statusUpdate = try {
|
||||
getStatusUpdate(false)
|
||||
} catch(e: ComposeException) {
|
||||
} catch (e: ComposeException) {
|
||||
return null
|
||||
}
|
||||
val draft = UpdateStatusTask.createDraft(draftAction) {
|
||||
|
@ -143,7 +143,8 @@ class LinkHandlerActivity : BaseActivity(), SystemWindowInsetsCallback, IControl
|
||||
contentFragmentId = android.R.id.content
|
||||
} else {
|
||||
setContentView(R.layout.activity_link_handler)
|
||||
toolbar?.let { toolbar ->
|
||||
val toolbar = this.toolbar
|
||||
if (toolbar != null) {
|
||||
if (supportActionBar != null) {
|
||||
toolbar.visibility = View.GONE
|
||||
windowOverlay?.visibility = View.GONE
|
||||
@ -221,6 +222,7 @@ class LinkHandlerActivity : BaseActivity(), SystemWindowInsetsCallback, IControl
|
||||
if (fragment is IToolBarSupportFragment) {
|
||||
return result
|
||||
}
|
||||
contentView?.statusBarHeight = insets.systemWindowInsetTop - controlBarHeight
|
||||
return result.consumeSystemWindowInsets()
|
||||
}
|
||||
|
||||
@ -341,11 +343,13 @@ class LinkHandlerActivity : BaseActivity(), SystemWindowInsetsCallback, IControl
|
||||
get() {
|
||||
val fragment = currentVisibleFragment
|
||||
val actionBar = supportActionBar
|
||||
var height = 0
|
||||
if (fragment is IToolBarSupportFragment) {
|
||||
return fragment.controlBarHeight
|
||||
fragment.controlBarHeight
|
||||
} else if (actionBar != null) {
|
||||
return actionBar.height
|
||||
height = actionBar.height
|
||||
}
|
||||
if (height != 0) return height
|
||||
if (actionBarHeight != 0) return actionBarHeight
|
||||
actionBarHeight = ThemeUtils.getActionBarHeight(this)
|
||||
return actionBarHeight
|
||||
|
@ -52,6 +52,9 @@ abstract class AbsContentListViewFragment<A : ListAdapter> : BaseFragment(),
|
||||
protected open val overrideDivider: Drawable?
|
||||
get() = ThemeUtils.getDrawableFromThemeAttribute(context, android.R.attr.listDivider)
|
||||
|
||||
protected val isProgressShowing: Boolean
|
||||
get() = progressContainer.visibility == View.VISIBLE
|
||||
|
||||
override lateinit var adapter: A
|
||||
|
||||
|
||||
|
@ -64,6 +64,25 @@ abstract class AbsContentRecyclerViewFragment<A : LoadMoreSupportAdapter<Recycle
|
||||
private val refreshCompleteListener: RefreshCompleteListener?
|
||||
get() = parentFragment as? RefreshCompleteListener
|
||||
|
||||
val isProgressShowing: Boolean
|
||||
get() = progressContainer.visibility == View.VISIBLE
|
||||
|
||||
override var refreshing: Boolean
|
||||
get () = swipeLayout.isRefreshing
|
||||
set(value) {
|
||||
if (isProgressShowing) return
|
||||
val currentRefreshing = swipeLayout.isRefreshing
|
||||
if (!currentRefreshing) {
|
||||
updateRefreshProgressOffset()
|
||||
}
|
||||
if (!value) {
|
||||
refreshCompleteListener?.onRefreshComplete(this)
|
||||
}
|
||||
if (value == currentRefreshing) return
|
||||
val layoutRefreshing = value && adapter.loadMoreIndicatorPosition != ILoadMoreSupportAdapter.NONE
|
||||
swipeLayout.isRefreshing = layoutRefreshing
|
||||
}
|
||||
|
||||
override fun canScroll(dy: Float): Boolean {
|
||||
return drawerCallback.canScroll(dy)
|
||||
}
|
||||
@ -136,21 +155,6 @@ abstract class AbsContentRecyclerViewFragment<A : LoadMoreSupportAdapter<Recycle
|
||||
drawerCallback.topChanged(offset)
|
||||
}
|
||||
|
||||
override var refreshing: Boolean
|
||||
get () = swipeLayout.isRefreshing
|
||||
set(value) {
|
||||
val currentRefreshing = swipeLayout.isRefreshing
|
||||
if (!currentRefreshing) {
|
||||
updateRefreshProgressOffset()
|
||||
}
|
||||
if (!value) {
|
||||
refreshCompleteListener?.onRefreshComplete(this)
|
||||
}
|
||||
if (value == currentRefreshing) return
|
||||
val layoutRefreshing = value && adapter.loadMoreIndicatorPosition != ILoadMoreSupportAdapter.NONE
|
||||
swipeLayout.isRefreshing = layoutRefreshing
|
||||
}
|
||||
|
||||
var refreshEnabled: Boolean
|
||||
get() = swipeLayout.isEnabled
|
||||
set(value) {
|
||||
|
@ -369,9 +369,9 @@ class AccountsDashboardFragment : BaseFragment(), LoaderCallbacks<AccountsInfo>,
|
||||
val icon = ContextCompat.getDrawable(context, R.drawable.ic_action_infinity)
|
||||
val color = ContextCompat.getColor(context, R.color.material_red)
|
||||
val size = resources.getDimensionPixelSize(R.dimen.element_spacing_msmall)
|
||||
menu.setMenuItemIcon(R.id.premium_features, BadgeDrawable(icon, color, size))
|
||||
menu.setItemIcon(R.id.premium_features, BadgeDrawable(icon, color, size))
|
||||
} else {
|
||||
menu.setMenuItemIcon(R.id.premium_features, R.drawable.ic_action_infinity)
|
||||
menu.setItemIcon(R.id.premium_features, R.drawable.ic_action_infinity)
|
||||
}
|
||||
var hasLists = false
|
||||
var hasGroups = false
|
||||
|
@ -81,7 +81,6 @@ import kotlinx.android.synthetic.main.header_user.*
|
||||
import kotlinx.android.synthetic.main.header_user.view.*
|
||||
import kotlinx.android.synthetic.main.layout_content_fragment_common.*
|
||||
import kotlinx.android.synthetic.main.layout_content_pages_common.*
|
||||
import nl.komponents.kovenant.combine.and
|
||||
import nl.komponents.kovenant.task
|
||||
import nl.komponents.kovenant.then
|
||||
import nl.komponents.kovenant.ui.alwaysUi
|
||||
@ -802,7 +801,7 @@ class UserFragment : BaseFragment(), OnClickListener, OnLinkClickListener,
|
||||
menu.setItemAvailability(R.id.blocked_users, isMyself)
|
||||
menu.setItemAvailability(R.id.block, !isMyself)
|
||||
|
||||
menu.setItemAvailability(R.id.add_to_home_screen,
|
||||
menu.setItemAvailability(R.id.add_to_home_screen_submenu,
|
||||
ShortcutManagerCompat.isRequestPinShortcutSupported(context))
|
||||
|
||||
var canAddToList = false
|
||||
@ -1036,17 +1035,19 @@ class UserFragment : BaseFragment(), OnClickListener, OnLinkClickListener,
|
||||
}
|
||||
return true
|
||||
}
|
||||
R.id.add_to_home_screen -> {
|
||||
if (!ShortcutManagerCompat.isRequestPinShortcutSupported(context)) return true
|
||||
val promise = showProgressDialog(FRAGMENT_TAG_ADD_USER_SHORTCUT_TO_HOME_SCREEN)
|
||||
.and(ShortcutCreator.user(context, user.account_key, user))
|
||||
val weakThis = WeakReference(this)
|
||||
promise.successUi { (_, shortcut) ->
|
||||
val fragment = weakThis.get() ?: return@successUi
|
||||
ShortcutManagerCompat.requestPinShortcut(fragment.context, shortcut, null)
|
||||
}.alwaysUi {
|
||||
val fragment = weakThis.get() ?: return@alwaysUi
|
||||
fragment.dismissProgressDialog(FRAGMENT_TAG_ADD_USER_SHORTCUT_TO_HOME_SCREEN)
|
||||
R.id.add_user_to_home_screen -> {
|
||||
ShortcutCreator.performCreation(this) {
|
||||
ShortcutCreator.user(context, user.account_key, user)
|
||||
}
|
||||
}
|
||||
R.id.add_statuses_to_home_screen -> {
|
||||
ShortcutCreator.performCreation(this) {
|
||||
ShortcutCreator.userTimeline(context, user.account_key, user)
|
||||
}
|
||||
}
|
||||
R.id.add_favorites_to_home_screen -> {
|
||||
ShortcutCreator.performCreation(this) {
|
||||
ShortcutCreator.userFavorites(context, user.account_key, user)
|
||||
}
|
||||
}
|
||||
else -> {
|
||||
@ -1860,6 +1861,6 @@ class UserFragment : BaseFragment(), OnClickListener, OnLinkClickListener,
|
||||
private const val TAB_TYPE_STATUSES_WITH_REPLIES = "statuses_with_replies"
|
||||
private const val TAB_TYPE_MEDIA = "media"
|
||||
private const val TAB_TYPE_FAVORITES = "favorites"
|
||||
private const val FRAGMENT_TAG_ADD_USER_SHORTCUT_TO_HOME_SCREEN = "add_user_shortcut_to_home_screen"
|
||||
private const val FRAGMENT_TAG_ADD_SHORTCUT_TO_HOME_SCREEN = "add_shortcut_to_home_screen"
|
||||
}
|
||||
}
|
||||
|
@ -25,17 +25,24 @@ import android.graphics.Canvas
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.os.Build
|
||||
import android.support.v4.content.pm.ShortcutInfoCompat
|
||||
import android.support.v4.content.pm.ShortcutManagerCompat
|
||||
import android.support.v4.graphics.drawable.IconCompat
|
||||
import com.bumptech.glide.Glide
|
||||
import nl.komponents.kovenant.Promise
|
||||
import nl.komponents.kovenant.combine.and
|
||||
import nl.komponents.kovenant.then
|
||||
import nl.komponents.kovenant.ui.alwaysUi
|
||||
import nl.komponents.kovenant.ui.successUi
|
||||
import org.mariotaku.kpreferences.get
|
||||
import org.mariotaku.twidere.R
|
||||
import org.mariotaku.twidere.annotation.ImageShapeStyle
|
||||
import org.mariotaku.twidere.constant.iWantMyStarsBackKey
|
||||
import org.mariotaku.twidere.constant.nameFirstKey
|
||||
import org.mariotaku.twidere.constant.profileImageStyleKey
|
||||
import org.mariotaku.twidere.extension.dismissProgressDialog
|
||||
import org.mariotaku.twidere.extension.loadProfileImage
|
||||
import org.mariotaku.twidere.extension.showProgressDialog
|
||||
import org.mariotaku.twidere.fragment.BaseFragment
|
||||
import org.mariotaku.twidere.model.ParcelableUser
|
||||
import org.mariotaku.twidere.model.UserKey
|
||||
import org.mariotaku.twidere.util.IntentUtils
|
||||
@ -109,6 +116,20 @@ object ShortcutCreator {
|
||||
return Promise.of(builder.build())
|
||||
}
|
||||
|
||||
inline fun performCreation(fragment: BaseFragment, createPromise: () -> Promise<ShortcutInfoCompat, Exception>) {
|
||||
if (!ShortcutManagerCompat.isRequestPinShortcutSupported(fragment.context)) return
|
||||
val promise = fragment.showProgressDialog("create_shortcut")
|
||||
.and(createPromise())
|
||||
val weakThis = WeakReference(fragment)
|
||||
promise.successUi { (_, shortcut) ->
|
||||
val f = weakThis.get() ?: return@successUi
|
||||
ShortcutManagerCompat.requestPinShortcut(f.context, shortcut, null)
|
||||
}.alwaysUi {
|
||||
val f = weakThis.get() ?: return@alwaysUi
|
||||
f.dismissProgressDialog("create_shortcut")
|
||||
}
|
||||
}
|
||||
|
||||
private fun Drawable.toProfileImageIcon(context: Context): IconCompat {
|
||||
if (useAdaptiveIcon) {
|
||||
val density = context.resources.displayMetrics.density
|
||||
|
@ -45,7 +45,11 @@ class TintedStatusRelativeLayout(context: Context, attrs: AttributeSet? = null)
|
||||
override var setPaddingEnabled: Boolean = false
|
||||
|
||||
private val colorPaint: Paint
|
||||
private var statusBarHeight: Int = 0
|
||||
var statusBarHeight: Int = 0
|
||||
set(value) {
|
||||
field = value
|
||||
invalidate()
|
||||
}
|
||||
var applyWindowInsetsListener: OnApplyWindowInsetsListenerCompat? = null
|
||||
|
||||
init {
|
||||
@ -56,17 +60,21 @@ class TintedStatusRelativeLayout(context: Context, attrs: AttributeSet? = null)
|
||||
setWillNotDraw(false)
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||
ViewCompat.setOnApplyWindowInsetsListener(this) { view, insets ->
|
||||
val top = insets.systemWindowInsetTop
|
||||
val left = insets.systemWindowInsetLeft
|
||||
val right = insets.systemWindowInsetRight
|
||||
val bottom = insets.systemWindowInsetBottom
|
||||
if (setPaddingEnabled) {
|
||||
setPadding(left, top, right, bottom)
|
||||
ViewCompat.setOnApplyWindowInsetsListener(this) lambda@ { view, insets ->
|
||||
val consumed = applyWindowInsetsListener?.onApplyWindowInsets(view, insets) ?: insets
|
||||
if (!consumed.isConsumed) {
|
||||
val top = consumed.systemWindowInsetTop
|
||||
val left = consumed.systemWindowInsetLeft
|
||||
val right = consumed.systemWindowInsetRight
|
||||
val bottom = consumed.systemWindowInsetBottom
|
||||
if (setPaddingEnabled) {
|
||||
setPadding(left, top, right, bottom)
|
||||
}
|
||||
statusBarHeight = top
|
||||
return@lambda consumed
|
||||
} else {
|
||||
return@lambda consumed.consumeSystemWindowInsets()
|
||||
}
|
||||
setStatusBarHeight(top)
|
||||
applyWindowInsetsListener?.onApplyWindowInsets(view, insets)
|
||||
insets.consumeSystemWindowInsets()
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -78,11 +86,6 @@ class TintedStatusRelativeLayout(context: Context, attrs: AttributeSet? = null)
|
||||
invalidate()
|
||||
}
|
||||
|
||||
fun setStatusBarHeight(height: Int) {
|
||||
statusBarHeight = height
|
||||
invalidate()
|
||||
}
|
||||
|
||||
override fun dispatchDraw(canvas: Canvas) {
|
||||
super.dispatchDraw(canvas)
|
||||
canvas.drawRect(0f, 0f, canvas.width.toFloat(), statusBarHeight.toFloat(), colorPaint)
|
||||
|
@ -87,8 +87,28 @@
|
||||
android:icon="@drawable/ic_action_web"
|
||||
android:title="@string/action_open_in_browser"/>
|
||||
<item
|
||||
android:id="@id/add_to_home_screen"
|
||||
android:id="@+id/add_to_home_screen_submenu"
|
||||
android:icon="@drawable/ic_action_home"
|
||||
android:title="@string/action_add_to_home_screen"/>
|
||||
|
||||
android:title="@string/action_add_to_home_screen_more">
|
||||
<menu>
|
||||
<item
|
||||
android:id="@+id/add_user_to_home_screen"
|
||||
android:icon="@drawable/ic_action_user"
|
||||
android:title="@string/title_user"/>
|
||||
<item
|
||||
android:id="@+id/add_statuses_to_home_screen"
|
||||
android:icon="@drawable/ic_action_quote"
|
||||
android:title="@string/title_statuses"/>
|
||||
<item
|
||||
android:id="@+id/add_media_to_home_screen"
|
||||
android:enabled="@bool/debug"
|
||||
android:icon="@drawable/ic_action_gallery"
|
||||
android:title="@string/title_media_timeline"
|
||||
android:visible="@bool/debug"/>
|
||||
<item
|
||||
android:id="@+id/add_favorites_to_home_screen"
|
||||
android:icon="@drawable/ic_action_star"
|
||||
android:title="@string/title_favorites"/>
|
||||
</menu>
|
||||
</item>
|
||||
</menu>
|
@ -21,9 +21,12 @@
|
||||
<string name="action_add_gif">Add GIF</string>
|
||||
<string name="action_add_media">Add media</string>
|
||||
<string name="action_add_member">Add member</string>
|
||||
<string name="action_add_name_to_home_screen">Add <xliff:g example="Name" id="name">%1$s</xliff:g> to home screen</string>
|
||||
<string name="action_add_tab_to_home_screen">Add tab to home screen</string>
|
||||
<string name="action_add_tab">Add tab</string>
|
||||
<string name="action_add_to_filter">Add to filter</string>
|
||||
<string name="action_add_to_home_screen">Add to home screen</string>
|
||||
<string name="action_add_to_home_screen_more">Add to home screen…</string>
|
||||
<string name="action_add_to_list">Add to list</string>
|
||||
<!-- [verb] Action for blocking user -->
|
||||
<string name="action_block">Block</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user