// Path: common/src/main/java/com/matejdro/wearvibrationcenter/common/CommPaths.java
// public interface CommPaths
// {
//     String PHONE_APP_CAPABILITY = "VibrationCenterPhone";
//     String WATCH_APP_CAPABILITY = "VibrationCenterWatch";
// 
//     String COMMAND_VIBRATE = "/Command/Vibrate";
//     String COMMAND_ALARM = "/Command/Alarm";
//     String COMMAND_APP_MUTE = "/Command/AppMute";
//     String COMMAND_TIMED_MUTE = "/Command/TimedMute";
//     String COMMAND_SEND_LOGS = "/Command/SendLogs";
// 
//     String COMMAND_RECEIVAL_ACKNOWLEDGMENT = "/Ack";
// 
//     String CHANNEL_LOGS = "/Channel/Logs";
// 
//     String LIST_ACTIVE_APPS_NAMES = "/List/ActiveApps/Names";
//     String LIST_ACTIVE_APPS_ICONS = "/List/ActiveApps/Icons";
// 
//     String ASSET_ICON = "Icon";
//     String ASSET_BACKGROUND = "Background";
// 
//     String PREFERENCES_PREFIX = "/Preferences";
// }


import android.Manifest;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Bundle;
import android.preference.Preference;
import androidx.annotation.NonNull;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.wearable.Wearable;
import com.matejdro.wearutils.logging.LogRetrievalTask;
import com.matejdro.wearutils.preferences.legacy.CustomStoragePreferenceFragment;
import com.matejdro.wearutils.preferencesync.PreferencePusher;
import com.matejdro.wearvibrationcenter.R;
import com.matejdro.wearvibrationcenter.common.CommPaths;
import de.psdev.licensesdialog.LicensesDialog;
                        .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()) {
// Path: common/src/main/java/com/matejdro/wearvibrationcenter/common/CommPaths.java
// public interface CommPaths
// {
//     String PHONE_APP_CAPABILITY = "VibrationCenterPhone";
//     String WATCH_APP_CAPABILITY = "VibrationCenterWatch";
// 
//     String COMMAND_VIBRATE = "/Command/Vibrate";
//     String COMMAND_ALARM = "/Command/Alarm";
//     String COMMAND_APP_MUTE = "/Command/AppMute";
//     String COMMAND_TIMED_MUTE = "/Command/TimedMute";
//     String COMMAND_SEND_LOGS = "/Command/SendLogs";
// 
//     String COMMAND_RECEIVAL_ACKNOWLEDGMENT = "/Ack";
// 
//     String CHANNEL_LOGS = "/Channel/Logs";
// 
//     String LIST_ACTIVE_APPS_NAMES = "/List/ActiveApps/Names";
//     String LIST_ACTIVE_APPS_ICONS = "/List/ActiveApps/Icons";
// 
//     String ASSET_ICON = "Icon";
//     String ASSET_BACKGROUND = "Background";
// 
//     String PREFERENCES_PREFIX = "/Preferences";
// }


// Path: mobile/src/main/java/com/matejdro/wearvibrationcenter/ui/GlobalSettingsFragment.java
import android.Manifest;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Bundle;
import android.preference.Preference;
import androidx.annotation.NonNull;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.wearable.Wearable;
import com.matejdro.wearutils.logging.LogRetrievalTask;
import com.matejdro.wearutils.preferences.legacy.CustomStoragePreferenceFragment;
import com.matejdro.wearutils.preferencesync.PreferencePusher;
import com.matejdro.wearvibrationcenter.R;
import com.matejdro.wearvibrationcenter.common.CommPaths;
import de.psdev.licensesdialog.LicensesDialog;

                        .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);