mirror of
https://framagit.org/tom79/nitterizeme
synced 2025-02-09 08:18:41 +01:00
Comment #26 - Pref activity -1
This commit is contained in:
parent
dae4f5c24c
commit
8905ec01fc
@ -53,6 +53,7 @@ dependencies {
|
||||
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
|
||||
implementation 'com.google.android.material:material:1.1.0'
|
||||
implementation 'androidx.preference:preference:1.1.1'
|
||||
implementation 'org.jsoup:jsoup:1.13.1'
|
||||
testImplementation 'junit:junit:4.13'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
|
||||
|
@ -221,6 +221,12 @@
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/AppTheme"
|
||||
android:targetActivity=".activities.DefaultAppActivity" />
|
||||
<activity-alias
|
||||
android:name=".activities.InvidiousSettingsActivity"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:label="@string/invidious_settings"
|
||||
android:theme="@style/AppTheme"
|
||||
android:targetActivity=".activities.InvidiousSettingsActivity" />
|
||||
<activity-alias
|
||||
android:name=".activities.WebviewPlayerActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||
|
@ -183,6 +183,11 @@
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:label="@string/app_name_lite"
|
||||
android:theme="@style/AppTheme" />
|
||||
<activity
|
||||
android:name=".activities.InvidiousSettingsActivity"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:label="@string/invidious_settings"
|
||||
android:theme="@style/AppTheme" />
|
||||
<activity
|
||||
android:name=".activities.WebviewPlayerActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||
|
@ -0,0 +1,48 @@
|
||||
package app.fedilab.nitterizeme.activities;
|
||||
/* Copyright 2020 Thomas Schneider
|
||||
*
|
||||
* This file is a part of UntrackMe
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under the terms of the
|
||||
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* UntrackMe 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 UntrackMe; if not,
|
||||
* see <http://www.gnu.org/licenses>. */
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.MenuItem;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import app.fedilab.nitterizeme.R;
|
||||
import app.fedilab.nitterizeme.fragments.InvidiousSettingsFragment;
|
||||
|
||||
public class InvidiousSettingsActivity extends AppCompatActivity {
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_invidious_settings);
|
||||
if (getSupportActionBar() != null) {
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
getSupportActionBar().setDisplayShowHomeEnabled(true);
|
||||
}
|
||||
getSupportFragmentManager()
|
||||
.beginTransaction()
|
||||
.replace(R.id.settings_container, new InvidiousSettingsFragment())
|
||||
.commit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
if (item.getItemId() == android.R.id.home) {
|
||||
finish();
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
@ -448,6 +448,14 @@ public class MainActivity extends AppCompatActivity {
|
||||
|
||||
}
|
||||
);
|
||||
|
||||
//Invidious custom settings
|
||||
ImageButton invidious_settings = findViewById(R.id.invidious_settings);
|
||||
invidious_settings.setOnClickListener(v -> {
|
||||
Intent intent = new Intent(MainActivity.this, InvidiousSettingsActivity.class);
|
||||
startActivity(intent);
|
||||
});
|
||||
|
||||
registerReceiver(broadcastReceiver, new IntentFilter(KILL_ACTIVITY));
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,28 @@
|
||||
package app.fedilab.nitterizeme.fragments;
|
||||
/* Copyright 2020 Thomas Schneider
|
||||
*
|
||||
* This file is a part of UntrackMe
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under the terms of the
|
||||
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* UntrackMe 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 UntrackMe; if not,
|
||||
* see <http://www.gnu.org/licenses>. */
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.preference.PreferenceFragmentCompat;
|
||||
|
||||
import app.fedilab.nitterizeme.R;
|
||||
|
||||
public class InvidiousSettingsFragment extends PreferenceFragmentCompat {
|
||||
@Override
|
||||
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
|
||||
setPreferencesFromResource(R.xml.preferences_invidious, rootKey);
|
||||
}
|
||||
}
|
@ -91,9 +91,9 @@ public class Utils {
|
||||
public static final Pattern maps = Pattern.compile("/maps/place/([^@]+@)?([\\d.,z]+).*");
|
||||
public static final Pattern ampExtract = Pattern.compile("amp/s/(.*)");
|
||||
public static final String RECEIVE_STREAMING_URL = "receive_streaming_url";
|
||||
public static final String INVIDIOUS_DARK_MODE = "invidious_dark_mode";
|
||||
private static final Pattern extractPlace = Pattern.compile("/maps/place/(((?!/data).)*)");
|
||||
private static final Pattern googleRedirect = Pattern.compile("https?://(www\\.)?google(\\.\\w{2,})?(\\.\\w{2,})/url\\?q=(.*)");
|
||||
|
||||
private static final String[] G_TRACKING = {
|
||||
"sourceid",
|
||||
"aqs",
|
||||
|
@ -25,13 +25,13 @@
|
||||
android:id="@+id/list_apps"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/no_apps"
|
||||
android:visibility="gone"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:textSize="20sp"
|
||||
android:text="@string/no_apps_set_as_default"
|
||||
/>
|
||||
android:textSize="20sp"
|
||||
android:visibility="gone" />
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
31
app/src/main/res/layout/activity_invidious_settings.xml
Normal file
31
app/src/main/res/layout/activity_invidious_settings.xml
Normal file
@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
/* Copyright 2020 Thomas Schneider
|
||||
*
|
||||
* This file is a part of UntrackMe
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under the terms of the
|
||||
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* UntrackMe 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 UntrackMe; if not,
|
||||
* see <http://www.gnu.org/licenses>. */
|
||||
-->
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/main_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="@dimen/fab_margin"
|
||||
android:scrollbars="none"
|
||||
tools:context=".activities.InvidiousSettingsActivity">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/settings_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</RelativeLayout>
|
@ -43,20 +43,20 @@
|
||||
android:id="@+id/scroll_url"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="40dp"
|
||||
android:padding="2dp"
|
||||
android:scrollbars="horizontal"
|
||||
android:scrollbarThumbHorizontal="@color/colorAccent"
|
||||
android:layout_marginHorizontal="10dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
android:padding="2dp"
|
||||
android:scrollbarThumbHorizontal="@color/colorAccent"
|
||||
android:scrollbars="horizontal"
|
||||
app:layout_constraintEnd_toStartOf="@id/copy_link"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/url"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:singleLine="true"
|
||||
android:gravity="center_vertical"
|
||||
android:singleLine="true"
|
||||
android:textColor="@color/colorAccent" />
|
||||
</HorizontalScrollView>
|
||||
|
||||
@ -64,12 +64,11 @@
|
||||
android:id="@+id/copy_link"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:padding="2dp"
|
||||
android:layout_margin="5dp"
|
||||
android:padding="2dp"
|
||||
android:src="@drawable/ic_copy"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
/>
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/indication"
|
||||
|
35
app/src/main/res/values/array.xml
Normal file
35
app/src/main/res/values/array.xml
Normal file
@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string-array name="invidious_theme_values">
|
||||
<item>0</item>
|
||||
<item>true</item>
|
||||
<item>false</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="invidious_tint_values">
|
||||
<item>0</item>
|
||||
<item>true</item>
|
||||
<item>false</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="invidious_language_values">
|
||||
<item>0</item>
|
||||
<item>ar</item>
|
||||
<item>de</item>
|
||||
<item>el</item>
|
||||
<item>en-US</item>
|
||||
<item>eo</item>
|
||||
<item>es</item>
|
||||
<item>eu</item>
|
||||
<item>fr</item>
|
||||
<item>is</item>
|
||||
<item>it</item>
|
||||
<item>nb_NO</item>
|
||||
<item>nl</item>
|
||||
<item>pl</item>
|
||||
<item>ru</item>
|
||||
<item>uk</item>
|
||||
<item>zh-CN</item>
|
||||
</string-array>
|
||||
|
||||
</resources>
|
@ -78,4 +78,46 @@
|
||||
<string name="copy_done">Copied</string>
|
||||
<string name="no_apps_set_as_default">No apps set as default!</string>
|
||||
<string name="custom_settings_for_invidious">Custom settings for Invidious</string>
|
||||
<string name="invidious_settings">Invidious settings</string>
|
||||
<string name="invidious_dark_theme">Theme</string>
|
||||
<string name="invidious_dark_theme_indication">Configure default theme without setting cookies</string>
|
||||
<string name="invidious_thin_mode">Thin mode</string>
|
||||
<string name="invidious_thin_mode_indication">Load HTML, CSS, JS and video elements (disables images)</string>
|
||||
<string name="invidious_language_mode_indication">Available locales</string>
|
||||
<string name="invidious_language_mode">UI Language</string>
|
||||
|
||||
|
||||
<string-array name="invidious_theme">
|
||||
<item>Default</item>
|
||||
<item>Dark theme</item>
|
||||
<item>Light theme</item>
|
||||
</string-array>
|
||||
|
||||
|
||||
<string-array name="invidious_tint">
|
||||
<item>Default</item>
|
||||
<item>Enabled</item>
|
||||
<item>Disabled</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="invidious_language">
|
||||
<item>Default</item>
|
||||
<item>Arabic</item>
|
||||
<item>German</item>
|
||||
<item>Greek</item>
|
||||
<item>English</item>
|
||||
<item>Esperanto</item>
|
||||
<item>Spanish</item>
|
||||
<item>Basque</item>
|
||||
<item>French</item>
|
||||
<item>Icelandic</item>
|
||||
<item>Italian</item>
|
||||
<item>Norwegian Bokmål</item>
|
||||
<item>Dutch</item>
|
||||
<item>Polish</item>
|
||||
<item>Russian</item>
|
||||
<item>Ukrainian</item>
|
||||
<item>Chinese</item>
|
||||
</string-array>
|
||||
|
||||
</resources>
|
||||
|
28
app/src/main/res/xml/preferences_invidious.xml
Normal file
28
app/src/main/res/xml/preferences_invidious.xml
Normal file
@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PreferenceScreen xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<ListPreference
|
||||
app:iconSpaceReserved="false"
|
||||
app:key="invidious_dark_mode"
|
||||
app:summary="@string/invidious_dark_theme_indication"
|
||||
app:title="@string/invidious_dark_theme"
|
||||
android:entries="@array/invidious_theme"
|
||||
android:entryValues="@array/invidious_theme_values" />
|
||||
|
||||
<ListPreference
|
||||
app:iconSpaceReserved="false"
|
||||
app:key="invidious_tint_mode"
|
||||
app:summary="@string/invidious_thin_mode_indication"
|
||||
app:title="@string/invidious_thin_mode"
|
||||
android:entries="@array/invidious_tint"
|
||||
android:entryValues="@array/invidious_tint_values" />
|
||||
|
||||
<ListPreference
|
||||
app:iconSpaceReserved="false"
|
||||
app:key="invidious_language_mode"
|
||||
app:summary="@string/invidious_language_mode_indication"
|
||||
app:title="@string/invidious_language_mode"
|
||||
android:entries="@array/invidious_language"
|
||||
android:entryValues="@array/invidious_language_values" />
|
||||
</PreferenceScreen>
|
Loading…
x
Reference in New Issue
Block a user