From 619a7ba8e4a40e69f2de2221274bf71919da3667 Mon Sep 17 00:00:00 2001 From: Thomas Date: Sat, 29 Feb 2020 11:07:38 +0100 Subject: [PATCH] some code cleaning --- .../fedilab/nitterizeme/InstanceActivity.java | 2 +- .../app/fedilab/nitterizeme/MainActivity.java | 10 ++++------ app/src/main/res/layout/content_main.xml | 16 ++++++++-------- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/app/src/main/java/app/fedilab/nitterizeme/InstanceActivity.java b/app/src/main/java/app/fedilab/nitterizeme/InstanceActivity.java index 9662d49..382906f 100644 --- a/app/src/main/java/app/fedilab/nitterizeme/InstanceActivity.java +++ b/app/src/main/java/app/fedilab/nitterizeme/InstanceActivity.java @@ -106,7 +106,7 @@ public class InstanceActivity extends AppCompatActivity { RecyclerView bibliogram_instances = activity.findViewById(R.id.bibliogram_instances); Button latency_test = activity.findViewById(R.id.latency_test); Button close = activity.findViewById(R.id.close); - if( result == null ) { + if (result == null) { View parentLayout = activity.findViewById(android.R.id.content); Snackbar.make(parentLayout, R.string.error_message_internet, Snackbar.LENGTH_LONG).setAction(R.string.close, v -> activity.finish()).show(); return; diff --git a/app/src/main/java/app/fedilab/nitterizeme/MainActivity.java b/app/src/main/java/app/fedilab/nitterizeme/MainActivity.java index a929fd4..d0afc00 100644 --- a/app/src/main/java/app/fedilab/nitterizeme/MainActivity.java +++ b/app/src/main/java/app/fedilab/nitterizeme/MainActivity.java @@ -48,19 +48,19 @@ import java.util.Objects; public class MainActivity extends AppCompatActivity { public static final String APP_PREFS = "app_prefs"; + public static final String SET_NITTER_HOST = "set_nitter_host"; + public static final String SET_INVIDIOUS_HOST = "set_invidious_host"; + public static final String SET_OSM_HOST = "set_osm_host"; + public static final String SET_BIBLIOGRAM_HOST = "set_bibliogram_host"; @SuppressWarnings("unused") public static String TAG = "NitterizeMe"; - public static final String SET_NITTER_HOST = "set_nitter_host"; public static String DEFAULT_NITTER_HOST = "nitter.net"; - public static final String SET_INVIDIOUS_HOST = "set_invidious_host"; public static String DEFAULT_INVIDIOUS_HOST = "invidio.us"; public static String SET_INVIDIOUS_ENABLED = "set_invidious_enabled"; public static String SET_NITTER_ENABLED = "set_nitter_enabled"; public static String SET_OSM_ENABLED = "set_osm_enabled"; - public static final String SET_OSM_HOST = "set_osm_host"; public static String DEFAULT_OSM_HOST = "www.openstreetmap.org"; public static String SET_BIBLIOGRAM_ENABLED = "set_bibliogram_enabled"; - public static final String SET_BIBLIOGRAM_HOST = "set_bibliogram_host"; public static String DEFAULT_BIBLIOGRAM_HOST = "bibliogram.art"; public static String SET_GEO_URIS = "set_geo_uris"; //Supported domains @@ -236,7 +236,6 @@ public class MainActivity extends AppCompatActivity { }); - expand_instance_nitter.setOnClickListener(v -> { boolean custom_instance_visibility = nitter_custom_group.getVisibility() == View.VISIBLE; if (custom_instance_visibility) { @@ -303,7 +302,6 @@ public class MainActivity extends AppCompatActivity { }); - if (nitterHost != null) { nitter_instance.setText(nitterHost); current_instance_nitter.setText(nitterHost); diff --git a/app/src/main/res/layout/content_main.xml b/app/src/main/res/layout/content_main.xml index 968b9ac..1aa65bd 100644 --- a/app/src/main/res/layout/content_main.xml +++ b/app/src/main/res/layout/content_main.xml @@ -109,11 +109,11 @@ android:layout_width="30dp" android:layout_height="30dp" android:background="@null" + android:contentDescription="@string/expand_instance_details" android:scaleType="fitCenter" android:src="@drawable/ic_expand_more" app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintTop_toTopOf="@id/guide_nitter" - android:contentDescription="@string/expand_instance_details" /> + app:layout_constraintTop_toTopOf="@id/guide_nitter" /> + app:layout_constraintTop_toTopOf="@id/guide_invidious" /> + app:layout_constraintTop_toTopOf="@id/guide_bibliogram" /> + app:layout_constraintTop_toTopOf="@id/guide_osm" />