Skip to content

Commit

Permalink
Using TAG for logging
Browse files Browse the repository at this point in the history
  • Loading branch information
QuantumBadger committed Jun 25, 2016
1 parent 113a0fd commit 6978b57
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,29 @@
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.*;
import android.widget.FrameLayout;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.VideoView;
import com.github.lzyzsd.circleprogress.DonutProgress;
import org.quantumbadger.redreader.R;
import org.quantumbadger.redreader.account.RedditAccountManager;
import org.quantumbadger.redreader.cache.CacheManager;
import org.quantumbadger.redreader.cache.CacheRequest;
import org.quantumbadger.redreader.common.*;
import org.quantumbadger.redreader.common.AndroidApi;
import org.quantumbadger.redreader.common.Constants;
import org.quantumbadger.redreader.common.General;
import org.quantumbadger.redreader.common.LinkHandler;
import org.quantumbadger.redreader.common.PrefsUtility;
import org.quantumbadger.redreader.common.RRError;
import org.quantumbadger.redreader.fragments.ImageInfoDialog;
import org.quantumbadger.redreader.image.*;
import org.quantumbadger.redreader.image.GetAlbumInfoListener;
import org.quantumbadger.redreader.image.GetImageInfoListener;
import org.quantumbadger.redreader.image.GifDecoderThread;
import org.quantumbadger.redreader.image.ImageInfo;
import org.quantumbadger.redreader.image.ImgurAPI;
import org.quantumbadger.redreader.reddit.prepared.RedditParsedPost;
import org.quantumbadger.redreader.reddit.prepared.RedditPreparedPost;
import org.quantumbadger.redreader.reddit.things.RedditPost;
Expand All @@ -65,6 +79,8 @@

public class ImageViewActivity extends BaseActivity implements RedditPostView.PostSelectionListener, ImageViewDisplayListManager.Listener {

private static final String TAG = "ImageViewActivity";

private GLSurfaceView surfaceView;
private ImageView imageView;
private GifDecoderThread gifThread;
Expand Down Expand Up @@ -149,7 +165,7 @@ public void run() {
);
}

Log.i("ImageViewActivity", "Loading URL " + mUrl);
Log.i(TAG, "Loading URL " + mUrl);

final DonutProgress progressBar = new DonutProgress(this);
progressBar.setIndeterminate(true);
Expand Down Expand Up @@ -181,7 +197,7 @@ public void onFailure(final @CacheRequest.RequestFailureType int type, final Thr
@Override
public void onSuccess(final ImageInfo info) {

Log.i("ImageViewActivity", "Got image URL: " + info.urlOriginal);
Log.i(TAG, "Got image URL: " + info.urlOriginal);

mImageInfo = info;

Expand Down Expand Up @@ -450,7 +466,7 @@ public void run() {
startActivity(intent);
} catch(final Throwable t) {
General.quickToast(ImageViewActivity.this, R.string.videoview_mode_app_vlc_launch_failed);
Log.e("ImageViewActivity", "VLC failed to launch", t);
Log.e(TAG, "VLC failed to launch", t);
}
finish();
}
Expand Down Expand Up @@ -618,7 +634,7 @@ public void onGifInvalid() {
imageTileSource = new ImageTileSourceWholeBitmap(buf);

} catch(Throwable t) {
Log.e("ImageViewActivity", "Exception when creating ImageTileSource", t);
Log.e(TAG, "Exception when creating ImageTileSource", t);
General.quickToast(this, R.string.imageview_decode_failed);
revertToWeb();
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ public class PostListingFragment extends RRFragment
implements RedditPostView.PostSelectionListener,
AbsListView.OnScrollListener {

private static final String TAG = "PostListingFragment";

private static final String SAVEDSTATE_FIRST_VISIBLE_POS = "firstVisiblePosition";

private final PostListingURL mPostListingURL;
Expand Down Expand Up @@ -655,8 +657,8 @@ public void onJsonParseStarted(final JsonValue value, final long timestamp, fina

final List<String> blockedSubreddits = PrefsUtility.pref_blocked_subreddits(context, mSharedPreferences); // Grab this so we don't have to pull from the prefs every post

Log.i("PostListingFragment", "Precaching images: " + (precacheImages ? "ON" : "OFF"));
Log.i("PostListingFragment", "Precaching comments: " + (precacheComments ? "ON" : "OFF"));
Log.i(TAG, "Precaching images: " + (precacheImages ? "ON" : "OFF"));
Log.i(TAG, "Precaching comments: " + (precacheComments ? "ON" : "OFF"));

final CacheManager cm = CacheManager.getInstance(context);

Expand Down Expand Up @@ -726,15 +728,15 @@ protected void onDownloadStarted() {}

@Override
protected void onFailure(final @CacheRequest.RequestFailureType int type, final Throwable t, final Integer status, final String readableMessage) {
Log.e("PostListingFragment", "Failed to precache " + url.toString() + "(RequestFailureType code: " + type + ")");
Log.e(TAG, "Failed to precache " + url.toString() + "(RequestFailureType code: " + type + ")");
}

@Override
protected void onProgress(final boolean authorizationInProgress, final long bytesRead, final long totalBytes) {}

@Override
protected void onSuccess(final CacheManager.ReadableCacheFile cacheFile, final long timestamp, final UUID session, final boolean fromCache, final String mimetype) {
Log.i("PostListingFragment", "Successfully precached " + url.toString());
Log.i(TAG, "Successfully precached " + url.toString());
}
});
}
Expand All @@ -751,33 +753,33 @@ public void onSuccess(final ImageInfo info) {

// Don't precache huge images
if(info.width != null && info.width > 2500) {
Log.i("PostListingFragment", String.format(
Log.i(TAG, String.format(
"Not precaching '%s': too wide (%d px)", post.url, info.width));
return;
}

if(info.height != null && info.height > 2500) {
Log.i("PostListingFragment", String.format(
Log.i(TAG, String.format(
"Not precaching '%s': too tall (%d px)", post.url, info.height));
return;
}

if(info.size != null && info.size > 10 * 1024 * 1024) {
Log.i("PostListingFragment", String.format(
Log.i(TAG, String.format(
"Not precaching '%s': too big (%d kB)", post.url, info.size / 1024));
return;
}

// Don't precache gifs if they're opened externally
if(Boolean.TRUE.equals(info.isAnimated) && !gifsOpenedInternally) {
Log.i("PostListingFragment", String.format(
Log.i(TAG, String.format(
"Not precaching '%s': GIFs are opened externally", post.url));
return;
}

// Don't precache images if they're opened externally
if(!Boolean.TRUE.equals(info.isAnimated) && !imagesOpenedInternally) {
Log.i("PostListingFragment", String.format(
Log.i(TAG, String.format(
"Not precaching '%s': images are opened externally", post.url));
return;
}
Expand All @@ -803,12 +805,12 @@ public void onSuccess(final ImageInfo info) {
@Override protected void onDownloadStarted() {}

@Override protected void onFailure(final @CacheRequest.RequestFailureType int type, final Throwable t, final Integer status, final String readableMessage) {
Log.e("PostListingFragment", "Failed to precache " + info.urlOriginal + "(RequestFailureType code: " + type + ")");
Log.e(TAG, "Failed to precache " + info.urlOriginal + "(RequestFailureType code: " + type + ")");
}
@Override protected void onProgress(final boolean authorizationInProgress, final long bytesRead, final long totalBytes) {}

@Override protected void onSuccess(final CacheManager.ReadableCacheFile cacheFile, final long timestamp, final UUID session, final boolean fromCache, final String mimetype) {
Log.i("PostListingFragment", "Successfully precached " + info.urlOriginal);
Log.i(TAG, "Successfully precached " + info.urlOriginal);
}
});
}
Expand Down

0 comments on commit 6978b57

Please sign in to comment.