// Path: mobile/src/main/java/com/matejdro/wearvibrationcenter/ui/GlobalSettingsFragment.java
// public class GlobalSettingsFragment extends CustomStoragePreferenceFragment implements TitleUtils.TitledFragment {
//     private GoogleApiClient googleApiClient;
// 
//     @Override
//     public void onCreate(Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
// 
//         addPreferencesFromResource(R.xml.global_settings);
// 
//         try {
//             findPreference("version").setSummary(getActivity().getPackageManager().getPackageInfo(getActivity().getPackageName(), 0).versionName);
//         } catch (PackageManager.NameNotFoundException ignored) {
//         }
// 
//         findPreference("supportButton").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
//             @Override
//             public boolean onPreferenceClick(Preference preference) {
//                 sendLogs();
//                 return true;
//             }
//         });
// 
//         findPreference("licenses").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
// 
//             @Override
//             public boolean onPreferenceClick(Preference preference) {
//                 new LicensesDialog.Builder(getActivity())
//                         .setNotices(R.raw.notices)
//                         .setIncludeOwnLicense(true)
//                         .build()
//                         .show();
//                 return true;
//             }
//         });
// 
//         findPreference("donateButton").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
//             @Override
//             public boolean onPreferenceClick(Preference preference) {
//                 Intent intent = new Intent(Intent.ACTION_VIEW);
//                 intent.setData(Uri.parse("https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=THRX5EMUNBZE6"));
//                 startActivity(intent);
//                 return true;
//             }
//         });
// 
//         if (canTransmitSettingsAutomatically()) {
//             googleApiClient = new GoogleApiClient.Builder(getActivity())
//                     .addApi(Wearable.API)
//                     .build();
// 
//             googleApiClient.connect();
//         }
//     }
// 
//     @Override
//     public void onStop() {
//         super.onStop();
// 
//         if (canTransmitSettingsAutomatically() && googleApiClient != null && googleApiClient.isConnected()) {
//             PreferencePusher.INSTANCE.pushPreferences(googleApiClient, getPreferenceManager().getSharedPreferences(), CommPaths.PREFERENCES_PREFIX, false);
//         }
//     }
// 
//     @Override
//     public String getTitle() {
//         return getString(R.string.global_settings);
//     }
// 
//     @SuppressWarnings("SameReturnValue")
//     protected boolean canTransmitSettingsAutomatically() {
//         return true;
//     }
// 
//     private void sendLogs() {
//         new LogRetrievalTask(getActivity(),
//                 CommPaths.COMMAND_SEND_LOGS,
//                 "matejdro+support@gmail.com",
//                 "com.matejdro.wearvibrationcenter.logs").execute((Void) null);
//     }
// 
//     @Override
//     public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[]
//             grantResults) {
//         super.onRequestPermissionsResult(requestCode, permissions, grantResults);
// 
//         if (permissions.length > 0 &&
//                 permissions[0].equals(Manifest.permission.WRITE_EXTERNAL_STORAGE) &&
//                 grantResults[0] == PackageManager.PERMISSION_GRANTED) {
//             sendLogs();
//         }
//     }
// }


import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.matejdro.wearutils.tasker.TaskerPreferenceActivity;
import com.matejdro.wearvibrationcenter.R;
import com.matejdro.wearvibrationcenter.ui.GlobalSettingsFragment;
        setContentView(R.layout.activity_single_fragment);

        getFragmentManager()
                .beginTransaction()
                .replace(R.id.content_frame, new TaskerGlobalSettingsFragment())
                .commit();

        super.onCreate(savedInstanceState);
    }

    @Override
    protected boolean onPreviousTaskerOptionsLoaded(Bundle taskerOptions) {
        if (taskerOptions.getInt("action", Integer.MAX_VALUE) != TaskerActions.ACTION_GLOBAL_SETTINGS) {
            return false;
        }

        return super.onPreviousTaskerOptionsLoaded(taskerOptions);
    }

    @Nullable
    @Override
    protected SharedPreferences getOriginalValues() {
        return PreferenceManager.getDefaultSharedPreferences(this);
    }

    @Override
    protected void onPreSave(Bundle settingsBundle, Intent taskerIntent) {
        settingsBundle.putInt("action", TaskerActions.ACTION_GLOBAL_SETTINGS);
    }

// Path: mobile/src/main/java/com/matejdro/wearvibrationcenter/ui/GlobalSettingsFragment.java
// public class GlobalSettingsFragment extends CustomStoragePreferenceFragment implements TitleUtils.TitledFragment {
//     private GoogleApiClient googleApiClient;
// 
//     @Override
//     public void onCreate(Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
// 
//         addPreferencesFromResource(R.xml.global_settings);
// 
//         try {
//             findPreference("version").setSummary(getActivity().getPackageManager().getPackageInfo(getActivity().getPackageName(), 0).versionName);
//         } catch (PackageManager.NameNotFoundException ignored) {
//         }
// 
//         findPreference("supportButton").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
//             @Override
//             public boolean onPreferenceClick(Preference preference) {
//                 sendLogs();
//                 return true;
//             }
//         });
// 
//         findPreference("licenses").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
// 
//             @Override
//             public boolean onPreferenceClick(Preference preference) {
//                 new LicensesDialog.Builder(getActivity())
//                         .setNotices(R.raw.notices)
//                         .setIncludeOwnLicense(true)
//                         .build()
//                         .show();
//                 return true;
//             }
//         });
// 
//         findPreference("donateButton").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
//             @Override
//             public boolean onPreferenceClick(Preference preference) {
//                 Intent intent = new Intent(Intent.ACTION_VIEW);
//                 intent.setData(Uri.parse("https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=THRX5EMUNBZE6"));
//                 startActivity(intent);
//                 return true;
//             }
//         });
// 
//         if (canTransmitSettingsAutomatically()) {
//             googleApiClient = new GoogleApiClient.Builder(getActivity())
//                     .addApi(Wearable.API)
//                     .build();
// 
//             googleApiClient.connect();
//         }
//     }
// 
//     @Override
//     public void onStop() {
//         super.onStop();
// 
//         if (canTransmitSettingsAutomatically() && googleApiClient != null && googleApiClient.isConnected()) {
//             PreferencePusher.INSTANCE.pushPreferences(googleApiClient, getPreferenceManager().getSharedPreferences(), CommPaths.PREFERENCES_PREFIX, false);
//         }
//     }
// 
//     @Override
//     public String getTitle() {
//         return getString(R.string.global_settings);
//     }
// 
//     @SuppressWarnings("SameReturnValue")
//     protected boolean canTransmitSettingsAutomatically() {
//         return true;
//     }
// 
//     private void sendLogs() {
//         new LogRetrievalTask(getActivity(),
//                 CommPaths.COMMAND_SEND_LOGS,
//                 "matejdro+support@gmail.com",
//                 "com.matejdro.wearvibrationcenter.logs").execute((Void) null);
//     }
// 
//     @Override
//     public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[]
//             grantResults) {
//         super.onRequestPermissionsResult(requestCode, permissions, grantResults);
// 
//         if (permissions.length > 0 &&
//                 permissions[0].equals(Manifest.permission.WRITE_EXTERNAL_STORAGE) &&
//                 grantResults[0] == PackageManager.PERMISSION_GRANTED) {
//             sendLogs();
//         }
//     }
// }


// Path: mobile/src/main/java/com/matejdro/wearvibrationcenter/tasker/TaskerGlobalSettingsActivity.java
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.matejdro.wearutils.tasker.TaskerPreferenceActivity;
import com.matejdro.wearvibrationcenter.R;
import com.matejdro.wearvibrationcenter.ui.GlobalSettingsFragment;

        setContentView(R.layout.activity_single_fragment);

        getFragmentManager()
                .beginTransaction()
                .replace(R.id.content_frame, new TaskerGlobalSettingsFragment())
                .commit();

        super.onCreate(savedInstanceState);
    }

    @Override
    protected boolean onPreviousTaskerOptionsLoaded(Bundle taskerOptions) {
        if (taskerOptions.getInt("action", Integer.MAX_VALUE) != TaskerActions.ACTION_GLOBAL_SETTINGS) {
            return false;
        }

        return super.onPreviousTaskerOptionsLoaded(taskerOptions);
    }

    @Nullable
    @Override
    protected SharedPreferences getOriginalValues() {
        return PreferenceManager.getDefaultSharedPreferences(this);
    }

    @Override
    protected void onPreSave(Bundle settingsBundle, Intent taskerIntent) {
        settingsBundle.putInt("action", TaskerActions.ACTION_GLOBAL_SETTINGS);
    }

    public static class TaskerGlobalSettingsFragment extends GlobalSettingsFragment