improved notification channels settings

This commit is contained in:
Mariotaku Lee 2017-09-02 00:39:54 +08:00
parent d07df91ade
commit 0b965f56bf
No known key found for this signature in database
GPG Key ID: 15C10F89D7C33535
19 changed files with 76 additions and 6 deletions

View File

@ -68,7 +68,7 @@ subprojects {
KPreferences : '0.9.7',
Kovenant : '3.3.0',
ParcelablePlease : '1.0.2',
Chameleon : '0.9.19',
Chameleon : '0.9.20',
UniqR : '0.9.4',
SQLiteQB : '0.9.15',
Glide : '3.7.0',

View File

@ -1054,6 +1054,11 @@ class UserFragment : BaseFragment(), OnClickListener, OnLinkClickListener,
ShortcutCreator.userFavorites(context, user.account_key, user)
}
}
R.id.add_media_to_home_screen -> {
ShortcutCreator.performCreation(this) {
ShortcutCreator.userMediaTimeline(context, user.account_key, user)
}
}
else -> {
val intent = item.intent
if (intent?.resolveActivity(context.packageManager) != null) {

View File

@ -96,6 +96,15 @@ object IntentUtils {
return intent
}
fun userMediaTimeline(accountKey: UserKey?, userKey: UserKey?, screenName: String?,
profileUrl: String? = null): Intent {
val uri = LinkCreator.getTwidereUserRelatedLink(AUTHORITY_USER_MEDIA_TIMELINE, accountKey,
userKey, screenName)
val intent = Intent(Intent.ACTION_VIEW, uri)
intent.putExtra(EXTRA_PROFILE_URL, profileUrl)
return intent
}
fun userFavorites(accountKey: UserKey?, userKey: UserKey?, screenName: String?,
profileUrl: String? = null): Intent {
val uri = LinkCreator.getTwidereUserRelatedLink(AUTHORITY_USER_FAVORITES, accountKey,

View File

@ -116,6 +116,20 @@ object ShortcutCreator {
return Promise.of(builder.build())
}
fun userMediaTimeline(context: Context, accountKey: UserKey?, user: ParcelableUser): Promise<ShortcutInfoCompat, Exception> {
val holder = DependencyHolder.get(context)
val preferences = holder.preferences
val userColorNameManager = holder.userColorNameManager
val launchIntent = IntentUtils.userMediaTimeline(accountKey, user.key,
user.screen_name, profileUrl = user.extras?.statusnet_profile_url)
val builder = ShortcutInfoCompat.Builder(context, "$accountKey:user-media-timeline:${user.key}")
builder.setIntent(launchIntent)
builder.setShortLabel(userColorNameManager.getDisplayName(user, preferences[nameFirstKey]))
builder.setIcon(IconCompat.createWithResource(context, R.mipmap.ic_shortcut_gallery))
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")

View File

@ -101,10 +101,8 @@
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"/>
android:title="@string/title_media_timeline"/>
<item
android:id="@+id/add_favorites_to_home_screen"
android:icon="@drawable/ic_action_star"

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Twidere - Twitter client for Android
~
~ Copyright (C) 2012-2017 Mariotaku Lee <mariotaku.lee@gmail.com>
~
~ 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 <http://www.gnu.org/licenses/>.
-->
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/bg_ic_shortcut_adaptive"/>
<foreground android:drawable="@mipmap/ic_shortcut_gallery_adaptive_foreground"/>
</adaptive-icon>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 773 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

View File

@ -22,8 +22,8 @@
<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_tab_to_home_screen">Add tab to home screen</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>
@ -896,6 +896,7 @@
<string name="preference_title_multi_column_tab_width">Multi column tab width</string>
<string name="preference_title_multi_column_tabs">Multi column tabs</string>
<string name="preference_title_navbar_style">Navbar style</string>
<string name="preference_title_notification_channels">Channels</string>
<string name="preference_title_notification_ringtone">Ringtone</string>
<string name="preference_title_override_language">App language</string>
<string name="preference_title_portrait">Portrait</string>

View File

@ -6,7 +6,8 @@
android:title="@string/notifications">
<org.mariotaku.twidere.preference.notification.AccountNotificationChannelsPreference
android:key="notification_channels"/>
android:key="notification_channels"
android:title="@string/preference_title_notification_channels"/>
<org.mariotaku.twidere.preference.TintedPreferenceCategory
android:key="cat_other_settings"

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="108px" height="108px" viewBox="0 0 108 108" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 46.2 (44496) - http://www.bohemiancoding.com/sketch -->
<title>ic_shortcut_gallery_adaptive_foreground-mdpi</title>
<desc>Created with Sketch.</desc>
<defs></defs>
<g id="App-Icon-Adaptive" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Shortcut-/-Gallery">
<g id="Foreground">
<g id="Group" transform="translate(18.000000, 18.000000)">
<rect id="Rectangle" x="0" y="0" width="72" height="72"></rect>
<path d="M56.25,51.75 L56.25,20.25 C56.25,17.775 54.225,15.75 51.75,15.75 L20.25,15.75 C17.775,15.75 15.75,17.775 15.75,20.25 L15.75,51.75 C15.75,54.225 17.775,56.25 20.25,56.25 L51.75,56.25 C54.225,56.25 56.25,54.225 56.25,51.75 Z M28.125,39.375 L33.75,46.1475 L41.625,36 L51.75,49.5 L20.25,49.5 L28.125,39.375 Z" id="Shape" fill="#4CAF50" fill-rule="nonzero"></path>
</g>
<rect id="Guide" x="18" y="18" width="72" height="72"></rect>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB