Skip to content

Commit

Permalink
Merge pull request #51 from muak/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
muak authored Dec 26, 2019
2 parents 65f7275 + 93a6bb3 commit dbe3837
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 7 deletions.
10 changes: 7 additions & 3 deletions AiForms.Effects.Droid/AddTextPlatformEffect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using Xamarin.Forms.Platform.Android;
using System;
using Android.Content;
using System.Threading.Tasks;

[assembly: ExportEffect(typeof(AddTextPlatformEffect), nameof(AddText))]
namespace AiForms.Effects.Droid
Expand Down Expand Up @@ -162,19 +163,20 @@ static void UpdateLayout(TextView textview, Element element, Android.Views.View

var textpaint = textview.Paint;
var rect = new Android.Graphics.Rect();
textpaint.GetTextBounds(textview.Text, 0, textview.Text.Length, rect);
//textpaint.GetTextBounds(textview.Text, 0, textview.Text.Length, rect); // GetTextBound.Width is sometimes a little small less than actual width.
var textWidth = (int)textpaint.MeasureText(textview.Text);

var xPos = 0;
if (AddText.GetHorizontalAlign(element) == Xamarin.Forms.TextAlignment.End) {
xPos = v.Width - rect.Width() - textview.PaddingLeft - textview.PaddingRight - (int)margin.Right - 4;
xPos = v.Width - textWidth - textview.PaddingLeft - textview.PaddingRight - (int)margin.Right - 4;
if (xPos < (int)margin.Left) {
xPos = (int)margin.Left;
}
textview.Right = v.Width - (int)margin.Right;
}
else {
xPos = (int)margin.Left;
textview.Right = (int)margin.Left + rect.Width() + textview.PaddingLeft + textview.PaddingRight + 4;
textview.Right = (int)margin.Left + textWidth + textview.PaddingLeft + textview.PaddingRight + 4;
if (textview.Right >= v.Width) {
textview.Right = v.Width - (int)margin.Right;
}
Expand All @@ -189,6 +191,8 @@ static void UpdateLayout(TextView textview, Element element, Android.Views.View

textview.Top = yPos;
textview.Bottom = yPos + height;

textview.Text = textview.Text; // HACK: For some reason, Invalidate is not work. Use reassign text instead of.
}

internal class ContainerOnLayoutChangeListener : Java.Lang.Object, Android.Views.View.IOnLayoutChangeListener
Expand Down
8 changes: 6 additions & 2 deletions AiForms.Effects.Droid/FeedbackPlatformEffect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ public class FeedbackPlatformEffect:AiEffectBase
typeof(Xamarin.Forms.AbsoluteLayout),
typeof(Grid),
typeof(Xamarin.Forms.RelativeLayout),
typeof(StackLayout)
typeof(StackLayout),
typeof(Xamarin.Forms.Button),
typeof(Xamarin.Forms.Image),
typeof(Xamarin.Forms.BoxView),
typeof(Xamarin.Forms.Label),
};

private Android.Views.View _view;
Expand Down Expand Up @@ -142,7 +146,7 @@ void OnOverlayTouch(object sender, Android.Views.View.TouchEventArgs e)
PlaySound();
}

_view.DispatchTouchEvent(e.Event);
_view?.DispatchTouchEvent(e.Event);

e.Handled = false;
}
Expand Down
15 changes: 15 additions & 0 deletions README-ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,21 @@ viewをタップするとPickerが表示され、日付を選択すると、そ
* [yuka-abn](https://github.com/yuka-abn)
* [gentledepp](https://github.com/gentledepp)

## 寄付

開発継続のため、寄付を募集しています。

寄付をいただけるとやる気が非常にアップしますので、どうかよろしくお願いいたします🙇

* [PayPalMe](https://paypal.me/kamusoftJP?locale.x=ja_JP)

## スポンサー

スポンサーも募集しています。
こちらはサブスクリプション制になります。

* [GitHub Sponsors](https://github.com/sponsors/muak)

## License

MIT Licensed.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -768,6 +768,22 @@ This effect supports Editor only.
* [yuka-abn](https://github.com/yuka-abn)
* [gentledepp](https://github.com/gentledepp)

## Donation

I am asking for your donation for continuous development🙇

Your donation will allow me to work harder and harder.

* [PayPalMe](https://paypal.me/kamusoftJP?locale.x=ja_JP)


## Sponsors

I am asking for sponsors too.
This is a subscription.

* [GitHub Sponsors](https://github.com/sponsors/muak)

## License

MIT Licensed.
6 changes: 4 additions & 2 deletions nuget/AzurePipelines.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@
<releaseNotes>
## Changes

* Add the Android platform init method.
* Feedback – On Android, a button is now ringed a sound. #50

## Bug fixes

* AlterColor – Slider thumb color isn't changed.
* AddText – Fixed the end of characters is sometimes omitted #48.
* Feedback – Fixed Android OnOverlayTouch crash #49.

</releaseNotes>
<tags>Xamarin.Forms Effects Command NumberPikcer LineHeight LineSpacing FlatButton Validation SoundEffect Border TimePicker DatePicker Placeholder Color SizeToFit TouchEvents Floating</tags>
<language>en-US</language>
Expand Down

0 comments on commit dbe3837

Please sign in to comment.