Skip to content
This repository has been archived by the owner on Feb 28, 2024. It is now read-only.

[SimpleDialog]sometimes need set gravity to message view #395

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions app/src/main/java/com/rey/material/app/ContactView.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import android.graphics.Shader;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.support.annotation.NonNull;
import android.support.v4.view.GravityCompat;
import android.text.TextUtils;
Expand Down Expand Up @@ -159,7 +158,9 @@ public void setOnClickListener(OnClickListener l) {
@Override
public boolean onTouchEvent(@NonNull MotionEvent event) {
boolean result = super.onTouchEvent(event);
return mRippleManager.onTouchEvent(this, event) || result;
if(result)
mRippleManager.onTouchEvent(this, event);
return result;
}

public void setAvatarBitmap(Bitmap bm){
Expand Down
3 changes: 0 additions & 3 deletions material/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,3 @@ dependencies {
}

// Place it at the end of the file
apply from: "$rootProject.projectDir/dist/distInfo.gradle"
apply from: "$rootProject.projectDir/dist/bintray.gradle"
apply from: "$rootProject.projectDir/dist/maven.gradle"
12 changes: 12 additions & 0 deletions material/src/main/java/com/rey/material/app/SimpleDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,18 @@ private void initMessageView(){
mMessage.setGravity(Gravity.START | Gravity.CENTER_VERTICAL);
}

/**
* Set a gravity to this message view
* @param gravity
* @return The SimpleDialog for chaining methods.
*/
public SimpleDialog messageGravity(int gravity){
if(mMessage == null)
initMessageView();
mMessage.setGravity(gravity);
return this;
}

/**
* Set a message text to this SimpleDialog.
* @param message
Expand Down
4 changes: 3 additions & 1 deletion material/src/main/java/com/rey/material/widget/Button.java
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,9 @@ public void setOnClickListener(OnClickListener l) {
@Override
public boolean onTouchEvent(@NonNull MotionEvent event) {
boolean result = super.onTouchEvent(event);
return getRippleManager().onTouchEvent(this, event) || result;
if(result)
getRippleManager().onTouchEvent(this, event);
return result;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ public void setOnClickListener(OnClickListener l) {
@Override
public boolean onTouchEvent(@NonNull MotionEvent event) {
boolean result = super.onTouchEvent(event);
return getRippleManager().onTouchEvent(this, event) || result;
if(result)
getRippleManager().onTouchEvent(this, event);
return result;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,9 @@ public void setOnClickListener(OnClickListener l) {
@Override
public boolean onTouchEvent(@NonNull MotionEvent event) {
boolean result = super.onTouchEvent(event);
return getRippleManager().onTouchEvent(this, event) || result;
if(result)
getRippleManager().onTouchEvent(this, event);
return result;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -501,8 +501,10 @@ public boolean onTouchEvent(@NonNull MotionEvent event) {
if(action == MotionEvent.ACTION_DOWN && ! mBackground.isPointerOver(event.getX(), event.getY()))
return false;

boolean result = super.onTouchEvent(event);
return getRippleManager().onTouchEvent(this, event) || result;
boolean result = super.onTouchEvent(event);
if(result)
getRippleManager().onTouchEvent(this, event);
return result;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,9 @@ public void setOnClickListener(OnClickListener l) {
@Override
public boolean onTouchEvent(@NonNull MotionEvent event) {
boolean result = super.onTouchEvent(event);
return getRippleManager().onTouchEvent(this, event) || result;
if(result)
getRippleManager().onTouchEvent(this, event);
return result;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,9 @@ public void setOnClickListener(OnClickListener l) {
@Override
public boolean onTouchEvent(@NonNull MotionEvent event) {
boolean result = super.onTouchEvent(event);
return getRippleManager().onTouchEvent(this, event) || result;
if(result)
getRippleManager().onTouchEvent(this, event);
return result;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@ public void setOnClickListener(OnClickListener l) {
@Override
public boolean onTouchEvent(@NonNull MotionEvent event) {
boolean result = super.onTouchEvent(event);
return getRippleManager().onTouchEvent(this, event) || result;
if(result)
getRippleManager().onTouchEvent(this, event);
return result;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@ public void setOnClickListener(OnClickListener l) {
@Override
public boolean onTouchEvent(@NonNull MotionEvent event) {
boolean result = super.onTouchEvent(event);
return getRippleManager().onTouchEvent(this, event) || result;
if(result)
getRippleManager().onTouchEvent(this, event);
return result;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,9 @@ public void setOnClickListener(OnClickListener l) {
@Override
public boolean onTouchEvent(@NonNull MotionEvent event) {
boolean result = super.onTouchEvent(event);
return getRippleManager().onTouchEvent(this, event) || result;
if(result)
getRippleManager().onTouchEvent(this, event);
return result;
}

}
4 changes: 3 additions & 1 deletion material/src/main/java/com/rey/material/widget/TextView.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,9 @@ public void setOnClickListener(OnClickListener l) {
@Override
public boolean onTouchEvent(@NonNull MotionEvent event) {
boolean result = super.onTouchEvent(event);
return getRippleManager().onTouchEvent(this, event) || result;
if(result)
getRippleManager().onTouchEvent(this, event);
return result;
}

public void setOnSelectionChangedListener(OnSelectionChangedListener listener){
Expand Down