diff --git a/twidere/src/main/AndroidManifest.xml b/twidere/src/main/AndroidManifest.xml index 8eb8fa2c6..c0c5466fc 100644 --- a/twidere/src/main/AndroidManifest.xml +++ b/twidere/src/main/AndroidManifest.xml @@ -390,7 +390,7 @@ + + + + + + + + + + + + + + diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/activity/shortcut/AbsShortcutCreatorActivity.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/activity/shortcut/AbsShortcutCreatorActivity.kt new file mode 100644 index 000000000..2eea60674 --- /dev/null +++ b/twidere/src/main/kotlin/org/mariotaku/twidere/activity/shortcut/AbsShortcutCreatorActivity.kt @@ -0,0 +1,98 @@ +/* + * 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.activity.shortcut + +import android.app.Activity +import android.content.Intent +import android.os.Bundle +import android.support.v4.content.pm.ShortcutInfoCompat +import android.support.v4.content.pm.ShortcutManagerCompat +import nl.komponents.kovenant.Promise +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.twidere.TwidereConstants.* +import org.mariotaku.twidere.activity.AccountSelectorActivity +import org.mariotaku.twidere.activity.BaseActivity +import org.mariotaku.twidere.extension.dismissProgressDialog +import org.mariotaku.twidere.extension.showProgressDialog +import org.mariotaku.twidere.model.UserKey +import java.lang.ref.WeakReference + +abstract class AbsShortcutCreatorActivity : BaseActivity() { + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + if (savedInstanceState != null) return + selectAccount() + } + + override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { + when (requestCode) { + REQUEST_SELECT_ACCOUNT -> { + if (resultCode != Activity.RESULT_OK || data == null) { + setResult(Activity.RESULT_CANCELED) + finish() + return + } + val extras = data.getBundleExtra(EXTRA_EXTRAS) + val accountKey = data.getParcelableExtra(EXTRA_ACCOUNT_KEY) ?: run { + setResult(Activity.RESULT_CANCELED) + finish() + return + } + onAccountSelected(accountKey, extras) + } + } + } + + + protected abstract fun onAccountSelected(accountKey: UserKey, extras: Bundle?) + + protected fun selectAccount() { + val selectAccountIntent = Intent(this, AccountSelectorActivity::class.java) + startActivityForResult(selectAccountIntent, REQUEST_SELECT_ACCOUNT) + } + + protected fun addShortcut(task: () -> Promise) { + val weakThis = WeakReference(this) + val promise = showProgressDialog(TAG_PROCESS_SHORTCUT_PROGRESS) + .and(task()) + promise.successUi { (_, shortcut) -> + val activity = weakThis.get() ?: return@successUi + 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_PROCESS_SHORTCUT_PROGRESS) + } + } + + companion object { + private const val TAG_PROCESS_SHORTCUT_PROGRESS = "process_shortcut_progress" + + } +} diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/activity/shortcut/AbsUserListRelatedShortcutCreatorActivity.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/activity/shortcut/AbsUserListRelatedShortcutCreatorActivity.kt new file mode 100644 index 000000000..c5f8f8504 --- /dev/null +++ b/twidere/src/main/kotlin/org/mariotaku/twidere/activity/shortcut/AbsUserListRelatedShortcutCreatorActivity.kt @@ -0,0 +1,72 @@ +/* + * 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.activity.shortcut + +import android.app.Activity +import android.content.Intent +import android.os.Bundle +import org.mariotaku.ktextension.Bundle +import org.mariotaku.ktextension.set +import org.mariotaku.twidere.TwidereConstants.* +import org.mariotaku.twidere.activity.UserListSelectorActivity +import org.mariotaku.twidere.model.ParcelableUserList +import org.mariotaku.twidere.model.UserKey + +/** + * Created by mariotaku on 2017/8/26. + */ +abstract class AbsUserListRelatedShortcutCreatorActivity : AbsShortcutCreatorActivity() { + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + + } + + override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { + when (requestCode) { + REQUEST_SELECT_USER_LIST -> { + if (resultCode != Activity.RESULT_OK || data == null) { + setResult(Activity.RESULT_CANCELED) + finish() + return + } + val list = data.getParcelableExtra(EXTRA_USER_LIST) + val extras = data.getBundleExtra(EXTRA_EXTRAS) + val accountKey = extras.getParcelable(EXTRA_ACCOUNT_KEY) + onUserListSelected(accountKey, list) + } + else -> { + super.onActivityResult(requestCode, resultCode, data) + } + } + } + + override final fun onAccountSelected(accountKey: UserKey, extras: Bundle?) { + val selectUserListIntent = Intent(this, UserListSelectorActivity::class.java) + selectUserListIntent.putExtra(EXTRA_ACCOUNT_KEY, accountKey) + selectUserListIntent.putExtra(EXTRA_SHOW_MY_LISTS, true) + selectUserListIntent.putExtra(EXTRA_EXTRAS, Bundle { + this[EXTRA_ACCOUNT_KEY] = accountKey + }) + startActivityForResult(selectUserListIntent, REQUEST_SELECT_USER_LIST) + } + + protected abstract fun onUserListSelected(accountKey: UserKey?, userList: ParcelableUserList) +} \ No newline at end of file diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/activity/shortcut/AbsUserRelatedShortcutCreatorActivity.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/activity/shortcut/AbsUserRelatedShortcutCreatorActivity.kt new file mode 100644 index 000000000..c4b3d7f25 --- /dev/null +++ b/twidere/src/main/kotlin/org/mariotaku/twidere/activity/shortcut/AbsUserRelatedShortcutCreatorActivity.kt @@ -0,0 +1,66 @@ +/* + * 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.activity.shortcut + +import android.app.Activity +import android.content.Intent +import android.os.Bundle +import org.mariotaku.ktextension.Bundle +import org.mariotaku.ktextension.set +import org.mariotaku.twidere.TwidereConstants.* +import org.mariotaku.twidere.activity.UserSelectorActivity +import org.mariotaku.twidere.model.ParcelableUser +import org.mariotaku.twidere.model.UserKey + +/** + * Created by mariotaku on 2017/8/26. + */ +abstract class AbsUserRelatedShortcutCreatorActivity : AbsShortcutCreatorActivity() { + + override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { + when (requestCode) { + REQUEST_SELECT_USER -> { + if (resultCode != Activity.RESULT_OK || data == null) { + setResult(Activity.RESULT_CANCELED) + finish() + return + } + val user = data.getParcelableExtra(EXTRA_USER) + val extras = data.getBundleExtra(EXTRA_EXTRAS) + val accountKey = extras.getParcelable(EXTRA_ACCOUNT_KEY) + onUserSelected(accountKey, user) + } + else -> { + super.onActivityResult(requestCode, resultCode, data) + } + } + } + + override final fun onAccountSelected(accountKey: UserKey, extras: Bundle?) { + val selectUserIntent = Intent(this, UserSelectorActivity::class.java) + selectUserIntent.putExtra(EXTRA_ACCOUNT_KEY, accountKey) + selectUserIntent.putExtra(EXTRA_EXTRAS, Bundle { + this[EXTRA_ACCOUNT_KEY] = accountKey + }) + startActivityForResult(selectUserIntent, REQUEST_SELECT_USER) + } + + protected abstract fun onUserSelected(accountKey: UserKey?, user: ParcelableUser) +} \ No newline at end of file diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/activity/shortcut/CreateComposeShortcutActivity.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/activity/shortcut/ComposeShortcutCreatorActivity.kt similarity index 97% rename from twidere/src/main/kotlin/org/mariotaku/twidere/activity/shortcut/CreateComposeShortcutActivity.kt rename to twidere/src/main/kotlin/org/mariotaku/twidere/activity/shortcut/ComposeShortcutCreatorActivity.kt index ffe2dd906..25528d46b 100644 --- a/twidere/src/main/kotlin/org/mariotaku/twidere/activity/shortcut/CreateComposeShortcutActivity.kt +++ b/twidere/src/main/kotlin/org/mariotaku/twidere/activity/shortcut/ComposeShortcutCreatorActivity.kt @@ -29,7 +29,7 @@ import org.mariotaku.twidere.BuildConfig import org.mariotaku.twidere.R import org.mariotaku.twidere.constant.IntentConstants.INTENT_ACTION_COMPOSE -class CreateComposeShortcutActivity : Activity() { +class ComposeShortcutCreatorActivity : Activity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) 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 deleted file mode 100644 index af59449d8..000000000 --- a/twidere/src/main/kotlin/org/mariotaku/twidere/activity/shortcut/CreateQuickAccessShortcutActivity.kt +++ /dev/null @@ -1,238 +0,0 @@ -/* - * 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.activity.shortcut - -import android.app.Activity -import android.app.Dialog -import android.content.DialogInterface -import android.content.Intent -import android.os.Bundle -import android.support.v4.content.pm.ShortcutManagerCompat -import android.support.v7.app.AlertDialog -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 -import org.mariotaku.ktextension.Bundle -import org.mariotaku.ktextension.set -import org.mariotaku.twidere.R -import org.mariotaku.twidere.TwidereConstants.* -import org.mariotaku.twidere.activity.AccountSelectorActivity -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.extension.applyOnShow -import org.mariotaku.twidere.extension.applyTheme -import org.mariotaku.twidere.extension.dismissProgressDialog -import org.mariotaku.twidere.extension.showProgressDialog -import org.mariotaku.twidere.fragment.BaseDialogFragment -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.shortcut.ShortcutCreator -import java.lang.ref.WeakReference - -class CreateQuickAccessShortcutActivity : BaseActivity() { - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - if (savedInstanceState == null) { - val df = QuickAccessShortcutTypeDialogFragment() - df.show(supportFragmentManager, "quick_access_shortcut_type") - } - } - - - override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { - when (requestCode) { - REQUEST_SELECT_ACCOUNT -> { - if (resultCode != Activity.RESULT_OK || data == null) { - setResult(Activity.RESULT_CANCELED) - finish() - return - } - val actionType = data.getBundleExtra(EXTRA_EXTRAS)?.getString(EXTRA_TYPE) - val accountKey = data.getParcelableExtra(EXTRA_ACCOUNT_KEY) ?: run { - setResult(Activity.RESULT_CANCELED) - finish() - return - } - when (actionType) { - "user", "user_timeline", "user_favorites" -> { - val selectUserIntent = Intent(this, UserSelectorActivity::class.java) - selectUserIntent.putExtra(EXTRA_ACCOUNT_KEY, accountKey) - selectUserIntent.putExtra(EXTRA_EXTRAS, Bundle { - this[EXTRA_TYPE] = actionType - this[EXTRA_ACCOUNT_KEY] = accountKey - }) - startActivityForResult(selectUserIntent, REQUEST_SELECT_USER) - } - "list", "list_timeline" -> { - val selectUserListIntent = Intent(this, UserListSelectorActivity::class.java) - selectUserListIntent.putExtra(EXTRA_ACCOUNT_KEY, accountKey) - selectUserListIntent.putExtra(EXTRA_SHOW_MY_LISTS, true) - selectUserListIntent.putExtra(EXTRA_EXTRAS, Bundle { - this[EXTRA_TYPE] = actionType - this[EXTRA_ACCOUNT_KEY] = accountKey - }) - startActivityForResult(selectUserListIntent, REQUEST_SELECT_USER_LIST) - } - else -> { - setResult(Activity.RESULT_CANCELED) - finish() - } - } - } - REQUEST_SELECT_USER -> { - if (resultCode != Activity.RESULT_OK || data == null) { - setResult(Activity.RESULT_CANCELED) - finish() - return - } - val user = data.getParcelableExtra(EXTRA_USER) - val extras = data.getBundleExtra(EXTRA_EXTRAS) - val accountKey = extras.getParcelable(EXTRA_ACCOUNT_KEY) - val actionType = extras.getString(EXTRA_TYPE) - addUserRelatedShortcut(actionType, accountKey, user) - } - REQUEST_SELECT_USER_LIST -> { - if (resultCode != Activity.RESULT_OK || data == null) { - setResult(Activity.RESULT_CANCELED) - finish() - return - } - val list = data.getParcelableExtra(EXTRA_USER_LIST) - val extras = data.getBundleExtra(EXTRA_EXTRAS) - val accountKey = extras.getParcelable(EXTRA_ACCOUNT_KEY) - val actionType = extras.getString(EXTRA_TYPE) - addUserListRelatedShortcut(actionType, accountKey, list) - } - } - } - - private fun addUserRelatedShortcut(actionType: String?, accountKey: UserKey?, user: ParcelableUser) { - when (actionType) { - "user_timeline" -> { - val launchIntent = IntentUtils.userTimeline(accountKey, user.key, - user.screen_name, profileUrl = user.extras?.statusnet_profile_url) - val icon = Intent.ShortcutIconResource.fromContext(this, R.mipmap.ic_launcher) - setResult(Activity.RESULT_OK, Intent().apply { - putExtra(Intent.EXTRA_SHORTCUT_INTENT, launchIntent) - putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, icon) - putExtra(Intent.EXTRA_SHORTCUT_NAME, userColorNameManager.getDisplayName(user, - preferences[nameFirstKey])) - }) - finish() - } - "user_favorites" -> { - val launchIntent = IntentUtils.userTimeline(accountKey, user.key, - user.screen_name, profileUrl = user.extras?.statusnet_profile_url) - val icon = Intent.ShortcutIconResource.fromContext(this, R.mipmap.ic_launcher) - setResult(Activity.RESULT_OK, Intent().apply { - putExtra(Intent.EXTRA_SHORTCUT_INTENT, launchIntent) - putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, icon) - putExtra(Intent.EXTRA_SHORTCUT_NAME, userColorNameManager.getDisplayName(user, - preferences[nameFirstKey])) - }) - finish() - } - else -> { - val weakThis = WeakReference(this) - val promise = showProgressDialog(TAG_LOAD_ICON_PROGRESS) - .and(ShortcutCreator.userShortcut(this, user.account_key, user)) - promise.successUi { (_, shortcut) -> - val activity = weakThis.get() ?: return@successUi - 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) - } - } - } - } - - private fun addUserListRelatedShortcut(actionType: String?, accountKey: UserKey?, list: ParcelableUserList) { - when (actionType) { - "list_timeline" -> { - val launchIntent = IntentUtils.userListTimeline(accountKey, list.id, - list.user_key, list.user_screen_name, list.name) - val icon = Intent.ShortcutIconResource.fromContext(this, R.mipmap.ic_launcher) - setResult(Activity.RESULT_OK, Intent().apply { - putExtra(Intent.EXTRA_SHORTCUT_INTENT, launchIntent) - putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, icon) - putExtra(Intent.EXTRA_SHORTCUT_NAME, list.name) - }) - } - else -> { - val launchIntent = IntentUtils.userListDetails(accountKey, list.id, - list.user_key, list.user_screen_name, list.name) - val icon = Intent.ShortcutIconResource.fromContext(this, R.mipmap.ic_launcher) - setResult(Activity.RESULT_OK, Intent().apply { - putExtra(Intent.EXTRA_SHORTCUT_INTENT, launchIntent) - putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, icon) - putExtra(Intent.EXTRA_SHORTCUT_NAME, list.name) - }) - } - } - finish() - } - - private fun onItemSelected(which: Int) { - val actionType = resources.getStringArray(R.array.values_quick_access_shortcut_types)[which] - val selectAccountIntent = Intent(this, AccountSelectorActivity::class.java) - selectAccountIntent.putExtra(EXTRA_EXTRAS, Bundle { - this[EXTRA_TYPE] = actionType - }) - if (actionType == "list") { - selectAccountIntent.putExtra(EXTRA_ACCOUNT_HOST, USER_TYPE_TWITTER_COM) - } - startActivityForResult(selectAccountIntent, REQUEST_SELECT_ACCOUNT) - } - - class QuickAccessShortcutTypeDialogFragment : BaseDialogFragment() { - override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { - val builder = AlertDialog.Builder(context) - builder.setItems(R.array.entries_quick_access_shortcut_types) { _, which -> - (activity as CreateQuickAccessShortcutActivity).onItemSelected(which) - } - return builder.create().apply { - applyOnShow { applyTheme() } - } - } - - override fun onCancel(dialog: DialogInterface?) { - activity?.finish() - } - } - - companion object { - private const val TAG_LOAD_ICON_PROGRESS = "load_icon_progress" - - } -} diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/activity/shortcut/UserFavoritesShortcutCreatorActivity.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/activity/shortcut/UserFavoritesShortcutCreatorActivity.kt new file mode 100644 index 000000000..60374a355 --- /dev/null +++ b/twidere/src/main/kotlin/org/mariotaku/twidere/activity/shortcut/UserFavoritesShortcutCreatorActivity.kt @@ -0,0 +1,36 @@ +/* + * 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.activity.shortcut + +import org.mariotaku.twidere.model.ParcelableUser +import org.mariotaku.twidere.model.UserKey +import org.mariotaku.twidere.util.shortcut.ShortcutCreator + +/** + * Created by mariotaku on 2017/8/27. + */ + +class UserFavoritesShortcutCreatorActivity : AbsUserRelatedShortcutCreatorActivity() { + + override fun onUserSelected(accountKey: UserKey?, user: ParcelableUser) { + addShortcut { ShortcutCreator.userFavorites(this, accountKey, user) } + } + +} diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/activity/shortcut/UserShortcutCreatorActivity.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/activity/shortcut/UserShortcutCreatorActivity.kt new file mode 100644 index 000000000..5393450ea --- /dev/null +++ b/twidere/src/main/kotlin/org/mariotaku/twidere/activity/shortcut/UserShortcutCreatorActivity.kt @@ -0,0 +1,36 @@ +/* + * 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.activity.shortcut + +import org.mariotaku.twidere.model.ParcelableUser +import org.mariotaku.twidere.model.UserKey +import org.mariotaku.twidere.util.shortcut.ShortcutCreator + +/** + * Created by mariotaku on 2017/8/27. + */ + +class UserShortcutCreatorActivity : AbsUserRelatedShortcutCreatorActivity() { + + override fun onUserSelected(accountKey: UserKey?, user: ParcelableUser) { + addShortcut { ShortcutCreator.user(this, accountKey, user) } + } + +} \ No newline at end of file diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/activity/shortcut/UserTimelineShortcutCreatorActivity.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/activity/shortcut/UserTimelineShortcutCreatorActivity.kt new file mode 100644 index 000000000..dd158bfa7 --- /dev/null +++ b/twidere/src/main/kotlin/org/mariotaku/twidere/activity/shortcut/UserTimelineShortcutCreatorActivity.kt @@ -0,0 +1,36 @@ +/* + * 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.activity.shortcut + +import org.mariotaku.twidere.model.ParcelableUser +import org.mariotaku.twidere.model.UserKey +import org.mariotaku.twidere.util.shortcut.ShortcutCreator + +/** + * Created by mariotaku on 2017/8/27. + */ + +class UserTimelineShortcutCreatorActivity : AbsUserRelatedShortcutCreatorActivity() { + + override fun onUserSelected(accountKey: UserKey?, user: ParcelableUser) { + addShortcut { ShortcutCreator.userTimeline(this, accountKey, user) } + } + +} \ 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 48ec19971..64289d536 100644 --- a/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/UserFragment.kt +++ b/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/UserFragment.kt @@ -1042,7 +1042,7 @@ class UserFragment : BaseFragment(), OnClickListener, OnLinkClickListener, 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)) + .and(ShortcutCreator.user(context, user.account_key, user)) val weakThis = WeakReference(this) promise.successUi { (_, shortcut) -> val fragment = weakThis.get() ?: return@successUi 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 index e39e23a74..06308154b 100644 --- a/twidere/src/main/kotlin/org/mariotaku/twidere/util/shortcut/ShortcutCreator.kt +++ b/twidere/src/main/kotlin/org/mariotaku/twidere/util/shortcut/ShortcutCreator.kt @@ -32,6 +32,7 @@ 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.iWantMyStarsBackKey import org.mariotaku.twidere.constant.nameFirstKey import org.mariotaku.twidere.constant.profileImageStyleKey import org.mariotaku.twidere.extension.loadProfileImage @@ -51,12 +52,11 @@ object ShortcutCreator { private const val adaptiveIconSizeDp = 108 private const val adaptiveIconOuterSidesDp = 18 - fun userShortcut(context: Context, accountKey: UserKey?, user: ParcelableUser): Promise { + fun user(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 @@ -67,7 +67,7 @@ object ShortcutCreator { 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}") + val builder = ShortcutInfoCompat.Builder(ctx, "$accountKey:user:${user.key}") builder.setIcon(drawable.toProfileImageIcon(ctx)) builder.setShortLabel(userColorNameManager.getDisplayName(user, preferences[nameFirstKey])) val launchIntent = IntentUtils.userProfile(accountKey, user.key, @@ -77,6 +77,38 @@ object ShortcutCreator { } } + fun userFavorites(context: Context, accountKey: UserKey?, user: ParcelableUser): Promise { + val holder = DependencyHolder.get(context) + val preferences = holder.preferences + val userColorNameManager = holder.userColorNameManager + + val launchIntent = IntentUtils.userFavorites(accountKey, user.key, + user.screen_name, profileUrl = user.extras?.statusnet_profile_url) + val builder = ShortcutInfoCompat.Builder(context, "$accountKey:user-favorites:${user.key}") + builder.setIntent(launchIntent) + builder.setShortLabel(userColorNameManager.getDisplayName(user, preferences[nameFirstKey])) + if (preferences[iWantMyStarsBackKey]) { + builder.setIcon(IconCompat.createWithResource(context, R.mipmap.ic_shortcut_favorite)) + } else { + builder.setIcon(IconCompat.createWithResource(context, R.mipmap.ic_shortcut_like)) + } + return Promise.of(builder.build()) + } + + fun userTimeline(context: Context, accountKey: UserKey?, user: ParcelableUser): Promise { + val holder = DependencyHolder.get(context) + val preferences = holder.preferences + val userColorNameManager = holder.userColorNameManager + + val launchIntent = IntentUtils.userTimeline(accountKey, user.key, + user.screen_name, profileUrl = user.extras?.statusnet_profile_url) + val builder = ShortcutInfoCompat.Builder(context, "$accountKey:user-timeline:${user.key}") + builder.setIntent(launchIntent) + builder.setShortLabel(userColorNameManager.getDisplayName(user, preferences[nameFirstKey])) + builder.setIcon(IconCompat.createWithResource(context, R.mipmap.ic_shortcut_quote)) + return Promise.of(builder.build()) + } + private fun Drawable.toProfileImageIcon(context: Context): IconCompat { if (useAdaptiveIcon) { val density = context.resources.displayMetrics.density diff --git a/twidere/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/twidere/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml deleted file mode 100644 index 3ac62c8f5..000000000 --- a/twidere/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ 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 index 6d8114bad..f2c63ae1d 100644 --- a/twidere/src/main/res/mipmap-anydpi-v26/ic_shortcut_camera.xml +++ b/twidere/src/main/res/mipmap-anydpi-v26/ic_shortcut_camera.xml @@ -1,5 +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 index d7b2434e1..34596d553 100644 --- a/twidere/src/main/res/mipmap-anydpi-v26/ic_shortcut_compose.xml +++ b/twidere/src/main/res/mipmap-anydpi-v26/ic_shortcut_compose.xml @@ -19,6 +19,6 @@ --> - + \ No newline at end of file diff --git a/twidere/src/main/res/mipmap-anydpi-v26/ic_shortcut_favorite.xml b/twidere/src/main/res/mipmap-anydpi-v26/ic_shortcut_favorite.xml new file mode 100644 index 000000000..179faa3da --- /dev/null +++ b/twidere/src/main/res/mipmap-anydpi-v26/ic_shortcut_favorite.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/twidere/src/main/res/mipmap-anydpi-v26/ic_shortcut_like.xml b/twidere/src/main/res/mipmap-anydpi-v26/ic_shortcut_like.xml new file mode 100644 index 000000000..69f9b4d8f --- /dev/null +++ b/twidere/src/main/res/mipmap-anydpi-v26/ic_shortcut_like.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/twidere/src/main/res/mipmap-anydpi-v26/ic_shortcut_quote.xml b/twidere/src/main/res/mipmap-anydpi-v26/ic_shortcut_quote.xml new file mode 100644 index 000000000..decdbabb2 --- /dev/null +++ b/twidere/src/main/res/mipmap-anydpi-v26/ic_shortcut_quote.xml @@ -0,0 +1,24 @@ + + + + + + + \ No newline at end of file diff --git a/twidere/src/main/res/mipmap-anydpi-v26/ic_shortcut_user.xml b/twidere/src/main/res/mipmap-anydpi-v26/ic_shortcut_user.xml new file mode 100644 index 000000000..6e6d658ef --- /dev/null +++ b/twidere/src/main/res/mipmap-anydpi-v26/ic_shortcut_user.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 deleted file mode 100644 index 6f18b5ca7..000000000 Binary files a/twidere/src/main/res/mipmap-hdpi/ic_shortcut_adaptive_background.png and /dev/null differ diff --git a/twidere/src/main/res/mipmap-hdpi/ic_shortcut_favorite.png b/twidere/src/main/res/mipmap-hdpi/ic_shortcut_favorite.png new file mode 100644 index 000000000..229b41d76 Binary files /dev/null and b/twidere/src/main/res/mipmap-hdpi/ic_shortcut_favorite.png differ diff --git a/twidere/src/main/res/mipmap-hdpi/ic_shortcut_favorite_adaptive_foreground.png b/twidere/src/main/res/mipmap-hdpi/ic_shortcut_favorite_adaptive_foreground.png new file mode 100644 index 000000000..e81405bff Binary files /dev/null and b/twidere/src/main/res/mipmap-hdpi/ic_shortcut_favorite_adaptive_foreground.png differ diff --git a/twidere/src/main/res/mipmap-hdpi/ic_shortcut_favorite_round.png b/twidere/src/main/res/mipmap-hdpi/ic_shortcut_favorite_round.png new file mode 100644 index 000000000..155349a6f Binary files /dev/null and b/twidere/src/main/res/mipmap-hdpi/ic_shortcut_favorite_round.png differ diff --git a/twidere/src/main/res/mipmap-hdpi/ic_shortcut_like.png b/twidere/src/main/res/mipmap-hdpi/ic_shortcut_like.png new file mode 100644 index 000000000..f65f470aa Binary files /dev/null and b/twidere/src/main/res/mipmap-hdpi/ic_shortcut_like.png differ diff --git a/twidere/src/main/res/mipmap-hdpi/ic_shortcut_like_adaptive_foreground.png b/twidere/src/main/res/mipmap-hdpi/ic_shortcut_like_adaptive_foreground.png new file mode 100644 index 000000000..ba7646e6b Binary files /dev/null and b/twidere/src/main/res/mipmap-hdpi/ic_shortcut_like_adaptive_foreground.png differ diff --git a/twidere/src/main/res/mipmap-hdpi/ic_shortcut_like_round.png b/twidere/src/main/res/mipmap-hdpi/ic_shortcut_like_round.png new file mode 100644 index 000000000..831654562 Binary files /dev/null and b/twidere/src/main/res/mipmap-hdpi/ic_shortcut_like_round.png differ diff --git a/twidere/src/main/res/mipmap-hdpi/ic_shortcut_quote.png b/twidere/src/main/res/mipmap-hdpi/ic_shortcut_quote.png new file mode 100644 index 000000000..2b77585f6 Binary files /dev/null and b/twidere/src/main/res/mipmap-hdpi/ic_shortcut_quote.png differ diff --git a/twidere/src/main/res/mipmap-hdpi/ic_shortcut_quote_adaptive_foreground.png b/twidere/src/main/res/mipmap-hdpi/ic_shortcut_quote_adaptive_foreground.png new file mode 100644 index 000000000..66c64810f Binary files /dev/null and b/twidere/src/main/res/mipmap-hdpi/ic_shortcut_quote_adaptive_foreground.png differ diff --git a/twidere/src/main/res/mipmap-hdpi/ic_shortcut_quote_round.png b/twidere/src/main/res/mipmap-hdpi/ic_shortcut_quote_round.png new file mode 100644 index 000000000..bd837cd60 Binary files /dev/null and b/twidere/src/main/res/mipmap-hdpi/ic_shortcut_quote_round.png differ diff --git a/twidere/src/main/res/mipmap-hdpi/ic_shortcut_user.png b/twidere/src/main/res/mipmap-hdpi/ic_shortcut_user.png new file mode 100644 index 000000000..294e0c9bd Binary files /dev/null and b/twidere/src/main/res/mipmap-hdpi/ic_shortcut_user.png differ diff --git a/twidere/src/main/res/mipmap-hdpi/ic_shortcut_user_adaptive_foreground.png b/twidere/src/main/res/mipmap-hdpi/ic_shortcut_user_adaptive_foreground.png new file mode 100644 index 000000000..cacc86d55 Binary files /dev/null and b/twidere/src/main/res/mipmap-hdpi/ic_shortcut_user_adaptive_foreground.png differ diff --git a/twidere/src/main/res/mipmap-hdpi/ic_shortcut_user_round.png b/twidere/src/main/res/mipmap-hdpi/ic_shortcut_user_round.png new file mode 100644 index 000000000..9d9618907 Binary files /dev/null and b/twidere/src/main/res/mipmap-hdpi/ic_shortcut_user_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 deleted file mode 100644 index 933ec4569..000000000 Binary files a/twidere/src/main/res/mipmap-mdpi/ic_shortcut_adaptive_background.png and /dev/null differ diff --git a/twidere/src/main/res/mipmap-mdpi/ic_shortcut_favorite.png b/twidere/src/main/res/mipmap-mdpi/ic_shortcut_favorite.png new file mode 100644 index 000000000..85d18b7d4 Binary files /dev/null and b/twidere/src/main/res/mipmap-mdpi/ic_shortcut_favorite.png differ diff --git a/twidere/src/main/res/mipmap-mdpi/ic_shortcut_favorite_adaptive_foreground.png b/twidere/src/main/res/mipmap-mdpi/ic_shortcut_favorite_adaptive_foreground.png new file mode 100644 index 000000000..9f2dff969 Binary files /dev/null and b/twidere/src/main/res/mipmap-mdpi/ic_shortcut_favorite_adaptive_foreground.png differ diff --git a/twidere/src/main/res/mipmap-mdpi/ic_shortcut_favorite_round.png b/twidere/src/main/res/mipmap-mdpi/ic_shortcut_favorite_round.png new file mode 100644 index 000000000..0d6f430b7 Binary files /dev/null and b/twidere/src/main/res/mipmap-mdpi/ic_shortcut_favorite_round.png differ diff --git a/twidere/src/main/res/mipmap-mdpi/ic_shortcut_like.png b/twidere/src/main/res/mipmap-mdpi/ic_shortcut_like.png new file mode 100644 index 000000000..dab830551 Binary files /dev/null and b/twidere/src/main/res/mipmap-mdpi/ic_shortcut_like.png differ diff --git a/twidere/src/main/res/mipmap-mdpi/ic_shortcut_like_adaptive_foreground.png b/twidere/src/main/res/mipmap-mdpi/ic_shortcut_like_adaptive_foreground.png new file mode 100644 index 000000000..b9a7abdbe Binary files /dev/null and b/twidere/src/main/res/mipmap-mdpi/ic_shortcut_like_adaptive_foreground.png differ diff --git a/twidere/src/main/res/mipmap-mdpi/ic_shortcut_like_round.png b/twidere/src/main/res/mipmap-mdpi/ic_shortcut_like_round.png new file mode 100644 index 000000000..c9792a400 Binary files /dev/null and b/twidere/src/main/res/mipmap-mdpi/ic_shortcut_like_round.png differ diff --git a/twidere/src/main/res/mipmap-mdpi/ic_shortcut_quote.png b/twidere/src/main/res/mipmap-mdpi/ic_shortcut_quote.png new file mode 100644 index 000000000..a5ea1dc45 Binary files /dev/null and b/twidere/src/main/res/mipmap-mdpi/ic_shortcut_quote.png differ diff --git a/twidere/src/main/res/mipmap-mdpi/ic_shortcut_quote_adaptive_foreground.png b/twidere/src/main/res/mipmap-mdpi/ic_shortcut_quote_adaptive_foreground.png new file mode 100644 index 000000000..1e853ac44 Binary files /dev/null and b/twidere/src/main/res/mipmap-mdpi/ic_shortcut_quote_adaptive_foreground.png differ diff --git a/twidere/src/main/res/mipmap-mdpi/ic_shortcut_quote_round.png b/twidere/src/main/res/mipmap-mdpi/ic_shortcut_quote_round.png new file mode 100644 index 000000000..0437c8c5b Binary files /dev/null and b/twidere/src/main/res/mipmap-mdpi/ic_shortcut_quote_round.png differ diff --git a/twidere/src/main/res/mipmap-mdpi/ic_shortcut_user.png b/twidere/src/main/res/mipmap-mdpi/ic_shortcut_user.png new file mode 100644 index 000000000..b285f1a57 Binary files /dev/null and b/twidere/src/main/res/mipmap-mdpi/ic_shortcut_user.png differ diff --git a/twidere/src/main/res/mipmap-mdpi/ic_shortcut_user_adaptive_foreground.png b/twidere/src/main/res/mipmap-mdpi/ic_shortcut_user_adaptive_foreground.png new file mode 100644 index 000000000..8c8df0d05 Binary files /dev/null and b/twidere/src/main/res/mipmap-mdpi/ic_shortcut_user_adaptive_foreground.png differ diff --git a/twidere/src/main/res/mipmap-mdpi/ic_shortcut_user_round.png b/twidere/src/main/res/mipmap-mdpi/ic_shortcut_user_round.png new file mode 100644 index 000000000..e9721552b Binary files /dev/null and b/twidere/src/main/res/mipmap-mdpi/ic_shortcut_user_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 deleted file mode 100644 index d0de366e4..000000000 Binary files a/twidere/src/main/res/mipmap-xhdpi/ic_shortcut_adaptive_background.png and /dev/null differ diff --git a/twidere/src/main/res/mipmap-xhdpi/ic_shortcut_favorite.png b/twidere/src/main/res/mipmap-xhdpi/ic_shortcut_favorite.png new file mode 100644 index 000000000..4d1565732 Binary files /dev/null and b/twidere/src/main/res/mipmap-xhdpi/ic_shortcut_favorite.png differ diff --git a/twidere/src/main/res/mipmap-xhdpi/ic_shortcut_favorite_adaptive_foreground.png b/twidere/src/main/res/mipmap-xhdpi/ic_shortcut_favorite_adaptive_foreground.png new file mode 100644 index 000000000..308dfbbb4 Binary files /dev/null and b/twidere/src/main/res/mipmap-xhdpi/ic_shortcut_favorite_adaptive_foreground.png differ diff --git a/twidere/src/main/res/mipmap-xhdpi/ic_shortcut_favorite_round.png b/twidere/src/main/res/mipmap-xhdpi/ic_shortcut_favorite_round.png new file mode 100644 index 000000000..3d9a3b4be Binary files /dev/null and b/twidere/src/main/res/mipmap-xhdpi/ic_shortcut_favorite_round.png differ diff --git a/twidere/src/main/res/mipmap-xhdpi/ic_shortcut_like.png b/twidere/src/main/res/mipmap-xhdpi/ic_shortcut_like.png new file mode 100644 index 000000000..7c1466123 Binary files /dev/null and b/twidere/src/main/res/mipmap-xhdpi/ic_shortcut_like.png differ diff --git a/twidere/src/main/res/mipmap-xhdpi/ic_shortcut_like_adaptive_foreground.png b/twidere/src/main/res/mipmap-xhdpi/ic_shortcut_like_adaptive_foreground.png new file mode 100644 index 000000000..d7e36a5ae Binary files /dev/null and b/twidere/src/main/res/mipmap-xhdpi/ic_shortcut_like_adaptive_foreground.png differ diff --git a/twidere/src/main/res/mipmap-xhdpi/ic_shortcut_like_round.png b/twidere/src/main/res/mipmap-xhdpi/ic_shortcut_like_round.png new file mode 100644 index 000000000..eb40435ea Binary files /dev/null and b/twidere/src/main/res/mipmap-xhdpi/ic_shortcut_like_round.png differ diff --git a/twidere/src/main/res/mipmap-xhdpi/ic_shortcut_quote.png b/twidere/src/main/res/mipmap-xhdpi/ic_shortcut_quote.png new file mode 100644 index 000000000..a4a0ef50e Binary files /dev/null and b/twidere/src/main/res/mipmap-xhdpi/ic_shortcut_quote.png differ diff --git a/twidere/src/main/res/mipmap-xhdpi/ic_shortcut_quote_adaptive_foreground.png b/twidere/src/main/res/mipmap-xhdpi/ic_shortcut_quote_adaptive_foreground.png new file mode 100644 index 000000000..baa219793 Binary files /dev/null and b/twidere/src/main/res/mipmap-xhdpi/ic_shortcut_quote_adaptive_foreground.png differ diff --git a/twidere/src/main/res/mipmap-xhdpi/ic_shortcut_quote_round.png b/twidere/src/main/res/mipmap-xhdpi/ic_shortcut_quote_round.png new file mode 100644 index 000000000..ccc713713 Binary files /dev/null and b/twidere/src/main/res/mipmap-xhdpi/ic_shortcut_quote_round.png differ diff --git a/twidere/src/main/res/mipmap-xhdpi/ic_shortcut_user.png b/twidere/src/main/res/mipmap-xhdpi/ic_shortcut_user.png new file mode 100644 index 000000000..825c54e26 Binary files /dev/null and b/twidere/src/main/res/mipmap-xhdpi/ic_shortcut_user.png differ diff --git a/twidere/src/main/res/mipmap-xhdpi/ic_shortcut_user_adaptive_foreground.png b/twidere/src/main/res/mipmap-xhdpi/ic_shortcut_user_adaptive_foreground.png new file mode 100644 index 000000000..5c400a4c2 Binary files /dev/null and b/twidere/src/main/res/mipmap-xhdpi/ic_shortcut_user_adaptive_foreground.png differ diff --git a/twidere/src/main/res/mipmap-xhdpi/ic_shortcut_user_round.png b/twidere/src/main/res/mipmap-xhdpi/ic_shortcut_user_round.png new file mode 100644 index 000000000..397049331 Binary files /dev/null and b/twidere/src/main/res/mipmap-xhdpi/ic_shortcut_user_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 deleted file mode 100644 index c9201df42..000000000 Binary files a/twidere/src/main/res/mipmap-xxhdpi/ic_shortcut_adaptive_background.png and /dev/null differ diff --git a/twidere/src/main/res/mipmap-xxhdpi/ic_shortcut_favorite.png b/twidere/src/main/res/mipmap-xxhdpi/ic_shortcut_favorite.png new file mode 100644 index 000000000..e1a99ec32 Binary files /dev/null and b/twidere/src/main/res/mipmap-xxhdpi/ic_shortcut_favorite.png differ diff --git a/twidere/src/main/res/mipmap-xxhdpi/ic_shortcut_favorite_adaptive_foreground.png b/twidere/src/main/res/mipmap-xxhdpi/ic_shortcut_favorite_adaptive_foreground.png new file mode 100644 index 000000000..8da12d31b Binary files /dev/null and b/twidere/src/main/res/mipmap-xxhdpi/ic_shortcut_favorite_adaptive_foreground.png differ diff --git a/twidere/src/main/res/mipmap-xxhdpi/ic_shortcut_favorite_round.png b/twidere/src/main/res/mipmap-xxhdpi/ic_shortcut_favorite_round.png new file mode 100644 index 000000000..d99cfeb81 Binary files /dev/null and b/twidere/src/main/res/mipmap-xxhdpi/ic_shortcut_favorite_round.png differ diff --git a/twidere/src/main/res/mipmap-xxhdpi/ic_shortcut_like.png b/twidere/src/main/res/mipmap-xxhdpi/ic_shortcut_like.png new file mode 100644 index 000000000..3be5fcbd1 Binary files /dev/null and b/twidere/src/main/res/mipmap-xxhdpi/ic_shortcut_like.png differ diff --git a/twidere/src/main/res/mipmap-xxhdpi/ic_shortcut_like_adaptive_foreground.png b/twidere/src/main/res/mipmap-xxhdpi/ic_shortcut_like_adaptive_foreground.png new file mode 100644 index 000000000..2fab3f6db Binary files /dev/null and b/twidere/src/main/res/mipmap-xxhdpi/ic_shortcut_like_adaptive_foreground.png differ diff --git a/twidere/src/main/res/mipmap-xxhdpi/ic_shortcut_like_round.png b/twidere/src/main/res/mipmap-xxhdpi/ic_shortcut_like_round.png new file mode 100644 index 000000000..6852e610e Binary files /dev/null and b/twidere/src/main/res/mipmap-xxhdpi/ic_shortcut_like_round.png differ diff --git a/twidere/src/main/res/mipmap-xxhdpi/ic_shortcut_quote.png b/twidere/src/main/res/mipmap-xxhdpi/ic_shortcut_quote.png new file mode 100644 index 000000000..a6f7991f2 Binary files /dev/null and b/twidere/src/main/res/mipmap-xxhdpi/ic_shortcut_quote.png differ diff --git a/twidere/src/main/res/mipmap-xxhdpi/ic_shortcut_quote_adaptive_foreground.png b/twidere/src/main/res/mipmap-xxhdpi/ic_shortcut_quote_adaptive_foreground.png new file mode 100644 index 000000000..d2b2f3ca9 Binary files /dev/null and b/twidere/src/main/res/mipmap-xxhdpi/ic_shortcut_quote_adaptive_foreground.png differ diff --git a/twidere/src/main/res/mipmap-xxhdpi/ic_shortcut_quote_round.png b/twidere/src/main/res/mipmap-xxhdpi/ic_shortcut_quote_round.png new file mode 100644 index 000000000..15250aeb5 Binary files /dev/null and b/twidere/src/main/res/mipmap-xxhdpi/ic_shortcut_quote_round.png differ diff --git a/twidere/src/main/res/mipmap-xxhdpi/ic_shortcut_user.png b/twidere/src/main/res/mipmap-xxhdpi/ic_shortcut_user.png new file mode 100644 index 000000000..ce992d211 Binary files /dev/null and b/twidere/src/main/res/mipmap-xxhdpi/ic_shortcut_user.png differ diff --git a/twidere/src/main/res/mipmap-xxhdpi/ic_shortcut_user_adaptive_foreground.png b/twidere/src/main/res/mipmap-xxhdpi/ic_shortcut_user_adaptive_foreground.png new file mode 100644 index 000000000..37b6f5409 Binary files /dev/null and b/twidere/src/main/res/mipmap-xxhdpi/ic_shortcut_user_adaptive_foreground.png differ diff --git a/twidere/src/main/res/mipmap-xxhdpi/ic_shortcut_user_round.png b/twidere/src/main/res/mipmap-xxhdpi/ic_shortcut_user_round.png new file mode 100644 index 000000000..107811b76 Binary files /dev/null and b/twidere/src/main/res/mipmap-xxhdpi/ic_shortcut_user_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 deleted file mode 100644 index 64c940b31..000000000 Binary files a/twidere/src/main/res/mipmap-xxxhdpi/ic_shortcut_adaptive_background.png and /dev/null differ diff --git a/twidere/src/main/res/mipmap-xxxhdpi/ic_shortcut_favorite.png b/twidere/src/main/res/mipmap-xxxhdpi/ic_shortcut_favorite.png new file mode 100644 index 000000000..cd6a94116 Binary files /dev/null and b/twidere/src/main/res/mipmap-xxxhdpi/ic_shortcut_favorite.png differ diff --git a/twidere/src/main/res/mipmap-xxxhdpi/ic_shortcut_favorite_adaptive_foreground.png b/twidere/src/main/res/mipmap-xxxhdpi/ic_shortcut_favorite_adaptive_foreground.png new file mode 100644 index 000000000..fa5a49b24 Binary files /dev/null and b/twidere/src/main/res/mipmap-xxxhdpi/ic_shortcut_favorite_adaptive_foreground.png differ diff --git a/twidere/src/main/res/mipmap-xxxhdpi/ic_shortcut_favorite_round.png b/twidere/src/main/res/mipmap-xxxhdpi/ic_shortcut_favorite_round.png new file mode 100644 index 000000000..22e9a96eb Binary files /dev/null and b/twidere/src/main/res/mipmap-xxxhdpi/ic_shortcut_favorite_round.png differ diff --git a/twidere/src/main/res/mipmap-xxxhdpi/ic_shortcut_like.png b/twidere/src/main/res/mipmap-xxxhdpi/ic_shortcut_like.png new file mode 100644 index 000000000..f459e4aa3 Binary files /dev/null and b/twidere/src/main/res/mipmap-xxxhdpi/ic_shortcut_like.png differ diff --git a/twidere/src/main/res/mipmap-xxxhdpi/ic_shortcut_like_adaptive_foreground.png b/twidere/src/main/res/mipmap-xxxhdpi/ic_shortcut_like_adaptive_foreground.png new file mode 100644 index 000000000..22b109c88 Binary files /dev/null and b/twidere/src/main/res/mipmap-xxxhdpi/ic_shortcut_like_adaptive_foreground.png differ diff --git a/twidere/src/main/res/mipmap-xxxhdpi/ic_shortcut_like_round.png b/twidere/src/main/res/mipmap-xxxhdpi/ic_shortcut_like_round.png new file mode 100644 index 000000000..125c4163e Binary files /dev/null and b/twidere/src/main/res/mipmap-xxxhdpi/ic_shortcut_like_round.png differ diff --git a/twidere/src/main/res/mipmap-xxxhdpi/ic_shortcut_quote.png b/twidere/src/main/res/mipmap-xxxhdpi/ic_shortcut_quote.png new file mode 100644 index 000000000..b2936aa1c Binary files /dev/null and b/twidere/src/main/res/mipmap-xxxhdpi/ic_shortcut_quote.png differ diff --git a/twidere/src/main/res/mipmap-xxxhdpi/ic_shortcut_quote_adaptive_foreground.png b/twidere/src/main/res/mipmap-xxxhdpi/ic_shortcut_quote_adaptive_foreground.png new file mode 100644 index 000000000..0db030c58 Binary files /dev/null and b/twidere/src/main/res/mipmap-xxxhdpi/ic_shortcut_quote_adaptive_foreground.png differ diff --git a/twidere/src/main/res/mipmap-xxxhdpi/ic_shortcut_quote_round.png b/twidere/src/main/res/mipmap-xxxhdpi/ic_shortcut_quote_round.png new file mode 100644 index 000000000..da11aaf59 Binary files /dev/null and b/twidere/src/main/res/mipmap-xxxhdpi/ic_shortcut_quote_round.png differ diff --git a/twidere/src/main/res/mipmap-xxxhdpi/ic_shortcut_user.png b/twidere/src/main/res/mipmap-xxxhdpi/ic_shortcut_user.png new file mode 100644 index 000000000..49db5438d Binary files /dev/null and b/twidere/src/main/res/mipmap-xxxhdpi/ic_shortcut_user.png differ diff --git a/twidere/src/main/res/mipmap-xxxhdpi/ic_shortcut_user_adaptive_foreground.png b/twidere/src/main/res/mipmap-xxxhdpi/ic_shortcut_user_adaptive_foreground.png new file mode 100644 index 000000000..08418e2c2 Binary files /dev/null and b/twidere/src/main/res/mipmap-xxxhdpi/ic_shortcut_user_adaptive_foreground.png differ diff --git a/twidere/src/main/res/mipmap-xxxhdpi/ic_shortcut_user_round.png b/twidere/src/main/res/mipmap-xxxhdpi/ic_shortcut_user_round.png new file mode 100644 index 000000000..5ba30131e Binary files /dev/null and b/twidere/src/main/res/mipmap-xxxhdpi/ic_shortcut_user_round.png differ diff --git a/twidere/src/main/res/values/colors.xml b/twidere/src/main/res/values/colors.xml index 792c7fa4d..b2ac3d7bb 100644 --- a/twidere/src/main/res/values/colors.xml +++ b/twidere/src/main/res/values/colors.xml @@ -47,5 +47,6 @@ #20333333 #85F1FF + #FAFAFA \ No newline at end of file