-
Notifications
You must be signed in to change notification settings - Fork 197
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1146 from BlisterB/master
Android: Fix fast forward button and text centered in buttons
- Loading branch information
Showing
11 changed files
with
244 additions
and
69 deletions.
There are no files selected for viewing
63 changes: 63 additions & 0 deletions
63
builds/android/app/src/main/java/org/easyrpg/player/button_mapping/FastForwardingButton.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package org.easyrpg.player.button_mapping; | ||
|
||
import android.content.Context; | ||
import android.graphics.Canvas; | ||
|
||
import org.easyrpg.player.settings.SettingsManager; | ||
import org.libsdl.app.SDLActivity; | ||
|
||
public class FastForwardingButton extends VirtualButton { | ||
boolean alreadyActivated; | ||
|
||
protected FastForwardingButton(Context context, int keyCode, double posX, double posY, int size) { | ||
super(context, keyCode, posX, posY, size); | ||
} | ||
|
||
@Override | ||
public void onPressed() { | ||
if (!debug_mode) { | ||
if (!isPressed) { | ||
isPressed = true; | ||
|
||
SDLActivity.onNativeKeyDown(this.keyCode); | ||
// Vibration | ||
if (SettingsManager.isVibrationEnabled() && vibrator != null) { | ||
vibrator.vibrate(SettingsManager.getVibrationDuration()); | ||
} | ||
} | ||
} | ||
} | ||
|
||
@Override | ||
public void onReleased() { | ||
if (!debug_mode) { | ||
if (isPressed) { | ||
isPressed = false; | ||
|
||
if (!isTapMode() || (isTapMode() && alreadyActivated)) { | ||
SDLActivity.onNativeKeyUp(this.keyCode); | ||
alreadyActivated = false; | ||
} else { | ||
alreadyActivated = true; | ||
} | ||
} | ||
} | ||
|
||
} | ||
|
||
@Override | ||
protected void onDraw(Canvas canvas) { | ||
setProperTransparency(canvas); | ||
|
||
// Draw the rectangle surrounding the button's letter | ||
int border = 5; | ||
canvas.drawRect(border, border, realSize - border, realSize - border, painter); | ||
|
||
// Draw the symbol, centered in the rectangle | ||
drawCenter(canvas, painter, String.valueOf(charButton)); | ||
} | ||
|
||
private boolean isTapMode() { | ||
return (SettingsManager.getFastForwardMode() == 1); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 0 additions & 37 deletions
37
...s/android/app/src/main/java/org/easyrpg/player/button_mapping/VirtualButtonRectangle.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
builds/android/app/src/main/jni/src/org_easyrpg_player_player_EasyRpgPlayerActivity.h
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.