Skip to content

Commit

Permalink
UI touch up + handeled TODO's and edge cases
Browse files Browse the repository at this point in the history
  • Loading branch information
muditpant13 authored and manjunathc23 committed Mar 16, 2017
1 parent 4da8ded commit 522d926
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ public void createViewToBeMaskedOut(int startX, int startY, int height, int widt
@Override
public void dismissWithError(String message) {
Toast.makeText(getContext(), message, Toast.LENGTH_LONG).show();
ViewUtils.setToInvisible(mViews.rlCoachMarkParent);
ViewUtils.showFirstAndHideOthers(mViews.rlShimOutViewParent, mViews.ivCoachMarkImage, mViews.llPopUpCoachMarkParent);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
import android.support.annotation.DrawableRes;
import android.support.annotation.Nullable;
import android.support.annotation.StringRes;
import android.util.Log;

import com.myntra.coachmarks.PopUpCoachMark;
import com.myntra.coachmarks.R;
import com.myntra.coachmarks.builder.CoachMarkBuilder;
import com.myntra.coachmarks.builder.CoachMarkLayoutMargin;
Expand All @@ -33,6 +35,8 @@
@ParametersAreNonnullByDefault
public class PopUpCoachMarkPresenter {

private static final String TAG = PopUpCoachMarkPresenter.class.getSimpleName();

private static final double MAX_NOTCH_RANGE = .85;
private static final double MIN_NOTCH_RANGE = 0.0;

Expand All @@ -43,7 +47,11 @@ public class PopUpCoachMarkPresenter {
private static final float ROTATION_180 = 180;
private static final float ROTATION_270 = 270;

private static final int MULTIPLICATION_FACTOR_FOR_NOTCH_UI_ADJUSTMENT = 3;
private static final double MULTIPLICATION_FACTOR_NOTCH_POSITION = 1.8;
private static final double MULTIPLICATION_FACTOR_FOR_NOTCH_UI_ADJUSTMENT_BOTTOM = 2.9;
private static final double MULTIPLICATION_FACTOR_FOR_UI_ADJUSTMENT_RIGHT = 0.4;
private static final double PIXEL_ADJUSTMENT_NOTCH = 0.5;


private CoachMarkBuilder mCoachMarkBuilder;
private IPopUpCoachMarkPresentation mPresentation;
Expand Down Expand Up @@ -235,12 +243,12 @@ private void setNotchDisplayEdge(int position,
coachMarkDimenInPixel.getPopUpHeightInPixels(),
coachMarkDimenInPixel.getNotchDimenInPixels());
notchMarginRect = new Rect(NO_MARGIN,
notchPosition - (2 * coachMarkDimenInPixel.getMarginOffsetForNotchInPixels()),
notchPosition - (int)(MULTIPLICATION_FACTOR_NOTCH_POSITION * coachMarkDimenInPixel.getMarginOffsetForNotchInPixels()),
NO_MARGIN,
NO_MARGIN);
mPresentation.setNotchPositionIfPopUpBottomRight(notchMarginRect, ROTATION_270);
notchUiAdjustmentMarginRect = new Rect(NO_MARGIN,
notchPosition - coachMarkDimenInPixel.getMarginOffsetForNotchInPixels(),
notchPosition + (int)(MULTIPLICATION_FACTOR_FOR_UI_ADJUSTMENT_RIGHT * coachMarkDimenInPixel.getMarginOffsetForNotchInPixels() + PIXEL_ADJUSTMENT_NOTCH),
NO_MARGIN,
NO_MARGIN);
mPresentation.uiAdjustmentForNotchIfPopUpRight(notchUiAdjustmentMarginRect);
Expand All @@ -265,8 +273,8 @@ private void setNotchDisplayEdge(int position,
NO_MARGIN);
mPresentation.setNotchPositionIfPopUpBottomRight(notchMarginRect, ROTATION_0);
notchUiAdjustmentMarginRect = new Rect(notchPosition +
MULTIPLICATION_FACTOR_FOR_NOTCH_UI_ADJUSTMENT *
coachMarkDimenInPixel.getMarginOffsetForNotchInPixels(),
(int)(MULTIPLICATION_FACTOR_FOR_NOTCH_UI_ADJUSTMENT_BOTTOM *
coachMarkDimenInPixel.getMarginOffsetForNotchInPixels()),
NO_MARGIN,
NO_MARGIN,
NO_MARGIN);
Expand Down Expand Up @@ -363,7 +371,7 @@ private void showCoachMark(@DialogDismissButtonPosition int dismissButtonPositio
CoachMarkAlignPosition.ALIGN_TOP);
break;
case PopUpPosition.NONE:
//TODO:: Handle this case
Log.wtf(TAG, "This should not have happened here. No position found case already handled");
break;
}

Expand Down Expand Up @@ -419,7 +427,9 @@ private int getDisplayPosition(Point viewCenterPoint,
}
break;
case PopUpPosition.NONE:
//TODO:: Handle this
//if user selects no position by default check clockwise to find the correct position
correctPosition = getCorrectPositionOfCoachMarkIfDefaultFails(viewCenterPoint,
coachMarkDimenInPixel);
break;
}
return correctPosition;
Expand Down
2 changes: 1 addition & 1 deletion coachmarks/src/main/res/drawable/triangle_up.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
android:toDegrees="45">
<shape android:shape="rectangle">
<stroke
android:width="1dp"
android:width="@dimen/coach_mark_notch_margin_offset"
android:color="@color/coach_mark_notch_stroke_color" />
<solid android:color="@color/coach_mark_white" />
</shape>
Expand Down
6 changes: 3 additions & 3 deletions coachmarks/src/main/res/layout/pop_up_coach_mark.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
android:visibility="gone" />

<RelativeLayout
android:id="@+id/testp"
android:id="@+id/rl_pop_up_text_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content">

Expand Down Expand Up @@ -93,7 +93,7 @@
<View
android:id="@+id/v_notch_base_white_top"
android:layout_width="@dimen/coach_mark_notch_bottom_invisible_width"
android:layout_height="1dp"
android:layout_height="@dimen/coach_mark_notch_margin_offset"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
Expand All @@ -102,7 +102,7 @@

<View
android:id="@+id/v_notch_base_white_left"
android:layout_width="1dp"
android:layout_width="@dimen/coach_mark_notch_margin_offset"
android:layout_height="@dimen/coach_mark_notch_bottom_invisible_height"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
Expand Down
2 changes: 1 addition & 1 deletion coachmarks/src/main/res/values/color.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<color name="coach_mark_white">#FFFFFF</color>
<color name="coach_mark_mask_color">#70000000</color>
<color name="coach_mark_black_translucent">#50000000</color>
<color name="coach_mark_separator_color">#bfc0c6</color>
<color name="coach_mark_separator_color">#D4D5D9</color>
<color name="primary_color_dark">#1B202A</color>
<color name="color_accent">#0BC6A0</color>
<color name="primary_color">#FFFFFF</color>
Expand Down
6 changes: 3 additions & 3 deletions coachmarks/src/main/res/values/dimens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
<dimen name="coach_mark_text_padding_top_bottom">8dp</dimen>

<dimen name="coach_mark_notch_width_height">20dp</dimen>
<dimen name="coach_mark_notch_bottom_invisible_width">16dp</dimen>
<dimen name="coach_mark_notch_bottom_invisible_height">17dp</dimen>
<dimen name="coach_mark_notch_margin_offset">1dp</dimen>
<dimen name="coach_mark_notch_bottom_invisible_width">16.75dp</dimen>
<dimen name="coach_mark_notch_bottom_invisible_height">16.75dp</dimen>
<dimen name="coach_mark_notch_margin_offset">0.85dp</dimen>

<item name="coach_mark_scale_anim_from" format="float" type="dimen">1.0</item>
<item name="coach_mark_scale_anim_to" format="float" type="dimen">1.5</item>
Expand Down

0 comments on commit 522d926

Please sign in to comment.