mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-17 19:38:52 +01:00
Fixed issue #201
This commit is contained in:
@@ -81,6 +81,8 @@ public class LiveViewManager implements SharedPreferences.OnSharedPreferenceChan
|
||||
|
||||
/**
|
||||
* Register a LiveView to be notified when this preference is updated.
|
||||
* Note that you must first register the view, otherwise #refresh() will
|
||||
* not be called on it
|
||||
*
|
||||
* @param v
|
||||
* @param pref
|
||||
|
||||
@@ -28,12 +28,14 @@ import com.google.android.mms.pdu_alt.PduHeaders;
|
||||
import com.moez.QKSMS.R;
|
||||
import com.moez.QKSMS.common.ConversationPrefsHelper;
|
||||
import com.moez.QKSMS.common.DonationManager;
|
||||
import com.moez.QKSMS.common.LiveViewManager;
|
||||
import com.moez.QKSMS.common.QKRateSnack;
|
||||
import com.moez.QKSMS.common.google.DraftCache;
|
||||
import com.moez.QKSMS.common.utils.KeyboardUtils;
|
||||
import com.moez.QKSMS.common.utils.MessageUtils;
|
||||
import com.moez.QKSMS.common.utils.Units;
|
||||
import com.moez.QKSMS.data.Conversation;
|
||||
import com.moez.QKSMS.interfaces.LiveView;
|
||||
import com.moez.QKSMS.mmssms.Utils;
|
||||
import com.moez.QKSMS.receiver.IconColorReceiver;
|
||||
import com.moez.QKSMS.transaction.NotificationManager;
|
||||
@@ -57,7 +59,7 @@ import java.net.URLDecoder;
|
||||
import java.util.Collection;
|
||||
|
||||
public class MainActivity extends QKActivity implements SlidingMenu.OnOpenListener, SlidingMenu.OnCloseListener,
|
||||
SlidingMenu.OnOpenedListener, SlidingMenu.OnClosedListener {
|
||||
SlidingMenu.OnOpenedListener, SlidingMenu.OnClosedListener, LiveView {
|
||||
|
||||
private final String TAG = "MainActivity";
|
||||
|
||||
@@ -113,6 +115,9 @@ public class MainActivity extends QKActivity implements SlidingMenu.OnOpenListen
|
||||
|
||||
showDialogIfNeeded(savedInstanceState);
|
||||
|
||||
LiveViewManager.registerView(this);
|
||||
LiveViewManager.registerPreference(this, SettingsFragment.BACKGROUND);
|
||||
|
||||
//Adds a small/non intrusive snackbar that asks the user to rate the app
|
||||
SnackEngage.from(this).withSnack(new QKRateSnack().withDuration(BaseSnack.DURATION_LONG))
|
||||
.build().engageWhenAppropriate();
|
||||
@@ -205,7 +210,7 @@ public class MainActivity extends QKActivity implements SlidingMenu.OnOpenListen
|
||||
private void launchWelcomeActivity() {
|
||||
if (mPrefs.getBoolean(SettingsFragment.WELCOME_SEEN, false)) {
|
||||
// User has already seen the welcome screen
|
||||
return;
|
||||
// return;
|
||||
}
|
||||
|
||||
Intent welcomeIntent = new Intent(this, WelcomeActivity.class);
|
||||
@@ -625,7 +630,8 @@ public class MainActivity extends QKActivity implements SlidingMenu.OnOpenListen
|
||||
* @param hasLockedMessages whether the thread(s) contain locked messages
|
||||
* @param context used to load the various UI elements
|
||||
*/
|
||||
public static void confirmDeleteThreadDialog(final DeleteThreadListener listener, Collection<Long> threadIds, boolean hasLockedMessages, Context context) {
|
||||
public static void confirmDeleteThreadDialog(final DeleteThreadListener listener, Collection<Long> threadIds,
|
||||
boolean hasLockedMessages, Context context) {
|
||||
View contents = View.inflate(context, R.layout.dialog_delete_thread, null);
|
||||
android.widget.TextView msg = (android.widget.TextView) contents.findViewById(R.id.message);
|
||||
|
||||
@@ -661,6 +667,15 @@ public class MainActivity extends QKActivity implements SlidingMenu.OnOpenListen
|
||||
.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refresh() {
|
||||
// Update the background color. This code is important during the welcome screen setup, when the activity
|
||||
// in the ThemeManager isn't the MainActivity
|
||||
findViewById(R.id.menu_frame).getRootView().setBackgroundColor(ThemeManager.getBackgroundColor());
|
||||
findViewById(R.id.menu_frame).setBackgroundColor(ThemeManager.getBackgroundColor());
|
||||
findViewById(R.id.content_frame).setBackgroundColor(ThemeManager.getBackgroundColor());
|
||||
}
|
||||
|
||||
public static class DeleteThreadListener implements DialogInterface.OnClickListener {
|
||||
private final Collection<Long> mThreadIds;
|
||||
private final Conversation.ConversationQueryHandler mHandler;
|
||||
|
||||
@@ -3,9 +3,13 @@ package com.moez.QKSMS.ui.base;
|
||||
import android.app.Fragment;
|
||||
import android.os.Bundle;
|
||||
import com.moez.QKSMS.QKSMSApp;
|
||||
import com.moez.QKSMS.common.LiveViewManager;
|
||||
import com.moez.QKSMS.interfaces.LiveView;
|
||||
import com.moez.QKSMS.ui.ThemeManager;
|
||||
import com.moez.QKSMS.ui.settings.SettingsFragment;
|
||||
import com.squareup.leakcanary.RefWatcher;
|
||||
|
||||
public class QKFragment extends Fragment {
|
||||
public class QKFragment extends Fragment implements LiveView {
|
||||
|
||||
protected QKActivity mContext;
|
||||
|
||||
@@ -13,6 +17,9 @@ public class QKFragment extends Fragment {
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
mContext = (QKActivity) getActivity();
|
||||
|
||||
LiveViewManager.registerView(this);
|
||||
LiveViewManager.registerPreference(this, SettingsFragment.BACKGROUND);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -21,4 +28,11 @@ public class QKFragment extends Fragment {
|
||||
RefWatcher refWatcher = QKSMSApp.getRefWatcher(getActivity());
|
||||
refWatcher.watch(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refresh() {
|
||||
if (getView() != null) {
|
||||
getView().setBackgroundColor(ThemeManager.getBackgroundColor());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,5 +177,6 @@ public class StarredContactsView extends LinearLayout implements LoaderManager.L
|
||||
@Override
|
||||
public void refresh() {
|
||||
mIndicator.setColorFilter(ThemeManager.getTextOnBackgroundSecondary(), PorterDuff.Mode.MULTIPLY);
|
||||
mFavoritesBackground.setBackgroundColor(ThemeManager.getBackgroundColor());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,4 +92,9 @@ public class WelcomeNightFragment extends BaseWelcomeFragment implements BaseWel
|
||||
.commit();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refresh() {
|
||||
// Don't let the super class change the background, since we'll handle animations here
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user