Skip to content

Commit

Permalink
Issue #SB-9022 merge: Merge pull request #4 from subranil/release-1.12.0
Browse files Browse the repository at this point in the history
Issue #SB-9022 feat: RTL support for urdu and similar languages
  • Loading branch information
AmiableAnil authored Nov 21, 2018
2 parents 188c8f9 + e01cff1 commit ee2411f
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 5 deletions.
3 changes: 2 additions & 1 deletion plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<resource-file src="res/drawable/rounded_button.xml" target="res/drawable/rounded_button.xml"/>
<resource-file src="res/drawable/ic_scanqrdemo.png" target="res/drawable/ic_scanqrdemo.png" />
<resource-file src="res/drawable-xxhdpi/ic_action_arrow_left.png" target="res/drawable-xxhdpi/ic_action_arrow_left.png" />
<resource-file src="res/drawable-xxhdpi/ic_action_arrow_right.png" target="res/drawable-xxhdpi/ic_action_arrow_right.png" />
<resource-file src="res/layout/qr_scanner_dialog.xml" target="res/layout/qr_scanner_dialog.xml" />
</platform>
</plugin>
</plugin>
Binary file added res/drawable-xxhdpi/ic_action_arrow_right.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion res/layout/qr_scanner_dialog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<Button
android:id="@+id/button_skip"
android:layout_width="102dp"
android:layout_height="25dp"
android:layout_height="30dp"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="5dp"
android:background="@drawable/rounded_button"
Expand Down
8 changes: 7 additions & 1 deletion src/android/org/sunbird/QRScanner.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ private void showScanDialog(JSONArray args, final CallbackContext callbackContex
String displayTextColor = args.optString(3, "#0b0b0b");
String buttonText = args.optString(4, "Skip");
boolean showButton = args.optBoolean(5, false);
boolean isRtl = args.optBoolean(6, false);

cordova.getActivity().runOnUiThread(new Runnable() {
@Override
Expand All @@ -84,7 +85,12 @@ public void run() {
Toolbar toolbar = view.findViewById(getIdOfResource("toolbar", "id"));
toolbar.setTitle(title);

toolbar.setNavigationIcon(getIdOfResource("ic_action_arrow_left", "drawable"));
if (isRtl) {
view.setLayoutDirection(View.LAYOUT_DIRECTION_RTL);
toolbar.setNavigationIcon(getIdOfResource("ic_action_arrow_right", "drawable"));
} else {
toolbar.setNavigationIcon(getIdOfResource("ic_action_arrow_left", "drawable"));
}
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Expand Down
4 changes: 2 additions & 2 deletions www/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ var PLUGIN_NAME = 'qrScanner';

var qrScanner = {
startScanner: function (screenTitle, displayText, displayTextColor,
buttonText, showButton, success, error) {
exec(success, error, PLUGIN_NAME, PLUGIN_NAME, ["startScanner", screenTitle, displayText, displayTextColor, buttonText, showButton]);
buttonText, showButton, isRtl, success, error) {
exec(success, error, PLUGIN_NAME, PLUGIN_NAME, ["startScanner", screenTitle, displayText, displayTextColor, buttonText, showButton, isRtl]);
},

stopScanner: function (success, error) {
Expand Down

0 comments on commit ee2411f

Please sign in to comment.