// Path: app/src/main/java/com/adkdevelopment/earthquakesurvival/App.java
// public class App extends Application {
// 
//     private static ApiManager sApiManager, sNewsManager;
//     private static Context sContext;
// 
//     // event bus from RxJava
//     private static RxBus _rxBus;
// 
//     // Singleton Retrofit for Earthquakes
//     public static ApiManager getApiManager() {
//         if (sApiManager == null) {
//             try {
//                 sApiManager = new ApiManager();
//             } catch (Exception e) {
//                 e.printStackTrace();
//             }
//         }
//         return sApiManager;
//     }
// 
//     // Singleton Retrofit for News
//     public static ApiManager getNewsManager() {
//         if (sNewsManager == null) {
//             try {
//                 sNewsManager = new ApiManager();
//             } catch (Exception e) {
//                 e.printStackTrace();
//             }
//         }
//         return sNewsManager;
//     }
// 
//     // singleton RxBus
//     public static RxBus getRxBusSingleton() {
//         if (_rxBus == null) {
//             _rxBus = new RxBus();
//         }
//         return _rxBus;
//     }
// 
//     @Override
//     public void onCreate() {
//         super.onCreate();
// 
//         if (!BuildConfig.DEBUG) {
//             Fabric.with(this, new Crashlytics());
//         }
// 
//         sContext = getApplicationContext();
//     }
// 
//     public static Context getContext() {
//         return sContext;
//     }
// }


import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import com.adkdevelopment.earthquakesurvival.App;
import com.adkdevelopment.earthquakesurvival.R;
import butterknife.ButterKnife;
import butterknife.Unbinder;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import android.os.Bundle;
import android.support.design.widget.Snackbar;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
/*
 * MIT License
 *
 * Copyright (c) 2016. Dmytro Karataiev
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 *
 */

package com.adkdevelopment.earthquakesurvival.ui.report_earthquake;




/**
 * A fragment reporting an earthquake to the USGS.
 */
public class ReportFragment extends Fragment {

    private static final String TAG = ReportFragment.class.getSimpleName();

    private Unbinder mUnbinder;

    public ReportFragment() {
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View rootView = inflater.inflate(R.layout.fragment_report, container, false);

        mUnbinder = ButterKnife.bind(this, rootView);

        // to inflate menu in this fragment
        setHasOptionsMenu(true);

        return rootView;
    }

    @Override
    public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
        super.onCreateOptionsMenu(menu, inflater);
        inflater.inflate(R.menu.menu_report, menu);
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {

        switch (item.getItemId()) {
            case R.id.action_send:
                sendReport();
                return true;
        }

        return super.onOptionsItemSelected(item);
    }

    /**
     * Sends a report to the USGS about an earthquake.
     */
    public void sendReport() {
// Path: app/src/main/java/com/adkdevelopment/earthquakesurvival/App.java
// public class App extends Application {
// 
//     private static ApiManager sApiManager, sNewsManager;
//     private static Context sContext;
// 
//     // event bus from RxJava
//     private static RxBus _rxBus;
// 
//     // Singleton Retrofit for Earthquakes
//     public static ApiManager getApiManager() {
//         if (sApiManager == null) {
//             try {
//                 sApiManager = new ApiManager();
//             } catch (Exception e) {
//                 e.printStackTrace();
//             }
//         }
//         return sApiManager;
//     }
// 
//     // Singleton Retrofit for News
//     public static ApiManager getNewsManager() {
//         if (sNewsManager == null) {
//             try {
//                 sNewsManager = new ApiManager();
//             } catch (Exception e) {
//                 e.printStackTrace();
//             }
//         }
//         return sNewsManager;
//     }
// 
//     // singleton RxBus
//     public static RxBus getRxBusSingleton() {
//         if (_rxBus == null) {
//             _rxBus = new RxBus();
//         }
//         return _rxBus;
//     }
// 
//     @Override
//     public void onCreate() {
//         super.onCreate();
// 
//         if (!BuildConfig.DEBUG) {
//             Fabric.with(this, new Crashlytics());
//         }
// 
//         sContext = getApplicationContext();
//     }
// 
//     public static Context getContext() {
//         return sContext;
//     }
// }


// Path: app/src/main/java/com/adkdevelopment/earthquakesurvival/ui/report_earthquake/ReportFragment.java
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import com.adkdevelopment.earthquakesurvival.App;
import com.adkdevelopment.earthquakesurvival.R;
import butterknife.ButterKnife;
import butterknife.Unbinder;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import android.os.Bundle;
import android.support.design.widget.Snackbar;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;

/*
 * MIT License
 *
 * Copyright (c) 2016. Dmytro Karataiev
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 *
 */

package com.adkdevelopment.earthquakesurvival.ui.report_earthquake;




/**
 * A fragment reporting an earthquake to the USGS.
 */
public class ReportFragment extends Fragment {

    private static final String TAG = ReportFragment.class.getSimpleName();

    private Unbinder mUnbinder;

    public ReportFragment() {
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View rootView = inflater.inflate(R.layout.fragment_report, container, false);

        mUnbinder = ButterKnife.bind(this, rootView);

        // to inflate menu in this fragment
        setHasOptionsMenu(true);

        return rootView;
    }

    @Override
    public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
        super.onCreateOptionsMenu(menu, inflater);
        inflater.inflate(R.menu.menu_report, menu);
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {

        switch (item.getItemId()) {
            case R.id.action_send:
                sendReport();
                return true;
        }

        return super.onOptionsItemSelected(item);
    }

    /**
     * Sends a report to the USGS about an earthquake.
     */
    public void sendReport() {
        App.getApiManager().getEarthquakeService()