summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoremancebo <emancebo@cyngn.com>2015-04-19 13:31:43 -0700
committeremancebo <emancebo@cyngn.com>2015-04-19 13:50:04 -0700
commit604f9c8a9dc1a50b296ab93bc36283f314314a37 (patch)
tree7f9685cd347adc6d89df58e8f6f083db96b7a375
parentdaf8076896b9ceb05b74f1d9dbcbc5b8c33c42ae (diff)
parent18979e723f449cb4312a0156306080ed36c15d1a (diff)
downloadandroid_external_cyanogen_UICommon-stable/cm-12.0-YNG1T.tar.gz
android_external_cyanogen_UICommon-stable/cm-12.0-YNG1T.tar.bz2
android_external_cyanogen_UICommon-stable/cm-12.0-YNG1T.zip
Merge branch 'cm-12.0' into stable/cm-12.0-YNG1Tstable/cm-12.0-YNG1T
Change-Id: I36f79fa39c4a5d6d9b6d62aeb4d2a851ff470c01
-rw-r--r--res/values/dimens.xml1
-rw-r--r--src/com/cyngn/uicommon/rs/grayscale.rs16
-rw-r--r--src/com/cyngn/uicommon/view/ExpandingCard.java33
3 files changed, 24 insertions, 26 deletions
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index fb1200e..4d10050 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
- <dimen name="expanding_card_aux_height">50dp</dimen>
<dimen name="expanding_card_elevation">5dp</dimen>
</resources>
diff --git a/src/com/cyngn/uicommon/rs/grayscale.rs b/src/com/cyngn/uicommon/rs/grayscale.rs
new file mode 100644
index 0000000..c5d06aa
--- /dev/null
+++ b/src/com/cyngn/uicommon/rs/grayscale.rs
@@ -0,0 +1,16 @@
+#pragma version(1)
+#pragma rs java_package_name(com.cyngn.uicommon.rs)
+#pragma rs_fp_imprecise
+
+uchar4 __attribute__((kernel)) grayscale(uchar4 pixelIn, uint32_t x, uint32_t y) {
+
+ uchar grayscale = pixelIn.r * 0.299 + pixelIn.g * 0.587 + pixelIn.b * 0.114;
+ uchar4 pixelOut;
+
+ pixelOut.a = pixelIn.a;
+ pixelOut.r = grayscale;
+ pixelOut.g = grayscale;
+ pixelOut.b = grayscale;
+
+ return pixelOut;
+} \ No newline at end of file
diff --git a/src/com/cyngn/uicommon/view/ExpandingCard.java b/src/com/cyngn/uicommon/view/ExpandingCard.java
index e69b755..b3b32b6 100644
--- a/src/com/cyngn/uicommon/view/ExpandingCard.java
+++ b/src/com/cyngn/uicommon/view/ExpandingCard.java
@@ -59,7 +59,6 @@ public class ExpandingCard extends FrameLayout {
private View mAuxView;
private int mAuxTop = -1;
- private int mAuxHeight;
private int mMainBottom = -1;
private ColorDrawable mColor;
private GradientDrawable mColorSelected;
@@ -88,7 +87,6 @@ public class ExpandingCard extends FrameLayout {
mAuxView = findViewById(R.id.auxiliaryView);
Resources res = getResources();
- mAuxHeight = res.getDimensionPixelSize(R.dimen.expanding_card_aux_height);
mCardElevation = res.getDimensionPixelSize(R.dimen.expanding_card_elevation);
mColor = new ColorDrawable(res.getColor(R.color.expanding_card_color));
mColorSelected = new GradientDrawable(GradientDrawable.Orientation.BOTTOM_TOP,
@@ -103,8 +101,8 @@ public class ExpandingCard extends FrameLayout {
public void expand(AnimationType type) {
mAuxView.setVisibility(View.VISIBLE);
- int mid = getAuxTop();
- int bottom = getMainBottom();
+ int mid = mMainView.getHeight() - mAuxView.getHeight();
+ int bottom = mMainView.getHeight();
ValueAnimator anim = null;
switch(type) {
@@ -142,7 +140,8 @@ public class ExpandingCard extends FrameLayout {
scrollingNeeded = mRowContainer.getTop(); // view at top/partially visible
} else {
int listViewHeight = mList.getHeight();
- int offset = mRowContainer.getTop() + mRowContainer.getHeight() + mAuxHeight - listViewHeight;
+ int offset = mRowContainer.getTop() + mRowContainer.getHeight()
+ + mAuxView.getHeight() - listViewHeight;
if (offset > 0) {
scrollingNeeded = offset;
}
@@ -224,13 +223,13 @@ public class ExpandingCard extends FrameLayout {
@Override
public void onAnimationEnd(Animator animation) {
- mAuxView.setVisibility(View.GONE);
+ mAuxView.setVisibility(View.INVISIBLE);
}
});
set.start();
} else {
// layouts are already collapsed. reset colors/visibility for completeness
- mAuxView.setVisibility(View.GONE);
+ mAuxView.setVisibility(View.INVISIBLE);
resetColors();
}
}
@@ -286,7 +285,7 @@ public class ExpandingCard extends FrameLayout {
if (mRowContainer != null) {
mRowContainer.setTranslationZ(0);
}
- mAuxView.setVisibility(View.GONE);
+ mAuxView.setVisibility(View.INVISIBLE);
new BottomMarginSetter().setMargin(mMainView, 0);
new TopMarginSetter().setMargin(mAuxView, 0);
mAuxTop = -1;
@@ -315,22 +314,6 @@ public class ExpandingCard extends FrameLayout {
}
}
- private int getAuxTop() {
- if (mAuxTop < 0) {
- mAuxTop = getMainBottom() - mAuxHeight;
- }
- return mAuxTop;
- }
-
- private int getMainBottom() {
- if (mMainBottom < 0) {
- // assumption: main view is bigger than aux view. We could use getBottom here,
- // but getHeight seems more robust since the height never changes
- mMainBottom = mMainView.getHeight();
- }
- return mMainBottom;
- }
-
private static interface MarginSetter {
public void setMargin(View v, int margin);
}
@@ -399,7 +382,7 @@ public class ExpandingCard extends FrameLayout {
}
}
}
- if (position > selectedCardPosition) {
+ if (selectedCardPosition != -1 && position > selectedCardPosition) {
card.expand(AnimationType.ANCHOR_BOTTOM);
} else {
card.expand(AnimationType.ANCHOR_TOP);