Просмотр исходного кода

app: remove our own getScreenDensity() fn since its already in miniquad.

darkfi 2 дней назад
Родитель
Сommit
edfea5294f
3 измененных файлов с 1 добавлено и 17 удалено
  1. 0 4
      bin/app/java/MainActivity.java
  2. 0 12
      bin/app/src/android/mod.rs
  3. 1 1
      bin/app/src/app/mod.rs

+ 0 - 4
bin/app/java/MainActivity.java

@@ -141,10 +141,6 @@ public int getKeyboardHeight() {
     return Math.max(0, imeInsets.bottom - navInsets.bottom);
     return Math.max(0, imeInsets.bottom - navInsets.bottom);
 }
 }
 
 
-public float getScreenDensity() {
-    return getResources().getDisplayMetrics().density;
-}
-
 public boolean isImeVisible() {
 public boolean isImeVisible() {
     View decorView = getWindow().getDecorView();
     View decorView = getWindow().getDecorView();
     WindowInsets insets = decorView.getRootWindowInsets();
     WindowInsets insets = decorView.getRootWindowInsets();

+ 0 - 12
bin/app/src/android/mod.rs

@@ -48,14 +48,6 @@ macro_rules! call_mainactivity_str_method {
         }
         }
     }};
     }};
 }
 }
-macro_rules! call_mainactivity_float_method {
-    ($method:expr) => {{
-        unsafe {
-            let env = get_jni_env();
-            ndk_utils::call_method!(CallFloatMethod, env, android::ACTIVITY, $method, "()F")
-        }
-    }};
-}
 macro_rules! call_mainactivity_bool_method {
 macro_rules! call_mainactivity_bool_method {
     ($method:expr) => {{
     ($method:expr) => {{
         unsafe {
         unsafe {
@@ -77,10 +69,6 @@ pub fn get_keyboard_height() -> usize {
     call_mainactivity_int_method!("getKeyboardHeight", "()I") as usize
     call_mainactivity_int_method!("getKeyboardHeight", "()I") as usize
 }
 }
 
 
-pub fn get_screen_density() -> f32 {
-    call_mainactivity_float_method!("getScreenDensity")
-}
-
 pub fn is_ime_visible() -> bool {
 pub fn is_ime_visible() -> bool {
     call_mainactivity_bool_method!("isImeVisible")
     call_mainactivity_bool_method!("isImeVisible")
 }
 }

+ 1 - 1
bin/app/src/app/mod.rs

@@ -101,7 +101,7 @@ impl App {
         let window = create_window("window");
         let window = create_window("window");
         #[cfg(target_os = "android")]
         #[cfg(target_os = "android")]
         let window_scale = {
         let window_scale = {
-            let screen_density = android::get_screen_density();
+            let screen_density = miniquad::window::dpi_scale();
             i!("Android screen density: {screen_density}");
             i!("Android screen density: {screen_density}");
             screen_density / 2.8
             screen_density / 2.8
         };
         };