Skip to content

Commit ffb5c1d

Browse files
committed
stuff
1 parent 13438f2 commit ffb5c1d

File tree

4 files changed

+29
-14
lines changed

4 files changed

+29
-14
lines changed

build/android/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ dependencies {
5555
// implementation 'io.github.cppfw:png:+'
5656
// implementation 'io.github.cppfw:jpeg:+'
5757
implementation 'io.github.cppfw:freetype:+'
58-
// implementation project(path: ':ruis')
58+
// implementation project(path: ':ruis')
5959
}
6060

6161
task copyResToAssets {

build/android/app/src/main/java/io/github/cppfw/ruisapp/RuisappActivity.java

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,29 @@ public int resolveKeyUnicode(int deviceID, int metaState, int keyCode){
3939
return 0;//could not load char map, thus could not resolve character
4040
}
4141
}
42-
42+
4343
return this.curCharMap.get(keyCode, metaState);
4444
}
45-
45+
4646
public float getDotsPerInch(){
4747
Display d = ((WindowManager)getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
4848
DisplayMetrics m = new DisplayMetrics();
4949
d.getMetrics(m);
5050
Log.d(LOGTAG, "getDotsPerInch(): xdpi = " + m.xdpi + " ydpi = " + m.ydpi + " density = " + m.density);
5151
return (m.xdpi + m.ydpi) / 2.0f;
5252
}
53-
53+
54+
public int[] getScreenDims(){
55+
DisplayMetrics metrics = new DisplayMetrics();
56+
getWindowManager().getDefaultDisplay().getRealMetrics(metrics);
57+
int width = metrics.widthPixels;
58+
int height = metrics.heightPixels;
59+
Log.d(LOGTAG, "getScreenDims(): width = " + width + ", height = " + height);
60+
return new int[] {width, height};
61+
}
62+
5463
private static native void handleCharacterStringInput(String str);
55-
64+
5665
@Override
5766
public boolean dispatchKeyEvent(KeyEvent event) {
5867
Log.d(LOGTAG, "dispatchKeyEvent(): invoked");
@@ -66,28 +75,28 @@ public boolean dispatchKeyEvent(KeyEvent event) {
6675
return super.dispatchKeyEvent(event);
6776
}
6877

69-
//Override the Back button handler to prevent activity from automatically closing by Back key.
78+
// Override the Back button handler to prevent activity from automatically closing by Back key.
7079
@Override
7180
public void onBackPressed() {
7281
}
73-
82+
7483
private InputMethodManager imm;
75-
84+
7685
@Override
7786
protected void onCreate(Bundle savedInstanceState){
7887
super.onCreate(savedInstanceState);
7988

8089
this.imm = (InputMethodManager)this.getSystemService(Service.INPUT_METHOD_SERVICE);
8190
}
82-
83-
91+
92+
8493
public void showVirtualKeyboard(){
8594
this.imm.showSoftInput(this.getWindow().getDecorView(), InputMethodManager.SHOW_FORCED);
8695
Rect r = new Rect();
8796
this.getWindow().getDecorView().getWindowVisibleDisplayFrame(r);
8897
Log.d(LOGTAG, "showVirtualKeyboard(): visible rect = " + r.left + ", " + r.right + ", " + r.top + ", " + r.bottom);
8998
}
90-
99+
91100
public void hideVirtualKeyboard(){
92101
this.imm.hideSoftInputFromWindow(this.getWindow().getDecorView().getWindowToken(), InputMethodManager.HIDE_IMPLICIT_ONLY);
93102
}
@@ -110,7 +119,7 @@ public String[] listDirContents(String path){
110119
}
111120
return null;
112121
}
113-
122+
114123
public String getStorageDir(){
115124
return this.getFilesDir().getPath();
116125
}

src/ruis/res/image.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,13 @@ class res_svg_image : public image
9696

9797
r4::vector2<uint32_t> dims(const ruis::units& units) const noexcept override
9898
{
99-
ASSERT(units.dots_per_pp() > 0)
99+
utki::assert(
100+
units.dots_per_pp() > 0,
101+
[&](auto& o) {
102+
o << "units.dots_per_pp() = " << units.dots_per_pp();
103+
},
104+
SL
105+
);
100106
auto wh = this->dom->get_dimensions(units.dots_per_inch() / units.dots_per_pp());
101107
wh *= units.dots_per_pp();
102108
using std::ceil;

0 commit comments

Comments
 (0)