4141import android .support .annotation .DrawableRes ;
4242import android .support .annotation .IdRes ;
4343import android .support .annotation .LayoutRes ;
44- import android .support .v4 .content .ContextCompat ;
45- import android .support .v7 .widget .AppCompatPopupWindow ;
46- import android .support .v7 .widget .LinearLayoutCompat ;
4744import android .view .Gravity ;
4845import android .view .LayoutInflater ;
4946import android .view .MotionEvent ;
5249import android .view .ViewTreeObserver ;
5350import android .view .animation .AccelerateDecelerateInterpolator ;
5451import android .widget .ImageView ;
52+ import android .widget .LinearLayout ;
5553import android .widget .PopupWindow ;
5654import android .widget .TextView ;
5755
@@ -82,7 +80,7 @@ public class SimpleTooltip implements PopupWindow.OnDismissListener {
8280 private final Context mContext ;
8381 private final OnDismissListener mOnDismissListener ;
8482 private final OnShowListener mOnShowListener ;
85- private AppCompatPopupWindow mPopupWindow ;
83+ private PopupWindow mPopupWindow ;
8684 private final int mGravity ;
8785 private final boolean mDismissOnInsideTouch ;
8886 private final boolean mDismissOnOutsideTouch ;
@@ -145,7 +143,7 @@ private void init() {
145143 }
146144
147145 private void configPopupWindow () {
148- mPopupWindow = new AppCompatPopupWindow (mContext , null , mDefaultPopupWindowStyleRes );
146+ mPopupWindow = new PopupWindow (mContext , null , mDefaultPopupWindowStyleRes );
149147 mPopupWindow .setOnDismissListener (this );
150148 mPopupWindow .setWidth (ViewGroup .LayoutParams .WRAP_CONTENT );
151149 mPopupWindow .setHeight (ViewGroup .LayoutParams .WRAP_CONTENT );
@@ -228,16 +226,16 @@ private void configContentView() {
228226 if (mShowArrow ) {
229227 mArrowView = new ImageView (mContext );
230228 mArrowView .setImageDrawable (mArrowDrawable );
231- LinearLayoutCompat .LayoutParams arrowLayoutParams ;
229+ LinearLayout .LayoutParams arrowLayoutParams ;
232230 if (mGravity == Gravity .TOP || mGravity == Gravity .BOTTOM ) {
233- arrowLayoutParams = new LinearLayoutCompat .LayoutParams ((int ) mArrowWidth , (int ) mArrowHeight , 0 );
231+ arrowLayoutParams = new LinearLayout .LayoutParams ((int ) mArrowWidth , (int ) mArrowHeight , 0 );
234232 } else {
235- arrowLayoutParams = new LinearLayoutCompat .LayoutParams ((int ) mArrowHeight , (int ) mArrowWidth , 0 );
233+ arrowLayoutParams = new LinearLayout .LayoutParams ((int ) mArrowHeight , (int ) mArrowWidth , 0 );
236234 }
237235 mArrowView .setLayoutParams (arrowLayoutParams );
238- LinearLayoutCompat linearLayout = new LinearLayoutCompat (mContext );
236+ LinearLayout linearLayout = new LinearLayout (mContext );
239237 linearLayout .setLayoutParams (new ViewGroup .LayoutParams (ViewGroup .LayoutParams .WRAP_CONTENT , ViewGroup .LayoutParams .WRAP_CONTENT ));
240- linearLayout .setOrientation (mGravity == Gravity .START || mGravity == Gravity .END ? LinearLayoutCompat .HORIZONTAL : LinearLayoutCompat .VERTICAL );
238+ linearLayout .setOrientation (mGravity == Gravity .START || mGravity == Gravity .END ? LinearLayout .HORIZONTAL : LinearLayout .VERTICAL );
241239 int padding = mAnimated ? mAnimationPadding : (int ) SimpleTooltipUtils .pxFromDp (4 );
242240 linearLayout .setPadding (padding , padding , padding , padding );
243241
@@ -249,7 +247,7 @@ private void configContentView() {
249247 linearLayout .addView (mContentView );
250248 }
251249
252- LinearLayoutCompat .LayoutParams contentViewParams = new LinearLayoutCompat .LayoutParams (ViewGroup .LayoutParams .WRAP_CONTENT , ViewGroup .LayoutParams .WRAP_CONTENT , 0 );
250+ LinearLayout .LayoutParams contentViewParams = new LinearLayout .LayoutParams (ViewGroup .LayoutParams .WRAP_CONTENT , ViewGroup .LayoutParams .WRAP_CONTENT , 0 );
253251 contentViewParams .gravity = Gravity .CENTER ;
254252 mContentView .setLayoutParams (contentViewParams );
255253
@@ -530,10 +528,10 @@ public Builder(Context context) {
530528 public SimpleTooltip build () throws IllegalArgumentException {
531529 validateArguments ();
532530 if (backgroundColor == 0 ) {
533- backgroundColor = ContextCompat .getColor (context , mDefaultBackgroundColorRes );
531+ backgroundColor = SimpleTooltipUtils .getColor (context , mDefaultBackgroundColorRes );
534532 }
535533 if (textColor == 0 ) {
536- textColor = ContextCompat .getColor (context , mDefaultTextColorRes );
534+ textColor = SimpleTooltipUtils .getColor (context , mDefaultTextColorRes );
537535 }
538536 if (contentView == null ) {
539537 TextView tv = new TextView (context );
@@ -543,7 +541,7 @@ public SimpleTooltip build() throws IllegalArgumentException {
543541 contentView = tv ;
544542 }
545543 if (arrowColor == 0 ) {
546- arrowColor = ContextCompat .getColor (context , mDefaultArrowColorRes );
544+ arrowColor = SimpleTooltipUtils .getColor (context , mDefaultArrowColorRes );
547545 }
548546 if (arrowDrawable == null ) {
549547 int arrowDirection = SimpleTooltipUtils .tooltipGravityToArrowDirection (gravity );
@@ -857,7 +855,7 @@ public Builder arrowDrawable(Drawable arrowDrawable) {
857855 }
858856
859857 public Builder arrowDrawable (@ DrawableRes int drawableRes ) {
860- this .arrowDrawable = ContextCompat .getDrawable (context , drawableRes );
858+ this .arrowDrawable = SimpleTooltipUtils .getDrawable (context , drawableRes );
861859 return this ;
862860 }
863861
0 commit comments