minimal changes for crash-fix release

* Unsubscribe all topics, not just one
* Use English when language not available to avoid NPE
* Use the same androidx component as everywhere else
This commit is contained in:
Eric House 2022-08-22 09:19:09 -07:00
parent 12511755a8
commit b93a9202e7
3 changed files with 9 additions and 5 deletions

View file

@ -54,6 +54,9 @@ public class DictListPreference extends XWListPreference {
curLang = LocUtils.getString( context, R.string.lang_name_english );
}
ISOCode isoCode = DictLangCache.getLangIsoCode( context, curLang );
if ( null == isoCode ) { // work around crash reported via Play Store
isoCode = Utils.ISO_EN;
}
DictUtils.DictAndLoc[] dals = DictUtils.dictList( context );
ArrayList<String> dictEntries = new ArrayList<>();

View file

@ -1,7 +1,7 @@
/* -*- compile-command: "find-and-gradle.sh inXw4dDeb"; -*- */
/*
* Copyright 2009 - 2020 by Eric House (xwords@eehouse.org). All
* rights reserved.
* Copyright 2009 - 2022 by Eric House (xwords@eehouse.org). All rights
* reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@ -23,6 +23,7 @@ package org.eehouse.android.xw4;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.text.TextUtils;
import org.eclipse.paho.client.mqttv3.IMqttActionListener;
import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken;
@ -472,7 +473,7 @@ public class MQTTUtils extends Thread
switch ( ii ) {
case 0:
action = "unsubscribe";
token = client.unsubscribe( mDevID );
token = client.unsubscribe( mTopics );
break; // not continue, which skips the Log() below
case 1:
action = "disconnect";
@ -617,7 +618,7 @@ public class MQTTUtils extends Thread
setState( State.SUBSCRIBING );
try {
mClient.subscribe( mTopics, qoss, null, this );
// Log.d( TAG, "subscribed to %s", mTopic );
// Log.d( TAG, "subscribed to %s", TextUtils.join( ", ", mTopics ) );
} catch ( MqttException ex ) {
ex.printStackTrace();
} catch ( Exception ex ) {

View file

@ -26,7 +26,7 @@ import android.content.res.Configuration;
import android.content.res.Resources;
import android.net.Uri;
import android.os.Build;
import android.preference.PreferenceManager;
import androidx.preference.PreferenceManager;
import org.eehouse.android.xw4.Assert;
import org.eehouse.android.xw4.DictUtils;