Skip to content

Commit bb78afe

Browse files
committed
Code inspector cleanup!
1 parent 84d90b7 commit bb78afe

14 files changed

+63
-80
lines changed

WordPress/src/main/java/org/wordpress/android/ui/notifications/NotesAdapter.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
package org.wordpress.android.ui.notifications;
22

3-
import android.animation.Animator;
43
import android.content.Context;
54
import android.database.Cursor;
65
import android.text.Html;
76
import android.text.TextUtils;
87
import android.view.LayoutInflater;
98
import android.view.View;
109
import android.view.ViewGroup;
11-
import android.view.animation.AccelerateInterpolator;
1210
import android.widget.CursorAdapter;
13-
import android.widget.ProgressBar;
1411
import android.widget.TextView;
1512

1613
import com.simperium.client.Bucket;
@@ -19,7 +16,6 @@
1916

2017
import org.wordpress.android.R;
2118
import org.wordpress.android.models.Note;
22-
import org.wordpress.android.ui.comments.CommentActions;
2319
import org.wordpress.android.util.PhotonUtils;
2420
import org.wordpress.android.util.SqlUtils;
2521
import org.wordpress.android.util.StringUtils;
@@ -34,10 +30,10 @@ class NotesAdapter extends CursorAdapter {
3430
private final int mAvatarSz;
3531
private final Query mQuery;
3632
private final Bucket<Note> mNotesBucket;
37-
private int mReadBackgroundResId;
38-
private int mUnreadBackgroundResId;
39-
private List<String> mHiddenNoteIds = new ArrayList<String>();
40-
private List<String> mModeratingNoteIds = new ArrayList<String>();
33+
private final int mReadBackgroundResId;
34+
private final int mUnreadBackgroundResId;
35+
private final List<String> mHiddenNoteIds = new ArrayList<String>();
36+
private final List<String> mModeratingNoteIds = new ArrayList<String>();
4137

4238
NotesAdapter(Context context, Bucket<Note> bucket) {
4339
super(context, null, 0x0);

WordPress/src/main/java/org/wordpress/android/ui/notifications/NotificationFragment.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ public static interface OnPostClickListener {
1414
public void onPostClicked(Note note, int remoteBlogId, int postId);
1515
}
1616

17-
public static interface OnCommentClickListener {
18-
public void onCommentClicked(Note note, int remoteBlogId, long commentId);
19-
}
20-
2117
public Note getNote();
2218
public void setNote(Note note);
2319
}

WordPress/src/main/java/org/wordpress/android/ui/notifications/NotificationsActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ public void onCommentChanged(CommentActions.ChangedFrom changedFrom, CommentActi
405405

406406
private class NoteClickListener implements NotificationsListFragment.OnNoteClickListener {
407407
@Override
408-
public void onClickNote(Note note, int position) {
408+
public void onClickNote(Note note) {
409409
if (note == null) return;
410410

411411
// open the latest version of this note just in case it has changed - this can

WordPress/src/main/java/org/wordpress/android/ui/notifications/NotificationsDetailListFragment.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
public class NotificationsDetailListFragment extends ListFragment implements NotificationFragment {
4040
private Note mNote;
41-
private List<NoteBlock> mNoteBlockArray = new ArrayList<NoteBlock>();
41+
private final List<NoteBlock> mNoteBlockArray = new ArrayList<NoteBlock>();
4242
private LinearLayout mRootLayout;
4343
private ViewGroup mFooterView;
4444

@@ -91,7 +91,7 @@ public void setNote(Note note) {
9191
mNote = note;
9292
}
9393

94-
public void reloadNoteBlocks() {
94+
private void reloadNoteBlocks() {
9595
new LoadNoteBlocksTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
9696
}
9797

@@ -101,8 +101,8 @@ public void setFooterView(ViewGroup footerView) {
101101

102102
private class NoteBlockAdapter extends ArrayAdapter<NoteBlock> {
103103

104-
private List<NoteBlock> mNoteBlockList;
105-
private LayoutInflater mLayoutInflater;
104+
private final List<NoteBlock> mNoteBlockList;
105+
private final LayoutInflater mLayoutInflater;
106106

107107
NoteBlockAdapter(Context context, List<NoteBlock> noteBlocks) {
108108
super(context, 0, noteBlocks);
@@ -130,7 +130,7 @@ public View getView(int position, View convertView, ViewGroup parent) {
130130
}
131131
}
132132

133-
private NoteBlock.OnNoteBlockTextClickListener mOnNoteBlockTextClickListener = new NoteBlock.OnNoteBlockTextClickListener() {
133+
private final NoteBlock.OnNoteBlockTextClickListener mOnNoteBlockTextClickListener = new NoteBlock.OnNoteBlockTextClickListener() {
134134
@Override
135135
public void onNoteBlockTextClicked(NoteBlockClickableSpan clickedSpan) {
136136
if (!isAdded()) return;
@@ -147,7 +147,7 @@ public void showReaderPostForNoteIds() {
147147
}
148148
};
149149

150-
private UserNoteBlock.OnGravatarClickedListener mOnGravatarClickedListener = new UserNoteBlock.OnGravatarClickedListener() {
150+
private final UserNoteBlock.OnGravatarClickedListener mOnGravatarClickedListener = new UserNoteBlock.OnGravatarClickedListener() {
151151
@Override
152152
public void onGravatarClicked(long siteId, long userId) {
153153
if (!isAdded()) return;
@@ -237,7 +237,7 @@ protected Boolean doInBackground(Void... params) {
237237
}
238238

239239
if (isBadgeView) {
240-
noteBlock.setIsBadge(true);
240+
noteBlock.setIsBadge();
241241
}
242242

243243
mNoteBlockArray.add(noteBlock);

WordPress/src/main/java/org/wordpress/android/ui/notifications/NotificationsListFragment.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ public class NotificationsListFragment extends ListFragment implements Bucket.Li
3131

3232
private int mRestoredListPosition;
3333

34-
Bucket<Note> mBucket;
34+
private Bucket<Note> mBucket;
3535

3636
/**
3737
* For responding to tapping of notes
3838
*/
3939
public interface OnNoteClickListener {
40-
public void onClickNote(Note note, int position);
40+
public void onClickNote(Note note);
4141
}
4242

4343
@Override
@@ -134,7 +134,7 @@ public void onListItemClick(ListView l, View v, int position, long id) {
134134
}
135135

136136
if (mNoteClickListener != null) {
137-
mNoteClickListener.onClickNote(note, position);
137+
mNoteClickListener.onClickNote(note);
138138
}
139139
}
140140

@@ -162,7 +162,7 @@ public void setNoteIsModerating(String noteId, boolean isModerating) {
162162
}
163163
}
164164

165-
protected void updateLastSeenTime() {
165+
void updateLastSeenTime() {
166166
// set the timestamp to now
167167
try {
168168
if (mNotesAdapter != null && mNotesAdapter.getCount() > 0 && SimperiumUtils.getMetaBucket() != null) {
@@ -178,7 +178,7 @@ protected void updateLastSeenTime() {
178178
}
179179
}
180180

181-
public void refreshNotes() {
181+
void refreshNotes() {
182182
if (!isAdded() || mNotesAdapter == null) {
183183
return;
184184
}

WordPress/src/main/java/org/wordpress/android/ui/notifications/NotificationsWebViewActivity.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88
import android.text.TextUtils;
99
import android.view.Menu;
1010
import android.view.MenuItem;
11-
import android.webkit.WebChromeClient;
12-
import android.webkit.WebView;
13-
import android.webkit.WebViewClient;
1411

1512
import org.wordpress.android.R;
1613
import org.wordpress.android.ui.AuthenticatedWebViewActivity;

WordPress/src/main/java/org/wordpress/android/ui/notifications/blocks/CommentUserNoteBlock.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@
1414
import org.wordpress.android.models.CommentStatus;
1515
import org.wordpress.android.ui.comments.CommentUtils;
1616
import org.wordpress.android.ui.notifications.utils.NotificationsUtils;
17-
import org.wordpress.android.util.AniUtils;
1817
import org.wordpress.android.util.DateTimeUtils;
19-
import org.wordpress.android.util.DisplayUtils;
2018
import org.wordpress.android.util.PhotonUtils;
2119

2220
// A user block with slightly different formatting for display in a comment detail
@@ -148,11 +146,11 @@ public Object getViewHolder(View view) {
148146
}
149147

150148
private class CommentUserNoteBlockHolder {
151-
private NetworkImageView avatarImageView;
152-
private TextView nameTextView;
153-
private TextView agoTextView;
154-
private TextView commentTextView;
155-
private View dividerView;
149+
private final NetworkImageView avatarImageView;
150+
private final TextView nameTextView;
151+
private final TextView agoTextView;
152+
private final TextView commentTextView;
153+
private final View dividerView;
156154

157155
public CommentUserNoteBlockHolder(View view) {
158156
nameTextView = (TextView)view.findViewById(R.id.user_name);
@@ -178,7 +176,7 @@ public void configureResources(Context context) {
178176
mIndentedLeftPadding = context.getResources().getDimensionPixelSize(R.dimen.margin_extra_large) * 2;
179177
}
180178

181-
private OnCommentStatusChangeListener mOnCommentChangedListener = new OnCommentStatusChangeListener() {
179+
private final OnCommentStatusChangeListener mOnCommentChangedListener = new OnCommentStatusChangeListener() {
182180
@Override
183181
public void onCommentStatusChanged(CommentStatus newStatus) {
184182
mCommentStatus = newStatus;

WordPress/src/main/java/org/wordpress/android/ui/notifications/blocks/HeaderUserNoteBlock.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
// Note header, displayed at top of detail view
2020
public class HeaderUserNoteBlock extends NoteBlock {
2121

22-
private JSONArray mHeaderArray;
22+
private final JSONArray mHeaderArray;
2323

24-
private UserNoteBlock.OnGravatarClickedListener mGravatarClickedListener;
24+
private final UserNoteBlock.OnGravatarClickedListener mGravatarClickedListener;
2525
private Boolean mIsComment;
2626
private int mAvatarSize;
2727

@@ -71,7 +71,7 @@ public View configureView(View view) {
7171
return view;
7272
}
7373

74-
private View.OnClickListener mOnClickListener = new View.OnClickListener() {
74+
private final View.OnClickListener mOnClickListener = new View.OnClickListener() {
7575
@Override
7676
public void onClick(View v) {
7777
if (getOnNoteBlockTextClickListener() != null) {
@@ -106,9 +106,9 @@ public void setIsComment(Boolean isComment) {
106106
}
107107

108108
private class NoteHeaderBlockHolder {
109-
private TextView nameTextView;
110-
private TextView snippetTextView;
111-
private NetworkImageView avatarImageView;
109+
private final TextView nameTextView;
110+
private final TextView snippetTextView;
111+
private final NetworkImageView avatarImageView;
112112

113113
public NoteHeaderBlockHolder(View view) {
114114
View rootView = view.findViewById(R.id.header_root_view);
@@ -119,7 +119,7 @@ public NoteHeaderBlockHolder(View view) {
119119
}
120120
}
121121

122-
private View.OnTouchListener mOnGravatarTouchListener = new View.OnTouchListener() {
122+
private final View.OnTouchListener mOnGravatarTouchListener = new View.OnTouchListener() {
123123
@Override
124124
public boolean onTouch(View v, MotionEvent event) {
125125

WordPress/src/main/java/org/wordpress/android/ui/notifications/blocks/NoteBlock.java

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import org.json.JSONObject;
2424
import org.wordpress.android.R;
2525
import org.wordpress.android.WordPress;
26-
import org.wordpress.android.ui.notifications.NotificationsDetailListFragment;
2726
import org.wordpress.android.ui.notifications.utils.NotificationsUtils;
2827
import org.wordpress.android.util.DisplayUtils;
2928
import org.wordpress.android.util.JSONUtil;
@@ -35,11 +34,11 @@
3534
*/
3635
public class NoteBlock {
3736

38-
private static String PROPERTY_MEDIA_TYPE = "type";
39-
private static String PROPERTY_MEDIA_URL = "url";
37+
private static final String PROPERTY_MEDIA_TYPE = "type";
38+
private static final String PROPERTY_MEDIA_URL = "url";
4039

41-
private JSONObject mNoteData;
42-
private OnNoteBlockTextClickListener mOnNoteBlockTextClickListener;
40+
private final JSONObject mNoteData;
41+
private final OnNoteBlockTextClickListener mOnNoteBlockTextClickListener;
4342
private JSONObject mMediaItem;
4443
private boolean mIsBadge;
4544
private boolean mHasAnimatedBadge;
@@ -55,32 +54,32 @@ public NoteBlock(JSONObject noteObject, OnNoteBlockTextClickListener onNoteBlock
5554
mOnNoteBlockTextClickListener = onNoteBlockTextClickListener;
5655
}
5756

58-
public OnNoteBlockTextClickListener getOnNoteBlockTextClickListener() {
57+
OnNoteBlockTextClickListener getOnNoteBlockTextClickListener() {
5958
return mOnNoteBlockTextClickListener;
6059
}
6160

6261
public BlockType getBlockType() {
6362
return BlockType.BASIC;
6463
}
6564

66-
public JSONObject getNoteData() {
65+
JSONObject getNoteData() {
6766
return mNoteData;
6867
}
6968

70-
public Spannable getNoteText() {
69+
Spannable getNoteText() {
7170
return NotificationsUtils.getSpannableTextFromIndices(mNoteData, mOnNoteBlockTextClickListener);
7271
}
7372

74-
public JSONObject getNoteMediaItem() {
73+
JSONObject getNoteMediaItem() {
7574
if (mMediaItem == null) {
7675
mMediaItem = JSONUtil.queryJSON(mNoteData, "media[0]", new JSONObject());
7776
}
7877

7978
return mMediaItem;
8079
}
8180

82-
public void setIsBadge(boolean isBadge) {
83-
mIsBadge = isBadge;
81+
public void setIsBadge() {
82+
mIsBadge = true;
8483
}
8584

8685
public void setBackgroundColor(int backgroundColor) {
@@ -95,14 +94,14 @@ private boolean hasMediaArray() {
9594
return mNoteData.has("media");
9695
}
9796

98-
public boolean hasImageMediaItem() {
97+
boolean hasImageMediaItem() {
9998
String mediaType = getNoteMediaItem().optString(PROPERTY_MEDIA_TYPE, "");
10099
return hasMediaArray() &&
101100
(mediaType.startsWith("image") || mediaType.equals("badge")) &&
102101
getNoteMediaItem().has(PROPERTY_MEDIA_URL);
103102
}
104103

105-
public boolean hasVideoMediaItem() {
104+
boolean hasVideoMediaItem() {
106105
return hasMediaArray() &&
107106
getNoteMediaItem().optString(PROPERTY_MEDIA_TYPE, "").startsWith("video") &&
108107
getNoteMediaItem().has(PROPERTY_MEDIA_URL);
@@ -184,7 +183,7 @@ public Object getViewHolder(View view) {
184183
return new BasicNoteBlockHolder(view);
185184
}
186185

187-
protected static class BasicNoteBlockHolder {
186+
static class BasicNoteBlockHolder {
188187
private final LinearLayout mRootLayout;
189188
private final WPTextView mTextView;
190189

WordPress/src/main/java/org/wordpress/android/ui/notifications/blocks/NoteBlockClickableSpan.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public class NoteBlockClickableSpan extends ClickableSpan {
2828
private boolean mShouldLink;
2929

3030
// Normal colors
31-
private int mBackgroundColor = Color.parseColor("#d2dee6"); // calypso blue border
31+
private final int mBackgroundColor = Color.parseColor("#d2dee6"); // calypso blue border
3232
private int mTextColor = Color.parseColor("#324155"); // calypso dark blue
3333
private final int mLinkColor = Color.parseColor("#2EA2CC"); // new kid on the block blue
3434

0 commit comments

Comments
 (0)