// 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: common/src/main/java/com/matejdro/wearvibrationcenter/common/TimedMuteCommand.java
// public class TimedMuteCommand implements Parcelable {
//     private final int muteDurationMinutes;
// 
//     public TimedMuteCommand(int muteDurationMinutes) {
//         this.muteDurationMinutes = muteDurationMinutes;
//     }
// 
//     public int getMuteDurationMinutes() {
//         return muteDurationMinutes;
//     }
// 
// 
//     @Override
//     public int describeContents() {
//         return 0;
//     }
// 
//     @Override
//     public void writeToParcel(Parcel dest, int flags) {
//         dest.writeInt(this.muteDurationMinutes);
//     }
// 
//     protected TimedMuteCommand(Parcel in) {
//         this.muteDurationMinutes = in.readInt();
//     }
// 
//     public static final Parcelable.Creator<TimedMuteCommand> CREATOR = new Parcelable.Creator<TimedMuteCommand>() {
//         @Override
//         public TimedMuteCommand createFromParcel(Parcel source) {
//             return new TimedMuteCommand(source);
//         }
// 
//         @Override
//         public TimedMuteCommand[] newArray(int size) {
//             return new TimedMuteCommand[size];
//         }
//     };
// }
// 
// Path: common/src/main/java/com/matejdro/wearvibrationcenter/preferences/GlobalSettings.java
// public class GlobalSettings {
//     public static final PreferenceDefinition<Boolean> ENABLE_VIBRATIONS = new SimplePreferenceDefinition<>("enable_vibrations", true);
//     public static final PreferenceDefinition<Integer> ALARM_TIMEOUT = new SimplePreferenceDefinition<>("alarm_timeout", 60);
//     public static final PreferenceDefinition<List<String>> MUTE_INTERVALS = new SimplePreferenceDefinition<>("mute_intervals", Arrays.asList("10", "20", "30", "60", "120"));
//     public static final EnumPreferenceDefinition<ZenModeChange> TIMED_MUTE_ZEN_CHANGE = new EnumPreferenceDefinition<>("timed_mute_zen", ZenModeChange.ALARMS);
//     public static final PreferenceDefinition<Integer> PROCESSING_DELAY = new SimplePreferenceDefinition<>("processing_delay", 2000);
// 
// 
// }


import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.wearable.activity.ConfirmationActivity;
import android.support.wearable.view.DefaultOffsettingHelper;
import android.support.wearable.view.WearableRecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.wearable.MessageApi;
import com.google.android.gms.wearable.MessageEvent;
import com.google.android.gms.wearable.Wearable;
import com.matejdro.wearvibrationcenter.common.CommPaths;
import com.matejdro.wearvibrationcenter.common.TimedMuteCommand;
import com.matejdro.wearutils.messages.MessagingUtils;
import com.matejdro.wearutils.messages.ParcelPacker;
import com.matejdro.wearutils.messages.SingleMessageReceiver;
import com.matejdro.wearutils.preferences.definition.Preferences;
import com.matejdro.wearvibrationcenter.R;
import com.matejdro.wearvibrationcenter.preferences.GlobalSettings;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;

        new MuteExecutor(duration).execute((Void) null);
    }

    private class MuteExecutor extends AsyncTask<Void, Void, Boolean>
    {
        private final int muteDurationMinutes;

        public MuteExecutor(int muteDurationMinutes) {
            this.muteDurationMinutes = muteDurationMinutes;
        }

        @Override
        protected void onPreExecute() {
            progressBar.setVisibility(View.VISIBLE);
            recycler.setVisibility(View.GONE);
        }

        @Override
        protected Boolean doInBackground(Void... params) {
            GoogleApiClient googleApiClient = new GoogleApiClient.Builder(TimedMuteActivity.this)
                    .addApi(Wearable.API)
                    .build();

            googleApiClient.blockingConnect();

            SingleMessageReceiver ackReceiver = new SingleMessageReceiver(googleApiClient,
                    Uri.parse("wear://*" + CommPaths.COMMAND_RECEIVAL_ACKNOWLEDGMENT),
                    MessageApi.FILTER_LITERAL);

// 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: common/src/main/java/com/matejdro/wearvibrationcenter/common/TimedMuteCommand.java
// public class TimedMuteCommand implements Parcelable {
//     private final int muteDurationMinutes;
// 
//     public TimedMuteCommand(int muteDurationMinutes) {
//         this.muteDurationMinutes = muteDurationMinutes;
//     }
// 
//     public int getMuteDurationMinutes() {
//         return muteDurationMinutes;
//     }
// 
// 
//     @Override
//     public int describeContents() {
//         return 0;
//     }
// 
//     @Override
//     public void writeToParcel(Parcel dest, int flags) {
//         dest.writeInt(this.muteDurationMinutes);
//     }
// 
//     protected TimedMuteCommand(Parcel in) {
//         this.muteDurationMinutes = in.readInt();
//     }
// 
//     public static final Parcelable.Creator<TimedMuteCommand> CREATOR = new Parcelable.Creator<TimedMuteCommand>() {
//         @Override
//         public TimedMuteCommand createFromParcel(Parcel source) {
//             return new TimedMuteCommand(source);
//         }
// 
//         @Override
//         public TimedMuteCommand[] newArray(int size) {
//             return new TimedMuteCommand[size];
//         }
//     };
// }
// 
// Path: common/src/main/java/com/matejdro/wearvibrationcenter/preferences/GlobalSettings.java
// public class GlobalSettings {
//     public static final PreferenceDefinition<Boolean> ENABLE_VIBRATIONS = new SimplePreferenceDefinition<>("enable_vibrations", true);
//     public static final PreferenceDefinition<Integer> ALARM_TIMEOUT = new SimplePreferenceDefinition<>("alarm_timeout", 60);
//     public static final PreferenceDefinition<List<String>> MUTE_INTERVALS = new SimplePreferenceDefinition<>("mute_intervals", Arrays.asList("10", "20", "30", "60", "120"));
//     public static final EnumPreferenceDefinition<ZenModeChange> TIMED_MUTE_ZEN_CHANGE = new EnumPreferenceDefinition<>("timed_mute_zen", ZenModeChange.ALARMS);
//     public static final PreferenceDefinition<Integer> PROCESSING_DELAY = new SimplePreferenceDefinition<>("processing_delay", 2000);
// 
// 
// }


// Path: wear/src/main/java/com/matejdro/wearvibrationcenter/mutepicker/TimedMuteActivity.java
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.wearable.activity.ConfirmationActivity;
import android.support.wearable.view.DefaultOffsettingHelper;
import android.support.wearable.view.WearableRecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.wearable.MessageApi;
import com.google.android.gms.wearable.MessageEvent;
import com.google.android.gms.wearable.Wearable;
import com.matejdro.wearvibrationcenter.common.CommPaths;
import com.matejdro.wearvibrationcenter.common.TimedMuteCommand;
import com.matejdro.wearutils.messages.MessagingUtils;
import com.matejdro.wearutils.messages.ParcelPacker;
import com.matejdro.wearutils.messages.SingleMessageReceiver;
import com.matejdro.wearutils.preferences.definition.Preferences;
import com.matejdro.wearvibrationcenter.R;
import com.matejdro.wearvibrationcenter.preferences.GlobalSettings;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;


        new MuteExecutor(duration).execute((Void) null);
    }

    private class MuteExecutor extends AsyncTask<Void, Void, Boolean>
    {
        private final int muteDurationMinutes;

        public MuteExecutor(int muteDurationMinutes) {
            this.muteDurationMinutes = muteDurationMinutes;
        }

        @Override
        protected void onPreExecute() {
            progressBar.setVisibility(View.VISIBLE);
            recycler.setVisibility(View.GONE);
        }

        @Override
        protected Boolean doInBackground(Void... params) {
            GoogleApiClient googleApiClient = new GoogleApiClient.Builder(TimedMuteActivity.this)
                    .addApi(Wearable.API)
                    .build();

            googleApiClient.blockingConnect();

            SingleMessageReceiver ackReceiver = new SingleMessageReceiver(googleApiClient,
                    Uri.parse("wear://*" + CommPaths.COMMAND_RECEIVAL_ACKNOWLEDGMENT),
                    MessageApi.FILTER_LITERAL);

            TimedMuteCommand command = new TimedMuteCommand(muteDurationMinutes);