removed unused class
This commit is contained in:
parent
401a7cdfbc
commit
f258d1fe1f
|
@ -1,84 +0,0 @@
|
||||||
/*
|
|
||||||
* Twidere - Twitter client for Android
|
|
||||||
*
|
|
||||||
* Copyright (C) 2012-2015 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;
|
|
||||||
|
|
||||||
import android.support.annotation.NonNull;
|
|
||||||
import android.support.annotation.Nullable;
|
|
||||||
import android.text.TextUtils;
|
|
||||||
|
|
||||||
import com.twitter.Validator;
|
|
||||||
|
|
||||||
import org.mariotaku.twidere.annotation.AccountType;
|
|
||||||
import org.mariotaku.twidere.model.AccountDetails;
|
|
||||||
import org.mariotaku.twidere.model.account.StatusNetAccountExtras;
|
|
||||||
|
|
||||||
public class TwidereValidator {
|
|
||||||
|
|
||||||
private final Validator mValidator;
|
|
||||||
|
|
||||||
public TwidereValidator() {
|
|
||||||
mValidator = new Validator();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getTextLimit(@NonNull AccountDetails[] credentials) {
|
|
||||||
int limit = -1;
|
|
||||||
for (AccountDetails details : credentials) {
|
|
||||||
int currentLimit = getTextLimit(details);
|
|
||||||
if (currentLimit != 0) {
|
|
||||||
if (limit <= 0) {
|
|
||||||
limit = currentLimit;
|
|
||||||
} else {
|
|
||||||
limit = Math.min(limit, currentLimit);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return limit;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param credentials Account for getting limit
|
|
||||||
* @return Text limit, <= 0 if no limit
|
|
||||||
*/
|
|
||||||
public static int getTextLimit(@NonNull AccountDetails credentials) {
|
|
||||||
if (credentials.type == null) {
|
|
||||||
return Validator.MAX_TWEET_LENGTH;
|
|
||||||
}
|
|
||||||
switch (credentials.type) {
|
|
||||||
case AccountType.STATUSNET: {
|
|
||||||
StatusNetAccountExtras extra = (StatusNetAccountExtras) credentials.extras;
|
|
||||||
if (extra != null) {
|
|
||||||
return extra.getTextLimit();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return Validator.MAX_TWEET_LENGTH;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getTweetLength(@Nullable final String text) {
|
|
||||||
if (text == null) return 0;
|
|
||||||
return mValidator.getTweetLength(text);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isValidDirectMessage(final CharSequence text) {
|
|
||||||
return !TextUtils.isEmpty(text);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -35,7 +35,7 @@ import org.mariotaku.twidere.TwidereConstants.*
|
||||||
import org.mariotaku.twidere.adapter.AccountDetailsAdapter
|
import org.mariotaku.twidere.adapter.AccountDetailsAdapter
|
||||||
import org.mariotaku.twidere.annotation.AccountType
|
import org.mariotaku.twidere.annotation.AccountType
|
||||||
import org.mariotaku.twidere.app.TwidereApplication
|
import org.mariotaku.twidere.app.TwidereApplication
|
||||||
import org.mariotaku.twidere.extension.model.is_oauth
|
import org.mariotaku.twidere.extension.model.isOAuth
|
||||||
import org.mariotaku.twidere.model.UserKey
|
import org.mariotaku.twidere.model.UserKey
|
||||||
import org.mariotaku.twidere.model.util.AccountUtils
|
import org.mariotaku.twidere.model.util.AccountUtils
|
||||||
import org.mariotaku.twidere.util.DataStoreUtils
|
import org.mariotaku.twidere.util.DataStoreUtils
|
||||||
|
@ -101,7 +101,7 @@ class AccountSelectorActivity : BaseActivity(), OnItemClickListener {
|
||||||
if (extraKeys != null) {
|
if (extraKeys != null) {
|
||||||
return@filter extraKeys.contains(it.key)
|
return@filter extraKeys.contains(it.key)
|
||||||
}
|
}
|
||||||
if (oauthOnly && !it.is_oauth) {
|
if (oauthOnly && !it.isOAuth) {
|
||||||
return@filter false
|
return@filter false
|
||||||
}
|
}
|
||||||
if (USER_TYPE_TWITTER_COM == accountHost) {
|
if (USER_TYPE_TWITTER_COM == accountHost) {
|
||||||
|
|
|
@ -56,6 +56,7 @@ import android.view.View.OnLongClickListener
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import com.twitter.Extractor
|
import com.twitter.Extractor
|
||||||
|
import com.twitter.Validator
|
||||||
import kotlinx.android.synthetic.main.activity_compose.*
|
import kotlinx.android.synthetic.main.activity_compose.*
|
||||||
import org.apache.commons.lang3.ArrayUtils
|
import org.apache.commons.lang3.ArrayUtils
|
||||||
import org.apache.commons.lang3.ObjectUtils
|
import org.apache.commons.lang3.ObjectUtils
|
||||||
|
@ -75,6 +76,7 @@ import org.mariotaku.twidere.adapter.MediaPreviewAdapter
|
||||||
import org.mariotaku.twidere.constant.*
|
import org.mariotaku.twidere.constant.*
|
||||||
import org.mariotaku.twidere.extension.applyTheme
|
import org.mariotaku.twidere.extension.applyTheme
|
||||||
import org.mariotaku.twidere.extension.model.getAccountUser
|
import org.mariotaku.twidere.extension.model.getAccountUser
|
||||||
|
import org.mariotaku.twidere.extension.model.textLimit
|
||||||
import org.mariotaku.twidere.extension.model.unique_id_non_null
|
import org.mariotaku.twidere.extension.model.unique_id_non_null
|
||||||
import org.mariotaku.twidere.fragment.BaseDialogFragment
|
import org.mariotaku.twidere.fragment.BaseDialogFragment
|
||||||
import org.mariotaku.twidere.fragment.EditAltTextDialogFragment
|
import org.mariotaku.twidere.fragment.EditAltTextDialogFragment
|
||||||
|
@ -113,7 +115,7 @@ class ComposeActivity : BaseActivity(), OnMenuItemClickListener, OnClickListener
|
||||||
@Inject
|
@Inject
|
||||||
lateinit var extractor: Extractor
|
lateinit var extractor: Extractor
|
||||||
@Inject
|
@Inject
|
||||||
lateinit var validator: TwidereValidator
|
lateinit var validator: Validator
|
||||||
@Inject
|
@Inject
|
||||||
lateinit var locationManager: LocationManager
|
lateinit var locationManager: LocationManager
|
||||||
|
|
||||||
|
@ -1097,7 +1099,7 @@ class ComposeActivity : BaseActivity(), OnMenuItemClickListener, OnClickListener
|
||||||
} else {
|
} else {
|
||||||
editText.accountKey = accounts[0].key
|
editText.accountKey = accounts[0].key
|
||||||
}
|
}
|
||||||
statusTextCount.maxLength = TwidereValidator.getTextLimit(accounts)
|
statusTextCount.maxLength = accounts.textLimit
|
||||||
setMenu()
|
setMenu()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1318,9 +1320,9 @@ class ComposeActivity : BaseActivity(), OnMenuItemClickListener, OnClickListener
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateStatus() {
|
private fun updateStatus() {
|
||||||
if (isFinishing) return
|
if (isFinishing || editText == null) return
|
||||||
val hasMedia = hasMedia()
|
val hasMedia = hasMedia()
|
||||||
val text = if (editText != null) ParseUtils.parseString(editText.text) else null
|
val text = editText.text.toString()
|
||||||
val tweetLength = validator.getTweetLength(text)
|
val tweetLength = validator.getTweetLength(text)
|
||||||
val maxLength = statusTextCount.maxLength
|
val maxLength = statusTextCount.maxLength
|
||||||
if (accountsAdapter.isSelectionEmpty) {
|
if (accountsAdapter.isSelectionEmpty) {
|
||||||
|
@ -1376,20 +1378,13 @@ class ComposeActivity : BaseActivity(), OnMenuItemClickListener, OnClickListener
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateTextCount() {
|
private fun updateTextCount() {
|
||||||
var text = editText.text?.toString() ?: return
|
val text = editText.text?.toString() ?: return
|
||||||
if (defaultFeatures.isMediaLinkCountsInStatus && media.isNotEmpty()) {
|
|
||||||
text += " https://twitter.com/example/status/12345678901234567890/photos/1"
|
|
||||||
}
|
|
||||||
statusTextCount.textCount = validator.getTweetLength(text)
|
statusTextCount.textCount = validator.getTweetLength(text)
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class ComposeLocationListener(activity: ComposeActivity) : LocationListener {
|
internal class ComposeLocationListener(activity: ComposeActivity) : LocationListener {
|
||||||
|
|
||||||
val activityRef: WeakReference<ComposeActivity>
|
private val activityRef = WeakReference(activity)
|
||||||
|
|
||||||
init {
|
|
||||||
activityRef = WeakReference(activity)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onLocationChanged(location: Location) {
|
override fun onLocationChanged(location: Location) {
|
||||||
val activity = activityRef.get() ?: return
|
val activity = activityRef.get() ?: return
|
||||||
|
@ -1409,12 +1404,10 @@ class ComposeActivity : BaseActivity(), OnMenuItemClickListener, OnClickListener
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class AccountIconViewHolder(val adapter: AccountIconsAdapter, itemView: View) : ViewHolder(itemView), OnClickListener {
|
internal class AccountIconViewHolder(val adapter: AccountIconsAdapter, itemView: View) : ViewHolder(itemView), OnClickListener {
|
||||||
val iconView: ShapedImageView
|
private val iconView = itemView.findViewById(android.R.id.icon) as ShapedImageView
|
||||||
val nameView: TextView
|
private val nameView = itemView.findViewById(android.R.id.text1) as TextView
|
||||||
|
|
||||||
init {
|
init {
|
||||||
iconView = itemView.findViewById(android.R.id.icon) as ShapedImageView
|
|
||||||
nameView = itemView.findViewById(android.R.id.text1) as TextView
|
|
||||||
itemView.setOnClickListener(this)
|
itemView.setOnClickListener(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
package org.mariotaku.twidere.extension.model
|
package org.mariotaku.twidere.extension.model
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import com.twitter.Validator
|
||||||
import org.mariotaku.twidere.annotation.AccountType
|
import org.mariotaku.twidere.annotation.AccountType
|
||||||
import org.mariotaku.twidere.model.AccountDetails
|
import org.mariotaku.twidere.model.AccountDetails
|
||||||
import org.mariotaku.twidere.model.account.AccountExtras
|
import org.mariotaku.twidere.model.account.AccountExtras
|
||||||
|
import org.mariotaku.twidere.model.account.StatusNetAccountExtras
|
||||||
import org.mariotaku.twidere.model.account.TwitterAccountExtras
|
import org.mariotaku.twidere.model.account.TwitterAccountExtras
|
||||||
import org.mariotaku.twidere.model.account.cred.Credentials
|
import org.mariotaku.twidere.model.account.cred.Credentials
|
||||||
import org.mariotaku.twidere.model.account.cred.OAuthCredentials
|
import org.mariotaku.twidere.model.account.cred.OAuthCredentials
|
||||||
|
@ -45,10 +47,10 @@ fun <T> AccountDetails.newMicroBlogInstance(
|
||||||
return credentials.newMicroBlogInstance(context, type, extraRequestParams, cls)
|
return credentials.newMicroBlogInstance(context, type, extraRequestParams, cls)
|
||||||
}
|
}
|
||||||
|
|
||||||
val AccountDetails.is_oauth: Boolean
|
val AccountDetails.isOAuth: Boolean
|
||||||
get() = credentials_type == Credentials.Type.OAUTH || credentials_type == Credentials.Type.XAUTH
|
get() = credentials_type == Credentials.Type.OAUTH || credentials_type == Credentials.Type.XAUTH
|
||||||
|
|
||||||
val AccountDetails.size_limit: UpdateStatusTask.SizeLimit
|
val AccountDetails.mediaSizeLimit: UpdateStatusTask.SizeLimit
|
||||||
get() = when (type) {
|
get() = when (type) {
|
||||||
AccountType.TWITTER -> {
|
AccountType.TWITTER -> {
|
||||||
val imageLimit = AccountExtras.ImageLimit.ofSize(2048, 1536)
|
val imageLimit = AccountExtras.ImageLimit.ofSize(2048, 1536)
|
||||||
|
@ -57,3 +59,36 @@ val AccountDetails.size_limit: UpdateStatusTask.SizeLimit
|
||||||
}
|
}
|
||||||
else -> UpdateStatusTask.SizeLimit(AccountExtras.ImageLimit(), AccountExtras.VideoLimit.unsupported())
|
else -> UpdateStatusTask.SizeLimit(AccountExtras.ImageLimit(), AccountExtras.VideoLimit.unsupported())
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Text limit when composing a status, 0 for no limit
|
||||||
|
*/
|
||||||
|
val AccountDetails.textLimit: Int get() {
|
||||||
|
if (type == null) {
|
||||||
|
return Validator.MAX_TWEET_LENGTH
|
||||||
|
}
|
||||||
|
when (type) {
|
||||||
|
AccountType.STATUSNET -> {
|
||||||
|
val extras = this.extras as? StatusNetAccountExtras
|
||||||
|
if (extras != null) {
|
||||||
|
return extras.textLimit
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Validator.MAX_TWEET_LENGTH
|
||||||
|
}
|
||||||
|
|
||||||
|
val Array<AccountDetails>.textLimit: Int
|
||||||
|
get() {
|
||||||
|
var limit = -1
|
||||||
|
forEach { details ->
|
||||||
|
val currentLimit = details.textLimit
|
||||||
|
if (currentLimit != 0) {
|
||||||
|
if (limit <= 0) {
|
||||||
|
limit = currentLimit
|
||||||
|
} else {
|
||||||
|
limit = Math.min(limit, currentLimit)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return limit
|
||||||
|
}
|
|
@ -22,6 +22,7 @@ package org.mariotaku.twidere.fragment
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.support.v4.app.DialogFragment
|
import android.support.v4.app.DialogFragment
|
||||||
import com.squareup.otto.Bus
|
import com.squareup.otto.Bus
|
||||||
|
import com.twitter.Validator
|
||||||
import org.mariotaku.kpreferences.KPreferences
|
import org.mariotaku.kpreferences.KPreferences
|
||||||
import org.mariotaku.twidere.util.*
|
import org.mariotaku.twidere.util.*
|
||||||
import org.mariotaku.twidere.util.dagger.GeneralComponentHelper
|
import org.mariotaku.twidere.util.dagger.GeneralComponentHelper
|
||||||
|
@ -39,7 +40,7 @@ open class BaseDialogFragment : DialogFragment() {
|
||||||
@Inject
|
@Inject
|
||||||
lateinit var kPreferences: KPreferences
|
lateinit var kPreferences: KPreferences
|
||||||
@Inject
|
@Inject
|
||||||
lateinit var validator: TwidereValidator
|
lateinit var validator: Validator
|
||||||
@Inject
|
@Inject
|
||||||
lateinit var keyboardShortcutsHandler: KeyboardShortcutsHandler
|
lateinit var keyboardShortcutsHandler: KeyboardShortcutsHandler
|
||||||
@Inject
|
@Inject
|
||||||
|
|
|
@ -24,6 +24,7 @@ import android.os.Bundle
|
||||||
import android.support.v4.app.Fragment
|
import android.support.v4.app.Fragment
|
||||||
import android.support.v4.text.BidiFormatter
|
import android.support.v4.text.BidiFormatter
|
||||||
import com.squareup.otto.Bus
|
import com.squareup.otto.Bus
|
||||||
|
import com.twitter.Validator
|
||||||
import org.mariotaku.twidere.fragment.iface.IBaseFragment
|
import org.mariotaku.twidere.fragment.iface.IBaseFragment
|
||||||
import org.mariotaku.twidere.model.DefaultFeatures
|
import org.mariotaku.twidere.model.DefaultFeatures
|
||||||
import org.mariotaku.twidere.util.*
|
import org.mariotaku.twidere.util.*
|
||||||
|
@ -57,7 +58,7 @@ open class BaseFragment : Fragment(), IBaseFragment<BaseFragment> {
|
||||||
@Inject
|
@Inject
|
||||||
lateinit var errorInfoStore: ErrorInfoStore
|
lateinit var errorInfoStore: ErrorInfoStore
|
||||||
@Inject
|
@Inject
|
||||||
lateinit var validator: TwidereValidator
|
lateinit var validator: Validator
|
||||||
@Inject
|
@Inject
|
||||||
lateinit var extraFeaturesService: ExtraFeaturesService
|
lateinit var extraFeaturesService: ExtraFeaturesService
|
||||||
@Inject
|
@Inject
|
||||||
|
|
|
@ -44,13 +44,13 @@ import org.mariotaku.twidere.annotation.AccountType
|
||||||
import org.mariotaku.twidere.constant.IntentConstants.*
|
import org.mariotaku.twidere.constant.IntentConstants.*
|
||||||
import org.mariotaku.twidere.constant.SharedPreferenceConstants.KEY_QUICK_SEND
|
import org.mariotaku.twidere.constant.SharedPreferenceConstants.KEY_QUICK_SEND
|
||||||
import org.mariotaku.twidere.extension.applyTheme
|
import org.mariotaku.twidere.extension.applyTheme
|
||||||
|
import org.mariotaku.twidere.extension.model.textLimit
|
||||||
import org.mariotaku.twidere.model.*
|
import org.mariotaku.twidere.model.*
|
||||||
import org.mariotaku.twidere.model.util.AccountUtils
|
import org.mariotaku.twidere.model.util.AccountUtils
|
||||||
import org.mariotaku.twidere.service.LengthyOperationsService
|
import org.mariotaku.twidere.service.LengthyOperationsService
|
||||||
import org.mariotaku.twidere.util.Analyzer
|
import org.mariotaku.twidere.util.Analyzer
|
||||||
import org.mariotaku.twidere.util.EditTextEnterHandler
|
import org.mariotaku.twidere.util.EditTextEnterHandler
|
||||||
import org.mariotaku.twidere.util.LinkCreator
|
import org.mariotaku.twidere.util.LinkCreator
|
||||||
import org.mariotaku.twidere.util.TwidereValidator
|
|
||||||
import org.mariotaku.twidere.util.Utils.isMyRetweet
|
import org.mariotaku.twidere.util.Utils.isMyRetweet
|
||||||
import org.mariotaku.twidere.view.ComposeEditText
|
import org.mariotaku.twidere.view.ComposeEditText
|
||||||
import org.mariotaku.twidere.view.StatusTextCountView
|
import org.mariotaku.twidere.view.StatusTextCountView
|
||||||
|
@ -95,7 +95,7 @@ class RetweetQuoteDialogFragment : BaseDialogFragment() {
|
||||||
val holder = StatusViewHolder(adapter, itemContent)
|
val holder = StatusViewHolder(adapter, itemContent)
|
||||||
holder.displayStatus(status = status, displayInReplyTo = false, displayExtraType = true)
|
holder.displayStatus(status = status, displayInReplyTo = false, displayExtraType = true)
|
||||||
|
|
||||||
textCountView.maxLength = TwidereValidator.getTextLimit(details)
|
textCountView.maxLength = details.textLimit
|
||||||
|
|
||||||
itemMenu.visibility = View.GONE
|
itemMenu.visibility = View.GONE
|
||||||
actionButtons.visibility = View.GONE
|
actionButtons.visibility = View.GONE
|
||||||
|
|
|
@ -2,6 +2,7 @@ package org.mariotaku.twidere.service
|
||||||
|
|
||||||
import android.app.IntentService
|
import android.app.IntentService
|
||||||
import com.twitter.Extractor
|
import com.twitter.Extractor
|
||||||
|
import com.twitter.Validator
|
||||||
import org.mariotaku.twidere.util.*
|
import org.mariotaku.twidere.util.*
|
||||||
import org.mariotaku.twidere.util.dagger.GeneralComponentHelper
|
import org.mariotaku.twidere.util.dagger.GeneralComponentHelper
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
@ -15,7 +16,7 @@ abstract class BaseIntentService(tag: String) : IntentService(tag) {
|
||||||
@Inject
|
@Inject
|
||||||
lateinit var notificationManager: NotificationManagerWrapper
|
lateinit var notificationManager: NotificationManagerWrapper
|
||||||
@Inject
|
@Inject
|
||||||
lateinit var validator: TwidereValidator
|
lateinit var validator: Validator
|
||||||
@Inject
|
@Inject
|
||||||
lateinit var extractor: Extractor
|
lateinit var extractor: Extractor
|
||||||
@Inject
|
@Inject
|
||||||
|
|
|
@ -37,7 +37,8 @@ import org.mariotaku.twidere.TwidereConstants.*
|
||||||
import org.mariotaku.twidere.annotation.AccountType
|
import org.mariotaku.twidere.annotation.AccountType
|
||||||
import org.mariotaku.twidere.app.TwidereApplication
|
import org.mariotaku.twidere.app.TwidereApplication
|
||||||
import org.mariotaku.twidere.extension.model.newMicroBlogInstance
|
import org.mariotaku.twidere.extension.model.newMicroBlogInstance
|
||||||
import org.mariotaku.twidere.extension.model.size_limit
|
import org.mariotaku.twidere.extension.model.mediaSizeLimit
|
||||||
|
import org.mariotaku.twidere.extension.model.textLimit
|
||||||
import org.mariotaku.twidere.model.*
|
import org.mariotaku.twidere.model.*
|
||||||
import org.mariotaku.twidere.model.account.AccountExtras
|
import org.mariotaku.twidere.model.account.AccountExtras
|
||||||
import org.mariotaku.twidere.model.analyzer.UpdateStatus
|
import org.mariotaku.twidere.model.analyzer.UpdateStatus
|
||||||
|
@ -213,7 +214,7 @@ class UpdateStatusTask(
|
||||||
for (i in 0 until pending.length) {
|
for (i in 0 until pending.length) {
|
||||||
val account = update.accounts[i]
|
val account = update.accounts[i]
|
||||||
val text = pending.overrideTexts[i]
|
val text = pending.overrideTexts[i]
|
||||||
val textLimit = TwidereValidator.getTextLimit(account)
|
val textLimit = account.textLimit
|
||||||
if (textLimit >= 0 && text.length <= textLimit) {
|
if (textLimit >= 0 && text.length <= textLimit) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
@ -262,7 +263,7 @@ class UpdateStatusTask(
|
||||||
if (statusUpdate.media.isNotNullOrEmpty()) {
|
if (statusUpdate.media.isNotNullOrEmpty()) {
|
||||||
// Fanfou only allow one photo
|
// Fanfou only allow one photo
|
||||||
fanfouUpdateStatusWithPhoto(microBlog, statusUpdate, pendingUpdate,
|
fanfouUpdateStatusWithPhoto(microBlog, statusUpdate, pendingUpdate,
|
||||||
pendingUpdate.overrideTexts[i], account.size_limit, i)
|
pendingUpdate.overrideTexts[i], account.mediaSizeLimit, i)
|
||||||
} else {
|
} else {
|
||||||
twitterUpdateStatus(microBlog, statusUpdate, pendingUpdate,
|
twitterUpdateStatus(microBlog, statusUpdate, pendingUpdate,
|
||||||
pendingUpdate.overrideTexts[i], i)
|
pendingUpdate.overrideTexts[i], i)
|
||||||
|
@ -647,7 +648,7 @@ class UpdateStatusTask(
|
||||||
//noinspection TryWithIdenticalCatches
|
//noinspection TryWithIdenticalCatches
|
||||||
var body: MediaStreamBody? = null
|
var body: MediaStreamBody? = null
|
||||||
try {
|
try {
|
||||||
val sizeLimit = account.size_limit
|
val sizeLimit = account.mediaSizeLimit
|
||||||
body = getBodyFromMedia(context, mediaLoader, media, sizeLimit,
|
body = getBodyFromMedia(context, mediaLoader, media, sizeLimit,
|
||||||
chucked, ContentLengthInputStream.ReadListener { length, position ->
|
chucked, ContentLengthInputStream.ReadListener { length, position ->
|
||||||
callback?.onUploadingProgressChanged(index, position, length)
|
callback?.onUploadingProgressChanged(index, position, length)
|
||||||
|
|
|
@ -36,6 +36,7 @@ import com.nostra13.universalimageloader.utils.L
|
||||||
import com.squareup.otto.Bus
|
import com.squareup.otto.Bus
|
||||||
import com.squareup.otto.ThreadEnforcer
|
import com.squareup.otto.ThreadEnforcer
|
||||||
import com.twitter.Extractor
|
import com.twitter.Extractor
|
||||||
|
import com.twitter.Validator
|
||||||
import dagger.Module
|
import dagger.Module
|
||||||
import dagger.Provides
|
import dagger.Provides
|
||||||
import edu.tsinghua.hotmobi.HotMobiLogger
|
import edu.tsinghua.hotmobi.HotMobiLogger
|
||||||
|
@ -233,8 +234,8 @@ class ApplicationModule(private val application: Application) {
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
fun twidereValidator(): TwidereValidator {
|
fun validator(): Validator {
|
||||||
return TwidereValidator()
|
return Validator()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
package org.mariotaku.twidere.util.dagger
|
package org.mariotaku.twidere.util.dagger
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import com.twitter.Validator
|
||||||
import edu.tsinghua.hotmobi.HotMobiLogger
|
import edu.tsinghua.hotmobi.HotMobiLogger
|
||||||
import okhttp3.ConnectionPool
|
import okhttp3.ConnectionPool
|
||||||
import org.mariotaku.kpreferences.KPreferences
|
import org.mariotaku.kpreferences.KPreferences
|
||||||
|
@ -52,7 +53,7 @@ class DependencyHolder internal constructor(context: Context) {
|
||||||
lateinit var dns: TwidereDns
|
lateinit var dns: TwidereDns
|
||||||
internal set
|
internal set
|
||||||
@Inject
|
@Inject
|
||||||
lateinit var validator: TwidereValidator
|
lateinit var validator: Validator
|
||||||
internal set
|
internal set
|
||||||
@Inject
|
@Inject
|
||||||
lateinit var preferences: SharedPreferencesWrapper
|
lateinit var preferences: SharedPreferencesWrapper
|
||||||
|
|
Loading…
Reference in New Issue