renamed StatusScheduleController -> StatusScheduleProvider

added GifShare interface
This commit is contained in:
Mariotaku Lee 2017-03-29 15:04:55 +08:00
parent 4d42a0965c
commit 9ef719066b
No known key found for this signature in database
GPG Key ID: 15C10F89D7C33535
11 changed files with 81 additions and 25 deletions

View File

@ -65,11 +65,13 @@
<init>(android.content.Context);
}
-keep class * extends org.mariotaku.twidere.util.MapFragmentFactory
-keep class * extends org.mariotaku.twidere.util.TwitterCardFragmentFactory
-keep class * extends org.mariotaku.twidere.util.Analyzer
-keep class * extends org.mariotaku.twidere.util.MapFragmentFactory
-keep class * extends org.mariotaku.twidere.util.gifshare.GifShareProvider.Factory
-keep class * extends org.mariotaku.twidere.util.premium.ExtraFeaturesService
-keep class * extends org.mariotaku.twidere.util.schedule.StatusScheduleController.Factory
-keep class * extends org.mariotaku.twidere.util.schedule.StatusScheduleProvider.Factory
-keep class * extends org.mariotaku.twidere.util.sync.SyncProviderInfoFactory
-keep class * extends org.mariotaku.twidere.util.twitter.card.TwitterCardViewFactory
-keep class * extends org.mariotaku.twidere.util.view.AppBarChildBehavior.ChildTransformation
-keepclassmembers class * {

View File

@ -64,8 +64,9 @@ import org.mariotaku.twidere.preference.iface.IDialogPreference
import org.mariotaku.twidere.util.*
import org.mariotaku.twidere.util.KeyboardShortcutsHandler.KeyboardShortcutCallback
import org.mariotaku.twidere.util.dagger.GeneralComponentHelper
import org.mariotaku.twidere.util.gifshare.GifShareProvider
import org.mariotaku.twidere.util.premium.ExtraFeaturesService
import org.mariotaku.twidere.util.schedule.StatusScheduleController
import org.mariotaku.twidere.util.schedule.StatusScheduleProvider
import org.mariotaku.twidere.util.support.ActivitySupport
import org.mariotaku.twidere.util.support.ActivitySupport.TaskDescriptionCompat
import org.mariotaku.twidere.util.theme.TwidereAppearanceCreator
@ -101,14 +102,19 @@ open class BaseActivity : ChameleonActivity(), IBaseActivity<BaseActivity>, IThe
@Inject
lateinit var extraFeaturesService: ExtraFeaturesService
@Inject
lateinit var statusScheduleControllerFactory: StatusScheduleController.Factory
lateinit var statusScheduleProviderFactory: StatusScheduleProvider.Factory
@Inject
lateinit var gifShareProviderFactory: GifShareProvider.Factory
@Inject
lateinit var defaultFeatures: DefaultFeatures
@Inject
lateinit var restHttpClient: RestHttpClient
protected val statusScheduleController: StatusScheduleController?
get() = statusScheduleControllerFactory.newInstance(this)
protected val statusScheduleProvider: StatusScheduleProvider?
get() = statusScheduleProviderFactory.newInstance(this)
protected val gifShareProvider: GifShareProvider?
get() = gifShareProviderFactory.newInstance(this)
private val actionHelper = IBaseActivity.ActionHelper(this)

View File

@ -561,7 +561,7 @@ class ComposeActivity : BaseActivity(), OnMenuItemClickListener, OnClickListener
updateTextCount()
}
R.id.schedule -> {
val controller = statusScheduleController ?: return true
val controller = statusScheduleProvider ?: return true
startActivityForResult(controller.createSetScheduleIntent(), REQUEST_SET_SCHEDULE)
}
else -> {

View File

@ -31,7 +31,7 @@ import org.mariotaku.twidere.util.Analyzer
import org.mariotaku.twidere.util.SharedPreferencesWrapper
import org.mariotaku.twidere.util.dagger.GeneralComponentHelper
import org.mariotaku.twidere.util.premium.ExtraFeaturesService
import org.mariotaku.twidere.util.schedule.StatusScheduleController
import org.mariotaku.twidere.util.schedule.StatusScheduleProvider
import org.mariotaku.twidere.view.ContainerView
import java.lang.ref.WeakReference
import java.util.concurrent.atomic.AtomicBoolean
@ -169,7 +169,7 @@ class PremiumDashboardActivity : BaseActivity() {
protected lateinit var preferences: SharedPreferencesWrapper
@Inject
protected lateinit var scheduleControllerFactory: StatusScheduleController.Factory
protected lateinit var mScheduleProviderFactory: StatusScheduleProvider.Factory
var position: Int = RecyclerView.NO_POSITION
internal set

View File

@ -32,7 +32,7 @@ import org.mariotaku.twidere.model.DefaultFeatures
import org.mariotaku.twidere.util.*
import org.mariotaku.twidere.util.dagger.GeneralComponentHelper
import org.mariotaku.twidere.util.premium.ExtraFeaturesService
import org.mariotaku.twidere.util.schedule.StatusScheduleController
import org.mariotaku.twidere.util.schedule.StatusScheduleProvider
import javax.inject.Inject
open class BaseFragment : Fragment(), IBaseFragment<BaseFragment> {
@ -67,12 +67,12 @@ open class BaseFragment : Fragment(), IBaseFragment<BaseFragment> {
@Inject
lateinit var defaultFeatures: DefaultFeatures
@Inject
lateinit var statusScheduleControllerFactory: StatusScheduleController.Factory
lateinit var statusScheduleProviderFactory: StatusScheduleProvider.Factory
@Inject
lateinit var restHttpClient: RestHttpClient
protected val statusScheduleController: StatusScheduleController?
get() = statusScheduleControllerFactory.newInstance(context)
protected val statusScheduleProvider: StatusScheduleProvider?
get() = statusScheduleProviderFactory.newInstance(context)
private val actionHelper = IBaseFragment.ActionHelper(this)

View File

@ -135,7 +135,7 @@ class DraftsFragment : BaseFragment(), LoaderCallbacks<Cursor?>, OnItemClickList
override fun onOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) {
R.id.scheduled_statuses -> {
val scheduleManageIntent = statusScheduleController?.createManageIntent() ?: return true
val scheduleManageIntent = statusScheduleProvider?.createManageIntent() ?: return true
startActivity(scheduleManageIntent)
return true
}

View File

@ -8,7 +8,7 @@ import org.mariotaku.twidere.util.*
import org.mariotaku.twidere.util.dagger.GeneralComponentHelper
import org.mariotaku.twidere.util.media.MediaPreloader
import org.mariotaku.twidere.util.premium.ExtraFeaturesService
import org.mariotaku.twidere.util.schedule.StatusScheduleController
import org.mariotaku.twidere.util.schedule.StatusScheduleProvider
import javax.inject.Inject
/**
@ -38,10 +38,10 @@ abstract class BaseAbstractTask<Params, Result, Callback>(val context: Context)
@Inject
lateinit var extraFeaturesService: ExtraFeaturesService
@Inject
lateinit var scheduleControllerFactory: StatusScheduleController.Factory
lateinit var scheduleProviderFactory: StatusScheduleProvider.Factory
val scheduleController: StatusScheduleController?
get() = scheduleControllerFactory.newInstance(context)
val scheduleProvider: StatusScheduleProvider?
get() = scheduleProviderFactory.newInstance(context)
init {
injectMembers()

View File

@ -262,7 +262,7 @@ class UpdateStatusTask(
throw SchedulerNotFoundException(context.getString(R.string.error_message_scheduler_not_available))
}
val controller = scheduleController ?: run {
val controller = scheduleProvider ?: run {
throw SchedulerNotFoundException(context.getString(R.string.error_message_scheduler_not_available))
}

View File

@ -62,7 +62,7 @@ import org.mariotaku.twidere.util.premium.ExtraFeaturesService
import org.mariotaku.twidere.util.refresh.AutoRefreshController
import org.mariotaku.twidere.util.refresh.JobSchedulerAutoRefreshController
import org.mariotaku.twidere.util.refresh.LegacyAutoRefreshController
import org.mariotaku.twidere.util.schedule.StatusScheduleController
import org.mariotaku.twidere.util.schedule.StatusScheduleProvider
import org.mariotaku.twidere.util.sync.JobSchedulerSyncController
import org.mariotaku.twidere.util.sync.LegacySyncController
import org.mariotaku.twidere.util.sync.SyncController
@ -257,8 +257,8 @@ class ApplicationModule(private val application: Application) {
@Provides
@Singleton
fun statusScheduleControllerFactory(): StatusScheduleController.Factory {
return StatusScheduleController.Factory.instance
fun statusScheduleProviderFactory(): StatusScheduleProvider.Factory {
return StatusScheduleProvider.Factory.instance
}
@Provides

View File

@ -0,0 +1,48 @@
/*
* 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/>.
*/
package org.mariotaku.twidere.util.gifshare
import android.content.Context
import android.content.Intent
import java.util.*
/**
* Created by mariotaku on 2017/3/24.
*/
interface GifShareProvider {
fun createGifSelectorIntent(): Intent
fun createSettingsIntent(): Intent?
interface Factory {
fun newInstance(context: Context): GifShareProvider?
companion object {
val instance: Factory get() = ServiceLoader.load(Factory::class.java)?.firstOrNull() ?: NullFactory
private object NullFactory : Factory {
override fun newInstance(context: Context) = null
}
}
}
}

View File

@ -32,7 +32,7 @@ import java.util.*
* Created by mariotaku on 2017/3/24.
*/
interface StatusScheduleController {
interface StatusScheduleProvider {
@WorkerThread
@Throws(ScheduleException::class)
@ -57,7 +57,7 @@ interface StatusScheduleController {
}
interface Factory {
fun newInstance(context: Context): StatusScheduleController?
fun newInstance(context: Context): StatusScheduleProvider?
fun parseInfo(json: String): ScheduleInfo?