forked from upstream-mirrors/quik
Fix per-conversation themeing
This commit is contained in:
@@ -24,6 +24,10 @@ import java.util.List;
|
|||||||
public class SwipeBackLayout extends FrameLayout {
|
public class SwipeBackLayout extends FrameLayout {
|
||||||
private final String TAG = "SwipeBackLayout";
|
private final String TAG = "SwipeBackLayout";
|
||||||
|
|
||||||
|
public interface ScrollChangedListener {
|
||||||
|
void onScrollChanged(float scrollPercent);
|
||||||
|
}
|
||||||
|
|
||||||
private static final int MIN_FLING_VELOCITY = 400; // dips per second
|
private static final int MIN_FLING_VELOCITY = 400; // dips per second
|
||||||
private static final int DEFAULT_SCRIM_COLOR = 0x99000000;
|
private static final int DEFAULT_SCRIM_COLOR = 0x99000000;
|
||||||
private static final int FULL_ALPHA = 255;
|
private static final int FULL_ALPHA = 255;
|
||||||
@@ -68,9 +72,9 @@ public class SwipeBackLayout extends FrameLayout {
|
|||||||
* The set of listeners to be sent events through.
|
* The set of listeners to be sent events through.
|
||||||
*/
|
*/
|
||||||
private List<SwipeListener> mListeners;
|
private List<SwipeListener> mListeners;
|
||||||
|
private ScrollChangedListener mScrollChangedListener;
|
||||||
|
|
||||||
private Drawable mShadowLeft;
|
private Drawable mShadowLeft;
|
||||||
private Drawable mShadowRight;
|
|
||||||
private Drawable mShadowBottom;
|
private Drawable mShadowBottom;
|
||||||
|
|
||||||
private float mScrimOpacity;
|
private float mScrimOpacity;
|
||||||
@@ -183,6 +187,10 @@ public class SwipeBackLayout extends FrameLayout {
|
|||||||
mListeners.remove(listener);
|
mListeners.remove(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setScrollChangedListener(ScrollChangedListener listener) {
|
||||||
|
mScrollChangedListener = listener;
|
||||||
|
}
|
||||||
|
|
||||||
public interface SwipeListener {
|
public interface SwipeListener {
|
||||||
/**
|
/**
|
||||||
* Invoke when state change
|
* Invoke when state change
|
||||||
@@ -423,12 +431,15 @@ public class SwipeBackLayout extends FrameLayout {
|
|||||||
public void onViewPositionChanged(View changedView, int left, int top, int dx, int dy) {
|
public void onViewPositionChanged(View changedView, int left, int top, int dx, int dy) {
|
||||||
super.onViewPositionChanged(changedView, left, top, dx, dy);
|
super.onViewPositionChanged(changedView, left, top, dx, dy);
|
||||||
if ((mTrackingEdge & EDGE_LEFT) != 0) {
|
if ((mTrackingEdge & EDGE_LEFT) != 0) {
|
||||||
mScrollPercent = Math.abs((float) left
|
mScrollPercent = Math.abs((float) left / (mContentView.getWidth() + mShadowLeft.getIntrinsicWidth()));
|
||||||
/ (mContentView.getWidth() + mShadowLeft.getIntrinsicWidth()));
|
|
||||||
} else if ((mTrackingEdge & EDGE_BOTTOM) != 0) {
|
} else if ((mTrackingEdge & EDGE_BOTTOM) != 0) {
|
||||||
mScrollPercent = Math.abs((float) top
|
mScrollPercent = Math.abs((float) top / (mContentView.getHeight() + mShadowBottom.getIntrinsicHeight()));
|
||||||
/ (mContentView.getHeight() + mShadowBottom.getIntrinsicHeight()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mScrollChangedListener != null) {
|
||||||
|
mScrollChangedListener.onScrollChanged(mScrollPercent);
|
||||||
|
}
|
||||||
|
|
||||||
mContentLeft = left;
|
mContentLeft = left;
|
||||||
mContentTop = top;
|
mContentTop = top;
|
||||||
invalidate();
|
invalidate();
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ public class MessageListActivity extends QKSwipeBackActivity {
|
|||||||
if (mThreadId != -1) {
|
if (mThreadId != -1) {
|
||||||
Log.v(TAG, "Opening thread: " + mThreadId);
|
Log.v(TAG, "Opening thread: " + mThreadId);
|
||||||
MessageListFragment fragment = MessageListFragment.getInstance(mThreadId, mRowId, mHighlight, mShowImmediate);
|
MessageListFragment fragment = MessageListFragment.getInstance(mThreadId, mRowId, mHighlight, mShowImmediate);
|
||||||
|
mSwipeBackLayout.setScrollChangedListener(fragment);
|
||||||
getFragmentManager()
|
getFragmentManager()
|
||||||
.beginTransaction()
|
.beginTransaction()
|
||||||
.replace(R.id.content_frame, fragment)
|
.replace(R.id.content_frame, fragment)
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ import com.moez.QKSMS.common.CIELChEvaluator;
|
|||||||
import com.moez.QKSMS.common.ConversationPrefsHelper;
|
import com.moez.QKSMS.common.ConversationPrefsHelper;
|
||||||
import com.moez.QKSMS.common.DialogHelper;
|
import com.moez.QKSMS.common.DialogHelper;
|
||||||
import com.moez.QKSMS.common.LiveViewManager;
|
import com.moez.QKSMS.common.LiveViewManager;
|
||||||
|
import com.moez.QKSMS.ui.SwipeBackLayout;
|
||||||
import com.moez.QKSMS.ui.dialog.conversationdetails.ConversationDetailsDialog;
|
import com.moez.QKSMS.ui.dialog.conversationdetails.ConversationDetailsDialog;
|
||||||
import com.moez.QKSMS.enums.QKPreference;
|
import com.moez.QKSMS.enums.QKPreference;
|
||||||
import com.moez.QKSMS.common.utils.KeyboardUtils;
|
import com.moez.QKSMS.common.utils.KeyboardUtils;
|
||||||
@@ -80,7 +81,7 @@ import java.util.HashSet;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class MessageListFragment extends QKContentFragment implements ActivityLauncher, SensorEventListener,
|
public class MessageListFragment extends QKContentFragment implements ActivityLauncher, SensorEventListener,
|
||||||
LoaderManager.LoaderCallbacks<Cursor>, RecyclerCursorAdapter.MultiSelectListener,
|
LoaderManager.LoaderCallbacks<Cursor>, RecyclerCursorAdapter.MultiSelectListener, SwipeBackLayout.ScrollChangedListener,
|
||||||
RecyclerCursorAdapter.ItemClickListener<MessageItem> {
|
RecyclerCursorAdapter.ItemClickListener<MessageItem> {
|
||||||
|
|
||||||
private final String TAG = "MessageListFragment";
|
private final String TAG = "MessageListFragment";
|
||||||
@@ -641,9 +642,6 @@ public class MessageListFragment extends QKContentFragment implements ActivityLa
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMenuChanging(float percentOpen) {
|
public void onMenuChanging(float percentOpen) {
|
||||||
if (mConversationPrefs != null) {
|
|
||||||
ThemeManager.setActiveColor(mCIELChEvaluator.evaluate(percentOpen));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -706,6 +704,13 @@ public class MessageListFragment extends QKContentFragment implements ActivityLa
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onScrollChanged(float scrollPercent) {
|
||||||
|
if (mConversationPrefs != null) {
|
||||||
|
ThemeManager.setActiveColor(mCIELChEvaluator.evaluate(scrollPercent));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private class DeleteMessageListener implements DialogInterface.OnClickListener {
|
private class DeleteMessageListener implements DialogInterface.OnClickListener {
|
||||||
private final MessageItem mMessageItem;
|
private final MessageItem mMessageItem;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user