bravobit / FFmpeg-Android

FFMpeg/FFprobe compiled for Android
https://bravobit.nl/
MIT License
734 stars 172 forks source link

Right-to-left layouts broken after FFmpeg initialization. #93

Closed formatBCE closed 5 years ago

formatBCE commented 5 years ago

My application is multi-language. I did initiate FFmpeg on app start. After locale change to Arabic (RTL) all layouts were remain unchanged. After couple days of investigation, i found, that after FFmpeg localization all views starting to ignore setLayoutDirection method. I moved FFmpeg initialization to exact place, where i need it - and problem gone on app start. However, after single FFmpeg using, all RTL layouts still come to LTR state. This bug has really heavy impact to any right-to-left locale, so please, investigate it.

formatBCE commented 5 years ago

Ok, i fixed it. It's known bug, which was originally produced by some post on developer.android.com. You use following method in Utils class:

static boolean isDebug(Context context) { return (context.getApplicationContext().getApplicationInfo().flags &= ApplicationInfo.FLAG_DEBUGGABLE) != 0; } &= operator overrides ALL flags in context (including RTL flag).

Correct code is

static boolean isDebug(Context context) { return (context.getApplicationContext().getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0; }

(& instead of &=)

Please fix it. PullRequest: https://github.com/bravobit/FFmpeg-Android/pull/94