bug fixes

This commit is contained in:
Mariotaku Lee 2016-07-08 09:52:19 +08:00
parent 0264df7310
commit 56e8276f00
3 changed files with 11 additions and 10 deletions

View File

@ -65,6 +65,7 @@ import org.apache.commons.lang3.ObjectUtils
import org.mariotaku.abstask.library.AbstractTask
import org.mariotaku.abstask.library.TaskStarter
import org.mariotaku.commons.io.StreamUtils
import org.mariotaku.ktextension.asTypedArray
import org.mariotaku.ktextension.setItemChecked
import org.mariotaku.twidere.BuildConfig
import org.mariotaku.twidere.Constants.*
@ -542,7 +543,7 @@ class ComposeActivity : BaseActivity(), OnMenuItemClickListener, OnClickListener
if (savedInstanceState != null) {
// Restore from previous saved state
val selected = Utils.newParcelableArray(savedInstanceState.getParcelableArray(EXTRA_ACCOUNT_KEYS), UserKey.CREATOR)
val selected = savedInstanceState.getParcelableArray(EXTRA_ACCOUNT_KEYS).asTypedArray(UserKey.CREATOR)
accountsAdapter!!.setSelectedAccountIds(*selected)
possiblySensitive = savedInstanceState.getBoolean(EXTRA_IS_POSSIBLY_SENSITIVE)
val mediaList = savedInstanceState.getParcelableArrayList<ParcelableMediaUpdate>(EXTRA_MEDIA)
@ -766,8 +767,7 @@ class ComposeActivity : BaseActivity(), OnMenuItemClickListener, OnClickListener
val action = intent.action
val hasAccountIds: Boolean
if (intent.hasExtra(EXTRA_ACCOUNT_KEYS)) {
val accountKeys = Utils.newParcelableArray(
intent.getParcelableArrayExtra(EXTRA_ACCOUNT_KEYS), UserKey.CREATOR)
val accountKeys = intent.getParcelableArrayExtra(EXTRA_ACCOUNT_KEYS).asTypedArray(UserKey.CREATOR)
accountsAdapter!!.setSelectedAccountIds(*accountKeys)
hasAccountIds = true
} else if (intent.hasExtra(EXTRA_ACCOUNT_KEY)) {

View File

@ -37,6 +37,7 @@ import com.afollestad.appthemeengine.Config
import com.afollestad.appthemeengine.customizers.ATEToolbarCustomizer
import kotlinx.android.synthetic.main.activity_media_viewer.*
import org.apache.commons.lang3.ArrayUtils
import org.mariotaku.ktextension.asTypedArray
import org.mariotaku.mediaviewer.library.*
import org.mariotaku.mediaviewer.library.subsampleimageview.SubsampleImageViewerFragment.EXTRA_MEDIA_URI
import org.mariotaku.twidere.R
@ -49,8 +50,10 @@ import org.mariotaku.twidere.provider.CacheProvider
import org.mariotaku.twidere.provider.ShareProvider
import org.mariotaku.twidere.task.SaveFileTask
import org.mariotaku.twidere.task.SaveMediaToGalleryTask
import org.mariotaku.twidere.util.*
import org.mariotaku.twidere.util.Utils
import org.mariotaku.twidere.util.AsyncTaskUtils
import org.mariotaku.twidere.util.IntentUtils
import org.mariotaku.twidere.util.MenuUtils
import org.mariotaku.twidere.util.PermissionUtils
import org.mariotaku.twidere.util.dagger.GeneralComponentHelper
import java.io.File
import javax.inject.Inject
@ -291,8 +294,7 @@ class MediaViewerActivity : BaseActivity(), IExtendedActivity, ATEToolbarCustomi
get() = intent.getParcelableExtra<ParcelableMedia>(EXTRA_CURRENT_MEDIA)
private val media: Array<ParcelableMedia> by lazy {
Utils.newParcelableArray(intent.getParcelableArrayExtra(EXTRA_MEDIA),
ParcelableMedia.CREATOR)
intent.getParcelableArrayExtra(EXTRA_MEDIA).asTypedArray(ParcelableMedia.CREATOR)
}
protected fun processShareIntent(intent: Intent) {

View File

@ -23,13 +23,13 @@ import android.app.Dialog
import android.content.DialogInterface
import android.os.Bundle
import android.support.v7.app.AlertDialog
import org.mariotaku.ktextension.asTypedArray
import org.mariotaku.twidere.R
import org.mariotaku.twidere.constant.IntentConstants.*
import org.mariotaku.twidere.model.ParcelableMedia
import org.mariotaku.twidere.model.ParcelableStatus
import org.mariotaku.twidere.model.UserKey
import org.mariotaku.twidere.util.IntentUtils
import org.mariotaku.twidere.util.Utils
class SensitiveContentWarningDialogFragment : BaseDialogFragment(), DialogInterface.OnClickListener {
@ -44,8 +44,7 @@ class SensitiveContentWarningDialogFragment : BaseDialogFragment(), DialogInterf
val status = args.getParcelable<ParcelableStatus>(EXTRA_STATUS)
val option = args.getBundle(EXTRA_ACTIVITY_OPTIONS)
val newDocument = args.getBoolean(EXTRA_NEW_DOCUMENT)
val media = Utils.newParcelableArray(args.getParcelableArray(EXTRA_MEDIA),
ParcelableMedia.CREATOR)
val media = args.getParcelableArray(EXTRA_MEDIA).asTypedArray(ParcelableMedia.CREATOR)
IntentUtils.openMediaDirectly(context, accountKey, status, null, current, media,
option, newDocument)
}