Keep Volley from leaking requests between activities and add a forgotten license notice.

This commit is contained in:
Vavassor 2017-03-01 00:43:46 -05:00
parent 054ab8fb1c
commit 1cbd7eecc7
2 changed files with 23 additions and 2 deletions

View file

@ -49,7 +49,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
public class ReportActivity extends BaseActivity { public class ReportActivity extends BaseActivity {
private static final String TAG = "ReportActivity"; // Volley request tag private static final String TAG = "ReportActivity"; // logging tag and Volley request tag
private String domain; private String domain;
private String accessToken; private String accessToken;
@ -117,8 +117,14 @@ public class ReportActivity extends BaseActivity {
fetchRecentStatuses(accountId); fetchRecentStatuses(accountId);
} }
@Override
protected void onDestroy() {
VolleySingleton.getInstance(this).cancelAll(TAG);
super.onDestroy();
}
/* JSONArray has a constructor to take primitive arrays but it's restricted to API level 19 and /* JSONArray has a constructor to take primitive arrays but it's restricted to API level 19 and
* above, so this is an alternative. */ * above, so this is an alternative. */
private static JSONArray makeStringArrayCompat(String[] stringArray) throws JSONException { private static JSONArray makeStringArrayCompat(String[] stringArray) throws JSONException {
JSONArray result = new JSONArray(); JSONArray result = new JSONArray();
for (int i = 0; i < stringArray.length; i++) { for (int i = 0; i < stringArray.length; i++) {

View file

@ -1,3 +1,18 @@
/* Copyright 2017 Andrew Dawson
*
* This file is part of Tusky.
*
* Tusky is free software: you can redistribute it and/or modify it under the terms of the GNU
* General Public License as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* Tusky is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details.
*
* You should have received a copy of the GNU General Public License along with Tusky. If not, see
* <http://www.gnu.org/licenses/>. */
package com.keylesspalace.tusky; package com.keylesspalace.tusky;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;