diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/activity/ComposeActivity.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/activity/ComposeActivity.kt index 501953066..3c127385c 100644 --- a/twidere/src/main/kotlin/org/mariotaku/twidere/activity/ComposeActivity.kt +++ b/twidere/src/main/kotlin/org/mariotaku/twidere/activity/ComposeActivity.kt @@ -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(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)) { diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/activity/MediaViewerActivity.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/activity/MediaViewerActivity.kt index fcf138a42..316cb4900 100644 --- a/twidere/src/main/kotlin/org/mariotaku/twidere/activity/MediaViewerActivity.kt +++ b/twidere/src/main/kotlin/org/mariotaku/twidere/activity/MediaViewerActivity.kt @@ -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(EXTRA_CURRENT_MEDIA) private val media: Array by lazy { - Utils.newParcelableArray(intent.getParcelableArrayExtra(EXTRA_MEDIA), - ParcelableMedia.CREATOR) + intent.getParcelableArrayExtra(EXTRA_MEDIA).asTypedArray(ParcelableMedia.CREATOR) } protected fun processShareIntent(intent: Intent) { diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/SensitiveContentWarningDialogFragment.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/SensitiveContentWarningDialogFragment.kt index 61e8f6cc4..41f82c6e5 100644 --- a/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/SensitiveContentWarningDialogFragment.kt +++ b/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/SensitiveContentWarningDialogFragment.kt @@ -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(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) }