From 7831ee8c6bfc3d15f8f2f69ec5531ec3798a75c7 Mon Sep 17 00:00:00 2001 From: Janne Mareike Koschinski <mail@justjanne.de> Date: Fri, 22 Nov 2024 18:58:34 +0100 Subject: [PATCH] chore: remove unneeded helpers --- .../de/kuschku/malheur/util/DisplayHelper.kt | 29 ---------------- .../kuschku/malheur/util/ReflectionHelper.kt | 34 ------------------- 2 files changed, 63 deletions(-) delete mode 100644 malheur/src/main/java/de/kuschku/malheur/util/DisplayHelper.kt delete mode 100644 malheur/src/main/java/de/kuschku/malheur/util/ReflectionHelper.kt diff --git a/malheur/src/main/java/de/kuschku/malheur/util/DisplayHelper.kt b/malheur/src/main/java/de/kuschku/malheur/util/DisplayHelper.kt deleted file mode 100644 index d5b058c5f..000000000 --- a/malheur/src/main/java/de/kuschku/malheur/util/DisplayHelper.kt +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.malheur.util - -import android.util.DisplayMetrics -import android.view.Display - -fun Display.getMetrics(): DisplayMetrics { - val metrics = DisplayMetrics() - getRealMetrics(metrics) - return metrics -} diff --git a/malheur/src/main/java/de/kuschku/malheur/util/ReflectionHelper.kt b/malheur/src/main/java/de/kuschku/malheur/util/ReflectionHelper.kt deleted file mode 100644 index 1009b395d..000000000 --- a/malheur/src/main/java/de/kuschku/malheur/util/ReflectionHelper.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Quasseldroid - Quassel client for Android - * - * Copyright (c) 2020 Janne Mareike Koschinski - * Copyright (c) 2020 The Quassel Project - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package de.kuschku.malheur.util - -fun <T> reflectionCollectGetters(klass: Class<T>?) = klass?.declaredMethods - ?.filter { it.parameterTypes.isEmpty() && it.returnType != Void::class.java } - ?.filter { it.name != "getClass" } - ?.filter { it.name.startsWith("get") || it.name.startsWith("is") } - ?.mapNotNull { - var result: Pair<String, Any?>? = null - try { - result = it.name to it.invoke(it) - } catch (e: IllegalAccessException) { - } catch (e: IllegalArgumentException) { - } - result - }?.toMap() -- GitLab