Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c34ab39e authored by Moez Bhatti's avatar Moez Bhatti
Browse files

Fixed crashlytics #975

parent 22d071c9
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -53,6 +53,9 @@ import java.util.Locale;
public class QKSMSAppBase extends MultiDexApplication {
    public static final String LOG_TAG = "Mms";

    public static final int LOADER_CONVERSATIONS = 0;
    public static final int LOADER_MESSAGES = 1;

    private SearchRecentSuggestions mRecentSuggestions;
    private TelephonyManager mTelephonyManager;
    private String mCountryIso;
+23 −13
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.widget.ImageView;
import butterknife.Bind;
import butterknife.ButterKnife;
import com.melnykov.fab.FloatingActionButton;
import com.moez.QKSMS.QKSMSApp;
import com.moez.QKSMS.R;
import com.moez.QKSMS.common.BlockedConversationHelper;
import com.moez.QKSMS.common.DialogHelper;
@@ -265,7 +266,7 @@ public class ConversationListFragment extends QKFragment implements LoaderManage
    }

    private void initLoaderManager() {
        getLoaderManager().restartLoader(0, null, this);
        getLoaderManager().restartLoader(QKSMSApp.LOADER_CONVERSATIONS, null, this);
    }

    @Override
@@ -289,13 +290,20 @@ public class ConversationListFragment extends QKFragment implements LoaderManage
        }
    }

    @Override
    public Loader<Cursor> onCreateLoader(int id, Bundle args) {
        if (id == QKSMSApp.LOADER_CONVERSATIONS) {
            return new CursorLoader(mContext, SmsHelper.CONVERSATIONS_CONTENT_PROVIDER, Conversation.ALL_THREADS_PROJECTION,
                    BlockedConversationHelper.getCursorSelection(mPrefs, mShowBlocked),
                    BlockedConversationHelper.getBlockedConversationArray(mPrefs), "date DESC");
        } else {
            return null;
        }
    }

    @Override
    public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
        if (loader.getId() == QKSMSApp.LOADER_CONVERSATIONS) {
            if (mAdapter != null) {
                // Swap the new cursor in.  (The framework will take care of closing the, old cursor once we return.)
                mAdapter.changeCursor(data);
@@ -307,9 +315,11 @@ public class ConversationListFragment extends QKFragment implements LoaderManage

            mEmptyState.setVisibility(data != null && data.getCount() > 0 ? View.GONE : View.VISIBLE);
        }
    }

    @Override
    public void onLoaderReset(Loader<Cursor> loader) {
        if (mAdapter != null) {
        if (mAdapter != null && loader.getId() == QKSMSApp.LOADER_CONVERSATIONS) {
            mAdapter.changeCursor(null);
        }
    }
+15 −6
Original line number Diff line number Diff line
@@ -82,6 +82,8 @@ import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;

import static android.R.attr.data;

public class MessageListFragment extends QKFragment implements ActivityLauncher, SensorEventListener,
        LoaderManager.LoaderCallbacks<Cursor>, RecyclerCursorAdapter.MultiSelectListener, SwipeBackLayout.ScrollChangedListener,
        RecyclerCursorAdapter.ItemClickListener<MessageItem> {
@@ -572,7 +574,7 @@ public class MessageListFragment extends QKFragment implements ActivityLauncher,
    }

    private void initLoaderManager() {
        getLoaderManager().initLoader(0, null, this);
        getLoaderManager().initLoader(QKSMSApp.LOADER_MESSAGES, null, this);
    }

    @Override
@@ -619,21 +621,28 @@ public class MessageListFragment extends QKFragment implements ActivityLauncher,
        // Ignored
    }

    @Override
    public Loader<Cursor> onCreateLoader(int id, Bundle args) {
        if (id == QKSMSApp.LOADER_MESSAGES) {
            return new CursorLoader(mContext,
                    Uri.withAppendedPath(Message.MMS_SMS_CONTENT_PROVIDER, String.valueOf(mThreadId)),
                    MessageColumns.PROJECTION, null, null, "normalized_date ASC");
        } else {
            return null;
        }
    }

    @Override
    public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
        if (mAdapter != null) {
        if (mAdapter != null && loader.getId() == QKSMSApp.LOADER_MESSAGES) {
            // Swap the new cursor in.  (The framework will take care of closing the, old cursor once we return.)
            mAdapter.changeCursor(data);
        }
    }

    @Override
    public void onLoaderReset(Loader<Cursor> loader) {
        if (mAdapter != null) {
        if (mAdapter != null && loader.getId() == QKSMSApp.LOADER_MESSAGES) {
            mAdapter.changeCursor(null);
        }
    }