Search in sources :

Example 26 with RefWatcher

use of com.squareup.leakcanary.RefWatcher in project chefly_android by chef-ly.

the class RegisterActivity method onDestroy.

@Override
protected void onDestroy() {
    //unregister to listen the data
    super.onDestroy();
    LocalBroadcastManager.getInstance(getApplicationContext()).unregisterReceiver(mBroadcastReceiver);
    if (BuildConfig.DEBUG) {
        RefWatcher refWatcher = CheflyApplication.getRefWatcher(this);
        refWatcher.watch(this);
    }
}
Also used : RefWatcher(com.squareup.leakcanary.RefWatcher)

Example 27 with RefWatcher

use of com.squareup.leakcanary.RefWatcher in project chefly_android by chef-ly.

the class GetCookingActivity method onDestroy.

//    @Override
//    public void onResume(){
//        super.onResume();
//
//        //TODO - resume voiceRec and TTS
//
//        // restart voice rec
//        if (voiceRec != null) {
//            voiceRec.startRec();
//        }
//
//    }
@Override
protected void onDestroy() {
    super.onDestroy();
    pager.clearOnPageChangeListeners();
    // calls cancel and shutdown on the recognizer
    voiceRec.killRec();
    voiceRec = null;
    textToSpeech.stop();
    textToSpeech.shutdown();
    speechListener = null;
    textToSpeech = null;
    // Unregister EventBus
    EventBus.getDefault().unregister(this);
    if (BuildConfig.DEBUG) {
        RefWatcher refWatcher = CheflyApplication.getRefWatcher(this);
        refWatcher.watch(this);
    }
}
Also used : RefWatcher(com.squareup.leakcanary.RefWatcher)

Example 28 with RefWatcher

use of com.squareup.leakcanary.RefWatcher in project chefly_android by chef-ly.

the class IntroActivity method onDestroy.

@Override
protected void onDestroy() {
    super.onDestroy();
    SharedPreferences.Editor sharedPreferencesEditor = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).edit();
    sharedPreferencesEditor.putBoolean("FirstTimeRun", true);
    sharedPreferencesEditor.apply();
    if (BuildConfig.DEBUG) {
        RefWatcher refWatcher = CheflyApplication.getRefWatcher(this);
        refWatcher.watch(this);
    }
}
Also used : SharedPreferences(android.content.SharedPreferences) RefWatcher(com.squareup.leakcanary.RefWatcher)

Example 29 with RefWatcher

use of com.squareup.leakcanary.RefWatcher in project chefly_android by chef-ly.

the class RecipeListActivity method onDestroy.

@Override
protected void onDestroy() {
    super.onDestroy();
    //  Update favorites list for user on server
    if (favListAdd.size() > 0 || favListRemove.size() > 0) {
        new AsyncTask<String, Integer, Integer>() {

            @Override
            protected Integer doInBackground(String... params) {
                GsonBuilder builder = new GsonBuilder();
                Gson gson = builder.create();
                Type type = new TypeToken<ArrayList<Integer>>() {
                }.getType();
                String bodyAdd = gson.toJson(favListAdd, type);
                String bodyRemove = gson.toJson(favListRemove, type);
                String token = CredentialsManager.getCredentials(getApplicationContext()).getAccessToken();
                if (token == null) {
                    token = "test";
                }
                Log.d(TAG, bodyAdd + " " + bodyRemove);
                RequestMethod rm = new RequestMethod();
                rm.setEndPoint(urlFavsString);
                rm.setMethod("POST");
                rm.setHeader("Authorization", "Bearer " + token);
                rm.setParam("add", bodyAdd);
                rm.setParam("remove", bodyRemove);
                try {
                    HttpConnection http = new HttpConnection();
                    http.downloadFromFeed(rm);
                } catch (IOException e) {
                    return 0;
                }
                return 200;
            }

            @Override
            protected void onPostExecute(Integer integer) {
                super.onPostExecute(integer);
            }
        }.execute();
    }
    if (BuildConfig.DEBUG) {
        RefWatcher refWatcher = CheflyApplication.getRefWatcher(this);
        refWatcher.watch(this);
    }
}
Also used : Type(java.lang.reflect.Type) GsonBuilder(com.google.gson.GsonBuilder) HttpConnection(com.se491.chef_ly.http.HttpConnection) TypeToken(com.google.gson.reflect.TypeToken) RequestMethod(com.se491.chef_ly.http.RequestMethod) Gson(com.google.gson.Gson) RefWatcher(com.squareup.leakcanary.RefWatcher) IOException(java.io.IOException)

Example 30 with RefWatcher

use of com.squareup.leakcanary.RefWatcher in project chefly_android by chef-ly.

the class MainActivity method onDestroy.

@Override
protected void onDestroy() {
    super.onDestroy();
    if (BuildConfig.DEBUG) {
        RefWatcher refWatcher = CheflyApplication.getRefWatcher(this);
        refWatcher.watch(this);
    }
}
Also used : RefWatcher(com.squareup.leakcanary.RefWatcher)

Aggregations

RefWatcher (com.squareup.leakcanary.RefWatcher)62 SharedPreferences (android.content.SharedPreferences)2 IOException (java.io.IOException)2 Manifest (android.Manifest)1 Application (android.app.Application)1 ContentProviderOperation (android.content.ContentProviderOperation)1 ContentUris (android.content.ContentUris)1 ContentValues (android.content.ContentValues)1 PackageManager (android.content.pm.PackageManager)1 Environment (android.os.Environment)1 StrictMode (android.os.StrictMode)1 MediaStore (android.provider.MediaStore)1 NonNull (android.support.annotation.NonNull)1 ContextCompat (android.support.v4.content.ContextCompat)1 PreferenceManager (android.support.v7.preference.PreferenceManager)1 TelephonyManager (android.telephony.TelephonyManager)1 TextUtils (android.text.TextUtils)1 Log (android.util.Log)1 Collectors (com.annimon.stream.Collectors)1 Stream (com.annimon.stream.Stream)1