Add some explanations
This commit is contained in:
parent
62ee3b1c0f
commit
bf08f98b0e
|
@ -53,6 +53,8 @@ public class MainActivity extends AppCompatActivity {
|
|||
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 String SET_OSM_HOST = "set_osm_host";
|
||||
public static String DEFAULT_OSM_HOST = "www.openstreetmap.org";
|
||||
public static final String APP_PREFS = "app_prefs";
|
||||
|
||||
//Supported domains
|
||||
|
@ -82,6 +84,7 @@ public class MainActivity extends AppCompatActivity {
|
|||
|
||||
TextInputEditText nitter_instance = findViewById(R.id.nitter_instance);
|
||||
TextInputEditText invidious_instance = findViewById(R.id.invidious_instance);
|
||||
TextInputEditText osm_instance = findViewById(R.id.osm_instance);
|
||||
|
||||
SwitchCompat enable_nitter = findViewById(R.id.enable_nitter);
|
||||
SwitchCompat enable_invidious = findViewById(R.id.enable_invidious);
|
||||
|
@ -99,6 +102,7 @@ public class MainActivity extends AppCompatActivity {
|
|||
RecyclerView list_apps = findViewById(R.id.list_apps);
|
||||
String nitterHost = sharedpreferences.getString(SET_NITTER_HOST, null);
|
||||
String invidiousHost = sharedpreferences.getString(SET_INVIDIOUS_HOST, null);
|
||||
String osmHost = sharedpreferences.getString(SET_OSM_HOST, null);
|
||||
|
||||
enable_invidious.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
|
@ -122,6 +126,9 @@ public class MainActivity extends AppCompatActivity {
|
|||
if(invidiousHost!=null) {
|
||||
invidious_instance.setText(invidiousHost);
|
||||
}
|
||||
if(osmHost!=null) {
|
||||
osm_instance.setText(osmHost);
|
||||
}
|
||||
button_save.setOnClickListener(v -> {
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
if (nitter_instance.getText() != null && nitter_instance.getText().toString().trim().length() > 0) {
|
||||
|
@ -129,12 +136,16 @@ public class MainActivity extends AppCompatActivity {
|
|||
} else {
|
||||
editor.putString(SET_NITTER_HOST, null);
|
||||
}
|
||||
editor.apply();
|
||||
if (invidious_instance.getText() != null && invidious_instance.getText().toString().trim().length() > 0) {
|
||||
editor.putString(SET_INVIDIOUS_HOST, invidious_instance.getText().toString().toLowerCase().trim());
|
||||
} else {
|
||||
editor.putString(SET_INVIDIOUS_HOST, null);
|
||||
}
|
||||
if (osm_instance.getText() != null && osm_instance.getText().toString().trim().length() > 0) {
|
||||
editor.putString(SET_OSM_HOST, osm_instance.getText().toString().toLowerCase().trim());
|
||||
} else {
|
||||
editor.putString(SET_OSM_HOST, null);
|
||||
}
|
||||
editor.apply();
|
||||
View parentLayout = findViewById(android.R.id.content);
|
||||
Snackbar.make(parentLayout, R.string.instances_saved, Snackbar.LENGTH_LONG).show();
|
||||
|
|
|
@ -85,7 +85,8 @@ public class TransformActivity extends AppCompatActivity {
|
|||
}else {
|
||||
zoom = data[2];
|
||||
}
|
||||
newUrl = "https://www.openstreetmap.org/#map="+zoom+"/"+data[0]+"/"+data[1];
|
||||
String osmHost = sharedpreferences.getString(MainActivity.SET_OSM_HOST, MainActivity.DEFAULT_OSM_HOST).toLowerCase();
|
||||
newUrl = "https://"+osmHost+"/#map="+zoom+"/"+data[0]+"/"+data[1];
|
||||
}
|
||||
}
|
||||
Intent delegate = new Intent(Intent.ACTION_VIEW);
|
||||
|
|
|
@ -32,13 +32,30 @@
|
|||
android:layout_margin="@dimen/fab_margin"
|
||||
>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/introduction"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
<TextView
|
||||
android:id="@+id/nitter_indications"
|
||||
android:layout_marginTop="30dp"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/introduction"
|
||||
android:text="@string/redirect_twitter_to_nitter"
|
||||
/>
|
||||
<LinearLayout
|
||||
android:id="@+id/nitter_container"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/nitter_indications"
|
||||
android:orientation="horizontal">
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:layout_weight="1"
|
||||
|
@ -62,14 +79,23 @@
|
|||
</LinearLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
<TextView
|
||||
android:id="@+id/invidious_indications"
|
||||
android:layout_marginTop="30dp"
|
||||
android:id="@+id/invidious_container"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/nitter_container"
|
||||
android:text="@string/redirect_youtube_to_invidious"
|
||||
/>
|
||||
<LinearLayout
|
||||
android:id="@+id/invidious_container"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/invidious_indications"
|
||||
android:orientation="horizontal">
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:layout_weight="1"
|
||||
|
@ -91,20 +117,39 @@
|
|||
android:id="@+id/enable_invidious"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/osm_indications"
|
||||
android:layout_marginTop="30dp"
|
||||
android:id="@+id/osm_container"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/invidious_container"
|
||||
android:text="@string/redirect_gm_to_osm"
|
||||
/>
|
||||
<LinearLayout
|
||||
android:layout_marginTop="5dp"
|
||||
android:id="@+id/osm_container"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/osm_indications"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
android:text="@string/redirect_gm_to_osm"
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:layout_weight="1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"/>
|
||||
android:layout_height="wrap_content">
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/osm_instance"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/custom_osm"
|
||||
android:inputType="textUri"
|
||||
android:maxLines="1" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:layout_margin="5dp"
|
||||
android:layout_gravity="center"
|
||||
|
|
|
@ -22,4 +22,7 @@
|
|||
<string name="icon_of_the_app">Icon of the app</string>
|
||||
<string name="open_with">Open with</string>
|
||||
<string name="redirect_gm_to_osm">Redirect Google Map to OpenStreetMap</string>
|
||||
<string name="custom_osm">Custom OSM hostname</string>
|
||||
<string name="redirect_youtube_to_invidious">Redirect YouTube to Invidious</string>
|
||||
<string name="redirect_twitter_to_nitter">Redirect Twitter to Nitter</string>
|
||||
</resources>
|
||||
|
|
Loading…
Reference in New Issue