Skip to content

Commit

Permalink
Merge pull request #27 from Feodor0090/slider-graphic-fix
Browse files Browse the repository at this point in the history
Use prerendered slider body, if it exists
  • Loading branch information
Feodor0090 authored Oct 10, 2021
2 parents 32c32dc + 0a169dd commit e12a51c
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 4 deletions.
2 changes: 1 addition & 1 deletion njtai/Application Descriptor
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Nokia-MIDlet-Category: Internet
Main-Class: njtai.d.NJTAID
MIDlet-Version: 1.1.42
MIDlet-Version: 1.1.43
Class-Path: .
MIDlet-Info-URL: https://github.com/Feodor0090/njtai
Nokia-MIDlet-On-Screen-Keypad: no
Expand Down
1 change: 1 addition & 0 deletions njtai/build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ S40_5th_Edition_SDK.includes=res/nhentai.png\
,res/text/page_en.txt\
,res/text/page_ru.txt\
,src/njtai/d/Main.java\
,res/slider.png\
S40_5th_Edition_SDK.excludes=\
Binary file added njtai/res/slider.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 25 additions & 3 deletions njtai/src/njtai/m/ui/View.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package njtai.m.ui;

import java.io.IOException;

import javax.microedition.lcdui.Alert;
import javax.microedition.lcdui.AlertType;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Font;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;

import njtai.NJTAI;
import njtai.m.NJTAIM;
Expand All @@ -18,8 +21,16 @@
*/
public abstract class View extends ViewBase {

Image slider;

public View(ExtMangaObj emo, Displayable prev, int page) {
super(emo, prev, page);
try {
slider = Image.createImage("/slider.png");
} catch (IOException e) {
e.printStackTrace();
slider = null;
}
}

protected void paintHUD(Graphics g, Font f, boolean drawZoom, boolean drawPages) {
Expand Down Expand Up @@ -109,9 +120,20 @@ private void drawZoomSlider(Graphics g, Font f) {
int x = (int) (25 + ((getWidth() - 50) * (zoom - 1) / 4));

// slider's body
for (int i = 0; i < 10; i++) {
g.setColor(NJTAI.blend(touchHoldPos == 8 ? 0x357EDE : 0x444444, 0xffffff, i * 255 / 9));
g.drawRoundRect(25 - i, 25 - i, getWidth() - 50 + (i * 2), i * 2, i, i);
if (slider == null) {
for (int i = 0; i < 10; i++) {
g.setColor(NJTAI.blend(touchHoldPos == 8 ? 0x357EDE : 0x444444, 0xffffff, i * 255 / 9));
g.drawRoundRect(25 - i, 25 - i, getWidth() - 50 + (i * 2), i * 2, i, i);
}
} else {
int y = touchHoldPos == 8 ? 20 : 0;
g.drawRegion(slider, 0, y, 35, 20, 0, 0, 15, 0);
g.drawRegion(slider, 35, y, 35, 20, 0, getWidth() - 35, 15, 0);
g.setClip(35, 0, getWidth() - 70, 50);
for (int i = 35; i < getWidth() - 34; i += 20) {
g.drawRegion(slider, 25, y, 20, 20, 0, i, 15, 0);
}
g.setClip(0, 0, getWidth(), getHeight());
}

// slider's pin
Expand Down

0 comments on commit e12a51c

Please sign in to comment.