Skip to content

Commit

Permalink
Adding implementation for left-handed mode that puts the keyboard and
Browse files Browse the repository at this point in the history
menu icon on the left when enabled.
  • Loading branch information
iiordanov committed Feb 5, 2017
1 parent b7c4856 commit fa1be76
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 2 deletions.
1 change: 0 additions & 1 deletion eclipse_projects/bVNC/res/layout-large/canvas.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/zoomer"
android:layout_gravity="center|right"
android:padding="10sp"
/>

Expand Down
1 change: 0 additions & 1 deletion eclipse_projects/bVNC/res/layout/canvas.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/zoomer"
android:layout_gravity="center|right"
android:padding="10sp"
/>

Expand Down
1 change: 1 addition & 0 deletions eclipse_projects/bVNC/res/menu/androidvncmenu.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@
<item android:id="@+id/itemDisableImmersive" android:title="@string/immersive_mode_disable" android:checkable="true"/>
<item android:id="@+id/itemForceLandscape" android:title="@string/landscape_force" android:checkable="true"/>
<item android:id="@+id/itemRAltAsIsoL3Shift" android:title="@string/right_alt_as_iso_l3_shift" android:checkable="true"/>
<item android:id="@+id/itemLeftHandedMode" android:title="@string/left_handed_mode" android:checkable="true"/>
</menu>
1 change: 1 addition & 0 deletions eclipse_projects/bVNC/res/values-pl/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
<string name="list_name_caption">Nazwa listy</string>
<string name="list_caption">Lista</string>
<string name="landscape_force">Wymuś poziomą orientację</string>
<string name="left_handed_mode">Tryb mańkut</string>
<string name="keys_caption">Przyciski</string>
<string name="keep_screen_awake_enable">Zachowaj włączony ekran</string>
<string name="keep_password_button">Zachowaj</string>
Expand Down
1 change: 1 addition & 0 deletions eclipse_projects/bVNC/res/values-ru/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@
<string name="keep_screen_awake_enable">Держать экран включенным</string>
<string name="keys_caption">Клавиши</string>
<string name="landscape_force">Альбомная ориентация</string>
<string name="left_handed_mode">Режим левши</string>
<string name="list_caption">Список</string>
<string name="list_name_caption">Имя списка</string>
<string name="local_mouse_check">Локальный курсор мыши (выберите, если курсор мыши не виден)</string>
Expand Down
1 change: 1 addition & 0 deletions eclipse_projects/bVNC/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ All Input Modes:
<string name="keep_screen_awake_enable">Keep Screen Awake</string>
<string name="keys_caption">Keys</string>
<string name="landscape_force">Force Landscape Orientation</string>
<string name="left_handed_mode">Left-Handed Mode</string>
<string name="list_caption">List</string>
<string name="list_name_caption">List Name</string>
<string name="local_mouse_check">Local mouse pointer (select if pointer is invisible)</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ public class Constants {
public static final String disableImmersiveTag = "disableImmersive";
public static final String forceLandscapeTag = "forceLandscape";
public static final String rAltAsIsoL3ShiftTag = "rAltAsIsoL3Shift";
public static final String leftHandedModeTag = "leftHandedModeTag";

public static final String ACTION_USB_PERMISSION = "com.iiordanov.aSPICE.USB_PERMISSION";
public static final int usbDeviceTimeout = 5000;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,8 @@ public boolean onMenuOpened(int featureId, Menu menu) {
forceLandscape.setChecked(Utils.querySharedPreferenceBoolean(this, Constants.forceLandscapeTag));
MenuItem rAltAsIsoL3Shift = menu.findItem(R.id.itemRAltAsIsoL3Shift);
rAltAsIsoL3Shift.setChecked(Utils.querySharedPreferenceBoolean(this, Constants.rAltAsIsoL3ShiftTag));
MenuItem itemLeftHandedMode = menu.findItem(R.id.itemLeftHandedMode);
itemLeftHandedMode.setChecked(Utils.querySharedPreferenceBoolean(this, Constants.leftHandedModeTag));
}
return true;
}
Expand Down Expand Up @@ -348,6 +350,9 @@ public void onClick(DialogInterface dialog, int i)
case R.id.itemRAltAsIsoL3Shift:
Utils.toggleSharedPreferenceBoolean(this, Constants.rAltAsIsoL3ShiftTag);
break;
case R.id.itemLeftHandedMode:
Utils.toggleSharedPreferenceBoolean(this, Constants.leftHandedModeTag);
break;
}
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
import android.os.SystemClock;
import android.support.v4.app.FragmentActivity;
import android.util.Log;
import android.view.Gravity;
import android.view.InputDevice;
import android.view.KeyEvent;
import android.view.Menu;
Expand All @@ -67,7 +68,9 @@
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.FrameLayout;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.Toast;
Expand Down Expand Up @@ -360,6 +363,18 @@ public void onClick(View v) {
}

});

FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
FrameLayout.LayoutParams.WRAP_CONTENT,
FrameLayout.LayoutParams.WRAP_CONTENT);

if (Utils.querySharedPreferenceBoolean(this, Constants.leftHandedModeTag)) {
params.gravity = Gravity.CENTER|Gravity.LEFT;
} else {
params.gravity = Gravity.CENTER|Gravity.RIGHT;
}
zoomer.setLayoutParams(params);

panner = new Panner(this, canvas.handler);

inputHandler = getInputHandlerById(R.id.itemInputTouchPanZoomMouse);
Expand Down

0 comments on commit fa1be76

Please sign in to comment.