Skip to content

Commit

Permalink
Merge pull request #8 from kevalpatel2106/fix/ui-shrink
Browse files Browse the repository at this point in the history
Fixing the issue UI of password page changes and shrinks sometimes
  • Loading branch information
kevalpatel2106 authored Feb 6, 2018
2 parents 7d3fff1 + ada47f0 commit 090391d
Showing 1 changed file with 12 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import android.support.annotation.Nullable;
import android.support.annotation.RequiresApi;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.View;

import com.kevalpatel.passcodeview.interfaces.AuthenticationListener;
Expand Down Expand Up @@ -166,27 +165,20 @@ private void prepareDividerPaint() {

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
measureMainView();
int viewHeight = MeasureSpec.getSize(heightMeasureSpec);
int viewWidth = MeasureSpec.getSize(widthMeasureSpec);

mRootViewBound.left = 0;
mRootViewBound.right = mRootViewBound.left + viewWidth;
mRootViewBound.top = 0;
mRootViewBound.bottom = mRootViewBound.left + viewHeight;

measureDivider();

setMeasuredDimension(widthMeasureSpec, heightMeasureSpec);
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}

/**
* Measure the root view and get bounds.
*/
private void measureMainView() {
getLocalVisibleRect(mRootViewBound);

//Get the height of the actionbar if we have any actionbar and add it to the top
TypedValue tv = new TypedValue();
if (mContext.getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true)) {
mRootViewBound.top = mRootViewBound.top
+ TypedValue.complexToDimensionPixelSize(tv.data, getResources().getDisplayMetrics());
}
}

/**
* Measure horizontal divider bounds.
* Don't change until you know what you are doing. :-)
Expand Down Expand Up @@ -291,13 +283,13 @@ public float getFingerPrintStatusTextSize() {
return mBoxFingerprint.getStatusTextSize();
}

public void setFingerPrintStatusTextSize(@Dimension float statusTextSize) {
mBoxFingerprint.setStatusTextSize(statusTextSize);
public void setFingerPrintStatusTextSize(@DimenRes int statusTextSize) {
mBoxFingerprint.setStatusTextSize(getResources().getDimension(statusTextSize));
invalidate();
}

public void setFingerPrintStatusTextSize(@DimenRes int statusTextSize) {
mBoxFingerprint.setStatusTextSize(getResources().getDimension(statusTextSize));
public void setFingerPrintStatusTextSize(@Dimension float statusTextSize) {
mBoxFingerprint.setStatusTextSize(statusTextSize);
invalidate();
}

Expand Down

0 comments on commit 090391d

Please sign in to comment.