Skip to content

Commit dbe3837

Browse files
authored
Merge pull request #51 from muak/development
Development
2 parents 65f7275 + 93a6bb3 commit dbe3837

File tree

5 files changed

+48
-7
lines changed

5 files changed

+48
-7
lines changed

AiForms.Effects.Droid/AddTextPlatformEffect.cs

+7-3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using Xamarin.Forms.Platform.Android;
77
using System;
88
using Android.Content;
9+
using System.Threading.Tasks;
910

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

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

167169
var xPos = 0;
168170
if (AddText.GetHorizontalAlign(element) == Xamarin.Forms.TextAlignment.End) {
169-
xPos = v.Width - rect.Width() - textview.PaddingLeft - textview.PaddingRight - (int)margin.Right - 4;
171+
xPos = v.Width - textWidth - textview.PaddingLeft - textview.PaddingRight - (int)margin.Right - 4;
170172
if (xPos < (int)margin.Left) {
171173
xPos = (int)margin.Left;
172174
}
173175
textview.Right = v.Width - (int)margin.Right;
174176
}
175177
else {
176178
xPos = (int)margin.Left;
177-
textview.Right = (int)margin.Left + rect.Width() + textview.PaddingLeft + textview.PaddingRight + 4;
179+
textview.Right = (int)margin.Left + textWidth + textview.PaddingLeft + textview.PaddingRight + 4;
178180
if (textview.Right >= v.Width) {
179181
textview.Right = v.Width - (int)margin.Right;
180182
}
@@ -189,6 +191,8 @@ static void UpdateLayout(TextView textview, Element element, Android.Views.View
189191

190192
textview.Top = yPos;
191193
textview.Bottom = yPos + height;
194+
195+
textview.Text = textview.Text; // HACK: For some reason, Invalidate is not work. Use reassign text instead of.
192196
}
193197

194198
internal class ContainerOnLayoutChangeListener : Java.Lang.Object, Android.Views.View.IOnLayoutChangeListener

AiForms.Effects.Droid/FeedbackPlatformEffect.cs

+6-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ public class FeedbackPlatformEffect:AiEffectBase
2828
typeof(Xamarin.Forms.AbsoluteLayout),
2929
typeof(Grid),
3030
typeof(Xamarin.Forms.RelativeLayout),
31-
typeof(StackLayout)
31+
typeof(StackLayout),
32+
typeof(Xamarin.Forms.Button),
33+
typeof(Xamarin.Forms.Image),
34+
typeof(Xamarin.Forms.BoxView),
35+
typeof(Xamarin.Forms.Label),
3236
};
3337

3438
private Android.Views.View _view;
@@ -142,7 +146,7 @@ void OnOverlayTouch(object sender, Android.Views.View.TouchEventArgs e)
142146
PlaySound();
143147
}
144148

145-
_view.DispatchTouchEvent(e.Event);
149+
_view?.DispatchTouchEvent(e.Event);
146150

147151
e.Handled = false;
148152
}

README-ja.md

+15
Original file line numberDiff line numberDiff line change
@@ -744,6 +744,21 @@ viewをタップするとPickerが表示され、日付を選択すると、そ
744744
* [yuka-abn](https://github.com/yuka-abn)
745745
* [gentledepp](https://github.com/gentledepp)
746746

747+
## 寄付
748+
749+
開発継続のため、寄付を募集しています。
750+
751+
寄付をいただけるとやる気が非常にアップしますので、どうかよろしくお願いいたします🙇
752+
753+
* [PayPalMe](https://paypal.me/kamusoftJP?locale.x=ja_JP)
754+
755+
## スポンサー
756+
757+
スポンサーも募集しています。
758+
こちらはサブスクリプション制になります。
759+
760+
* [GitHub Sponsors](https://github.com/sponsors/muak)
761+
747762
## License
748763

749764
MIT Licensed.

README.md

+16
Original file line numberDiff line numberDiff line change
@@ -768,6 +768,22 @@ This effect supports Editor only.
768768
* [yuka-abn](https://github.com/yuka-abn)
769769
* [gentledepp](https://github.com/gentledepp)
770770

771+
## Donation
772+
773+
I am asking for your donation for continuous development🙇
774+
775+
Your donation will allow me to work harder and harder.
776+
777+
* [PayPalMe](https://paypal.me/kamusoftJP?locale.x=ja_JP)
778+
779+
780+
## Sponsors
781+
782+
I am asking for sponsors too.
783+
This is a subscription.
784+
785+
* [GitHub Sponsors](https://github.com/sponsors/muak)
786+
771787
## License
772788

773789
MIT Licensed.

nuget/AzurePipelines.nuspec

+4-2
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@
1515
<releaseNotes>
1616
## Changes
1717

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

2020
## Bug fixes
2121

22-
* AlterColor – Slider thumb color isn't changed.
22+
* AddText – Fixed the end of characters is sometimes omitted #48.
23+
* Feedback – Fixed Android OnOverlayTouch crash #49.
24+
2325
</releaseNotes>
2426
<tags>Xamarin.Forms Effects Command NumberPikcer LineHeight LineSpacing FlatButton Validation SoundEffect Border TimePicker DatePicker Placeholder Color SizeToFit TouchEvents Floating</tags>
2527
<language>en-US</language>

0 commit comments

Comments
 (0)