commit
3e7e654c71
@ -85,6 +85,7 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|
||||||
def room_version = "2.2.5"
|
def room_version = "2.2.5"
|
||||||
def archLifecycleVersion = '2.1.0'
|
def archLifecycleVersion = '2.1.0'
|
||||||
|
|
||||||
@ -104,4 +105,5 @@ dependencies {
|
|||||||
implementation "androidx.lifecycle:lifecycle-extensions:$archLifecycleVersion"
|
implementation "androidx.lifecycle:lifecycle-extensions:$archLifecycleVersion"
|
||||||
annotationProcessor "androidx.lifecycle:lifecycle-common-java8:$archLifecycleVersion"
|
annotationProcessor "androidx.lifecycle:lifecycle-common-java8:$archLifecycleVersion"
|
||||||
|
|
||||||
|
implementation 'androidx.preference:preference:1.1.1'
|
||||||
}
|
}
|
||||||
|
@ -2,19 +2,26 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
package="net.schueller.peertube">
|
package="net.schueller.peertube">
|
||||||
<!-- required for torrent downloading -->
|
<!-- required to play video in background via notification -->
|
||||||
|
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" /> <!-- connect to peertube server -->
|
||||||
|
<uses-permission android:name="android.permission.INTERNET" /> <!-- required for torrent downloading -->
|
||||||
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:name=".application.AppApplication"
|
android:name=".application.AppApplication"
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
|
android:fullBackupContent="@xml/backup_descriptor"
|
||||||
android:icon="@mipmap/ic_launcher"
|
android:icon="@mipmap/ic_launcher"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/AppTheme"
|
android:theme="@style/AppTheme"
|
||||||
tools:ignore="GoogleAppIndexingWarning">
|
tools:ignore="GoogleAppIndexingWarning">
|
||||||
|
|
||||||
|
<!-- Server Address Book -->
|
||||||
<activity
|
<activity
|
||||||
android:name=".activity.ServerAddressBookActivity"
|
android:name=".activity.ServerAddressBookActivity"
|
||||||
android:label="@string/title_activity_server_address_book"
|
android:label="@string/title_activity_server_address_book"
|
||||||
android:theme="@style/AppTheme.NoActionBar" />
|
android:theme="@style/AppTheme.NoActionBar" /> <!-- Video Lists -->
|
||||||
<activity
|
<activity
|
||||||
android:name=".activity.VideoListActivity"
|
android:name=".activity.VideoListActivity"
|
||||||
android:launchMode="singleTop"
|
android:launchMode="singleTop"
|
||||||
@ -29,27 +36,29 @@
|
|||||||
<meta-data
|
<meta-data
|
||||||
android:name="android.app.searchable"
|
android:name="android.app.searchable"
|
||||||
android:resource="@xml/searchable" />
|
android:resource="@xml/searchable" />
|
||||||
</activity>
|
</activity> <!-- Video Player -->
|
||||||
<activity
|
<activity
|
||||||
android:name=".activity.VideoPlayActivity"
|
android:name=".activity.VideoPlayActivity"
|
||||||
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize|uiMode"
|
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize|uiMode"
|
||||||
android:label="@string/title_activity_video_play"
|
android:label="@string/title_activity_video_play"
|
||||||
android:launchMode="singleInstance"
|
android:launchMode="singleInstance"
|
||||||
android:supportsPictureInPicture="true"
|
android:supportsPictureInPicture="true"
|
||||||
android:theme="@style/AppTheme.NoActionBar" />
|
android:theme="@style/AppTheme.NoActionBar" /> <!-- Settings -->
|
||||||
<activity
|
<activity
|
||||||
android:name=".activity.SettingsActivity"
|
android:name=".activity.SettingsActivity"
|
||||||
android:label="@string/title_activity_settings"
|
android:label="@string/title_activity_settings"
|
||||||
android:theme="@style/AppTheme.NoActionBar" />
|
android:theme="@style/AppTheme.NoActionBar" /> <!-- Server Selection -->
|
||||||
<activity
|
<activity
|
||||||
android:name=".activity.SelectServerActivity"
|
android:name=".activity.SelectServerActivity"
|
||||||
android:theme="@style/AppTheme.NoActionBar" />
|
android:label="@string/title_activity_select_server"
|
||||||
|
android:theme="@style/AppTheme.NoActionBar" /> <!-- Me -->
|
||||||
<activity
|
<activity
|
||||||
android:name=".activity.MeActivity"
|
android:name=".activity.MeActivity"
|
||||||
android:label="@string/title_activity_account"
|
android:label="@string/title_activity_me"
|
||||||
android:theme="@style/AppTheme.NoActionBar" />
|
android:theme="@style/AppTheme.NoActionBar" /> <!-- Account -->
|
||||||
<activity
|
<activity
|
||||||
android:name=".activity.AccountActivity"
|
android:name=".activity.AccountActivity"
|
||||||
|
android:label="@string/title_activity_account"
|
||||||
android:theme="@style/AppTheme.NoActionBar" /> <!-- Content provider for search suggestions -->
|
android:theme="@style/AppTheme.NoActionBar" /> <!-- Content provider for search suggestions -->
|
||||||
<provider
|
<provider
|
||||||
android:name=".provider.SearchSuggestionsProvider"
|
android:name=".provider.SearchSuggestionsProvider"
|
||||||
@ -58,10 +67,6 @@
|
|||||||
android:exported="false" />
|
android:exported="false" />
|
||||||
|
|
||||||
<service android:name=".service.VideoPlayerService" />
|
<service android:name=".service.VideoPlayerService" />
|
||||||
</application> <!-- required to play video in background via notification -->
|
</application>
|
||||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" /> <!-- connect to peertube server -->
|
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
@ -20,7 +20,6 @@ package net.schueller.peertube.activity;
|
|||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.nfc.Tag;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
@ -108,7 +107,6 @@ public class MeActivity extends CommonActivity {
|
|||||||
logout.setOnClickListener(view -> {
|
logout.setOnClickListener(view -> {
|
||||||
Session.getInstance().invalidate();
|
Session.getInstance().invalidate();
|
||||||
account.setVisibility(View.GONE);
|
account.setVisibility(View.GONE);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
getUserData();
|
getUserData();
|
||||||
|
@ -19,6 +19,7 @@ package net.schueller.peertube.activity;
|
|||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.appcompat.widget.Toolbar;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||||
@ -48,11 +49,12 @@ import net.schueller.peertube.network.GetVideoDataService;
|
|||||||
import net.schueller.peertube.network.RetrofitInstance;
|
import net.schueller.peertube.network.RetrofitInstance;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import static net.schueller.peertube.helper.Constants.DEFAULT_THEME;
|
import static net.schueller.peertube.helper.Constants.DEFAULT_THEME;
|
||||||
import static net.schueller.peertube.helper.Constants.THEME_PREF_KEY;
|
import static net.schueller.peertube.helper.Constants.THEME_PREF_KEY;
|
||||||
|
|
||||||
public class SelectServerActivity extends AppCompatActivity {
|
public class SelectServerActivity extends CommonActivity {
|
||||||
|
|
||||||
private ServerAdapter serverAdapter;
|
private ServerAdapter serverAdapter;
|
||||||
private SwipeRefreshLayout swipeRefreshLayout;
|
private SwipeRefreshLayout swipeRefreshLayout;
|
||||||
@ -65,11 +67,24 @@ public class SelectServerActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
private boolean isLoading = false;
|
private boolean isLoading = false;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onSupportNavigateUp() {
|
||||||
|
finish(); // close this activity as oppose to navigating up
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_server_selection);
|
setContentView(R.layout.activity_server_selection);
|
||||||
|
|
||||||
|
// Attaching the layout to the toolbar object
|
||||||
|
Toolbar toolbar = findViewById(R.id.tool_bar_server_selection);
|
||||||
|
// Setting toolbar as the ActionBar with setSupportActionBar() call
|
||||||
|
setSupportActionBar(toolbar);
|
||||||
|
Objects.requireNonNull(getSupportActionBar()).setDisplayHomeAsUpEnabled(true);
|
||||||
|
getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_baseline_close_24);
|
||||||
|
|
||||||
loadList();
|
loadList();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -21,12 +21,16 @@ import android.app.AlertDialog;
|
|||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.view.Menu;
|
||||||
|
import android.view.MenuInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
|
|
||||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
import androidx.appcompat.widget.Toolbar;
|
||||||
import androidx.fragment.app.FragmentManager;
|
import androidx.fragment.app.FragmentManager;
|
||||||
import androidx.fragment.app.FragmentTransaction;
|
import androidx.fragment.app.FragmentTransaction;
|
||||||
import androidx.lifecycle.ViewModelProvider;
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
@ -41,6 +45,8 @@ import net.schueller.peertube.database.ServerViewModel;
|
|||||||
import net.schueller.peertube.fragment.AddServerFragment;
|
import net.schueller.peertube.fragment.AddServerFragment;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
public class ServerAddressBookActivity extends CommonActivity implements AddServerFragment.OnFragmentInteractionListener {
|
public class ServerAddressBookActivity extends CommonActivity implements AddServerFragment.OnFragmentInteractionListener {
|
||||||
|
|
||||||
private String TAG = "ServerAddressBookActivity";
|
private String TAG = "ServerAddressBookActivity";
|
||||||
@ -51,11 +57,23 @@ public class ServerAddressBookActivity extends CommonActivity implements AddServ
|
|||||||
private FloatingActionButton floatingActionButton;
|
private FloatingActionButton floatingActionButton;
|
||||||
private FragmentManager fragmentManager;
|
private FragmentManager fragmentManager;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onSupportNavigateUp() {
|
||||||
|
finish(); // close this activity as oppose to navigating up
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_server_address_book);
|
setContentView(R.layout.activity_server_address_book);
|
||||||
|
|
||||||
|
// Attaching the layout to the toolbar object
|
||||||
|
Toolbar toolbar = findViewById(R.id.tool_bar_server_address_book);
|
||||||
|
// Setting toolbar as the ActionBar with setSupportActionBar() call
|
||||||
|
setSupportActionBar(toolbar);
|
||||||
|
Objects.requireNonNull(getSupportActionBar()).setDisplayHomeAsUpEnabled(true);
|
||||||
|
getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_baseline_close_24);
|
||||||
|
|
||||||
mServerViewModel = new ViewModelProvider(this).get(ServerViewModel.class);
|
mServerViewModel = new ViewModelProvider(this).get(ServerViewModel.class);
|
||||||
|
|
||||||
|
@ -15,220 +15,39 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.schueller.peertube.activity;
|
package net.schueller.peertube.activity;
|
||||||
|
|
||||||
import android.annotation.TargetApi;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.content.SharedPreferences;
|
|
||||||
import android.content.res.Configuration;
|
|
||||||
import android.os.Build;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.Preference;
|
|
||||||
|
|
||||||
import androidx.appcompat.app.ActionBar;
|
import androidx.appcompat.app.ActionBar;
|
||||||
|
import androidx.appcompat.widget.Toolbar;
|
||||||
import android.preference.PreferenceFragment;
|
import androidx.preference.PreferenceFragmentCompat;
|
||||||
import android.preference.PreferenceManager;
|
|
||||||
import android.preference.PreferenceScreen;
|
|
||||||
import android.view.MenuItem;
|
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
import net.schueller.peertube.R;
|
import net.schueller.peertube.R;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.Objects;
|
||||||
|
|
||||||
import static net.schueller.peertube.helper.Constants.DEFAULT_THEME;
|
public class SettingsActivity extends CommonActivity {
|
||||||
import static net.schueller.peertube.helper.Constants.THEME_PREF_KEY;
|
|
||||||
|
|
||||||
public class SettingsActivity extends AppCompatPreferenceActivity {
|
|
||||||
|
|
||||||
private static String previousThemeColorValue = "";
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
|
||||||
switch (item.getItemId()) {
|
|
||||||
case android.R.id.home:
|
|
||||||
this.finish();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return super.onOptionsItemSelected(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String getSelectedColor(Context context, String colorId) {
|
|
||||||
|
|
||||||
String res = "Color not found";
|
|
||||||
String[] themeArray = context.getResources().getStringArray(R.array.themeValues);
|
|
||||||
String[] colorArray = context.getResources().getStringArray(R.array.themeArray);
|
|
||||||
|
|
||||||
for (int i = 0; i < themeArray.length; i++) {
|
|
||||||
if (themeArray[i].equals(colorId)) {
|
|
||||||
res = colorArray[i];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A preference value change listener that updates the preference's summary
|
|
||||||
* to reflect its new value.
|
|
||||||
*/
|
|
||||||
private static Preference.OnPreferenceChangeListener sBindPreferenceSummaryToValueListener = (preference, value) -> {
|
|
||||||
String stringValue = value.toString();
|
|
||||||
|
|
||||||
// check URL is valid
|
|
||||||
// if (preference.getKey().equals("pref_api_base") && !Patterns.WEB_URL.matcher(stringValue).matches()) {
|
|
||||||
// Toast.makeText(preference.getContext(), R.string.invalid_url, Toast.LENGTH_LONG).show();
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
// Check if Theme color has change & Provide selected color
|
|
||||||
if (preference.getKey().equals("pref_theme")) {
|
|
||||||
|
|
||||||
stringValue = getSelectedColor(preference.getContext(), stringValue);
|
|
||||||
|
|
||||||
if (!previousThemeColorValue.equals("") && !previousThemeColorValue.equals(stringValue)) {
|
|
||||||
Toast.makeText(preference.getContext(), R.string.pref_description_app_theme, Toast.LENGTH_LONG).show();
|
|
||||||
}
|
|
||||||
|
|
||||||
previousThemeColorValue = stringValue;
|
|
||||||
preference.setSummary(stringValue);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
preference.setSummary(stringValue);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Helper method to determine if the device has an extra-large screen. For
|
|
||||||
* example, 10" tablets are extra-large.
|
|
||||||
*/
|
|
||||||
private static boolean isXLargeTablet(Context context) {
|
|
||||||
return (context.getResources().getConfiguration().screenLayout
|
|
||||||
& Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Binds a preference's summary to its value. More specifically, when the
|
|
||||||
* preference's value is changed, its summary (line of text below the
|
|
||||||
* preference title) is updated to reflect the value. The summary is also
|
|
||||||
* immediately updated upon calling this method. The exact display format is
|
|
||||||
* dependent on the type of preference.
|
|
||||||
*
|
|
||||||
* @see #sBindPreferenceSummaryToValueListener
|
|
||||||
*/
|
|
||||||
private static void bindPreferenceSummaryToValue(Preference preference) {
|
|
||||||
// Set the listener to watch for value changes.
|
|
||||||
preference.setOnPreferenceChangeListener(sBindPreferenceSummaryToValueListener);
|
|
||||||
|
|
||||||
// Trigger the listener immediately with the preference's
|
|
||||||
// current value.
|
|
||||||
sBindPreferenceSummaryToValueListener.onPreferenceChange(preference,
|
|
||||||
PreferenceManager
|
|
||||||
.getDefaultSharedPreferences(preference.getContext())
|
|
||||||
.getString(preference.getKey(), ""));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
|
||||||
|
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
setupActionBar();
|
setContentView(R.layout.activity_settings);
|
||||||
getFragmentManager().beginTransaction().replace(android.R.id.content, new GeneralPreferenceFragment()).commit();
|
getSupportFragmentManager()
|
||||||
}
|
.beginTransaction()
|
||||||
|
.replace(R.id.settings, new SettingsFragment())
|
||||||
/**
|
.commit();
|
||||||
* Set up the {@link android.app.ActionBar}, if the API is available.
|
|
||||||
*/
|
|
||||||
private void setupActionBar() {
|
|
||||||
ActionBar actionBar = getSupportActionBar();
|
ActionBar actionBar = getSupportActionBar();
|
||||||
if (actionBar != null) {
|
if (actionBar != null) {
|
||||||
// Show the Up button in the action bar.
|
|
||||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public static class SettingsFragment extends PreferenceFragmentCompat {
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onIsMultiPane() {
|
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
|
||||||
return isXLargeTablet(this);
|
setPreferencesFromResource(R.xml.root_preferences, rootKey);
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
|
||||||
public void onBuildHeaders(List<Header> target) {
|
|
||||||
//loadHeadersFromResource(R.xml.pref_headers, target);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This method stops fragment injection in malicious applications.
|
|
||||||
* Make sure to deny any unknown fragments here.
|
|
||||||
*/
|
|
||||||
protected boolean isValidFragment(String fragmentName) {
|
|
||||||
return PreferenceFragment.class.getName().equals(fragmentName)
|
|
||||||
|| GeneralPreferenceFragment.class.getName().equals(fragmentName);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This fragment shows general preferences only. It is used when the
|
|
||||||
* activity is showing a two-pane mainmenu UI.
|
|
||||||
*/
|
|
||||||
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
|
||||||
public static class GeneralPreferenceFragment extends PreferenceFragment {
|
|
||||||
@Override
|
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
addPreferencesFromResource(R.xml.pref_general);
|
|
||||||
setHasOptionsMenu(true);
|
|
||||||
|
|
||||||
// Bind the summaries of EditText/List/Dialog/Ringtone preferences
|
|
||||||
// to their values. When their values change, their summaries are
|
|
||||||
// updated to reflect the new value, per the Android Design
|
|
||||||
// guidelines.
|
|
||||||
//bindPreferenceSummaryToValue(findPreference("pref_api_base"));
|
|
||||||
bindPreferenceSummaryToValue(findPreference("pref_theme"));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
|
||||||
int id = item.getItemId();
|
|
||||||
if (id == android.R.id.home) {
|
|
||||||
startActivity(new Intent(getActivity(), SettingsActivity.class));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return super.onOptionsItemSelected(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen,
|
|
||||||
Preference preference) {
|
|
||||||
// String key = preference.getKey();
|
|
||||||
// if ("pref_api_base".equals(key)) {
|
|
||||||
// Intent intentServer = new Intent(preference.getContext(), SelectServerActivity.class);
|
|
||||||
// startActivity(intentServer);
|
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onResume() {
|
|
||||||
setPreferenceScreen(null);
|
|
||||||
addPreferencesFromResource(R.xml.pref_general);
|
|
||||||
//bindPreferenceSummaryToValue(findPreference("pref_api_base"));
|
|
||||||
|
|
||||||
super.onResume();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -18,7 +18,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:elevation="4dp"
|
android:elevation="4dp"
|
||||||
app:layout_scrollFlags="scroll|enterAlways" />
|
/>
|
||||||
|
|
||||||
</com.google.android.material.appbar.AppBarLayout>
|
</com.google.android.material.appbar.AppBarLayout>
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
tools:context=".activity.MeActivity"
|
tools:context=".activity.MeActivity"
|
||||||
|
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<com.google.android.material.appbar.AppBarLayout
|
<com.google.android.material.appbar.AppBarLayout
|
||||||
@ -18,7 +17,6 @@
|
|||||||
android:id="@+id/tool_bar_me"
|
android:id="@+id/tool_bar_me"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:layout_scrollFlags="scroll|enterAlways"
|
|
||||||
android:elevation="4dp" />
|
android:elevation="4dp" />
|
||||||
|
|
||||||
</com.google.android.material.appbar.AppBarLayout>
|
</com.google.android.material.appbar.AppBarLayout>
|
||||||
|
@ -7,6 +7,22 @@
|
|||||||
tools:context=".activity.ServerAddressBookActivity"
|
tools:context=".activity.ServerAddressBookActivity"
|
||||||
android:id="@+id/server_book">
|
android:id="@+id/server_book">
|
||||||
|
|
||||||
|
<com.google.android.material.appbar.AppBarLayout
|
||||||
|
android:id="@+id/appbar_server_address_book"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.Toolbar
|
||||||
|
android:id="@+id/tool_bar_server_address_book"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_scrollFlags="scroll|enterAlways"
|
||||||
|
android:elevation="4dp" />
|
||||||
|
|
||||||
|
</com.google.android.material.appbar.AppBarLayout>
|
||||||
|
|
||||||
|
|
||||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||||
android:id="@+id/add_server"
|
android:id="@+id/add_server"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
@ -6,17 +6,21 @@
|
|||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
tools:context=".activity.SelectServerActivity">
|
tools:context=".activity.SelectServerActivity">
|
||||||
|
|
||||||
<LinearLayout
|
<com.google.android.material.appbar.AppBarLayout
|
||||||
|
android:id="@+id/appbar_server_selection"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
|
||||||
>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.Toolbar
|
||||||
|
android:id="@+id/tool_bar_server_selection"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:elevation="4dp"
|
||||||
|
app:layout_scrollFlags="scroll|enterAlways" />
|
||||||
|
|
||||||
|
</com.google.android.material.appbar.AppBarLayout>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/empty_server_selection_view"
|
android:id="@+id/empty_server_selection_view"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@ -29,6 +33,7 @@
|
|||||||
android:id="@+id/serversSwipeRefreshLayout"
|
android:id="@+id/serversSwipeRefreshLayout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:layout_below="@+id/appbar_server_selection"
|
||||||
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
@ -40,7 +45,5 @@
|
|||||||
|
|
||||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
9
app/src/main/res/layout/activity_settings.xml
Normal file
9
app/src/main/res/layout/activity_settings.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:id="@+id/settings"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent" />
|
||||||
|
</LinearLayout>
|
@ -363,6 +363,16 @@
|
|||||||
<string name="server_book_del_alert_title">Remove Server</string>
|
<string name="server_book_del_alert_title">Remove Server</string>
|
||||||
<string name="server_book_del_alert_msg">Are you sure you want to remove this server from the address book?</string>
|
<string name="server_book_del_alert_msg">Are you sure you want to remove this server from the address book?</string>
|
||||||
|
|
||||||
|
<string name="title_activity_select_server">Select Server</string>
|
||||||
|
<string name="title_activity_me">Account</string>
|
||||||
|
<string name="title_activity_settings2">SettingsActivity2</string>
|
||||||
|
|
||||||
|
<string name="settings_activity_video_list_category_title">Video List</string>
|
||||||
|
<string name="settings_activity_video_playback_category_title">Video Playback</string>
|
||||||
|
<string name="settings_activity_about_category_title">About</string>
|
||||||
|
<string name="settings_activity_look_and_feel_category_title"><![CDATA[Look & Feel]]></string>
|
||||||
|
|
||||||
|
|
||||||
<!-- Constants, Don't translate -->
|
<!-- Constants, Don't translate -->
|
||||||
<string name="pref_token_access" translatable="false">pref_token_access</string>
|
<string name="pref_token_access" translatable="false">pref_token_access</string>
|
||||||
<string name="pref_token_refresh" translatable="false">pref_token_refresh</string>
|
<string name="pref_token_refresh" translatable="false">pref_token_refresh</string>
|
||||||
|
4
app/src/main/res/xml/backup_descriptor.xml
Normal file
4
app/src/main/res/xml/backup_descriptor.xml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<full-backup-content>
|
||||||
|
<!-- Exclude specific shared preferences that contain GCM registration Id -->
|
||||||
|
</full-backup-content>
|
84
app/src/main/res/xml/root_preferences.xml
Normal file
84
app/src/main/res/xml/root_preferences.xml
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
<PreferenceScreen xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
|
||||||
|
<PreferenceCategory app:title="@string/settings_activity_look_and_feel_category_title">
|
||||||
|
|
||||||
|
<ListPreference
|
||||||
|
app:defaultValue="@array/empty_array"
|
||||||
|
app:entries="@array/supportedLanguagesArray"
|
||||||
|
app:entryValues="@array/supportedLanguagesValues"
|
||||||
|
app:key="pref_language_app"
|
||||||
|
app:summary="@string/pref_description_language_app"
|
||||||
|
app:title="@string/pref_language_app" />
|
||||||
|
|
||||||
|
<ListPreference
|
||||||
|
app:defaultValue="AppTheme.BLUE"
|
||||||
|
app:entries="@array/themeArray"
|
||||||
|
app:entryValues="@array/themeValues"
|
||||||
|
app:key="pref_theme"
|
||||||
|
app:summary="@string/pref_description_app_theme"
|
||||||
|
app:title="@string/pref_title_app_theme" />
|
||||||
|
|
||||||
|
<SwitchPreference
|
||||||
|
app:defaultValue="false"
|
||||||
|
app:key="pref_dark_mode"
|
||||||
|
app:summary="@string/pref_description_dark_mode"
|
||||||
|
app:title="@string/pref_title_dark_mode" />
|
||||||
|
|
||||||
|
</PreferenceCategory>
|
||||||
|
|
||||||
|
<PreferenceCategory app:title="@string/settings_activity_video_list_category_title">
|
||||||
|
|
||||||
|
<SwitchPreference
|
||||||
|
app:defaultValue="false"
|
||||||
|
app:key="pref_show_nsfw"
|
||||||
|
app:summary="@string/pref_description_show_nsfw"
|
||||||
|
app:title="@string/pref_title_show_nsfw" />
|
||||||
|
|
||||||
|
<MultiSelectListPreference
|
||||||
|
app:defaultValue="@array/empty_array"
|
||||||
|
app:entries="@array/languageArray"
|
||||||
|
app:entryValues="@array/languageValues"
|
||||||
|
app:key="pref_language"
|
||||||
|
app:summary="@string/pref_description_language"
|
||||||
|
app:title="@string/pref_language" />
|
||||||
|
|
||||||
|
</PreferenceCategory>
|
||||||
|
|
||||||
|
<PreferenceCategory app:title="@string/settings_activity_video_playback_category_title">
|
||||||
|
|
||||||
|
<SwitchPreference
|
||||||
|
app:defaultValue="true"
|
||||||
|
app:key="pref_back_pause"
|
||||||
|
app:summary="@string/pref_description_back_pause"
|
||||||
|
app:title="@string/pref_title_back_pause" />
|
||||||
|
|
||||||
|
<ListPreference
|
||||||
|
app:defaultValue="@array/empty_array"
|
||||||
|
app:entries="@array/backgroundBehavior"
|
||||||
|
app:entryValues="@array/backgroundBehaviorValues"
|
||||||
|
app:key="pref_background_behavior"
|
||||||
|
app:summary="@string/pref_background_behavior_summary"
|
||||||
|
app:title="@string/pref_background_behavior" />
|
||||||
|
|
||||||
|
<SwitchPreference
|
||||||
|
app:defaultValue="false"
|
||||||
|
app:key="pref_torrent_player"
|
||||||
|
app:summary="@string/pref_description_torrent_player"
|
||||||
|
app:title="@string/pref_title_torrent_player" />
|
||||||
|
|
||||||
|
</PreferenceCategory>
|
||||||
|
|
||||||
|
<PreferenceCategory app:title="@string/settings_activity_about_category_title">
|
||||||
|
|
||||||
|
<Preference
|
||||||
|
app:summary="@string/versionName"
|
||||||
|
app:title="@string/pref_title_version" />
|
||||||
|
|
||||||
|
<Preference
|
||||||
|
app:summary="@string/pref_description_license"
|
||||||
|
app:title="@string/pref_title_license" />
|
||||||
|
|
||||||
|
|
||||||
|
</PreferenceCategory>
|
||||||
|
|
||||||
|
</PreferenceScreen>
|
Loading…
Reference in New Issue
Block a user