diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/activity/shortcut/CreateQuickAccessShortcutActivity.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/activity/shortcut/CreateQuickAccessShortcutActivity.kt index a3810eb3d..af59449d8 100644 --- a/twidere/src/main/kotlin/org/mariotaku/twidere/activity/shortcut/CreateQuickAccessShortcutActivity.kt +++ b/twidere/src/main/kotlin/org/mariotaku/twidere/activity/shortcut/CreateQuickAccessShortcutActivity.kt @@ -23,12 +23,11 @@ import android.app.Activity import android.app.Dialog import android.content.DialogInterface import android.content.Intent -import android.graphics.Bitmap -import android.graphics.Canvas import android.os.Bundle +import android.support.v4.content.pm.ShortcutManagerCompat import android.support.v7.app.AlertDialog -import com.bumptech.glide.Glide import nl.komponents.kovenant.combine.and +import nl.komponents.kovenant.ui.alwaysUi import nl.komponents.kovenant.ui.failUi import nl.komponents.kovenant.ui.successUi import org.mariotaku.kpreferences.get @@ -41,17 +40,16 @@ import org.mariotaku.twidere.activity.BaseActivity import org.mariotaku.twidere.activity.UserListSelectorActivity import org.mariotaku.twidere.activity.UserSelectorActivity import org.mariotaku.twidere.constant.nameFirstKey -import org.mariotaku.twidere.constant.profileImageStyleKey import org.mariotaku.twidere.extension.applyOnShow import org.mariotaku.twidere.extension.applyTheme -import org.mariotaku.twidere.extension.loadProfileImage +import org.mariotaku.twidere.extension.dismissProgressDialog +import org.mariotaku.twidere.extension.showProgressDialog import org.mariotaku.twidere.fragment.BaseDialogFragment -import org.mariotaku.twidere.fragment.ProgressDialogFragment import org.mariotaku.twidere.model.ParcelableUser import org.mariotaku.twidere.model.ParcelableUserList import org.mariotaku.twidere.model.UserKey import org.mariotaku.twidere.util.IntentUtils -import org.mariotaku.twidere.util.glide.DeferredTarget +import org.mariotaku.twidere.util.shortcut.ShortcutCreator import java.lang.ref.WeakReference class CreateQuickAccessShortcutActivity : BaseActivity() { @@ -159,32 +157,21 @@ class CreateQuickAccessShortcutActivity : BaseActivity() { finish() } else -> { - val displayName = userColorNameManager.getDisplayName(user, preferences[nameFirstKey]) - val deferred = Glide.with(this).loadProfileImage(this, user, - shapeStyle = preferences[profileImageStyleKey], cornerRadiusRatio = 0.1f, - size = getString(R.string.profile_image_size)).into(DeferredTarget()) val weakThis = WeakReference(this) - executeAfterFragmentResumed { - ProgressDialogFragment.show(it.supportFragmentManager, TAG_LOAD_ICON_PROGRESS) - } and deferred.promise.successUi { drawable -> + val promise = showProgressDialog(TAG_LOAD_ICON_PROGRESS) + .and(ShortcutCreator.userShortcut(this, user.account_key, user)) + promise.successUi { (_, shortcut) -> val activity = weakThis.get() ?: return@successUi - val launchIntent = IntentUtils.userProfile(accountKey, user.key, - user.screen_name, profileUrl = user.extras?.statusnet_profile_url) - val icon = Bitmap.createBitmap(drawable.intrinsicWidth, - drawable.intrinsicHeight, Bitmap.Config.ARGB_8888) - val canvas = Canvas(icon) - drawable.setBounds(0, 0, icon.width, icon.height) - drawable.draw(canvas) - activity.setResult(Activity.RESULT_OK, Intent().apply { - putExtra(Intent.EXTRA_SHORTCUT_INTENT, launchIntent) - putExtra(Intent.EXTRA_SHORTCUT_ICON, icon) - putExtra(Intent.EXTRA_SHORTCUT_NAME, displayName) - }) + activity.setResult(Activity.RESULT_OK, + ShortcutManagerCompat.createShortcutResultIntent(activity, shortcut)) activity.finish() }.failUi { val activity = weakThis.get() ?: return@failUi activity.setResult(Activity.RESULT_CANCELED) activity.finish() + }.alwaysUi { + val activity = weakThis.get() ?: return@alwaysUi + activity.dismissProgressDialog(TAG_LOAD_ICON_PROGRESS) } } } @@ -246,5 +233,6 @@ class CreateQuickAccessShortcutActivity : BaseActivity() { companion object { private const val TAG_LOAD_ICON_PROGRESS = "load_icon_progress" + } } diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/extension/IBaseActivityExtensions.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/extension/IBaseActivityExtensions.kt new file mode 100644 index 000000000..8c8ae67b0 --- /dev/null +++ b/twidere/src/main/kotlin/org/mariotaku/twidere/extension/IBaseActivityExtensions.kt @@ -0,0 +1,41 @@ +/* + * Twidere - Twitter client for Android + * + * Copyright (C) 2012-2017 Mariotaku Lee + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package org.mariotaku.twidere.extension + +import android.support.v4.app.FragmentActivity +import nl.komponents.kovenant.Promise +import org.mariotaku.ktextension.dismissDialogFragment +import org.mariotaku.twidere.activity.iface.IBaseActivity +import org.mariotaku.twidere.fragment.ProgressDialogFragment + +/** + * Created by mariotaku on 2017/8/23. + */ +fun IBaseActivity.showProgressDialog(tag: String): Promise { + return executeAfterFragmentResumed { + ProgressDialogFragment.show(it.supportFragmentManager, tag) + } +} + +fun IBaseActivity.dismissProgressDialog(tag: String): Promise { + return executeAfterFragmentResumed { + it.supportFragmentManager.dismissDialogFragment(tag) + } +} \ No newline at end of file diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/extension/IBaseFragmentExtensions.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/extension/IBaseFragmentExtensions.kt new file mode 100644 index 000000000..7d698a3f1 --- /dev/null +++ b/twidere/src/main/kotlin/org/mariotaku/twidere/extension/IBaseFragmentExtensions.kt @@ -0,0 +1,41 @@ +/* + * Twidere - Twitter client for Android + * + * Copyright (C) 2012-2017 Mariotaku Lee + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package org.mariotaku.twidere.extension + +import android.support.v4.app.Fragment +import nl.komponents.kovenant.Promise +import org.mariotaku.ktextension.dismissDialogFragment +import org.mariotaku.twidere.fragment.ProgressDialogFragment +import org.mariotaku.twidere.fragment.iface.IBaseFragment + +/** + * Created by mariotaku on 2017/8/23. + */ +fun IBaseFragment.showProgressDialog(tag: String): Promise { + return executeAfterFragmentResumed { + ProgressDialogFragment.show(it.childFragmentManager, tag) + } +} + +fun IBaseFragment.dismissProgressDialog(tag: String): Promise { + return executeAfterFragmentResumed { + it.childFragmentManager.dismissDialogFragment(tag) + } +} \ No newline at end of file diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/UserFragment.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/UserFragment.kt index 8f7f3c1b8..48ec19971 100644 --- a/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/UserFragment.kt +++ b/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/UserFragment.kt @@ -53,6 +53,7 @@ import android.support.v4.app.LoaderManager.LoaderCallbacks import android.support.v4.content.ContextCompat import android.support.v4.content.FixedAsyncTaskLoader import android.support.v4.content.Loader +import android.support.v4.content.pm.ShortcutManagerCompat import android.support.v4.content.res.ResourcesCompat import android.support.v4.graphics.ColorUtils import android.support.v4.view.OnApplyWindowInsetsListener @@ -80,6 +81,7 @@ 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 @@ -140,6 +142,7 @@ import org.mariotaku.twidere.util.TwidereLinkify.OnLinkClickListener import org.mariotaku.twidere.util.UserColorNameManager.UserColorChangedListener import org.mariotaku.twidere.util.UserColorNameManager.UserNicknameChangedListener import org.mariotaku.twidere.util.menu.TwidereMenuInfo +import org.mariotaku.twidere.util.shortcut.ShortcutCreator import org.mariotaku.twidere.util.support.ActivitySupport import org.mariotaku.twidere.util.support.ActivitySupport.TaskDescriptionCompat import org.mariotaku.twidere.util.support.ViewSupport @@ -678,16 +681,16 @@ class UserFragment : BaseFragment(), OnClickListener, OnLinkClickListener, userFragmentView.windowInsetsListener = OnApplyWindowInsetsListener listener@ { _, insets -> val top = insets.systemWindowInsetTop - profileContentContainer.setPadding(0, top, 0, 0) - profileBannerSpace.statusBarHeight = top + profileContentContainer.setPadding(0, top, 0, 0) + profileBannerSpace.statusBarHeight = top - if (profileBannerSpace.toolbarHeight == 0) { - var toolbarHeight = toolbar.measuredHeight - if (toolbarHeight == 0) { - toolbarHeight = ThemeUtils.getActionBarHeight(context) - } - profileBannerSpace.toolbarHeight = toolbarHeight + if (profileBannerSpace.toolbarHeight == 0) { + var toolbarHeight = toolbar.measuredHeight + if (toolbarHeight == 0) { + toolbarHeight = ThemeUtils.getActionBarHeight(context) } + profileBannerSpace.toolbarHeight = toolbarHeight + } return@listener insets } @@ -802,6 +805,9 @@ 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, + ShortcutManagerCompat.isRequestPinShortcutSupported(context)) + var canAddToList = false var canMute = false var canReportSpam = false @@ -1033,9 +1039,22 @@ 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.userShortcut(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) + } + } else -> { val intent = item.intent - if (intent != null && intent.resolveActivity(context.packageManager) != null) { + if (intent?.resolveActivity(context.packageManager) != null) { startActivity(intent) } } @@ -1590,7 +1609,7 @@ class UserFragment : BaseFragment(), OnClickListener, OnLinkClickListener, do { val resp = microBlog.getUserListOwnerships(paging) resp.mapTo(ownedLists) { item -> - val userList = item.toParcelable( user.account_key) + val userList = item.toParcelable(user.account_key) userList.is_user_inside = listMemberships.any { it.id == item.id } return@mapTo userList } @@ -1836,12 +1855,13 @@ class UserFragment : BaseFragment(), OnClickListener, OnLinkClickListener, private val LOADER_ID_USER = 1 private val LOADER_ID_FRIENDSHIP = 2 - private val TAB_POSITION_STATUSES = 0 - private val TAB_POSITION_MEDIA = 1 - private val TAB_POSITION_FAVORITES = 2 - private val TAB_TYPE_STATUSES = "statuses" - private val TAB_TYPE_STATUSES_WITH_REPLIES = "statuses_with_replies" - private val TAB_TYPE_MEDIA = "media" - private val TAB_TYPE_FAVORITES = "favorites" + private const val TAB_POSITION_STATUSES = 0 + private const val TAB_POSITION_MEDIA = 1 + private const val TAB_POSITION_FAVORITES = 2 + private const val TAB_TYPE_STATUSES = "statuses" + 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" } } diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/util/shortcut/ShortcutCreator.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/util/shortcut/ShortcutCreator.kt new file mode 100644 index 000000000..e39e23a74 --- /dev/null +++ b/twidere/src/main/kotlin/org/mariotaku/twidere/util/shortcut/ShortcutCreator.kt @@ -0,0 +1,106 @@ +/* + * Twidere - Twitter client for Android + * + * Copyright (C) 2012-2017 Mariotaku Lee + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package org.mariotaku.twidere.util.shortcut + +import android.content.Context +import android.graphics.Bitmap +import android.graphics.Canvas +import android.graphics.drawable.Drawable +import android.os.Build +import android.support.v4.content.pm.ShortcutInfoCompat +import android.support.v4.graphics.drawable.IconCompat +import com.bumptech.glide.Glide +import nl.komponents.kovenant.Promise +import nl.komponents.kovenant.then +import org.mariotaku.kpreferences.get +import org.mariotaku.twidere.R +import org.mariotaku.twidere.annotation.ImageShapeStyle +import org.mariotaku.twidere.constant.nameFirstKey +import org.mariotaku.twidere.constant.profileImageStyleKey +import org.mariotaku.twidere.extension.loadProfileImage +import org.mariotaku.twidere.model.ParcelableUser +import org.mariotaku.twidere.model.UserKey +import org.mariotaku.twidere.util.IntentUtils +import org.mariotaku.twidere.util.dagger.DependencyHolder +import org.mariotaku.twidere.util.glide.DeferredTarget +import java.lang.ref.WeakReference + +/** + * Created by mariotaku on 2017/8/23. + */ +object ShortcutCreator { + + private val useAdaptiveIcon = Build.VERSION.SDK_INT >= Build.VERSION_CODES.O + private const val adaptiveIconSizeDp = 108 + private const val adaptiveIconOuterSidesDp = 18 + + fun userShortcut(context: Context, accountKey: UserKey?, user: ParcelableUser): Promise { + val holder = DependencyHolder.get(context) + val preferences = holder.preferences + val userColorNameManager = holder.userColorNameManager + + + val profileImageStyle = if (useAdaptiveIcon) ImageShapeStyle.SHAPE_RECTANGLE else preferences[profileImageStyleKey] + val profileImageCornerRadiusRatio = if (useAdaptiveIcon) 0f else 0.1f + + val deferred = Glide.with(context).loadProfileImage(context, user, + shapeStyle = profileImageStyle, cornerRadiusRatio = profileImageCornerRadiusRatio, + size = context.getString(R.string.profile_image_size)).into(DeferredTarget()) + + val weakContext = WeakReference(context) + return deferred.promise.then { drawable -> + val ctx = weakContext.get() ?: throw InterruptedException() + val builder = ShortcutInfoCompat.Builder(ctx, "user-shortcut-$accountKey-${user.key}") + builder.setIcon(drawable.toProfileImageIcon(ctx)) + builder.setShortLabel(userColorNameManager.getDisplayName(user, preferences[nameFirstKey])) + val launchIntent = IntentUtils.userProfile(accountKey, user.key, + user.screen_name, profileUrl = user.extras?.statusnet_profile_url) + builder.setIntent(launchIntent) + return@then builder.build() + } + } + + private fun Drawable.toProfileImageIcon(context: Context): IconCompat { + if (useAdaptiveIcon) { + val density = context.resources.displayMetrics.density + val adaptiveIconSize = Math.round(adaptiveIconSizeDp * density) + val adaptiveIconOuterSides = Math.round(adaptiveIconOuterSidesDp * density) + + val bitmap = Bitmap.createBitmap(adaptiveIconSize, adaptiveIconSize, + Bitmap.Config.ARGB_8888) + val canvas = Canvas(bitmap) + + setBounds(adaptiveIconOuterSides, adaptiveIconOuterSides, + adaptiveIconSize - adaptiveIconOuterSides, + adaptiveIconSize - adaptiveIconOuterSides) + draw(canvas) + + return IconCompat.createWithAdaptiveBitmap(bitmap) + } else { + val bitmap = Bitmap.createBitmap(intrinsicWidth, intrinsicHeight, Bitmap.Config.ARGB_8888) + val canvas = Canvas(bitmap) + setBounds(0, 0, bitmap.width, bitmap.height) + draw(canvas) + + return IconCompat.createWithBitmap(bitmap) + } + } + +} \ No newline at end of file diff --git a/twidere/src/main/res/menu/menu_user_profile.xml b/twidere/src/main/res/menu/menu_user_profile.xml index db88e0530..c2bb04196 100644 --- a/twidere/src/main/res/menu/menu_user_profile.xml +++ b/twidere/src/main/res/menu/menu_user_profile.xml @@ -86,5 +86,9 @@ android:id="@id/open_in_browser" android:icon="@drawable/ic_action_web" android:title="@string/action_open_in_browser"/> + \ No newline at end of file diff --git a/twidere/src/main/res/mipmap-anydpi-v26/ic_shortcut_camera.xml b/twidere/src/main/res/mipmap-anydpi-v26/ic_shortcut_camera.xml new file mode 100644 index 000000000..6d8114bad --- /dev/null +++ b/twidere/src/main/res/mipmap-anydpi-v26/ic_shortcut_camera.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/twidere/src/main/res/mipmap-anydpi-v26/ic_shortcut_compose.xml b/twidere/src/main/res/mipmap-anydpi-v26/ic_shortcut_compose.xml new file mode 100644 index 000000000..d7b2434e1 --- /dev/null +++ b/twidere/src/main/res/mipmap-anydpi-v26/ic_shortcut_compose.xml @@ -0,0 +1,24 @@ + + + + + + + \ No newline at end of file diff --git a/twidere/src/main/res/mipmap-hdpi/ic_shortcut_adaptive_background.png b/twidere/src/main/res/mipmap-hdpi/ic_shortcut_adaptive_background.png new file mode 100644 index 000000000..6f18b5ca7 Binary files /dev/null and b/twidere/src/main/res/mipmap-hdpi/ic_shortcut_adaptive_background.png differ diff --git a/twidere/src/main/res/mipmap-hdpi/ic_shortcut_camera.png b/twidere/src/main/res/mipmap-hdpi/ic_shortcut_camera.png new file mode 100644 index 000000000..a4e0871fa Binary files /dev/null and b/twidere/src/main/res/mipmap-hdpi/ic_shortcut_camera.png differ diff --git a/twidere/src/main/res/mipmap-hdpi/ic_shortcut_camera_adaptive_foreground.png b/twidere/src/main/res/mipmap-hdpi/ic_shortcut_camera_adaptive_foreground.png new file mode 100644 index 000000000..b464c6a29 Binary files /dev/null and b/twidere/src/main/res/mipmap-hdpi/ic_shortcut_camera_adaptive_foreground.png differ diff --git a/twidere/src/main/res/mipmap-hdpi/ic_shortcut_camera_round.png b/twidere/src/main/res/mipmap-hdpi/ic_shortcut_camera_round.png new file mode 100644 index 000000000..23ceb9826 Binary files /dev/null and b/twidere/src/main/res/mipmap-hdpi/ic_shortcut_camera_round.png differ diff --git a/twidere/src/main/res/mipmap-hdpi/ic_shortcut_compose.png b/twidere/src/main/res/mipmap-hdpi/ic_shortcut_compose.png new file mode 100644 index 000000000..46b305e79 Binary files /dev/null and b/twidere/src/main/res/mipmap-hdpi/ic_shortcut_compose.png differ diff --git a/twidere/src/main/res/mipmap-hdpi/ic_shortcut_compose_adaptive_foreground.png b/twidere/src/main/res/mipmap-hdpi/ic_shortcut_compose_adaptive_foreground.png new file mode 100644 index 000000000..d1b165e71 Binary files /dev/null and b/twidere/src/main/res/mipmap-hdpi/ic_shortcut_compose_adaptive_foreground.png differ diff --git a/twidere/src/main/res/mipmap-hdpi/ic_shortcut_compose_round.png b/twidere/src/main/res/mipmap-hdpi/ic_shortcut_compose_round.png new file mode 100644 index 000000000..abe7c0fac Binary files /dev/null and b/twidere/src/main/res/mipmap-hdpi/ic_shortcut_compose_round.png differ diff --git a/twidere/src/main/res/mipmap-mdpi/ic_shortcut_adaptive_background.png b/twidere/src/main/res/mipmap-mdpi/ic_shortcut_adaptive_background.png new file mode 100644 index 000000000..933ec4569 Binary files /dev/null and b/twidere/src/main/res/mipmap-mdpi/ic_shortcut_adaptive_background.png differ diff --git a/twidere/src/main/res/mipmap-mdpi/ic_shortcut_camera.png b/twidere/src/main/res/mipmap-mdpi/ic_shortcut_camera.png new file mode 100644 index 000000000..7ae9ca3f4 Binary files /dev/null and b/twidere/src/main/res/mipmap-mdpi/ic_shortcut_camera.png differ diff --git a/twidere/src/main/res/mipmap-mdpi/ic_shortcut_camera_adaptive_foreground.png b/twidere/src/main/res/mipmap-mdpi/ic_shortcut_camera_adaptive_foreground.png new file mode 100644 index 000000000..71a97474b Binary files /dev/null and b/twidere/src/main/res/mipmap-mdpi/ic_shortcut_camera_adaptive_foreground.png differ diff --git a/twidere/src/main/res/mipmap-mdpi/ic_shortcut_camera_round.png b/twidere/src/main/res/mipmap-mdpi/ic_shortcut_camera_round.png new file mode 100644 index 000000000..36a8e90bb Binary files /dev/null and b/twidere/src/main/res/mipmap-mdpi/ic_shortcut_camera_round.png differ diff --git a/twidere/src/main/res/mipmap-mdpi/ic_shortcut_compose.png b/twidere/src/main/res/mipmap-mdpi/ic_shortcut_compose.png new file mode 100644 index 000000000..b616dfa73 Binary files /dev/null and b/twidere/src/main/res/mipmap-mdpi/ic_shortcut_compose.png differ diff --git a/twidere/src/main/res/mipmap-mdpi/ic_shortcut_compose_adaptive_foreground.png b/twidere/src/main/res/mipmap-mdpi/ic_shortcut_compose_adaptive_foreground.png new file mode 100644 index 000000000..d3cbfa80a Binary files /dev/null and b/twidere/src/main/res/mipmap-mdpi/ic_shortcut_compose_adaptive_foreground.png differ diff --git a/twidere/src/main/res/mipmap-mdpi/ic_shortcut_compose_round.png b/twidere/src/main/res/mipmap-mdpi/ic_shortcut_compose_round.png new file mode 100644 index 000000000..8eb2d9335 Binary files /dev/null and b/twidere/src/main/res/mipmap-mdpi/ic_shortcut_compose_round.png differ diff --git a/twidere/src/main/res/mipmap-xhdpi/ic_shortcut_adaptive_background.png b/twidere/src/main/res/mipmap-xhdpi/ic_shortcut_adaptive_background.png new file mode 100644 index 000000000..d0de366e4 Binary files /dev/null and b/twidere/src/main/res/mipmap-xhdpi/ic_shortcut_adaptive_background.png differ diff --git a/twidere/src/main/res/mipmap-xhdpi/ic_shortcut_camera.png b/twidere/src/main/res/mipmap-xhdpi/ic_shortcut_camera.png new file mode 100644 index 000000000..9a119c186 Binary files /dev/null and b/twidere/src/main/res/mipmap-xhdpi/ic_shortcut_camera.png differ diff --git a/twidere/src/main/res/mipmap-xhdpi/ic_shortcut_camera_adaptive_foreground.png b/twidere/src/main/res/mipmap-xhdpi/ic_shortcut_camera_adaptive_foreground.png new file mode 100644 index 000000000..56397ecb1 Binary files /dev/null and b/twidere/src/main/res/mipmap-xhdpi/ic_shortcut_camera_adaptive_foreground.png differ diff --git a/twidere/src/main/res/mipmap-xhdpi/ic_shortcut_camera_round.png b/twidere/src/main/res/mipmap-xhdpi/ic_shortcut_camera_round.png new file mode 100644 index 000000000..ef5f6c7c8 Binary files /dev/null and b/twidere/src/main/res/mipmap-xhdpi/ic_shortcut_camera_round.png differ diff --git a/twidere/src/main/res/mipmap-xhdpi/ic_shortcut_compose.png b/twidere/src/main/res/mipmap-xhdpi/ic_shortcut_compose.png new file mode 100644 index 000000000..0978fe538 Binary files /dev/null and b/twidere/src/main/res/mipmap-xhdpi/ic_shortcut_compose.png differ diff --git a/twidere/src/main/res/mipmap-xhdpi/ic_shortcut_compose_adaptive_foreground.png b/twidere/src/main/res/mipmap-xhdpi/ic_shortcut_compose_adaptive_foreground.png new file mode 100644 index 000000000..dc8686ea7 Binary files /dev/null and b/twidere/src/main/res/mipmap-xhdpi/ic_shortcut_compose_adaptive_foreground.png differ diff --git a/twidere/src/main/res/mipmap-xhdpi/ic_shortcut_compose_round.png b/twidere/src/main/res/mipmap-xhdpi/ic_shortcut_compose_round.png new file mode 100644 index 000000000..723151413 Binary files /dev/null and b/twidere/src/main/res/mipmap-xhdpi/ic_shortcut_compose_round.png differ diff --git a/twidere/src/main/res/mipmap-xxhdpi/ic_shortcut_adaptive_background.png b/twidere/src/main/res/mipmap-xxhdpi/ic_shortcut_adaptive_background.png new file mode 100644 index 000000000..c9201df42 Binary files /dev/null and b/twidere/src/main/res/mipmap-xxhdpi/ic_shortcut_adaptive_background.png differ diff --git a/twidere/src/main/res/mipmap-xxhdpi/ic_shortcut_camera.png b/twidere/src/main/res/mipmap-xxhdpi/ic_shortcut_camera.png new file mode 100644 index 000000000..d39697c9c Binary files /dev/null and b/twidere/src/main/res/mipmap-xxhdpi/ic_shortcut_camera.png differ diff --git a/twidere/src/main/res/mipmap-xxhdpi/ic_shortcut_camera_adaptive_foreground.png b/twidere/src/main/res/mipmap-xxhdpi/ic_shortcut_camera_adaptive_foreground.png new file mode 100644 index 000000000..d42345439 Binary files /dev/null and b/twidere/src/main/res/mipmap-xxhdpi/ic_shortcut_camera_adaptive_foreground.png differ diff --git a/twidere/src/main/res/mipmap-xxhdpi/ic_shortcut_camera_round.png b/twidere/src/main/res/mipmap-xxhdpi/ic_shortcut_camera_round.png new file mode 100644 index 000000000..ea8839d0d Binary files /dev/null and b/twidere/src/main/res/mipmap-xxhdpi/ic_shortcut_camera_round.png differ diff --git a/twidere/src/main/res/mipmap-xxhdpi/ic_shortcut_compose.png b/twidere/src/main/res/mipmap-xxhdpi/ic_shortcut_compose.png new file mode 100644 index 000000000..6df3ee1c9 Binary files /dev/null and b/twidere/src/main/res/mipmap-xxhdpi/ic_shortcut_compose.png differ diff --git a/twidere/src/main/res/mipmap-xxhdpi/ic_shortcut_compose_adaptive_foreground.png b/twidere/src/main/res/mipmap-xxhdpi/ic_shortcut_compose_adaptive_foreground.png new file mode 100644 index 000000000..1ef0c3547 Binary files /dev/null and b/twidere/src/main/res/mipmap-xxhdpi/ic_shortcut_compose_adaptive_foreground.png differ diff --git a/twidere/src/main/res/mipmap-xxhdpi/ic_shortcut_compose_round.png b/twidere/src/main/res/mipmap-xxhdpi/ic_shortcut_compose_round.png new file mode 100644 index 000000000..46f651c0e Binary files /dev/null and b/twidere/src/main/res/mipmap-xxhdpi/ic_shortcut_compose_round.png differ diff --git a/twidere/src/main/res/mipmap-xxxhdpi/ic_shortcut_adaptive_background.png b/twidere/src/main/res/mipmap-xxxhdpi/ic_shortcut_adaptive_background.png new file mode 100644 index 000000000..64c940b31 Binary files /dev/null and b/twidere/src/main/res/mipmap-xxxhdpi/ic_shortcut_adaptive_background.png differ diff --git a/twidere/src/main/res/mipmap-xxxhdpi/ic_shortcut_camera.png b/twidere/src/main/res/mipmap-xxxhdpi/ic_shortcut_camera.png new file mode 100644 index 000000000..241066cdb Binary files /dev/null and b/twidere/src/main/res/mipmap-xxxhdpi/ic_shortcut_camera.png differ diff --git a/twidere/src/main/res/mipmap-xxxhdpi/ic_shortcut_camera_adaptive_foreground.png b/twidere/src/main/res/mipmap-xxxhdpi/ic_shortcut_camera_adaptive_foreground.png new file mode 100644 index 000000000..35b5667d2 Binary files /dev/null and b/twidere/src/main/res/mipmap-xxxhdpi/ic_shortcut_camera_adaptive_foreground.png differ diff --git a/twidere/src/main/res/mipmap-xxxhdpi/ic_shortcut_camera_round.png b/twidere/src/main/res/mipmap-xxxhdpi/ic_shortcut_camera_round.png new file mode 100644 index 000000000..d71123bb2 Binary files /dev/null and b/twidere/src/main/res/mipmap-xxxhdpi/ic_shortcut_camera_round.png differ diff --git a/twidere/src/main/res/mipmap-xxxhdpi/ic_shortcut_compose.png b/twidere/src/main/res/mipmap-xxxhdpi/ic_shortcut_compose.png new file mode 100644 index 000000000..765a2ad0f Binary files /dev/null and b/twidere/src/main/res/mipmap-xxxhdpi/ic_shortcut_compose.png differ diff --git a/twidere/src/main/res/mipmap-xxxhdpi/ic_shortcut_compose_adaptive_foreground.png b/twidere/src/main/res/mipmap-xxxhdpi/ic_shortcut_compose_adaptive_foreground.png new file mode 100644 index 000000000..123169fb7 Binary files /dev/null and b/twidere/src/main/res/mipmap-xxxhdpi/ic_shortcut_compose_adaptive_foreground.png differ diff --git a/twidere/src/main/res/mipmap-xxxhdpi/ic_shortcut_compose_round.png b/twidere/src/main/res/mipmap-xxxhdpi/ic_shortcut_compose_round.png new file mode 100644 index 000000000..a541c6a9b Binary files /dev/null and b/twidere/src/main/res/mipmap-xxxhdpi/ic_shortcut_compose_round.png differ diff --git a/twidere/src/main/res/values/ids.xml b/twidere/src/main/res/values/ids.xml index e9e0978ea..1a25998bd 100644 --- a/twidere/src/main/res/values/ids.xml +++ b/twidere/src/main/res/values/ids.xml @@ -84,4 +84,5 @@ + \ No newline at end of file diff --git a/twidere/src/main/res/values/strings.xml b/twidere/src/main/res/values/strings.xml index d9fc083a7..5f721e211 100644 --- a/twidere/src/main/res/values/strings.xml +++ b/twidere/src/main/res/values/strings.xml @@ -23,6 +23,7 @@ Add member Add tab Add to filter + Add to home screen Add to list Block diff --git a/twidere/src/main/res/xml/compose_shortcuts.xml b/twidere/src/main/res/xml/compose_shortcuts.xml index 1dc526124..9b7ee547b 100644 --- a/twidere/src/main/res/xml/compose_shortcuts.xml +++ b/twidere/src/main/res/xml/compose_shortcuts.xml @@ -5,7 +5,7 @@ tools:targetApi="n_mr1"> @@ -16,7 +16,7 @@ diff --git a/twidere/src/main/svg/drawable/ic_app_shortcut_camera-mdpi.svg b/twidere/src/main/svg/drawable/ic_app_shortcut_camera-mdpi.svg deleted file mode 100644 index cc2f41ccb..000000000 --- a/twidere/src/main/svg/drawable/ic_app_shortcut_camera-mdpi.svg +++ /dev/null @@ -1,16 +0,0 @@ - - - - ic_app_shortcut_camera-mdpi - Created with Sketch. - - - - - - - - - - - \ No newline at end of file diff --git a/twidere/src/main/svg/drawable/ic_app_shortcut_compose-mdpi.svg b/twidere/src/main/svg/drawable/ic_app_shortcut_compose-mdpi.svg deleted file mode 100644 index e558638b7..000000000 --- a/twidere/src/main/svg/drawable/ic_app_shortcut_compose-mdpi.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - ic_app_shortcut_compose-mdpi - Created with Sketch. - - - - - - - - \ No newline at end of file