Convert 'MessageListFragment' to Kotlin
This commit is contained in:
parent
6d506151f3
commit
b6ba133d12
5 changed files with 1507 additions and 1976 deletions
|
@ -217,7 +217,7 @@ open class MessageList :
|
|||
if (!hasMessageListFragment) {
|
||||
val fragmentTransaction = fragmentManager.beginTransaction()
|
||||
val messageListFragment = MessageListFragment.newInstance(
|
||||
search, false, K9.isThreadedViewEnabled && !noThreading
|
||||
search!!, false, K9.isThreadedViewEnabled && !noThreading
|
||||
)
|
||||
fragmentTransaction.add(R.id.message_list_container, messageListFragment)
|
||||
fragmentTransaction.commit()
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
package com.fsck.k9.fragment
|
||||
|
||||
import android.content.Context
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager
|
||||
import org.koin.dsl.module
|
||||
|
||||
val fragmentModule = module {
|
||||
single { SortTypeToastProvider() }
|
||||
factory { LocalBroadcastManager.getInstance(get<Context>()) }
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -71,12 +71,10 @@ public class MessageListHandler extends Handler {
|
|||
sendMessage(msg);
|
||||
}
|
||||
|
||||
public void restoreListPosition() {
|
||||
public void restoreListPosition(Parcelable savedListState) {
|
||||
MessageListFragment fragment = mFragment.get();
|
||||
if (fragment != null) {
|
||||
android.os.Message msg = android.os.Message.obtain(this, ACTION_RESTORE_LIST_POSITION,
|
||||
fragment.savedListState);
|
||||
fragment.savedListState = null;
|
||||
android.os.Message msg = android.os.Message.obtain(this, ACTION_RESTORE_LIST_POSITION, savedListState);
|
||||
sendMessage(msg);
|
||||
}
|
||||
}
|
||||
|
@ -125,16 +123,17 @@ public class MessageListHandler extends Handler {
|
|||
break;
|
||||
}
|
||||
case ACTION_GO_BACK: {
|
||||
fragment.fragmentListener.goBack();
|
||||
fragment.goBack();
|
||||
break;
|
||||
}
|
||||
case ACTION_RESTORE_LIST_POSITION: {
|
||||
fragment.listView.onRestoreInstanceState((Parcelable) msg.obj);
|
||||
Parcelable savedListState = (Parcelable) msg.obj;
|
||||
fragment.restoreListState(savedListState);
|
||||
break;
|
||||
}
|
||||
case ACTION_OPEN_MESSAGE: {
|
||||
MessageReference messageReference = (MessageReference) msg.obj;
|
||||
fragment.fragmentListener.openMessage(messageReference);
|
||||
fragment.openMessage(messageReference);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
package com.fsck.k9.ui.messagelist
|
||||
|
||||
import com.fsck.k9.fragment.MessageListFragment
|
||||
import org.koin.androidx.viewmodel.ext.android.viewModel
|
||||
|
||||
class MessageListFragmentDiContainer(fragment: MessageListFragment) {
|
||||
val viewModel: MessageListViewModel by fragment.viewModel()
|
||||
}
|
Loading…
Reference in a new issue