diff options
author | Daniel Lublin <daniel@lublin.se> | 2022-03-04 12:02:29 +0300 |
---|---|---|
committer | Daniel Lublin <daniel@lublin.se> | 2022-03-04 12:02:29 +0300 |
commit | 8b36dbecd23300e8cd938d4d69f7c1d5397b3776 (patch) | |
tree | 6463194471ff4d2ca9ad032f77290d022ed4068e | |
parent | 62c4e22a0283565e2a15fdfd098adae2472ce07c (diff) |
Use in-class TAG constant for logging
15 files changed, 43 insertions, 54 deletions
diff --git a/app/src/main/java/se/lublin/mumla/Constants.java b/app/src/main/java/se/lublin/mumla/Constants.java deleted file mode 100644 index db44d18..0000000 --- a/app/src/main/java/se/lublin/mumla/Constants.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (C) 2014 Andrew Comminos - * - * This program 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. - * - * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package se.lublin.mumla; - -public class Constants { - public static final String TAG = "Mumla"; -} diff --git a/app/src/main/java/se/lublin/mumla/Settings.java b/app/src/main/java/se/lublin/mumla/Settings.java index 622e71c..c56f3b5 100644 --- a/app/src/main/java/se/lublin/mumla/Settings.java +++ b/app/src/main/java/se/lublin/mumla/Settings.java @@ -43,13 +43,14 @@ import se.lublin.humla.Constants; import se.lublin.mumla.db.DatabaseCertificate; import se.lublin.mumla.db.MumlaSQLiteDatabase; -import static se.lublin.mumla.Constants.TAG; - /** * Singleton settings class for universal access to the app's preferences. + * * @author morlunk */ public class Settings { + private static final String TAG = Settings.class.getName(); + public static final String PREF_INPUT_METHOD = "audioInputMethod"; public static final Set<String> ARRAY_INPUT_METHODS; /** Voice activity transmits depending on the amplitude of user input. */ diff --git a/app/src/main/java/se/lublin/mumla/app/MumlaActivity.java b/app/src/main/java/se/lublin/mumla/app/MumlaActivity.java index 241f211..f566b29 100644 --- a/app/src/main/java/se/lublin/mumla/app/MumlaActivity.java +++ b/app/src/main/java/se/lublin/mumla/app/MumlaActivity.java @@ -101,12 +101,12 @@ import se.lublin.mumla.util.HumlaServiceFragment; import se.lublin.mumla.util.HumlaServiceProvider; import se.lublin.mumla.util.MumlaTrustStore; -import static se.lublin.mumla.Constants.TAG; - public class MumlaActivity extends AppCompatActivity implements ListView.OnItemClickListener, FavouriteServerListFragment.ServerConnectHandler, HumlaServiceProvider, DatabaseProvider, SharedPreferences.OnSharedPreferenceChangeListener, DrawerAdapter.DrawerDataProvider, ServerEditFragment.ServerEditListener { + private static final String TAG = MumlaActivity.class.getName(); + /** * If specified, the provided integer drawer fragment ID is shown when the activity is created. */ diff --git a/app/src/main/java/se/lublin/mumla/channel/AccessTokenFragment.java b/app/src/main/java/se/lublin/mumla/channel/AccessTokenFragment.java index 09da207..7cf902c 100644 --- a/app/src/main/java/se/lublin/mumla/channel/AccessTokenFragment.java +++ b/app/src/main/java/se/lublin/mumla/channel/AccessTokenFragment.java @@ -37,15 +37,16 @@ import android.widget.TextView.OnEditorActionListener; import java.util.ArrayList; import java.util.List; -import se.lublin.mumla.Constants; import se.lublin.mumla.R; import se.lublin.mumla.db.DatabaseProvider; import se.lublin.mumla.util.HumlaServiceFragment; public class AccessTokenFragment extends HumlaServiceFragment { + private static final String TAG = AccessTokenFragment.class.getName(); public interface AccessTokenListener { public void onAccessTokenAdded(long serverId, String token); + public void onAccessTokenRemoved(long serverId, String token); } @@ -112,7 +113,7 @@ public class AccessTokenFragment extends HumlaServiceFragment { mTokenField.setText(""); - Log.i(Constants.TAG, "Adding token: " + tokenText); + Log.i(TAG, "Adding token: " + tokenText); mTokens.add(tokenText); mTokenAdapter.notifyDataSetChanged(); diff --git a/app/src/main/java/se/lublin/mumla/channel/ChannelChatFragment.java b/app/src/main/java/se/lublin/mumla/channel/ChannelChatFragment.java index e42a464..e79d041 100644 --- a/app/src/main/java/se/lublin/mumla/channel/ChannelChatFragment.java +++ b/app/src/main/java/se/lublin/mumla/channel/ChannelChatFragment.java @@ -59,13 +59,14 @@ import se.lublin.humla.model.User; import se.lublin.humla.util.HumlaDisconnectedException; import se.lublin.humla.util.HumlaObserver; import se.lublin.humla.util.IHumlaObserver; -import se.lublin.mumla.Constants; import se.lublin.mumla.R; import se.lublin.mumla.service.IChatMessage; import se.lublin.mumla.util.HumlaServiceFragment; import se.lublin.mumla.util.MumbleImageGetter; public class ChannelChatFragment extends HumlaServiceFragment implements ChatTargetProvider.OnChatTargetSelectedListener { + private static final String TAG = ChannelChatFragment.class.getName(); + private static final Pattern LINK_PATTERN = Pattern.compile("(https?://\\S+)"); private IHumlaObserver mServiceObserver = new HumlaObserver() { @@ -153,7 +154,7 @@ public class ChannelChatFragment extends HumlaServiceFragment implements ChatTar try { sendMessage(); } catch (HumlaDisconnectedException e) { - Log.d(Constants.TAG, "ChannelChatFragment, exception from sendMessage: " + e); + Log.d(TAG, "exception from sendMessage: " + e); } } }); @@ -164,7 +165,7 @@ public class ChannelChatFragment extends HumlaServiceFragment implements ChatTar try { sendMessage(); } catch (HumlaDisconnectedException e) { - Log.d(Constants.TAG, "ChannelChatFragment, exception from sendMessage: " + e); + Log.d(TAG, "exception from sendMessage: " + e); } return true; } diff --git a/app/src/main/java/se/lublin/mumla/channel/ChannelFragment.java b/app/src/main/java/se/lublin/mumla/channel/ChannelFragment.java index 2c31d69..a382e04 100644 --- a/app/src/main/java/se/lublin/mumla/channel/ChannelFragment.java +++ b/app/src/main/java/se/lublin/mumla/channel/ChannelFragment.java @@ -52,7 +52,6 @@ import se.lublin.humla.model.WhisperTarget; import se.lublin.humla.util.HumlaObserver; import se.lublin.humla.util.IHumlaObserver; import se.lublin.humla.util.VoiceTargetMode; -import se.lublin.mumla.Constants; import se.lublin.mumla.R; import se.lublin.mumla.Settings; import se.lublin.mumla.util.HumlaServiceFragment; @@ -62,6 +61,7 @@ import se.lublin.mumla.util.HumlaServiceFragment; * Created by andrew on 02/08/13. */ public class ChannelFragment extends HumlaServiceFragment implements SharedPreferences.OnSharedPreferenceChangeListener, ChatTargetProvider { + private static final String TAG = ChannelFragment.class.getName(); private ViewPager mViewPager; private PagerTabStrip mTabStrip; @@ -89,7 +89,7 @@ public class ChannelFragment extends HumlaServiceFragment implements SharedPrefe try { selfSession = getService().HumlaSession().getSessionId(); } catch (IllegalStateException e) { - Log.d(Constants.TAG, "ChannelFragment, exception in onUserTalkStateUpdated: " + e); + Log.d(TAG, "exception in onUserTalkStateUpdated: " + e); return; } if (user != null && user.getSession() == selfSession) { @@ -117,7 +117,7 @@ public class ChannelFragment extends HumlaServiceFragment implements SharedPrefe try { selfSession = getService().HumlaSession().getSessionId(); } catch (IllegalStateException e) { - Log.d(Constants.TAG, "ChannelFragment, exception in onUserStateUpdated: " + e); + Log.d(TAG, "exception in onUserStateUpdated: " + e); return; } if (user != null && user.getSession() == selfSession) { diff --git a/app/src/main/java/se/lublin/mumla/channel/ChannelListAdapter.java b/app/src/main/java/se/lublin/mumla/channel/ChannelListAdapter.java index 1628556..ea93b4a 100644 --- a/app/src/main/java/se/lublin/mumla/channel/ChannelListAdapter.java +++ b/app/src/main/java/se/lublin/mumla/channel/ChannelListAdapter.java @@ -49,7 +49,6 @@ import se.lublin.humla.model.IChannel; import se.lublin.humla.model.IUser; import se.lublin.humla.model.Server; import se.lublin.humla.model.TalkState; -import se.lublin.mumla.Constants; import se.lublin.mumla.R; import se.lublin.mumla.db.MumlaDatabase; import se.lublin.mumla.drawable.CircleDrawable; @@ -59,6 +58,8 @@ import se.lublin.mumla.service.MumlaService; * Created by andrew on 31/07/13. */ public class ChannelListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> implements UserMenu.IUserLocalStateListener { + private static final String TAG = ChannelListAdapter.class.getName(); + // Set particular bits to make the integer-based model item ids unique. public static final long CHANNEL_ID_MASK = (0x1L << 32); public static final long USER_ID_MASK = (0x1L << 33); @@ -155,7 +156,7 @@ public class ChannelListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo try { ourChan = session.getSessionChannel(); } catch(IllegalStateException e) { - Log.d(Constants.TAG, "ChannelListAdapter, exception in onBindViewHolder: " + e); + Log.d(TAG, "exception in onBindViewHolder: " + e); } if (ourChan != null) { if (channel.equals(ourChan)) { @@ -308,7 +309,7 @@ public class ChannelListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo } } } catch (IllegalStateException e) { - Log.d(Constants.TAG, "ChannelListAdapter, exception in updateChannels: " + e); + Log.d(TAG, "exception in updateChannels: " + e); } } diff --git a/app/src/main/java/se/lublin/mumla/channel/ChannelMenu.java b/app/src/main/java/se/lublin/mumla/channel/ChannelMenu.java index 72d8914..2447755 100644 --- a/app/src/main/java/se/lublin/mumla/channel/ChannelMenu.java +++ b/app/src/main/java/se/lublin/mumla/channel/ChannelMenu.java @@ -41,7 +41,6 @@ import se.lublin.humla.model.Server; import se.lublin.humla.model.WhisperTargetChannel; import se.lublin.humla.net.Permissions; import se.lublin.humla.util.VoiceTargetMode; -import se.lublin.mumla.Constants; import se.lublin.mumla.R; import se.lublin.mumla.channel.comment.ChannelDescriptionFragment; import se.lublin.mumla.db.MumlaDatabase; @@ -50,6 +49,8 @@ import se.lublin.mumla.db.MumlaDatabase; * Created by andrew on 22/11/15. */ public class ChannelMenu implements PermissionsPopupMenu.IOnMenuPrepareListener, PopupMenu.OnMenuItemClickListener { + private static final String TAG = ChannelMenu.class.getName(); + private final Context mContext; private final IChannel mChannel; private final IHumlaService mService; @@ -85,7 +86,7 @@ public class ChannelMenu implements PermissionsPopupMenu.IOnMenuPrepareListener, try { ourChan = mService.HumlaSession().getSessionChannel(); } catch(IllegalStateException e) { - Log.d(Constants.TAG, "ChannelMenu, exception in onMenuPrepare: " + e); + Log.d(TAG, "exception in onMenuPrepare: " + e); } if (ourChan != null) { menu.findItem(R.id.context_channel_link).setChecked(mChannel.getLinks().contains(ourChan)); diff --git a/app/src/main/java/se/lublin/mumla/channel/ChannelSearchProvider.java b/app/src/main/java/se/lublin/mumla/channel/ChannelSearchProvider.java index 60b9a5b..a985fce 100644 --- a/app/src/main/java/se/lublin/mumla/channel/ChannelSearchProvider.java +++ b/app/src/main/java/se/lublin/mumla/channel/ChannelSearchProvider.java @@ -37,11 +37,11 @@ import se.lublin.humla.IHumlaService; import se.lublin.humla.IHumlaSession; import se.lublin.humla.model.IChannel; import se.lublin.humla.model.IUser; -import se.lublin.mumla.Constants; import se.lublin.mumla.R; import se.lublin.mumla.service.MumlaService; public class ChannelSearchProvider extends ContentProvider { + private static final String TAG = ChannelSearchProvider.class.getName(); public static final String INTENT_DATA_CHANNEL = "channel"; public static final String INTENT_DATA_USER = "user"; @@ -105,7 +105,7 @@ public class ChannelSearchProvider extends ContentProvider { } if(mService == null) { - Log.v(Constants.TAG, "Failed to connect to service from search provider!"); + Log.v(TAG, "Failed to connect to service from search provider!"); return null; } } diff --git a/app/src/main/java/se/lublin/mumla/channel/UserMenu.java b/app/src/main/java/se/lublin/mumla/channel/UserMenu.java index ca2c87a..b87a82a 100644 --- a/app/src/main/java/se/lublin/mumla/channel/UserMenu.java +++ b/app/src/main/java/se/lublin/mumla/channel/UserMenu.java @@ -36,7 +36,6 @@ import java.util.List; import se.lublin.humla.model.IChannel; import se.lublin.humla.model.IUser; import se.lublin.humla.net.Permissions; -import se.lublin.mumla.Constants; import se.lublin.mumla.R; import se.lublin.mumla.channel.comment.UserCommentFragment; import se.lublin.mumla.service.MumlaService; @@ -46,6 +45,8 @@ import se.lublin.mumla.util.ModelUtils; * Created by andrew on 19/11/15. */ public class UserMenu implements PermissionsPopupMenu.IOnMenuPrepareListener, PopupMenu.OnMenuItemClickListener { + private static final String TAG = UserMenu.class.getName(); + private final Context mContext; private final IUser mUser; private final MumlaService mService; @@ -68,7 +69,7 @@ public class UserMenu implements PermissionsPopupMenu.IOnMenuPrepareListener, Po try { self = mUser.getSession() == mService.getSessionId(); } catch (IllegalStateException e) { - Log.d(Constants.TAG, "UserMenu, exception in onMenuPrepare: " + e); + Log.d(TAG, "exception in onMenuPrepare: " + e); return; } int perms = mService.getPermissions(); diff --git a/app/src/main/java/se/lublin/mumla/db/MumlaSQLiteDatabase.java b/app/src/main/java/se/lublin/mumla/db/MumlaSQLiteDatabase.java index 8453023..4826333 100644 --- a/app/src/main/java/se/lublin/mumla/db/MumlaSQLiteDatabase.java +++ b/app/src/main/java/se/lublin/mumla/db/MumlaSQLiteDatabase.java @@ -28,9 +28,10 @@ import java.util.ArrayList; import java.util.List; import se.lublin.humla.model.Server; -import se.lublin.mumla.Constants; public class MumlaSQLiteDatabase extends SQLiteOpenHelper implements MumlaDatabase { + private static final String TAG = MumlaSQLiteDatabase.class.getName(); + public static final String DATABASE_NAME = "mumble.db"; public static final String TABLE_SERVER = "server"; @@ -139,7 +140,7 @@ public class MumlaSQLiteDatabase extends SQLiteOpenHelper implements MumlaDataba SQLiteDatabase db, int oldVersion, int newVersion) { - Log.w(Constants.TAG, "Database upgrade from " + oldVersion + " to " + newVersion); + Log.w(TAG, "Database upgrade from " + oldVersion + " to " + newVersion); if (oldVersion <= PRE_FAVOURITES_DB_VERSION) { db.execSQL(TABLE_FAVOURITES_CREATE_SQL); } diff --git a/app/src/main/java/se/lublin/mumla/preference/CertificateExportActivity.java b/app/src/main/java/se/lublin/mumla/preference/CertificateExportActivity.java index 5446e79..cfc0f34 100644 --- a/app/src/main/java/se/lublin/mumla/preference/CertificateExportActivity.java +++ b/app/src/main/java/se/lublin/mumla/preference/CertificateExportActivity.java @@ -46,7 +46,6 @@ import java.io.IOException; import java.io.OutputStream; import java.util.List; -import se.lublin.mumla.Constants; import se.lublin.mumla.R; import se.lublin.mumla.db.DatabaseCertificate; import se.lublin.mumla.db.MumlaDatabase; @@ -56,6 +55,8 @@ import se.lublin.mumla.db.MumlaSQLiteDatabase; * Created by andrew on 12/01/16. */ public class CertificateExportActivity extends AppCompatActivity implements DialogInterface.OnClickListener { + private static final String TAG = CertificateExportActivity.class.getName(); + /** * The name of the directory to export to on external storage. */ @@ -118,10 +119,10 @@ public class CertificateExportActivity extends AppCompatActivity implements Dial writeCertificate(os, mCertificatePending, df != null ? df.getName() : "<unknown>"); } catch (FileNotFoundException e) { showErrorDialog(R.string.externalStorageUnavailable); - Log.w(Constants.TAG, "FileNotFound on output file picked by user?!"); + Log.w(TAG, "FileNotFound on output file picked by user?!"); } } else if (mCertificatePending == null) { - Log.w(Constants.TAG, "No pending certificate after user picked output file"); + Log.w(TAG, "No pending certificate after user picked output file"); } finish(); } @@ -168,7 +169,7 @@ public class CertificateExportActivity extends AppCompatActivity implements Dial if (mCertificatePending != null) { saveCertificateClassic(mCertificatePending); } else { - Log.w(Constants.TAG, "No pending certificate after permission was granted"); + Log.w(TAG, "No pending certificate after permission was granted"); } } else { Toast.makeText(CertificateExportActivity.this, getString(R.string.grant_perm_storage), diff --git a/app/src/main/java/se/lublin/mumla/servers/ServerInfoTask.java b/app/src/main/java/se/lublin/mumla/servers/ServerInfoTask.java index 80cccb9..9ea0c76 100644 --- a/app/src/main/java/se/lublin/mumla/servers/ServerInfoTask.java +++ b/app/src/main/java/se/lublin/mumla/servers/ServerInfoTask.java @@ -26,7 +26,6 @@ import java.net.InetAddress; import java.nio.ByteBuffer; import se.lublin.humla.model.Server; -import se.lublin.mumla.Constants; /** * Pings the requested server and returns a ServerInfoResponse. @@ -35,6 +34,8 @@ import se.lublin.mumla.Constants; * */ public class ServerInfoTask extends AsyncTask<Server, Void, ServerInfoResponse> { + private static final String TAG = ServerInfoTask.class.getName(); + private Server server; @Override @@ -65,7 +66,7 @@ public class ServerInfoTask extends AsyncTask<Server, Void, ServerInfoResponse> ServerInfoResponse response = new ServerInfoResponse(server, responseBuffer, latencyInMs); - Log.d(Constants.TAG, "Server version: " + response.getVersionString() + Log.d(TAG, "Server version: " + response.getVersionString() + " Users: " + response.getCurrentUsers() + "/" + response.getMaximumUsers()); return response; diff --git a/app/src/main/java/se/lublin/mumla/service/MumlaService.java b/app/src/main/java/se/lublin/mumla/service/MumlaService.java index dd3f24b..a700d16 100644 --- a/app/src/main/java/se/lublin/mumla/service/MumlaService.java +++ b/app/src/main/java/se/lublin/mumla/service/MumlaService.java @@ -62,6 +62,8 @@ public class MumlaService extends HumlaService implements SharedPreferences.OnSharedPreferenceChangeListener, MumlaConnectionNotification.OnActionListener, MumlaReconnectNotification.OnActionListener, IMumlaService { + private static final String TAG = MumlaService.class.getName(); + /** Undocumented constant that permits a proximity-sensing wake lock. */ public static final int PROXIMITY_SCREEN_OFF_WAKE_LOCK = 32; public static final int TTS_THRESHOLD = 250; // Maximum number of characters to read @@ -345,7 +347,7 @@ public class MumlaService extends HumlaService implements try { super.onConnectionSynchronized(); } catch (RuntimeException e) { - Log.d(Constants.TAG, "HumlaService, exception in onConnectionSynchronized: " + e); + Log.d(TAG, "exception in onConnectionSynchronized: " + e); return; } diff --git a/app/src/main/java/se/lublin/mumla/util/MumbleImageGetter.java b/app/src/main/java/se/lublin/mumla/util/MumbleImageGetter.java index 7187b35..bff8e58 100644 --- a/app/src/main/java/se/lublin/mumla/util/MumbleImageGetter.java +++ b/app/src/main/java/se/lublin/mumla/util/MumbleImageGetter.java @@ -37,7 +37,6 @@ import java.net.URLDecoder; import java.util.HashMap; import java.util.Map; -import se.lublin.mumla.Constants; import se.lublin.mumla.Settings; /** @@ -46,6 +45,7 @@ import se.lublin.mumla.Settings; * Created by andrew on 07/02/14. */ public class MumbleImageGetter implements Html.ImageGetter { + private static final String TAG = MumbleImageGetter.class.getName(); /** The maximum image size in bytes to load. */ private static final int MAX_LENGTH = 64000; @@ -85,7 +85,7 @@ public class MumbleImageGetter implements Html.ImageGetter { bitmap = getURLImage(decodedSource); } } catch (IllegalArgumentException | ArrayIndexOutOfBoundsException e) { - Log.w(Constants.TAG, "MumbleImageGetter, exception when decoding data:image: " + e.toString()); + Log.w(TAG, "exception when decoding data:image: " + e.toString()); return null; } if(bitmap == null) return null; |