Auto evaluate emplacement
This commit is contained in:
parent
5820c607c2
commit
76733161dc
|
@ -35,10 +35,5 @@ public class PixelfedComposeActivity extends BasePixelfedComposeActivity{
|
|||
|
||||
@Override
|
||||
protected void displayEmojiPopup() {
|
||||
final EmojiPopup emojiPopup = EmojiPopup.Builder.fromRootView(drawer_layout).build(toot_content);
|
||||
|
||||
toot_emoji.setOnClickListener(v -> {
|
||||
emojiPopup.toggle(); // Toggles visibility of the Popup.
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ import android.content.res.ColorStateList;
|
|||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
|
@ -185,7 +186,6 @@ public abstract class BasePixelfedComposeActivity extends BaseActivity implement
|
|||
private final int TAKE_PHOTO = 56532;
|
||||
public long currentToId;
|
||||
protected MastalabAutoCompleteTextView toot_content;
|
||||
protected ImageButton toot_emoji;
|
||||
protected LinearLayout drawer_layout;
|
||||
String mCurrentPhotoPath;
|
||||
File photoFile = null;
|
||||
|
@ -439,7 +439,7 @@ public abstract class BasePixelfedComposeActivity extends BaseActivity implement
|
|||
}
|
||||
InputStream tempInput = null;
|
||||
SharedPreferences sharedpreferences = activity.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
boolean isWM = sharedpreferences.getBoolean(Helper.SET_WATERMARK, false);
|
||||
boolean isWM = sharedpreferences.getBoolean(Helper.SET_WATERMARK, true);
|
||||
ContentResolver cr = activity.getContentResolver();
|
||||
String mime = cr.getType(inUri);
|
||||
if ((mime == null || mime.toLowerCase().contains("image")) && isWM) {
|
||||
|
@ -447,17 +447,29 @@ public abstract class BasePixelfedComposeActivity extends BaseActivity implement
|
|||
if( WMText == null || WMText.trim().length() == 0) {
|
||||
WMText = "@" + account.getUsername() + "@" + account.getInstance();
|
||||
}
|
||||
WatermarkText watermarkText = new WatermarkText(WMText)
|
||||
.setPositionX(0)
|
||||
.setPositionY(0.90)
|
||||
.setTextColor(Color.WHITE)
|
||||
.setTextShadow(0.1f, 3, 3, Color.LTGRAY)
|
||||
.setTextAlpha(200)
|
||||
.setRotation(0)
|
||||
.setTextSize(15);
|
||||
|
||||
Paint mPaint = new Paint();
|
||||
mPaint.setTextSize(WMText.length());
|
||||
float width = mPaint.measureText(WMText, 0, WMText.length());
|
||||
try {
|
||||
Bitmap backgroundBitmap = MediaStore.Images.Media.getBitmap(activity.getContentResolver() , inUri);
|
||||
|
||||
int w = backgroundBitmap.getWidth();
|
||||
int h = backgroundBitmap.getHeight();
|
||||
|
||||
float textSize = 15;
|
||||
float valx = 1-(w - width - 10 )/(float)w;
|
||||
if( valx < 0 )
|
||||
valx = 0;
|
||||
float valy = (h - Helper.convertDpToPixel(textSize, activity) - 10)/(float)h;
|
||||
WatermarkText watermarkText = new WatermarkText(WMText)
|
||||
.setPositionX(valx)
|
||||
.setPositionY(valy)
|
||||
.setTextColor(Color.WHITE)
|
||||
.setTextShadow(0.1f, 1, 1, Color.LTGRAY)
|
||||
.setTextAlpha(200)
|
||||
.setRotation(0)
|
||||
.setTextSize(textSize);
|
||||
|
||||
Bitmap bitmap = WatermarkBuilder
|
||||
.create(activity, backgroundBitmap)
|
||||
.loadWatermarkText(watermarkText)
|
||||
|
|
|
@ -29,6 +29,7 @@ import android.content.pm.PackageManager;
|
|||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
|
@ -46,6 +47,7 @@ import android.text.InputType;
|
|||
import android.text.SpannableString;
|
||||
import android.text.TextWatcher;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.util.Log;
|
||||
import android.util.Patterns;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
|
@ -511,7 +513,7 @@ public abstract class BaseTootActivity extends BaseActivity implements UploadSta
|
|||
}
|
||||
InputStream tempInput = null;
|
||||
SharedPreferences sharedpreferences = activity.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
boolean isWM = sharedpreferences.getBoolean(Helper.SET_WATERMARK, false);
|
||||
boolean isWM = sharedpreferences.getBoolean(Helper.SET_WATERMARK, true);
|
||||
ContentResolver cr = activity.getContentResolver();
|
||||
String mime = cr.getType(inUri);
|
||||
if ((mime == null || mime.toLowerCase().contains("image")) && isWM) {
|
||||
|
@ -519,17 +521,31 @@ public abstract class BaseTootActivity extends BaseActivity implements UploadSta
|
|||
if( WMText == null || WMText.trim().length() == 0) {
|
||||
WMText = "@" + account.getUsername() + "@" + account.getInstance();
|
||||
}
|
||||
WatermarkText watermarkText = new WatermarkText(WMText)
|
||||
.setPositionX(0)
|
||||
.setPositionY(0.90)
|
||||
.setTextColor(Color.WHITE)
|
||||
.setTextShadow(0.1f, 3, 3, Color.LTGRAY)
|
||||
.setTextAlpha(200)
|
||||
.setRotation(0)
|
||||
.setTextSize(15);
|
||||
|
||||
Paint mPaint = new Paint();
|
||||
mPaint.setTextSize(WMText.length());
|
||||
float width = mPaint.measureText(WMText, 0, WMText.length());
|
||||
|
||||
try {
|
||||
Bitmap backgroundBitmap = MediaStore.Images.Media.getBitmap(activity.getContentResolver() , inUri);
|
||||
|
||||
int w = backgroundBitmap.getWidth();
|
||||
int h = backgroundBitmap.getHeight();
|
||||
|
||||
float textSize = 15;
|
||||
float valx = 1-(w - width - 10 )/(float)w;
|
||||
if( valx < 0 )
|
||||
valx = 0;
|
||||
float valy = (h - Helper.convertDpToPixel(textSize, activity) - 10)/(float)h;
|
||||
WatermarkText watermarkText = new WatermarkText(WMText)
|
||||
.setPositionX(valx)
|
||||
.setPositionY(valy)
|
||||
.setTextColor(Color.WHITE)
|
||||
.setTextShadow(0.1f, 1, 1, Color.LTGRAY)
|
||||
.setTextAlpha(200)
|
||||
.setRotation(0)
|
||||
.setTextSize(textSize);
|
||||
|
||||
Bitmap bitmap = WatermarkBuilder
|
||||
.create(activity, backgroundBitmap)
|
||||
.loadWatermarkText(watermarkText)
|
||||
|
|
Loading…
Reference in New Issue