Merge branch 'main' into sponsorpost-votes
This commit is contained in:
@@ -21,14 +21,21 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set up NDK
|
||||
uses: nttld/setup-ndk@v1
|
||||
with:
|
||||
ndk-version: r25c
|
||||
add-to-path: false
|
||||
|
||||
- name: Set up JDK
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: '17'
|
||||
distribution: 'adopt'
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
|
||||
- name: Download tools
|
||||
run: |
|
||||
sudo apt update
|
||||
@@ -47,6 +54,8 @@ jobs:
|
||||
java -jar scripts/apktool.jar b smali -o smali/VTLite.apk --use-aapt2 -p scripts/framework/
|
||||
zipalign -p -f 4 smali/VTLite.apk smali/VTLite.apk_aligned
|
||||
mv smali/VTLite.apk_aligned smali/VTLite.apk
|
||||
env:
|
||||
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
|
||||
|
||||
- name: Sign and verify the apk
|
||||
run: |
|
||||
|
||||
+1
-1
@@ -78,7 +78,7 @@ android {
|
||||
targetCompatibility JavaVersion.VERSION_14
|
||||
}
|
||||
namespace 'ru.vtosters.lite'
|
||||
ndkVersion '26.1.10909125'
|
||||
ndkVersion '25.2.9519653'
|
||||
buildFeatures {
|
||||
aidl true
|
||||
}
|
||||
|
||||
@@ -19661,38 +19661,39 @@ public final class R {
|
||||
public static final int cache_size = 0x7f12188d; // 2131892365
|
||||
public static final int cache_size_summ = 0x7f12188e; // 2131892366
|
||||
public static final int clear_all_cache = 0x7f12188f; // 2131892367
|
||||
public static final int invalidate_theme_cache_each_update_title = 0x7f121890; // 2131892368
|
||||
public static final int invertFilters = 0x7f121891; // 2131892369
|
||||
public static final int invertFilters_summ = 0x7f121892; // 2131892370
|
||||
public static final int invertcached_summ = 0x7f121893; // 2131892371
|
||||
public static final int invertcached_title = 0x7f121894; // 2131892372
|
||||
public static final int microg_dialog1 = 0x7f121895; // 2131892373
|
||||
public static final int microg_dialog2 = 0x7f121896; // 2131892374
|
||||
public static final int microg_dialog3 = 0x7f121897; // 2131892375
|
||||
public static final int serverFeaturesDisable = 0x7f121898; // 2131892376
|
||||
public static final int serverFeaturesDisable_summ = 0x7f121899; // 2131892377
|
||||
public static final int sett_autoupdates = 0x7f12189a; // 2131892378
|
||||
public static final int sett_autoupdates_summ = 0x7f12189b; // 2131892379
|
||||
public static final int sett_battery = 0x7f12189c; // 2131892380
|
||||
public static final int sett_battery_summ1 = 0x7f12189d; // 2131892381
|
||||
public static final int sett_battery_summ2 = 0x7f12189e; // 2131892382
|
||||
public static final int sett_chats = 0x7f12189f; // 2131892383
|
||||
public static final int sett_chats_summ = 0x7f1218a0; // 2131892384
|
||||
public static final int sett_community = 0x7f1218a1; // 2131892385
|
||||
public static final int sett_community_summ = 0x7f1218a2; // 2131892386
|
||||
public static final int sett_missing_links = 0x7f1218a3; // 2131892387
|
||||
public static final int sett_missing_links_summ = 0x7f1218a4; // 2131892388
|
||||
public static final int sett_nogms_summ = 0x7f1218a5; // 2131892389
|
||||
public static final int sett_notifs = 0x7f1218a6; // 2131892390
|
||||
public static final int sett_notifs_summ = 0x7f1218a7; // 2131892391
|
||||
public static final int sett_recommendations = 0x7f1218a8; // 2131892392
|
||||
public static final int tgs_token_missing = 0x7f1218aa; // 2131892394
|
||||
public static final int tgs_token_reset = 0x7f1218ab; // 2131892395
|
||||
public static final int tgs_token_reset_dialog = 0x7f1218ac; // 2131892396
|
||||
public static final int tgs_token_reset_menu = 0x7f1218ad; // 2131892397
|
||||
public static final int update_err = 0x7f1218ae; // 2131892398
|
||||
public static final int update_latest = 0x7f1218af; // 2131892399
|
||||
public static final int APKTOOL_DUMMY_18a9 = 0x7f1218a9; // 2131892393
|
||||
public static final int disable_roaming_state = 0x7f121890; // 2131892368
|
||||
public static final int disable_roaming_state_submit = 0x7f121891; // 2131892369
|
||||
public static final int invalidate_theme_cache_each_update_title = 0x7f121892; // 2131892370
|
||||
public static final int invertFilters = 0x7f121893; // 2131892371
|
||||
public static final int invertFilters_summ = 0x7f121894; // 2131892372
|
||||
public static final int invertcached_summ = 0x7f121895; // 2131892373
|
||||
public static final int invertcached_title = 0x7f121896; // 2131892374
|
||||
public static final int microg_dialog1 = 0x7f121897; // 2131892375
|
||||
public static final int microg_dialog2 = 0x7f121898; // 2131892376
|
||||
public static final int microg_dialog3 = 0x7f121899; // 2131892377
|
||||
public static final int serverFeaturesDisable = 0x7f12189a; // 2131892378
|
||||
public static final int serverFeaturesDisable_summ = 0x7f12189b; // 2131892379
|
||||
public static final int sett_autoupdates = 0x7f12189c; // 2131892380
|
||||
public static final int sett_autoupdates_summ = 0x7f12189d; // 2131892381
|
||||
public static final int sett_battery = 0x7f12189e; // 2131892382
|
||||
public static final int sett_battery_summ1 = 0x7f12189f; // 2131892383
|
||||
public static final int sett_battery_summ2 = 0x7f1218a0; // 2131892384
|
||||
public static final int sett_chats = 0x7f1218a1; // 2131892385
|
||||
public static final int sett_chats_summ = 0x7f1218a2; // 2131892386
|
||||
public static final int sett_community = 0x7f1218a3; // 2131892387
|
||||
public static final int sett_community_summ = 0x7f1218a4; // 2131892388
|
||||
public static final int sett_missing_links = 0x7f1218a5; // 2131892389
|
||||
public static final int sett_missing_links_summ = 0x7f1218a6; // 2131892390
|
||||
public static final int sett_nogms_summ = 0x7f1218a7; // 2131892391
|
||||
public static final int sett_notifs = 0x7f1218a8; // 2131892392
|
||||
public static final int sett_notifs_summ = 0x7f1218a9; // 2131892393
|
||||
public static final int sett_recommendations = 0x7f1218aa; // 2131892394
|
||||
public static final int tgs_token_missing = 0x7f1218ab; // 2131892395
|
||||
public static final int tgs_token_reset = 0x7f1218ac; // 2131892396
|
||||
public static final int tgs_token_reset_dialog = 0x7f1218ad; // 2131892397
|
||||
public static final int tgs_token_reset_menu = 0x7f1218ae; // 2131892398
|
||||
public static final int update_err = 0x7f1218af; // 2131892399
|
||||
public static final int update_latest = 0x7f1218b0; // 2131892400
|
||||
}
|
||||
|
||||
public static final class style {
|
||||
|
||||
@@ -5,12 +5,9 @@ import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.EditText;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.LinearLayout;
|
||||
import androidx.preference.Preference;
|
||||
import bruhcollective.itaysonlab.libvkx.client.LibVKXClient;
|
||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
import com.vk.core.network.Network;
|
||||
import com.vtosters.lite.R;
|
||||
@@ -21,10 +18,7 @@ import org.json.JSONObject;
|
||||
import ru.vtosters.hooks.other.Preferences;
|
||||
import ru.vtosters.hooks.other.ThemesUtils;
|
||||
import ru.vtosters.lite.concurrent.VTExecutors;
|
||||
import ru.vtosters.lite.downloaders.AudioDownloader;
|
||||
import ru.vtosters.lite.downloaders.VideoDownloader;
|
||||
import ru.vtosters.lite.music.LastFMScrobbler;
|
||||
import ru.vtosters.lite.music.cache.MusicCacheImpl;
|
||||
import ru.vtosters.lite.proxy.ProxyUtils;
|
||||
import ru.vtosters.lite.ui.adapters.ImagineArrayAdapter;
|
||||
import ru.vtosters.lite.utils.AccountManagerUtils;
|
||||
@@ -37,8 +31,6 @@ import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
public class MediaFragment extends TrackedMaterialPreferenceToolbarFragment {
|
||||
private static final ExecutorService executor = Executors.newCachedThreadPool();
|
||||
|
||||
public static void download(Context ctx) {
|
||||
final EditText input = new EditText(ctx);
|
||||
input.setTextColor(ThemesUtils.getTextAttr());
|
||||
@@ -93,47 +85,6 @@ public class MediaFragment extends TrackedMaterialPreferenceToolbarFragment {
|
||||
deleteVideoHistoryDialog(requireContext());
|
||||
return true;
|
||||
});
|
||||
findPreference("lastfm_auth").setOnPreferenceClickListener(preference -> {
|
||||
if (LastFMScrobbler.isLoggedIn()) {
|
||||
logout(getContext());
|
||||
} else {
|
||||
lastfmAuth(getContext());
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
if (LastFMScrobbler.isLoggedIn()) {
|
||||
findPreference("lastfm_auth").setSummary(requireContext().getString(R.string.lastfm_authorized_as) + " " + LastFMScrobbler.getUserName());
|
||||
} else {
|
||||
findPreference("lastfm_enabled").setEnabled(false);
|
||||
}
|
||||
|
||||
findPreference("lastfm").setVisible(!Preferences.serverFeaturesDisable());
|
||||
|
||||
findPreference("cached_tracks").setSummary(String.format(requireContext().getString(R.string.cached_tracks_counter), MusicCacheImpl.getTracksCount()));
|
||||
findPreference("cached_tracks").setOnPreferenceClickListener(preference -> {
|
||||
if (MusicCacheImpl.isEmpty()) {
|
||||
AndroidUtils.sendToast(requireContext().getString(R.string.no_cache_error));
|
||||
} else {
|
||||
delcache(requireContext());
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
findPreference("useGenius").setVisible(!Preferences.serverFeaturesDisable());
|
||||
|
||||
findPreference("audio_download").setOnPreferenceClickListener(preference -> {
|
||||
dlaudio(requireContext());
|
||||
return true;
|
||||
});
|
||||
|
||||
findPreference("invertCachedTracks").setVisible(!MusicCacheImpl.isEmpty());
|
||||
|
||||
findPreference("musicdefcatalog").setVisible(!Preferences.getBoolValue("useOldAppVer", false));
|
||||
findPreference("useOldAppVer").setOnPreferenceClickListener(preference -> {
|
||||
LifecycleUtils.restartApplicationWithTimer();
|
||||
return true;
|
||||
});
|
||||
|
||||
findPreference("select_photo_search_engine").setOnPreferenceClickListener(preference -> {
|
||||
var items = new ImagineArrayAdapter.ImagineArrayAdapterItem[SearchEngine.values().length + 1];
|
||||
@@ -164,83 +115,6 @@ public class MediaFragment extends TrackedMaterialPreferenceToolbarFragment {
|
||||
findPreference("maxquality").setEnabled(Preferences.isEnableExternalOpening());
|
||||
}
|
||||
|
||||
private void lastfmAuth(Context ctx) {
|
||||
LinearLayout linearLayout = new LinearLayout(ctx);
|
||||
linearLayout.setOrientation(LinearLayout.VERTICAL);
|
||||
|
||||
final EditText fn = new EditText(ctx);
|
||||
fn.setHint(R.string.lastfm_login);
|
||||
fn.setTextColor(ThemesUtils.getTextAttr());
|
||||
fn.setHintTextColor(ThemesUtils.getSTextAttr());
|
||||
fn.setBackgroundTintList(ThemesUtils.getAccenedColorStateList());
|
||||
linearLayout.addView(fn);
|
||||
fn.getLayoutParams().width = ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
ViewGroup.MarginLayoutParams margin = ((ViewGroup.MarginLayoutParams) fn.getLayoutParams());
|
||||
margin.setMargins(AndroidUtils.dp2px(20f), 0, AndroidUtils.dp2px(20f), 0);
|
||||
fn.setLayoutParams(margin);
|
||||
|
||||
final EditText ln = new EditText(ctx);
|
||||
ln.setHint(R.string.lastfm_password);
|
||||
ln.setTextColor(ThemesUtils.getTextAttr());
|
||||
ln.setHintTextColor(ThemesUtils.getSTextAttr());
|
||||
ln.setBackgroundTintList(ThemesUtils.getAccenedColorStateList());
|
||||
linearLayout.addView(ln);
|
||||
ln.getLayoutParams().width = ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
ln.setLayoutParams(margin);
|
||||
|
||||
new VkAlertDialog.Builder(ctx)
|
||||
.setTitle(R.string.lastfm_enter_credentials)
|
||||
.setPositiveButton(R.string.lastfm_enter,
|
||||
(dialog, which) -> {
|
||||
String login = fn.getText().toString();
|
||||
String pass = ln.getText().toString();
|
||||
LastFMScrobbler.authenticate(login, pass);
|
||||
}
|
||||
)
|
||||
.setView(linearLayout)
|
||||
.show();
|
||||
}
|
||||
|
||||
private void logout(Context ctx) {
|
||||
new VkAlertDialog.Builder(ctx)
|
||||
.setTitle(R.string.lastfm_logout_title)
|
||||
.setMessage(R.string.lastfm_logout_confirm)
|
||||
.setPositiveButton(R.string.vkim_yes,
|
||||
(dialog, which) -> LastFMScrobbler.logout())
|
||||
.setNeutralButton(R.string.vkim_no,
|
||||
(dialog, which) -> dialog.cancel())
|
||||
.show();
|
||||
}
|
||||
|
||||
private void delcache(Context ctx) {
|
||||
new VkAlertDialog.Builder(ctx)
|
||||
.setTitle(R.string.warning)
|
||||
.setMessage(R.string.cached_tracks_remove_confirm)
|
||||
.setPositiveButton(R.string.yes,
|
||||
(dialog, which) -> executor.submit(MusicCacheImpl::clear))
|
||||
.setNeutralButton(R.string.no,
|
||||
(dialog, which) -> dialog.cancel())
|
||||
.show();
|
||||
}
|
||||
|
||||
private void dlaudio(Context ctx) {
|
||||
if (LibVKXClient.isIntegrationEnabled()) {
|
||||
AndroidUtils.sendToast(AndroidUtils.getString("vkx_integration_enabled_info"));
|
||||
return;
|
||||
}
|
||||
|
||||
new VkAlertDialog.Builder(ctx)
|
||||
.setTitle(R.string.download_method)
|
||||
.setMessage(R.string.download_method_desc)
|
||||
.setPositiveButton(R.string.download_method_cache, (dialog, which) -> {
|
||||
executor.submit(AudioDownloader::cacheAllAudios);
|
||||
})
|
||||
.setNegativeButton(R.string.download_method_mp3, (dialog, which) -> {
|
||||
executor.submit(AudioDownloader::downloadAllAudios);
|
||||
})
|
||||
.show();
|
||||
}
|
||||
|
||||
public void deleteVideoHistory() {
|
||||
VTExecutors.getIoExecutor().execute(() -> {
|
||||
var request = new Request.a()
|
||||
@@ -280,4 +154,4 @@ public class MediaFragment extends TrackedMaterialPreferenceToolbarFragment {
|
||||
public int T4() {
|
||||
return R.string.vtlmedia;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,323 @@
|
||||
package ru.vtosters.lite.ui.fragments;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
import androidx.preference.Preference;
|
||||
import bruhcollective.itaysonlab.libvkx.client.LibVKXClient;
|
||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
import com.vtosters.lite.ui.SummaryListPreference;
|
||||
import ru.vtosters.hooks.other.Preferences;
|
||||
import ru.vtosters.hooks.other.ThemesUtils;
|
||||
import ru.vtosters.lite.downloaders.AudioDownloader;
|
||||
import ru.vtosters.lite.music.LastFMScrobbler;
|
||||
import ru.vtosters.lite.music.cache.MusicCacheImpl;
|
||||
import ru.vtosters.lite.ui.PreferenceFragmentUtils;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.lite.utils.LifecycleUtils;
|
||||
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
public class MusicFragment extends TrackedMaterialPreferenceToolbarFragment {
|
||||
private static final ExecutorService executor = Executors.newCachedThreadPool();
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
addPreferencesFromResource(com.vtosters.lite.R.xml.empty);
|
||||
|
||||
requireActivity().getWindow().setStatusBarColor(ThemesUtils.getBackgroundContent());
|
||||
requireActivity().getWindow().setNavigationBarColor(ThemesUtils.getBackgroundContent());
|
||||
|
||||
PreferenceFragmentUtils.addPreferenceCategory(getPreferenceScreen(), "Офлайн прослушивание");
|
||||
|
||||
PreferenceFragmentUtils.addPreference(
|
||||
getPreferenceScreen(),
|
||||
"cached_tracks",
|
||||
getString(com.vtosters.lite.R.string.cached_tracks_title),
|
||||
String.format(requireContext().getString(com.vtosters.lite.R.string.cached_tracks_counter), MusicCacheImpl.getTracksCount()),
|
||||
null,
|
||||
preference -> {
|
||||
if (MusicCacheImpl.isEmpty()) {
|
||||
AndroidUtils.sendToast(requireContext().getString(com.vtosters.lite.R.string.no_cache_error));
|
||||
} else {
|
||||
delcache(requireContext());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
);
|
||||
|
||||
PreferenceFragmentUtils.addPreference(
|
||||
getPreferenceScreen(),
|
||||
"audio_download",
|
||||
getString(com.vtosters.lite.R.string.audio_download_title),
|
||||
null,
|
||||
null,
|
||||
preference -> {
|
||||
dlaudio(requireContext());
|
||||
return true;
|
||||
}
|
||||
);
|
||||
|
||||
PreferenceFragmentUtils.addMaterialSwitchPreference(
|
||||
getPreferenceScreen(),
|
||||
"invertCachedTracks",
|
||||
getString(com.vtosters.lite.R.string.invertcached_title),
|
||||
getString(com.vtosters.lite.R.string.invertcached_summ),
|
||||
null,
|
||||
false,
|
||||
(preference, o) -> {
|
||||
Preferences.getPreferences().edit().putBoolean("invertCachedTracks", (boolean) o).apply();
|
||||
return true;
|
||||
}
|
||||
).setEnabled(!MusicCacheImpl.isEmpty());
|
||||
|
||||
PreferenceFragmentUtils.addMaterialSwitchPreference(
|
||||
getPreferenceScreen(),
|
||||
"autocache",
|
||||
getString(com.vtosters.lite.R.string.autocache_title),
|
||||
getString(com.vtosters.lite.R.string.autocache_summ),
|
||||
null,
|
||||
false,
|
||||
(preference, o) -> {
|
||||
Preferences.getPreferences().edit().putBoolean("autocache", (boolean) o).apply();
|
||||
return true;
|
||||
}
|
||||
);
|
||||
|
||||
PreferenceFragmentUtils.addPreferenceCategory(getPreferenceScreen(), "Скачивание аудио в MP3");
|
||||
|
||||
PreferenceFragmentUtils.addMaterialSwitchPreference(
|
||||
getPreferenceScreen(),
|
||||
"dldir",
|
||||
"Альтернативная папка для скачивания",
|
||||
"Использовать папку Downloads вместо Music для скачивания музыки в MP3",
|
||||
null,
|
||||
false,
|
||||
(preference, o) -> {
|
||||
Preferences.getPreferences().edit().putBoolean("dldir", (boolean) o).apply();
|
||||
return true;
|
||||
}
|
||||
);
|
||||
|
||||
PreferenceFragmentUtils.addMaterialSwitchPreference(
|
||||
getPreferenceScreen(),
|
||||
"setMetaData",
|
||||
"Сохранять метадату песен",
|
||||
"Сохранять id3v2 теги для песен для MP3",
|
||||
null,
|
||||
true,
|
||||
(preference, o) -> {
|
||||
Preferences.getPreferences().edit().putBoolean("setMetaData", (boolean) o).apply();
|
||||
return true;
|
||||
}
|
||||
);
|
||||
|
||||
if (!Preferences.serverFeaturesDisable()) {
|
||||
PreferenceFragmentUtils.addPreferenceCategory(getPreferenceScreen(), "Интеграция Genius");
|
||||
PreferenceFragmentUtils.addMaterialSwitchPreference(
|
||||
getPreferenceScreen(),
|
||||
"useGenius",
|
||||
getString(com.vtosters.lite.R.string.useGenius_title),
|
||||
getString(com.vtosters.lite.R.string.useGenius_summ),
|
||||
null,
|
||||
false,
|
||||
(preference, o) -> {
|
||||
Preferences.getPreferences().edit().putBoolean("useGenius", (boolean) o).apply();
|
||||
return true;
|
||||
}
|
||||
);
|
||||
|
||||
PreferenceFragmentUtils.addPreferenceCategory(getPreferenceScreen(), "Интеграция Last.fm");
|
||||
|
||||
PreferenceFragmentUtils.addPreference(
|
||||
getPreferenceScreen(),
|
||||
"lastfm_auth",
|
||||
getString(com.vtosters.lite.R.string.lastfm_auth_title),
|
||||
getString(com.vtosters.lite.R.string.lastfm_auth_summ),
|
||||
null,
|
||||
preference -> {
|
||||
if (LastFMScrobbler.isLoggedIn()) {
|
||||
logout(getContext());
|
||||
} else {
|
||||
lastfmAuth(getContext());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
);
|
||||
|
||||
PreferenceFragmentUtils.addMaterialSwitchPreference(
|
||||
getPreferenceScreen(),
|
||||
"lastfm_enabled",
|
||||
AndroidUtils.getString("lastfm_enabled_title"),
|
||||
AndroidUtils.getString("lastfm_enabled_summ"),
|
||||
null,
|
||||
false,
|
||||
(preference, o) -> {
|
||||
Preferences.getPreferences().edit().putBoolean("lastfm_enabled", (boolean) o).apply();
|
||||
return true;
|
||||
}
|
||||
).setEnabled(LastFMScrobbler.isLoggedIn());
|
||||
|
||||
if (LastFMScrobbler.isLoggedIn()) {
|
||||
findPreference("lastfm_auth").setSummary(getString(com.vtosters.lite.R.string.lastfm_authorized_as) + " " + LastFMScrobbler.getUserName());
|
||||
}
|
||||
|
||||
PreferenceFragmentUtils.addPreferenceCategory(getPreferenceScreen(), "Интеграция VK X");
|
||||
|
||||
PreferenceFragmentUtils.addPreference(
|
||||
getPreferenceScreen(),
|
||||
"",
|
||||
getString(com.vtosters.lite.R.string.vkx_why),
|
||||
getString(com.vtosters.lite.R.string.vkx_why_summary),
|
||||
null,
|
||||
null
|
||||
);
|
||||
|
||||
PreferenceFragmentUtils.addMaterialSwitchPreference(
|
||||
getPreferenceScreen(),
|
||||
"libvkx_integration",
|
||||
getString(com.vtosters.lite.R.string.vkx_integration),
|
||||
null,
|
||||
null,
|
||||
false,
|
||||
(preference, o) -> {
|
||||
Preferences.getPreferences().edit().putBoolean("libvkx_integration", (boolean) o).apply();
|
||||
return true;
|
||||
}
|
||||
);
|
||||
|
||||
if (!LibVKXClient.isVkxInstalled()) {
|
||||
findPreference("libvkx_integration").setSummary("У вас не установлен VKX. Интеграция работать не будет");
|
||||
findPreference("libvkx_integration").setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
PreferenceFragmentUtils.addPreferenceCategory(getPreferenceScreen(), "Прочее");
|
||||
|
||||
PreferenceFragmentUtils.addMaterialSwitchPreference(
|
||||
getPreferenceScreen(),
|
||||
"useOldAppVer",
|
||||
getString(com.vtosters.lite.R.string.useOldAppVer_title),
|
||||
"Включите если вас не устраивают новые рекомендации и вас интересует только свое аудио",
|
||||
null,
|
||||
false,
|
||||
(preference, o) -> {
|
||||
Preferences.getPreferences().edit().putBoolean("useOldAppVer", (boolean) o).apply();
|
||||
LifecycleUtils.restartApplicationWithTimer();
|
||||
return true;
|
||||
}
|
||||
);
|
||||
|
||||
SummaryListPreference list = new SummaryListPreference(getPreferenceScreen().getContext());
|
||||
list.setTitle(com.vtosters.lite.R.string.musicdefcatalog_title);
|
||||
list.setKey("musicdefcatalog");
|
||||
list.setEntryValues(com.vtosters.lite.R.array.musicdefcatalog);
|
||||
list.setEntries(com.vtosters.lite.R.array.musicdefcatalog_value);
|
||||
list.setDialogTitle(com.vtosters.lite.R.string.musicdefcatalog_dialogTitle);
|
||||
list.setDefaultValue("default");
|
||||
list.setVisible(!Preferences.getBoolValue("useOldAppVer", false));
|
||||
|
||||
getPreferenceScreen().addPreference(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceTreeClick(Preference preference) {
|
||||
return super.onPreferenceTreeClick(preference);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
if (LastFMScrobbler.isLoggedIn() && !Preferences.serverFeaturesDisable()) {
|
||||
findPreference("lastfm_auth").setSummary(getString(com.vtosters.lite.R.string.lastfm_authorized_as) + " " + LastFMScrobbler.getUserName());
|
||||
findPreference("lastfm_enabled").setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void lastfmAuth(Context ctx) {
|
||||
LinearLayout linearLayout = new LinearLayout(ctx);
|
||||
linearLayout.setOrientation(LinearLayout.VERTICAL);
|
||||
|
||||
EditText fn = new EditText(ctx);
|
||||
fn.setHint(com.vtosters.lite.R.string.lastfm_login);
|
||||
fn.setTextColor(ThemesUtils.getTextAttr());
|
||||
fn.setHintTextColor(ThemesUtils.getSTextAttr());
|
||||
fn.setBackgroundTintList(ThemesUtils.getAccenedColorStateList());
|
||||
linearLayout.addView(fn);
|
||||
fn.getLayoutParams().width = ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
ViewGroup.MarginLayoutParams margin = ((ViewGroup.MarginLayoutParams) fn.getLayoutParams());
|
||||
margin.setMargins(AndroidUtils.dp2px(20f), 0, AndroidUtils.dp2px(20f), 0);
|
||||
fn.setLayoutParams(margin);
|
||||
|
||||
EditText ln = new EditText(ctx);
|
||||
ln.setHint(com.vtosters.lite.R.string.lastfm_password);
|
||||
ln.setTextColor(ThemesUtils.getTextAttr());
|
||||
ln.setHintTextColor(ThemesUtils.getSTextAttr());
|
||||
ln.setBackgroundTintList(ThemesUtils.getAccenedColorStateList());
|
||||
linearLayout.addView(ln);
|
||||
ln.getLayoutParams().width = ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
ln.setLayoutParams(margin);
|
||||
|
||||
new VkAlertDialog.Builder(ctx)
|
||||
.setTitle(com.vtosters.lite.R.string.lastfm_enter_credentials)
|
||||
.setPositiveButton(com.vtosters.lite.R.string.lastfm_enter,
|
||||
(dialog, which) -> {
|
||||
String login = fn.getText().toString();
|
||||
String pass = ln.getText().toString();
|
||||
LastFMScrobbler.authenticate(login, pass);
|
||||
}
|
||||
)
|
||||
.setView(linearLayout)
|
||||
.show();
|
||||
}
|
||||
|
||||
private void logout(Context ctx) {
|
||||
new VkAlertDialog.Builder(ctx)
|
||||
.setTitle(com.vtosters.lite.R.string.lastfm_logout_title)
|
||||
.setMessage(com.vtosters.lite.R.string.lastfm_logout_confirm)
|
||||
.setPositiveButton(com.vtosters.lite.R.string.vkim_yes,
|
||||
(dialog, which) -> LastFMScrobbler.logout())
|
||||
.setNeutralButton(com.vtosters.lite.R.string.vkim_no,
|
||||
(dialog, which) -> dialog.cancel())
|
||||
.show();
|
||||
}
|
||||
|
||||
private void delcache(Context ctx) {
|
||||
new VkAlertDialog.Builder(ctx)
|
||||
.setTitle(com.vtosters.lite.R.string.warning)
|
||||
.setMessage(com.vtosters.lite.R.string.cached_tracks_remove_confirm)
|
||||
.setPositiveButton(com.vtosters.lite.R.string.yes,
|
||||
(dialog, which) -> executor.submit(MusicCacheImpl::clear))
|
||||
.setNeutralButton(com.vtosters.lite.R.string.no,
|
||||
(dialog, which) -> dialog.cancel())
|
||||
.show();
|
||||
}
|
||||
|
||||
private void dlaudio(Context ctx) {
|
||||
if (LibVKXClient.isIntegrationEnabled()) {
|
||||
AndroidUtils.sendToast(AndroidUtils.getString("vkx_integration_enabled_info"));
|
||||
return;
|
||||
}
|
||||
|
||||
new VkAlertDialog.Builder(ctx)
|
||||
.setTitle(com.vtosters.lite.R.string.download_method)
|
||||
.setMessage(com.vtosters.lite.R.string.download_method_desc)
|
||||
.setPositiveButton(com.vtosters.lite.R.string.download_method_cache, (dialog, which) -> {
|
||||
executor.submit(AudioDownloader::cacheAllAudios);
|
||||
})
|
||||
.setNegativeButton(com.vtosters.lite.R.string.download_method_mp3, (dialog, which) -> {
|
||||
executor.submit(AudioDownloader::downloadAllAudios);
|
||||
})
|
||||
.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int T4() {
|
||||
return com.vtosters.lite.R.string.vtl_music_settings;
|
||||
}
|
||||
}
|
||||
@@ -466,6 +466,18 @@ public class VTSettings extends TrackedMaterialPreferenceToolbarFragment {
|
||||
}
|
||||
);
|
||||
|
||||
PreferenceFragmentUtils.addPreference(
|
||||
getPreferenceScreen(),
|
||||
"",
|
||||
requireContext().getString(R.string.music),
|
||||
getValAsString(R.string.useGenius_title, Preferences.getBoolValue("useGenius", false)),
|
||||
R.drawable.ic_music_outline_28,
|
||||
preference -> {
|
||||
NavigatorUtils.switchFragment(requireContext(), MusicFragment.class);
|
||||
return false;
|
||||
}
|
||||
);
|
||||
|
||||
PreferenceFragmentUtils.addPreference(
|
||||
getPreferenceScreen(),
|
||||
"",
|
||||
|
||||
@@ -14,62 +14,6 @@
|
||||
android:key="compression"
|
||||
android:title="@string/compression_types"/>
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory android:title="@string/vtl_music_settings">
|
||||
<Preference
|
||||
android:key="cached_tracks"
|
||||
android:title="@string/cached_tracks_title"/>
|
||||
<com.vtosters.lite.ui.MaterialSwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="invertCachedTracks"
|
||||
android:summary="@string/invertcached_summ"
|
||||
android:title="@string/invertcached_title"/>
|
||||
<com.vtosters.lite.ui.MaterialSwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="autocache"
|
||||
android:summary="@string/autocache_summ"
|
||||
android:title="@string/autocache_title"/>
|
||||
<com.vtosters.lite.ui.MaterialSwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="dldir"
|
||||
android:summary="Использовать папку Downloads вместо Music для скачивания музыки в MP3"
|
||||
android:title="Альтернативная папка для скачивания"/>
|
||||
<com.vtosters.lite.ui.MaterialSwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="useGenius"
|
||||
android:summary="@string/useGenius_summ"
|
||||
android:title="@string/useGenius_title"/>
|
||||
<com.vtosters.lite.ui.MaterialSwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="useOldAppVer"
|
||||
android:summary="@string/useOldAppVer_summ"
|
||||
android:title="@string/useOldAppVer_title"/>
|
||||
<com.vtosters.lite.ui.SummaryListPreference
|
||||
android:defaultValue="default"
|
||||
android:dialogTitle="@string/musicdefcatalog_dialogTitle"
|
||||
android:entries="@array/musicdefcatalog_value"
|
||||
android:entryValues="@array/musicdefcatalog"
|
||||
android:key="musicdefcatalog"
|
||||
android:title="@string/musicdefcatalog_title"/>
|
||||
<com.vtosters.lite.ui.MaterialSwitchPreference
|
||||
android:defaultValue="true"
|
||||
android:key="setMetaData"
|
||||
android:summary="Сохранять id3v2 теги для песен для MP3"
|
||||
android:title="Сохранять метадату песен"/>
|
||||
<Preference
|
||||
android:key="audio_download"
|
||||
android:title="@string/audio_download_title"/>
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory android:title="Last.fm" android:key="lastfm">
|
||||
<Preference
|
||||
android:key="lastfm_auth"
|
||||
android:summary="@string/lastfm_auth_summ"
|
||||
android:title="@string/lastfm_auth_title"/>
|
||||
<com.vtosters.lite.ui.MaterialSwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="lastfm_enabled"
|
||||
android:summary="@string/lastfm_enabled_summ"
|
||||
android:title="@string/lastfm_enabled_title"/>
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory android:title="@string/vtl_video_settings">
|
||||
<Preference
|
||||
android:key="download_video"
|
||||
@@ -99,21 +43,4 @@
|
||||
android:key="select_photo_search_engine"
|
||||
android:title="@string/photo_search_engine_title"/>
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory android:title="@string/vkx_title" android:key="vkx_sett">
|
||||
<Preference
|
||||
android:enabled="false"
|
||||
android:summary="@string/vkx_why_summary"
|
||||
android:title="@string/vkx_why"/>
|
||||
<Preference
|
||||
android:persistent="false"
|
||||
android:title="@string/vkx_download">
|
||||
<intent
|
||||
android:action="android.intent.action.VIEW"
|
||||
android:data="https://vkx.app"/>
|
||||
</Preference>
|
||||
<com.vtosters.lite.ui.MaterialSwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="libvkx_integration"
|
||||
android:title="@string/vkx_integration"/>
|
||||
</PreferenceCategory>
|
||||
</PreferenceScreen>
|
||||
Reference in New Issue
Block a user