// Path: QuickStart/app/src/main/java/com/magnet/samples/android/quickstart/helpers/Utils.java
// public class Utils {
//   public static AlertDialog showWarning(final Context context, final String title, final String message) {
//     AlertDialog dialog = new AlertDialog.Builder(context).setMessage(message)
//         .setTitle(title)
//         .setIcon(android.R.drawable.ic_dialog_alert)
//         .setPositiveButton("OK", new DialogInterface.OnClickListener() {
//           @Override public void onClick(DialogInterface dialog, int which) {
//             dialog.dismiss();
//           }
//         })
//         .create();
// 
//     dialog.show();
//     return dialog;
//   }
// }
// 
// Path: QuickStart/app/src/main/java/com/magnet/samples/android/quickstart/util/Logger.java
// public class Logger {
// 
//     private static final String APP_TAG = "QuickStart";
// 
//     public static void debug (Object... args) {
//         debug(null, args);
//     }
// 
//     private static String makeTag(String tag) {
//         String fullTag = APP_TAG;
//         if (tag != null) {
//             fullTag += " - " + tag;
//         }
//         return fullTag;
//     }
// 
//     private static String makeMessage(Object... args) {
//         String msg = "---------";
//         for (int i = 0; i < args.length - 1; i++) {
//             msg += args[i] + ", ";
//         }
//         if (args.length > 0) {
//             msg += args[args.length - 1];
//         }
//         return msg;
//     }
// 
//     public static void debug(String tag, Object... args) {
//         String fullTag = makeTag(tag);
//         String msg = makeMessage(args);
//         Log.d(fullTag, msg);
//     }
// 
//     public static void error (String tag, Throwable throwable, Object... args) {
//         String fullTag = makeTag(tag);
//         String msg = makeMessage(args);
//         Log.e(fullTag, msg, throwable);
//     }
// 
//     public static void error (String tag, Object... args) {
//         String fullTag = makeTag(tag);
//         String msg = makeMessage(args);
//         Log.e(fullTag, msg);
//     }
// 
//     public static void error (String tag, Throwable throwable) {
//         String fullTag = makeTag(tag);
//         Log.e(fullTag, "ERROR", throwable);
//     }
// 
// 
// }


import java.util.Map;
import android.os.Bundle;
import android.os.Handler;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.CheckBox;
import com.magnet.max.android.User;
import com.magnet.mmx.client.api.MMXPushMessage;
import com.magnet.mmx.protocol.PushResult;
import com.magnet.samples.android.quickstart.R;
import com.magnet.samples.android.quickstart.helpers.Utils;
import com.magnet.samples.android.quickstart.util.Logger;
import java.util.HashMap;
/*
 *  Copyright (c) 2016 Magnet Systems, Inc.
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *
 */

package com.magnet.samples.android.quickstart.activities;


/**
 * @see <a href="https://developer.magnet.com/docs/message/v2.1/android/set-up-gcm/index.html">Setup GCM</a>
 * @see <a href="https://developer.magnet.com/docs/message/v2.1/android/creating-a-push-message/index.html">Creating a Push Message</a>
 */
public class PushActivity extends BaseActivity {

    private CheckBox soundOn;

    private final Handler mHandler = new Handler();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_push);
        soundOn = (CheckBox) findViewById(R.id.pushSoundOn);
    }

    @Override
    public void onClick(View v) {

    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case R.id.chatMenuSend:
                String message = getFieldText(R.id.pushMessage);
                if (message != null) {
// Path: QuickStart/app/src/main/java/com/magnet/samples/android/quickstart/helpers/Utils.java
// public class Utils {
//   public static AlertDialog showWarning(final Context context, final String title, final String message) {
//     AlertDialog dialog = new AlertDialog.Builder(context).setMessage(message)
//         .setTitle(title)
//         .setIcon(android.R.drawable.ic_dialog_alert)
//         .setPositiveButton("OK", new DialogInterface.OnClickListener() {
//           @Override public void onClick(DialogInterface dialog, int which) {
//             dialog.dismiss();
//           }
//         })
//         .create();
// 
//     dialog.show();
//     return dialog;
//   }
// }
// 
// Path: QuickStart/app/src/main/java/com/magnet/samples/android/quickstart/util/Logger.java
// public class Logger {
// 
//     private static final String APP_TAG = "QuickStart";
// 
//     public static void debug (Object... args) {
//         debug(null, args);
//     }
// 
//     private static String makeTag(String tag) {
//         String fullTag = APP_TAG;
//         if (tag != null) {
//             fullTag += " - " + tag;
//         }
//         return fullTag;
//     }
// 
//     private static String makeMessage(Object... args) {
//         String msg = "---------";
//         for (int i = 0; i < args.length - 1; i++) {
//             msg += args[i] + ", ";
//         }
//         if (args.length > 0) {
//             msg += args[args.length - 1];
//         }
//         return msg;
//     }
// 
//     public static void debug(String tag, Object... args) {
//         String fullTag = makeTag(tag);
//         String msg = makeMessage(args);
//         Log.d(fullTag, msg);
//     }
// 
//     public static void error (String tag, Throwable throwable, Object... args) {
//         String fullTag = makeTag(tag);
//         String msg = makeMessage(args);
//         Log.e(fullTag, msg, throwable);
//     }
// 
//     public static void error (String tag, Object... args) {
//         String fullTag = makeTag(tag);
//         String msg = makeMessage(args);
//         Log.e(fullTag, msg);
//     }
// 
//     public static void error (String tag, Throwable throwable) {
//         String fullTag = makeTag(tag);
//         Log.e(fullTag, "ERROR", throwable);
//     }
// 
// 
// }


// Path: QuickStart/app/src/main/java/com/magnet/samples/android/quickstart/activities/PushActivity.java
import java.util.Map;
import android.os.Bundle;
import android.os.Handler;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.CheckBox;
import com.magnet.max.android.User;
import com.magnet.mmx.client.api.MMXPushMessage;
import com.magnet.mmx.protocol.PushResult;
import com.magnet.samples.android.quickstart.R;
import com.magnet.samples.android.quickstart.helpers.Utils;
import com.magnet.samples.android.quickstart.util.Logger;
import java.util.HashMap;

/*
 *  Copyright (c) 2016 Magnet Systems, Inc.
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *
 */

package com.magnet.samples.android.quickstart.activities;


/**
 * @see <a href="https://developer.magnet.com/docs/message/v2.1/android/set-up-gcm/index.html">Setup GCM</a>
 * @see <a href="https://developer.magnet.com/docs/message/v2.1/android/creating-a-push-message/index.html">Creating a Push Message</a>
 */
public class PushActivity extends BaseActivity {

    private CheckBox soundOn;

    private final Handler mHandler = new Handler();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_push);
        soundOn = (CheckBox) findViewById(R.id.pushSoundOn);
    }

    @Override
    public void onClick(View v) {

    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case R.id.chatMenuSend:
                String message = getFieldText(R.id.pushMessage);
                if (message != null) {
                    sendMessage(message, soundOn.isChecked());