mirror of
https://github.com/KDE/kdeconnect-android
synced 2025-08-29 21:27:40 +00:00
Fix minifier deleting "unused" xml that were actually used
This commit is contained in:
parent
6ab846cbbd
commit
54e5224f20
@ -211,6 +211,6 @@ public class FindMyPhonePlugin extends Plugin {
|
||||
|
||||
@Override
|
||||
public PluginSettingsFragment getSettingsFragment(Activity activity) {
|
||||
return FindMyPhoneSettingsFragment.newInstance(getPluginKey());
|
||||
return FindMyPhoneSettingsFragment.newInstance(getPluginKey(), R.xml.findmyphoneplugin_preferences);
|
||||
}
|
||||
}
|
||||
|
@ -28,9 +28,9 @@ public class FindMyPhoneSettingsFragment extends PluginSettingsFragment {
|
||||
private SharedPreferences sharedPreferences;
|
||||
private Preference ringtonePreference;
|
||||
|
||||
public static FindMyPhoneSettingsFragment newInstance(@NonNull String pluginKey) {
|
||||
public static FindMyPhoneSettingsFragment newInstance(@NonNull String pluginKey, int layout) {
|
||||
FindMyPhoneSettingsFragment fragment = new FindMyPhoneSettingsFragment();
|
||||
fragment.setArguments(pluginKey);
|
||||
fragment.setArguments(pluginKey, layout);
|
||||
|
||||
return fragment;
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ import android.graphics.drawable.Drawable;
|
||||
import org.kde.kdeconnect.NetworkPacket;
|
||||
import org.kde.kdeconnect.Plugins.Plugin;
|
||||
import org.kde.kdeconnect.Plugins.PluginFactory;
|
||||
import org.kde.kdeconnect.UserInterface.PluginSettingsFragment;
|
||||
import org.kde.kdeconnect_tp.R;
|
||||
|
||||
import androidx.core.content.ContextCompat;
|
||||
@ -54,6 +55,11 @@ public class MousePadPlugin extends Plugin {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PluginSettingsFragment getSettingsFragment(Activity activity) {
|
||||
return PluginSettingsFragment.newInstance(getPluginKey(), R.xml.mousepadplugin_preferences);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasMainActivity() {
|
||||
return true;
|
||||
|
@ -19,6 +19,7 @@ import androidx.core.content.ContextCompat;
|
||||
import org.kde.kdeconnect.NetworkPacket;
|
||||
import org.kde.kdeconnect.Plugins.Plugin;
|
||||
import org.kde.kdeconnect.Plugins.PluginFactory;
|
||||
import org.kde.kdeconnect.UserInterface.PluginSettingsFragment;
|
||||
import org.kde.kdeconnect_tp.R;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
@ -254,6 +255,11 @@ public class MprisPlugin extends Plugin {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PluginSettingsFragment getSettingsFragment(Activity activity) {
|
||||
return PluginSettingsFragment.newInstance(getPluginKey(), R.xml.mprisplugin_preferences);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreate() {
|
||||
MprisMediaSession.getInstance().onCreate(context.getApplicationContext(), this, device.getDeviceId());
|
||||
|
@ -166,7 +166,8 @@ public abstract class Plugin {
|
||||
* @return The PluginSettingsFragment used to display this plugins settings
|
||||
*/
|
||||
public PluginSettingsFragment getSettingsFragment(Activity activity) {
|
||||
return PluginSettingsFragment.newInstance(getPluginKey());
|
||||
throw new RuntimeException("Plugin doesn't reimplement getSettingsFragment: " + getPluginKey());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
package org.kde.kdeconnect.Plugins.RemoteKeyboardPlugin;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.SystemClock;
|
||||
@ -24,6 +25,7 @@ import org.kde.kdeconnect.Plugins.Plugin;
|
||||
import org.kde.kdeconnect.Plugins.PluginFactory;
|
||||
import org.kde.kdeconnect.UserInterface.MainActivity;
|
||||
import org.kde.kdeconnect.UserInterface.StartActivityAlertDialogFragment;
|
||||
import org.kde.kdeconnect.UserInterface.PluginSettingsFragment;
|
||||
import org.kde.kdeconnect_tp.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -159,6 +161,11 @@ public class RemoteKeyboardPlugin extends Plugin implements SharedPreferences.On
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PluginSettingsFragment getSettingsFragment(Activity activity) {
|
||||
return PluginSettingsFragment.newInstance(getPluginKey(), R.xml.remotekeyboardplugin_preferences);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasMainActivity() {
|
||||
return false;
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
package org.kde.kdeconnect.Plugins.SMSPlugin;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.Manifest;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.BroadcastReceiver;
|
||||
@ -36,6 +37,7 @@ import org.kde.kdeconnect.NetworkPacket;
|
||||
import org.kde.kdeconnect.Plugins.Plugin;
|
||||
import org.kde.kdeconnect.Plugins.PluginFactory;
|
||||
import org.kde.kdeconnect.Plugins.TelephonyPlugin.TelephonyPlugin;
|
||||
import org.kde.kdeconnect.UserInterface.PluginSettingsFragment;
|
||||
import org.kde.kdeconnect_tp.BuildConfig;
|
||||
import org.kde.kdeconnect_tp.R;
|
||||
|
||||
@ -557,6 +559,11 @@ public class SMSPlugin extends Plugin {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PluginSettingsFragment getSettingsFragment(Activity activity) {
|
||||
return PluginSettingsFragment.newInstance(getPluginKey(), R.xml.smsplugin_preferences);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getSupportedPacketTypes() {
|
||||
return new String[]{
|
||||
|
@ -263,7 +263,7 @@ public class SftpPlugin extends Plugin implements SharedPreferences.OnSharedPref
|
||||
|
||||
@Override
|
||||
public PluginSettingsFragment getSettingsFragment(Activity activity) {
|
||||
return SftpSettingsFragment.newInstance(getPluginKey());
|
||||
return SftpSettingsFragment.newInstance(getPluginKey(), R.xml.sftpplugin_preferences);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -64,9 +64,9 @@ public class SftpSettingsFragment
|
||||
private ActionMode actionMode;
|
||||
private JSONObject savedActionModeState;
|
||||
|
||||
public static SftpSettingsFragment newInstance(@NonNull String pluginKey) {
|
||||
public static SftpSettingsFragment newInstance(@NonNull String pluginKey, int layout) {
|
||||
SftpSettingsFragment fragment = new SftpSettingsFragment();
|
||||
fragment.setArguments(pluginKey);
|
||||
fragment.setArguments(pluginKey, layout);
|
||||
|
||||
return fragment;
|
||||
}
|
||||
|
@ -197,7 +197,7 @@ public class SharePlugin extends Plugin {
|
||||
|
||||
@Override
|
||||
public PluginSettingsFragment getSettingsFragment(Activity activity) {
|
||||
return ShareSettingsFragment.newInstance(getPluginKey());
|
||||
return ShareSettingsFragment.newInstance(getPluginKey(), R.xml.shareplugin_preferences);
|
||||
}
|
||||
|
||||
void sendUriList(final ArrayList<Uri> uriList) {
|
||||
|
@ -37,9 +37,9 @@ public class ShareSettingsFragment extends PluginSettingsFragment {
|
||||
|
||||
private Preference filePicker;
|
||||
|
||||
public static ShareSettingsFragment newInstance(@NonNull String pluginKey) {
|
||||
public static ShareSettingsFragment newInstance(@NonNull String pluginKey, int layout) {
|
||||
ShareSettingsFragment fragment = new ShareSettingsFragment();
|
||||
fragment.setArguments(pluginKey);
|
||||
fragment.setArguments(pluginKey, layout);
|
||||
|
||||
return fragment;
|
||||
}
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
package org.kde.kdeconnect.Plugins.TelephonyPlugin;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.Manifest;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
@ -26,6 +27,7 @@ import org.kde.kdeconnect.Helpers.ContactsHelper;
|
||||
import org.kde.kdeconnect.NetworkPacket;
|
||||
import org.kde.kdeconnect.Plugins.Plugin;
|
||||
import org.kde.kdeconnect.Plugins.PluginFactory;
|
||||
import org.kde.kdeconnect.UserInterface.PluginSettingsFragment;
|
||||
import org.kde.kdeconnect_tp.R;
|
||||
|
||||
import java.util.Map;
|
||||
@ -318,4 +320,9 @@ public class TelephonyPlugin extends Plugin {
|
||||
public boolean hasSettings() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PluginSettingsFragment getSettingsFragment(Activity activity) {
|
||||
return PluginSettingsFragment.newInstance(getPluginKey(), R.xml.telephonyplugin_preferences);
|
||||
}
|
||||
}
|
||||
|
@ -18,28 +18,33 @@ import org.kde.kdeconnect.Device;
|
||||
import org.kde.kdeconnect.Plugins.Plugin;
|
||||
import org.kde.kdeconnect.Plugins.PluginFactory;
|
||||
import org.kde.kdeconnect_tp.R;
|
||||
import android.util.Log;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public class PluginSettingsFragment extends PreferenceFragmentCompat {
|
||||
private static final String ARG_PLUGIN_KEY = "plugin_key";
|
||||
private static final String ARG_LAYOUT = "layout";
|
||||
|
||||
private String pluginKey;
|
||||
private int layout;
|
||||
protected Device device;
|
||||
protected Plugin plugin;
|
||||
|
||||
public static PluginSettingsFragment newInstance(@NonNull String pluginKey) {
|
||||
public static PluginSettingsFragment newInstance(@NonNull String pluginKey, int settingsLayout) {
|
||||
PluginSettingsFragment fragment = new PluginSettingsFragment();
|
||||
fragment.setArguments(pluginKey);
|
||||
fragment.setArguments(pluginKey, settingsLayout);
|
||||
|
||||
return fragment;
|
||||
}
|
||||
|
||||
public PluginSettingsFragment() {}
|
||||
|
||||
protected Bundle setArguments(@NonNull String pluginKey) {
|
||||
protected Bundle setArguments(@NonNull String pluginKey, int settingsLayout) {
|
||||
Bundle args = new Bundle();
|
||||
args.putString(ARG_PLUGIN_KEY, pluginKey);
|
||||
args.putInt(ARG_LAYOUT, settingsLayout);
|
||||
|
||||
|
||||
setArguments(args);
|
||||
|
||||
@ -52,7 +57,8 @@ public class PluginSettingsFragment extends PreferenceFragmentCompat {
|
||||
throw new RuntimeException("You must provide a pluginKey by calling setArguments(@NonNull String pluginKey)");
|
||||
}
|
||||
|
||||
pluginKey = getArguments().getString(ARG_PLUGIN_KEY);
|
||||
this.pluginKey = getArguments().getString(ARG_PLUGIN_KEY);
|
||||
this.layout = getArguments().getInt(ARG_LAYOUT);
|
||||
this.device = getDeviceOrThrow(getDeviceId());
|
||||
this.plugin = device.getPlugin(pluginKey);
|
||||
|
||||
@ -67,9 +73,7 @@ public class PluginSettingsFragment extends PreferenceFragmentCompat {
|
||||
prefsManager.setSharedPreferencesMode(Context.MODE_PRIVATE);
|
||||
}
|
||||
|
||||
int resFile = getResources().getIdentifier(pluginKey.toLowerCase(Locale.ENGLISH) + "_preferences", "xml",
|
||||
requireContext().getPackageName());
|
||||
addPreferencesFromResource(resFile);
|
||||
addPreferencesFromResource(layout);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
x
Reference in New Issue
Block a user