diff --git a/twidere.component.common/src/main/java/org/mariotaku/microblog/library/twitter/auth/BasicAuthorization.java b/twidere.component.common/src/main/java/org/mariotaku/microblog/library/twitter/auth/BasicAuthorization.java
index 918299c6c..1de3f1868 100644
--- a/twidere.component.common/src/main/java/org/mariotaku/microblog/library/twitter/auth/BasicAuthorization.java
+++ b/twidere.component.common/src/main/java/org/mariotaku/microblog/library/twitter/auth/BasicAuthorization.java
@@ -18,6 +18,7 @@
package org.mariotaku.microblog.library.twitter.auth;
+import android.support.annotation.NonNull;
import android.util.Base64;
import org.mariotaku.restfu.RestRequest;
@@ -38,7 +39,7 @@ public final class BasicAuthorization implements Authorization {
}
@Override
- public String getHeader(Endpoint endpoint, RestRequest info) {
+ public String getHeader(@NonNull Endpoint endpoint, @NonNull RestRequest info) {
if (!hasAuthorization()) return null;
return "Basic " + Base64.encodeToString((user + ":" + password).getBytes(), Base64.NO_WRAP);
}
diff --git a/twidere.component.common/src/main/java/org/mariotaku/microblog/library/twitter/auth/BearerAuthorization.java b/twidere.component.common/src/main/java/org/mariotaku/microblog/library/twitter/auth/BearerAuthorization.java
index 5fb28fe55..6452e10e1 100644
--- a/twidere.component.common/src/main/java/org/mariotaku/microblog/library/twitter/auth/BearerAuthorization.java
+++ b/twidere.component.common/src/main/java/org/mariotaku/microblog/library/twitter/auth/BearerAuthorization.java
@@ -18,6 +18,8 @@
package org.mariotaku.microblog.library.twitter.auth;
+import android.support.annotation.NonNull;
+
import org.mariotaku.restfu.RestRequest;
import org.mariotaku.restfu.http.Authorization;
import org.mariotaku.restfu.http.Endpoint;
@@ -34,7 +36,7 @@ public class BearerAuthorization implements Authorization {
@Override
- public String getHeader(Endpoint endpoint, RestRequest info) {
+ public String getHeader(@NonNull Endpoint endpoint, @NonNull RestRequest info) {
return "Bearer " + accessToken;
}
diff --git a/twidere.component.common/src/main/java/org/mariotaku/microblog/library/twitter/auth/EmptyAuthorization.java b/twidere.component.common/src/main/java/org/mariotaku/microblog/library/twitter/auth/EmptyAuthorization.java
index 2fe137487..75a678243 100644
--- a/twidere.component.common/src/main/java/org/mariotaku/microblog/library/twitter/auth/EmptyAuthorization.java
+++ b/twidere.component.common/src/main/java/org/mariotaku/microblog/library/twitter/auth/EmptyAuthorization.java
@@ -18,6 +18,8 @@
package org.mariotaku.microblog.library.twitter.auth;
+import android.support.annotation.NonNull;
+
import org.mariotaku.restfu.RestRequest;
import org.mariotaku.restfu.http.Authorization;
import org.mariotaku.restfu.http.Endpoint;
@@ -28,7 +30,7 @@ import org.mariotaku.restfu.http.Endpoint;
public final class EmptyAuthorization implements Authorization {
@Override
- public String getHeader(Endpoint endpoint, RestRequest info) {
+ public String getHeader(@NonNull Endpoint endpoint, @NonNull RestRequest info) {
return null;
}
diff --git a/twidere.component.common/src/main/java/org/mariotaku/microblog/library/twitter/model/CardDataMap.java b/twidere.component.common/src/main/java/org/mariotaku/microblog/library/twitter/model/CardDataMap.java
index 0476c401a..244c1bc4e 100644
--- a/twidere.component.common/src/main/java/org/mariotaku/microblog/library/twitter/model/CardDataMap.java
+++ b/twidere.component.common/src/main/java/org/mariotaku/microblog/library/twitter/model/CardDataMap.java
@@ -18,6 +18,8 @@
package org.mariotaku.microblog.library.twitter.model;
+import android.support.annotation.NonNull;
+
import com.bluelinelabs.logansquare.LoganSquare;
import com.fasterxml.jackson.core.JsonGenerator;
@@ -49,15 +51,16 @@ public class CardDataMap implements ValueMap {
}
@Override
- public boolean has(String key) {
+ public boolean has(@NonNull String key) {
return map.containsKey(key);
}
@Override
- public Object get(String key) {
+ public Object get(@NonNull String key) {
return map.get(key);
}
+ @NonNull
@Override
public String[] keys() {
final Set
This is a cumbersome low-level constructor that should not be invoked directly by the user.
@@ -204,15 +205,15 @@ public final class QrCode {
errorCorrectionLevel = ecl;
modules = new boolean[size][size]; // Entirely white grid
isFunction = new boolean[size][size];
-
+
// Draw function patterns, draw all codewords, do masking
drawFunctionPatterns();
byte[] allCodewords = appendErrorCorrection(dataCodewords);
drawCodewords(allCodewords);
this.mask = handleConstructorMasking(mask);
}
-
-
+
+
/**
* Creates a new QR Code symbol based on the specified existing object, but with a potentially
* different mask pattern. The version, error correction level, codewords, etc. of the newly
@@ -226,18 +227,18 @@ public final class QrCode {
// Check arguments
if (mask < -1 || mask > 7)
throw new IllegalArgumentException("Mask value out of range");
-
+
// Copy scalar fields
version = qr.version;
size = qr.size;
errorCorrectionLevel = qr.errorCorrectionLevel;
-
+
// Handle grid fields
isFunction = qr.isFunction; // Shallow copy because the data is read-only
modules = qr.modules.clone(); // Deep copy
for (int i = 0; i < modules.length; i++)
modules[i] = modules[i].clone();
-
+
// Handle masking
applyMask(qr.mask); // Undo old mask
this.mask = handleConstructorMasking(mask);
@@ -246,7 +247,7 @@ public final class QrCode {
/*---- Public instance methods ----*/
-
+
/**
* Returns the color of the module (pixel) at the specified coordinates, which is either 0 for white or 1 for black. The top
* left corner has the coordinates (x=0, y=0). If the specified coordinates are out of bounds, then 0 (white) is returned.
@@ -262,19 +263,19 @@ public final class QrCode {
}
/*---- Private helper methods for constructor: Drawing function modules ----*/
-
+
private void drawFunctionPatterns() {
// Draw horizontal and vertical timing patterns
for (int i = 0; i < size; i++) {
setFunctionModule(6, i, i % 2 == 0);
setFunctionModule(i, 6, i % 2 == 0);
}
-
+
// Draw 3 finder patterns (all corners except bottom right; overwrites some timing modules)
drawFinderPattern(3, 3);
drawFinderPattern(size - 4, 3);
drawFinderPattern(3, size - 4);
-
+
// Draw numerous alignment patterns
int[] alignPatPos = getAlignmentPatternPositions(version);
int numAlign = alignPatPos.length;
@@ -286,13 +287,13 @@ public final class QrCode {
drawAlignmentPattern(alignPatPos[i], alignPatPos[j]);
}
}
-
+
// Draw configuration data
drawFormatBits(0); // Dummy mask value; overwritten later in the constructor
drawVersion();
}
-
-
+
+
// Draws two copies of the format bits (with its own error correction code)
// based on the given mask and this object's error correction level field.
private void drawFormatBits(int mask) {
@@ -305,7 +306,7 @@ public final class QrCode {
data ^= 0x5412; // uint15
if (data >>> 15 != 0)
throw new AssertionError();
-
+
// Draw first copy
for (int i = 0; i <= 5; i++)
setFunctionModule(8, i, ((data >>> i) & 1) != 0);
@@ -314,7 +315,7 @@ public final class QrCode {
setFunctionModule(7, 8, ((data >>> 8) & 1) != 0);
for (int i = 9; i < 15; i++)
setFunctionModule(14 - i, 8, ((data >>> i) & 1) != 0);
-
+
// Draw second copy
for (int i = 0; i <= 7; i++)
setFunctionModule(size - 1 - i, 8, ((data >>> i) & 1) != 0);
@@ -322,14 +323,14 @@ public final class QrCode {
setFunctionModule(8, size - 15 + i, ((data >>> i) & 1) != 0);
setFunctionModule(8, size - 8, true);
}
-
-
+
+
// Draws two copies of the version bits (with its own error correction code),
// based on this object's version field (which only has an effect for 7 <= version <= 40).
private void drawVersion() {
if (version < 7)
return;
-
+
// Calculate error correction code and pack bits
int rem = version; // version is uint6, in the range [7, 40]
for (int i = 0; i < 12; i++)
@@ -337,7 +338,7 @@ public final class QrCode {
int data = version << 12 | rem; // uint18
if (data >>> 18 != 0)
throw new AssertionError();
-
+
// Draw two copies
for (int i = 0; i < 18; i++) {
boolean bit = ((data >>> i) & 1) != 0;
@@ -346,8 +347,8 @@ public final class QrCode {
setFunctionModule(b, a, bit);
}
}
-
-
+
+
// Draws a 9*9 finder pattern including the border separator, with the center module at (x, y).
private void drawFinderPattern(int x, int y) {
for (int i = -4; i <= 4; i++) {
@@ -359,8 +360,8 @@ public final class QrCode {
}
}
}
-
-
+
+
// Draws a 5*5 alignment pattern, with the center module at (x, y).
private void drawAlignmentPattern(int x, int y) {
for (int i = -2; i <= 2; i++) {
@@ -368,8 +369,8 @@ public final class QrCode {
setFunctionModule(x + j, y + i, Math.max(Math.abs(i), Math.abs(j)) != 1);
}
}
-
-
+
+
// Sets the color of a module and marks it as a function module.
// Only used by the constructor. Coordinates must be in range.
private void setFunctionModule(int x, int y, boolean isBlack) {
@@ -379,20 +380,20 @@ public final class QrCode {
/*---- Private helper methods for constructor: Codewords and masking ----*/
-
+
// Returns a new byte string representing the given data with the appropriate error correction
// codewords appended to it, based on this object's version and error correction level.
private byte[] appendErrorCorrection(byte[] data) {
if (data.length != getNumDataCodewords(version, errorCorrectionLevel))
throw new IllegalArgumentException();
-
+
// Calculate parameter numbers
int numBlocks = NUM_ERROR_CORRECTION_BLOCKS[errorCorrectionLevel.ordinal()][version];
int blockEccLen = ECC_CODEWORDS_PER_BLOCK[errorCorrectionLevel.ordinal()][version];
int rawCodewords = getNumRawDataModules(version) / 8;
int numShortBlocks = numBlocks - rawCodewords % numBlocks;
int shortBlockLen = rawCodewords / numBlocks;
-
+
// Split data into blocks and append ECC to each block
byte[][] blocks = new byte[numBlocks][];
ReedSolomonGenerator rs = new ReedSolomonGenerator(blockEccLen);
@@ -404,7 +405,7 @@ public final class QrCode {
System.arraycopy(ecc, 0, block, block.length - blockEccLen, ecc.length);
blocks[i] = block;
}
-
+
// Interleave (not concatenate) the bytes from every block into a single sequence
byte[] result = new byte[rawCodewords];
for (int i = 0, k = 0; i < blocks[0].length; i++) {
@@ -418,14 +419,14 @@ public final class QrCode {
}
return result;
}
-
-
+
+
// Draws the given sequence of 8-bit codewords (data and error correction) onto the entire
// data area of this QR Code symbol. Function modules need to be marked off before this is called.
private void drawCodewords(@NonNull byte[] data) {
if (data.length != getNumRawDataModules(version) / 8)
throw new IllegalArgumentException();
-
+
int i = 0; // Bit index into the data
// Do the funny zigzag scan
for (int right = size - 1; right >= 1; right -= 2) { // Index of right column in each column pair
@@ -448,8 +449,8 @@ public final class QrCode {
if (i != data.length * 8)
throw new AssertionError();
}
-
-
+
+
// XORs the data modules in this QR Code with the given mask pattern. Due to XOR's mathematical
// properties, calling applyMask(m) twice with the same value is equivalent to no change at all.
// This means it is possible to apply a mask, undo it, and try another mask. Note that a final
@@ -475,8 +476,8 @@ public final class QrCode {
}
}
}
-
-
+
+
// A messy helper function for the constructors. This QR Code must be in an unmasked state when this
// method is called. The given argument is the requested mask, which is -1 for auto or 0 to 7 for fixed.
// This method applies and returns the actual mask chosen, from 0 to 7.
@@ -500,13 +501,13 @@ public final class QrCode {
applyMask(mask); // Apply the final choice of mask
return mask; // The caller shall assign this value to the final-declared field
}
-
-
+
+
// Calculates and returns the penalty score based on state of this QR Code's current modules.
// This is used by the automatic mask choice algorithm to find the mask pattern that yields the lowest score.
private int getPenaltyScore() {
int result = 0;
-
+
// Adjacent modules in row having same color
for (int y = 0; y < size; y++) {
boolean colorX = false;
@@ -539,7 +540,7 @@ public final class QrCode {
}
}
}
-
+
// 2*2 blocks of modules having same color
for (int y = 0; y < size - 1; y++) {
for (int x = 0; x < size - 1; x++) {
@@ -550,7 +551,7 @@ public final class QrCode {
result += PENALTY_N2;
}
}
-
+
// Finder-like pattern in rows
for (int y = 0; y < size; y++) {
for (int x = 0, bits = 0; x < size; x++) {
@@ -567,7 +568,7 @@ public final class QrCode {
result += PENALTY_N3;
}
}
-
+
// Balance of black and white modules
int black = 0;
for (boolean[] row : modules) {
@@ -586,7 +587,7 @@ public final class QrCode {
/*---- Private static helper functions ----*/
-
+
// Returns a set of positions of the alignment patterns in ascending order. These positions are
// used on both the x and y axes. Each value in the resulting array is in the range [0, 177).
// This stateless pure function could be implemented as table of 40 variable-length lists of unsigned bytes.
@@ -602,7 +603,7 @@ public final class QrCode {
step = (ver * 4 + numAlign * 2 + 1) / (2 * numAlign - 2) * 2; // ceil((size - 13) / (2*numAlign - 2)) * 2
else // C-C-C-Combo breaker!
step = 26;
-
+
int[] result = new int[numAlign];
int size = ver * 4 + 17;
result[0] = 6;
@@ -611,15 +612,15 @@ public final class QrCode {
return result;
}
}
-
-
+
+
// Returns the number of data bits that can be stored in a QR Code of the given version number, after
// all function modules are excluded. This includes remainder bits, so it might not be a multiple of 8.
// The result is in the range [208, 29648]. This could be implemented as a 40-entry lookup table.
private static int getNumRawDataModules(int ver) {
if (ver < 1 || ver > 40)
throw new IllegalArgumentException("Version number out of range");
-
+
int size = ver * 4 + 17;
int result = size * size; // Number of modules in the whole QR symbol square
result -= 64 * 3; // Subtract the three finders with separators
@@ -636,8 +637,8 @@ public final class QrCode {
}
return result;
}
-
-
+
+
// Returns the number of 8-bit data (i.e. not error correction) codewords contained in any
// QR Code of the given version number and error correction level, with remainder bits discarded.
// This stateless pure function could be implemented as a (40*4)-cell lookup table.
@@ -649,14 +650,14 @@ public final class QrCode {
/*---- Private tables of constants ----*/
-
+
// For use in getPenaltyScore(), when evaluating which mask is best.
private static final int PENALTY_N1 = 3;
private static final int PENALTY_N2 = 3;
private static final int PENALTY_N3 = 40;
private static final int PENALTY_N4 = 10;
-
-
+
+
private static final byte[][] ECC_CODEWORDS_PER_BLOCK = {
// Version: (note that index 0 is for padding, and is set to an illegal value)
//0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40 Error correction level
@@ -665,7 +666,7 @@ public final class QrCode {
{-1, 13, 22, 18, 26, 18, 24, 18, 22, 20, 24, 28, 26, 24, 20, 30, 24, 28, 28, 26, 30, 28, 30, 30, 30, 30, 28, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30}, // Quartile
{-1, 17, 28, 22, 16, 22, 28, 26, 26, 24, 28, 24, 28, 22, 24, 24, 30, 28, 28, 26, 28, 30, 24, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30}, // High
};
-
+
private static final byte[][] NUM_ERROR_CORRECTION_BLOCKS = {
// Version: (note that index 0 is for padding, and is set to an illegal value)
//0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40 Error correction level
@@ -678,7 +679,7 @@ public final class QrCode {
/*---- Public helper enumeration ----*/
-
+
/**
* Represents the error correction level used in a QR Code symbol.
*/
@@ -686,12 +687,12 @@ public final class QrCode {
// These enum constants must be declared in ascending order of error protection,
// for the sake of the implicit ordinal() method and values() function.
LOW(1), MEDIUM(0), QUARTILE(3), HIGH(2);
-
+
// In the range 0 to 3 (unsigned 2-bit integer).
final int formatBits;
-
+
// Constructor.
- private Ecc(int fb) {
+ Ecc(int fb) {
formatBits = fb;
}
}
@@ -699,7 +700,7 @@ public final class QrCode {
/*---- Private helper class ----*/
-
+
/**
* Computes the Reed-Solomon error correction codewords for a sequence of data codewords
* at a given degree. Objects are immutable, and the state only depends on the degree.
@@ -708,14 +709,14 @@ public final class QrCode {
private static final class ReedSolomonGenerator {
/*-- Immutable field --*/
-
+
// Coefficients of the divisor polynomial, stored from highest to lowest power, excluding the leading term which
// is always 1. For example the polynomial x^3 + 255x^2 + 8x + 93 is stored as the uint8 array {255, 8, 93}.
private final byte[] coefficients;
/*-- Constructor --*/
-
+
/**
* Creates a Reed-Solomon ECC generator for the specified degree. This could be implemented
* as a lookup table over all possible parameter values, instead of as an algorithm.
@@ -725,11 +726,11 @@ public final class QrCode {
public ReedSolomonGenerator(int degree) {
if (degree < 1 || degree > 255)
throw new IllegalArgumentException("Degree out of range");
-
+
// Start with the monomial x^0
coefficients = new byte[degree];
coefficients[degree - 1] = 1;
-
+
// Compute the product polynomial (x - r^0) * (x - r^1) * (x - r^2) * ... * (x - r^{degree-1}),
// drop the highest term, and store the rest of the coefficients in order of descending powers.
// Note that r = 0x02, which is a generator element of this field GF(2^8/0x11D).
@@ -747,7 +748,7 @@ public final class QrCode {
/*-- Method --*/
-
+
/**
* Computes and returns the Reed-Solomon error correction codewords for the specified sequence of data codewords.
* The returned object is always a new byte array. This method does not alter this object's state (because it is immutable).
@@ -770,7 +771,7 @@ public final class QrCode {
/*-- Static function --*/
-
+
// Returns the product of the two given field elements modulo GF(2^8/0x11D). The arguments and result
// are unsigned 8-bit integers. This could be implemented as a lookup table of 256*256 entries of uint8.
private static int multiply(int x, int y) {
@@ -786,7 +787,7 @@ public final class QrCode {
throw new AssertionError();
return z;
}
-
+
}
-
+
}
diff --git a/twidere/src/main/java/io/nayuki/qrcodegen/QrSegment.java b/twidere/src/main/java/io/nayuki/qrcodegen/QrSegment.java
index 2477e0cb9..d780f3cff 100755
--- a/twidere/src/main/java/io/nayuki/qrcodegen/QrSegment.java
+++ b/twidere/src/main/java/io/nayuki/qrcodegen/QrSegment.java
@@ -254,7 +254,7 @@ public final class QrSegment {
/*-- Constructor --*/
- private Mode(int mode, int... ccbits) {
+ Mode(int mode, int... ccbits) {
this.modeBits = mode;
numBitsCharCount = ccbits;
}
diff --git a/twidere/src/main/java/org/mariotaku/twidere/adapter/SavedSearchesAdapter.java b/twidere/src/main/java/org/mariotaku/twidere/adapter/SavedSearchesAdapter.java
index 95553b6b0..af8217d98 100644
--- a/twidere/src/main/java/org/mariotaku/twidere/adapter/SavedSearchesAdapter.java
+++ b/twidere/src/main/java/org/mariotaku/twidere/adapter/SavedSearchesAdapter.java
@@ -68,7 +68,7 @@ public class SavedSearchesAdapter extends BaseAdapter {
public View getView(final int position, final View convertView, final ViewGroup parent) {
final View view = convertView != null ? convertView : mInflater.inflate(
android.R.layout.simple_list_item_1, null);
- final TextView text = (TextView) view.findViewById(android.R.id.text1);
+ final TextView text = view.findViewById(android.R.id.text1);
text.setText(getItem(position).getName());
return view;
}
diff --git a/twidere/src/main/java/org/mariotaku/twidere/adapter/decorator/ExtendedDividerItemDecoration.java b/twidere/src/main/java/org/mariotaku/twidere/adapter/decorator/ExtendedDividerItemDecoration.java
index 5e5ae3ce6..82e66e133 100644
--- a/twidere/src/main/java/org/mariotaku/twidere/adapter/decorator/ExtendedDividerItemDecoration.java
+++ b/twidere/src/main/java/org/mariotaku/twidere/adapter/decorator/ExtendedDividerItemDecoration.java
@@ -20,8 +20,6 @@ import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
-import android.support.annotation.IntRange;
-import android.support.v4.view.ViewCompat;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.RecyclerView.Adapter;
@@ -114,7 +112,7 @@ public class ExtendedDividerItemDecoration extends RecyclerView.ItemDecoration {
final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child
.getLayoutParams();
final int top = child.getBottom() + params.bottomMargin +
- Math.round(ViewCompat.getTranslationY(child));
+ Math.round(child.getTranslationY());
final int bottom = top + mDivider.getIntrinsicHeight();
if (mPadding != null && mPadding.get(childPos, mPaddingRect)) {
mDivider.setBounds(left + mPaddingRect.left, top + mPaddingRect.top, right - mPaddingRect.right,
@@ -145,7 +143,7 @@ public class ExtendedDividerItemDecoration extends RecyclerView.ItemDecoration {
final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child
.getLayoutParams();
final int left = child.getRight() + params.rightMargin +
- Math.round(ViewCompat.getTranslationX(child));
+ Math.round(child.getTranslationX());
final int right = left + mDivider.getIntrinsicHeight();
mDivider.setBounds(left + mPaddingRect.left, top + mPaddingRect.top, right - mPaddingRect.right,
diff --git a/twidere/src/main/java/org/mariotaku/twidere/fragment/DataExportImportTypeSelectorDialogFragment.java b/twidere/src/main/java/org/mariotaku/twidere/fragment/DataExportImportTypeSelectorDialogFragment.java
index 93ebedfbe..41447df2e 100644
--- a/twidere/src/main/java/org/mariotaku/twidere/fragment/DataExportImportTypeSelectorDialogFragment.java
+++ b/twidere/src/main/java/org/mariotaku/twidere/fragment/DataExportImportTypeSelectorDialogFragment.java
@@ -200,7 +200,7 @@ public final class DataExportImportTypeSelectorDialogFragment extends BaseDialog
@Override
public View getView(final int position, @Nullable final View convertView, final ViewGroup parent) {
final View view = super.getView(position, convertView, parent);
- final TextView text1 = (TextView) view.findViewById(android.R.id.text1);
+ final TextView text1 = view.findViewById(android.R.id.text1);
text1.setText(getItem(position).title);
view.setEnabled(isEnabled(position));
return view;
diff --git a/twidere/src/main/java/org/mariotaku/twidere/fragment/ThemedListPreferenceDialogFragmentCompat.java b/twidere/src/main/java/org/mariotaku/twidere/fragment/ThemedListPreferenceDialogFragmentCompat.java
index a6c2f369a..c769edfc0 100644
--- a/twidere/src/main/java/org/mariotaku/twidere/fragment/ThemedListPreferenceDialogFragmentCompat.java
+++ b/twidere/src/main/java/org/mariotaku/twidere/fragment/ThemedListPreferenceDialogFragmentCompat.java
@@ -20,8 +20,6 @@ import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.support.v7.preference.ListPreference;
-import org.mariotaku.twidere.util.TwidereArrayUtils;
-
public class ThemedListPreferenceDialogFragmentCompat extends ThemedPreferenceDialogFragmentCompat {
private int mClickedDialogEntryIndex;
diff --git a/twidere/src/main/java/org/mariotaku/twidere/model/ParcelableAccount.java b/twidere/src/main/java/org/mariotaku/twidere/model/ParcelableAccount.java
index 91a6530a8..63e4f6485 100644
--- a/twidere/src/main/java/org/mariotaku/twidere/model/ParcelableAccount.java
+++ b/twidere/src/main/java/org/mariotaku/twidere/model/ParcelableAccount.java
@@ -28,6 +28,7 @@ import org.mariotaku.twidere.annotation.AccountType;
import org.mariotaku.twidere.model.util.UserKeyCursorFieldConverter;
import org.mariotaku.twidere.provider.TwidereDataStore.Accounts;
+@SuppressWarnings("DeprecatedIsStillUsed")
@CursorObject
@Deprecated
public class ParcelableAccount {
diff --git a/twidere/src/main/java/org/mariotaku/twidere/model/ParcelableCredentials.java b/twidere/src/main/java/org/mariotaku/twidere/model/ParcelableCredentials.java
index 2a44ff429..86878a094 100644
--- a/twidere/src/main/java/org/mariotaku/twidere/model/ParcelableCredentials.java
+++ b/twidere/src/main/java/org/mariotaku/twidere/model/ParcelableCredentials.java
@@ -28,6 +28,7 @@ import org.mariotaku.twidere.provider.TwidereDataStore.Accounts;
/**
* Created by mariotaku on 15/5/26.
*/
+@SuppressWarnings("DeprecatedIsStillUsed")
@CursorObject
@Deprecated
public class ParcelableCredentials extends ParcelableAccount {
diff --git a/twidere/src/main/java/org/mariotaku/twidere/model/pagination/CursorPagination.java b/twidere/src/main/java/org/mariotaku/twidere/model/pagination/CursorPagination.java
index 4fb712bed..98813b7a8 100644
--- a/twidere/src/main/java/org/mariotaku/twidere/model/pagination/CursorPagination.java
+++ b/twidere/src/main/java/org/mariotaku/twidere/model/pagination/CursorPagination.java
@@ -21,10 +21,10 @@ package org.mariotaku.twidere.model.pagination;
import android.os.Parcel;
import android.os.Parcelable;
+import android.support.annotation.Nullable;
import com.hannesdorfmann.parcelableplease.annotation.ParcelablePlease;
-import org.jetbrains.annotations.Nullable;
import org.mariotaku.microblog.library.twitter.model.Paging;
/**
diff --git a/twidere/src/main/java/org/mariotaku/twidere/model/pagination/PagePagination.java b/twidere/src/main/java/org/mariotaku/twidere/model/pagination/PagePagination.java
index d71335a59..d0074aa57 100644
--- a/twidere/src/main/java/org/mariotaku/twidere/model/pagination/PagePagination.java
+++ b/twidere/src/main/java/org/mariotaku/twidere/model/pagination/PagePagination.java
@@ -21,10 +21,10 @@ package org.mariotaku.twidere.model.pagination;
import android.os.Parcel;
import android.os.Parcelable;
+import android.support.annotation.Nullable;
import com.hannesdorfmann.parcelableplease.annotation.ParcelablePlease;
-import org.jetbrains.annotations.Nullable;
import org.mariotaku.microblog.library.twitter.model.Paging;
/**
diff --git a/twidere/src/main/java/org/mariotaku/twidere/preference/SeekBarDialogPreference.java b/twidere/src/main/java/org/mariotaku/twidere/preference/SeekBarDialogPreference.java
index 6bd3ca1ba..53876be06 100644
--- a/twidere/src/main/java/org/mariotaku/twidere/preference/SeekBarDialogPreference.java
+++ b/twidere/src/main/java/org/mariotaku/twidere/preference/SeekBarDialogPreference.java
@@ -209,13 +209,13 @@ public class SeekBarDialogPreference extends DialogPreference implements IDialog
super.onBindDialogView(view);
final SeekBarDialogPreference preference = (SeekBarDialogPreference) getPreference();
final CharSequence message = preference.getDialogMessage();
- final TextView dialogMessageText = (TextView) view.findViewById(R.id.text_dialog_message);
+ final TextView dialogMessageText = view.findViewById(R.id.text_dialog_message);
dialogMessageText.setText(message);
dialogMessageText.setVisibility(TextUtils.isEmpty(message) ? View.GONE : View.VISIBLE);
- mProgressText = (TextView) view.findViewById(R.id.text_progress);
+ mProgressText = view.findViewById(R.id.text_progress);
- mSeekBar = (SeekBar) view.findViewById(R.id.seek_bar);
+ mSeekBar = view.findViewById(R.id.seek_bar);
mSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(final SeekBar seekBar, final int progress, final boolean fromUser) {
diff --git a/twidere/src/main/java/org/mariotaku/twidere/preference/ThemeBackgroundPreference.java b/twidere/src/main/java/org/mariotaku/twidere/preference/ThemeBackgroundPreference.java
index c331a1ee5..9a655179e 100644
--- a/twidere/src/main/java/org/mariotaku/twidere/preference/ThemeBackgroundPreference.java
+++ b/twidere/src/main/java/org/mariotaku/twidere/preference/ThemeBackgroundPreference.java
@@ -184,7 +184,7 @@ public class ThemeBackgroundPreference extends DialogPreference implements Const
final View view = inflater.inflate(R.layout.dialog_theme_background_preference, listViewParent);
((ViewGroup) view.findViewById(R.id.list_container)).addView(listView);
mAlphaContainer = view.findViewById(R.id.alpha_container);
- mAlphaSlider = (SeekBar) view.findViewById(R.id.alpha_slider);
+ mAlphaSlider = view.findViewById(R.id.alpha_slider);
mAlphaSlider.setMax(MAX_ALPHA - MIN_ALPHA);
mAlphaSlider.setProgress(preferences.getInt(KEY_THEME_BACKGROUND_ALPHA, DEFAULT_THEME_BACKGROUND_ALPHA) - MIN_ALPHA);
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
diff --git a/twidere/src/main/java/org/mariotaku/twidere/util/MicroBlogAPIFactory.java b/twidere/src/main/java/org/mariotaku/twidere/util/MicroBlogAPIFactory.java
index 8405f5b6c..2aa852ddb 100644
--- a/twidere/src/main/java/org/mariotaku/twidere/util/MicroBlogAPIFactory.java
+++ b/twidere/src/main/java/org/mariotaku/twidere/util/MicroBlogAPIFactory.java
@@ -94,7 +94,7 @@ public class MicroBlogAPIFactory implements TwidereConstants {
@NonNull
public static String getApiBaseUrl(@NonNull String format, @Nullable final String domain) {
- final Matcher matcher = Pattern.compile("\\[(\\.?)DOMAIN(\\.?)\\]", Pattern.CASE_INSENSITIVE).matcher(format);
+ final Matcher matcher = Pattern.compile("\\[(\\.?)DOMAIN(\\.?)]", Pattern.CASE_INSENSITIVE).matcher(format);
final String baseUrl;
if (!matcher.find()) {
// For backward compatibility
diff --git a/twidere/src/main/java/org/mariotaku/twidere/util/MouseScrollDirectionDecider.java b/twidere/src/main/java/org/mariotaku/twidere/util/MouseScrollDirectionDecider.java
index 50b44f78d..121cf0341 100644
--- a/twidere/src/main/java/org/mariotaku/twidere/util/MouseScrollDirectionDecider.java
+++ b/twidere/src/main/java/org/mariotaku/twidere/util/MouseScrollDirectionDecider.java
@@ -22,7 +22,6 @@ package org.mariotaku.twidere.util;
import android.annotation.SuppressLint;
import android.content.Context;
import android.support.annotation.Nullable;
-import android.support.v4.view.MotionEventCompat;
import android.view.InputDevice;
import android.view.MotionEvent;
import android.view.View;
@@ -75,7 +74,7 @@ public class MouseScrollDirectionDecider {
if ((event.getSource() & InputDevice.SOURCE_CLASS_POINTER) == 0) {
return false;
}
- if (event.getAction() != MotionEventCompat.ACTION_SCROLL) return false;
+ if (event.getAction() != MotionEvent.ACTION_SCROLL) return false;
verticalScroll = event.getAxisValue(MotionEvent.AXIS_VSCROLL);
horizontalScroll = event.getAxisValue(MotionEvent.AXIS_HSCROLL);
verticalView.onGenericMotionEvent(event);
diff --git a/twidere/src/main/java/org/mariotaku/twidere/util/ServiceUtils.java b/twidere/src/main/java/org/mariotaku/twidere/util/ServiceUtils.java
index 8007375f1..bc64f05b8 100644
--- a/twidere/src/main/java/org/mariotaku/twidere/util/ServiceUtils.java
+++ b/twidere/src/main/java/org/mariotaku/twidere/util/ServiceUtils.java
@@ -24,7 +24,6 @@ import android.content.Context;
import android.content.ContextWrapper;
import android.content.Intent;
import android.content.ServiceConnection;
-import android.util.Log;
import java.util.HashMap;
diff --git a/twidere/src/main/java/org/mariotaku/twidere/util/net/SimpleCookieJar.java b/twidere/src/main/java/org/mariotaku/twidere/util/net/SimpleCookieJar.java
index 381ca1055..6a4429e52 100644
--- a/twidere/src/main/java/org/mariotaku/twidere/util/net/SimpleCookieJar.java
+++ b/twidere/src/main/java/org/mariotaku/twidere/util/net/SimpleCookieJar.java
@@ -1,5 +1,7 @@
package org.mariotaku.twidere.util.net;
+import android.support.annotation.NonNull;
+
import java.util.ArrayList;
import java.util.List;
@@ -11,12 +13,12 @@ public final class SimpleCookieJar implements CookieJar {
private final List
+ @Suppress("ConvertTryFinallyToUseCall")
try {
cur.moveToFirst()
val indices = ObjectCursor.indicesFrom(cur, ParcelableUser::class.java)
diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/loader/group/BaseGroupsLoader.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/loader/group/BaseGroupsLoader.kt
index 2eebc7240..ecc62e0e3 100644
--- a/twidere/src/main/kotlin/org/mariotaku/twidere/loader/group/BaseGroupsLoader.kt
+++ b/twidere/src/main/kotlin/org/mariotaku/twidere/loader/group/BaseGroupsLoader.kt
@@ -78,12 +78,12 @@ abstract class BaseGroupsLoader(
nextPagination = CursorPagination.valueOf(listLoaded.nextCursor)
prevPagination = CursorPagination.valueOf(listLoaded.previousCursor)
val dataSize = data.size
- for (i in 0..listSize - 1) {
+ for (i in 0 until listSize) {
val group = listLoaded[i]
data.add(ParcelableGroupUtils.from(group, accountKey, dataSize + i, isMember(group)))
}
} else {
- for (i in 0..listSize - 1) {
+ for (i in 0 until listSize) {
val list = listLoaded[i]
data.add(ParcelableGroupUtils.from(listLoaded[i], accountKey, i, isMember(list)))
}
diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/loader/userlists/BaseUserListsLoader.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/loader/userlists/BaseUserListsLoader.kt
index eae68d2f9..584227737 100644
--- a/twidere/src/main/kotlin/org/mariotaku/twidere/loader/userlists/BaseUserListsLoader.kt
+++ b/twidere/src/main/kotlin/org/mariotaku/twidere/loader/userlists/BaseUserListsLoader.kt
@@ -97,13 +97,13 @@ abstract class BaseUserListsLoader(
nextPagination = CursorPagination.valueOf(listLoaded.nextCursor)
prevPagination = CursorPagination.valueOf(listLoaded.previousCursor)
val dataSize = data.size
- for (i in 0..listSize - 1) {
+ for (i in 0 until listSize) {
val list = listLoaded[i]
data.add(list.toParcelable(accountKey, (dataSize + i).toLong(),
isFollowing(list), profileImageSize))
}
} else {
- for (i in 0..listSize - 1) {
+ for (i in 0 until listSize) {
val list = listLoaded[i]
data.add(listLoaded[i].toParcelable(accountKey, i.toLong(),
isFollowing(list), profileImageSize))
diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/menu/AccountActionProvider.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/menu/AccountActionProvider.kt
index a2b296d16..3546db839 100644
--- a/twidere/src/main/kotlin/org/mariotaku/twidere/menu/AccountActionProvider.kt
+++ b/twidere/src/main/kotlin/org/mariotaku/twidere/menu/AccountActionProvider.kt
@@ -6,7 +6,6 @@ import android.content.Intent
import android.view.ActionProvider
import android.view.Menu
import android.view.SubMenu
-import android.view.View
import org.mariotaku.twidere.TwidereConstants
import org.mariotaku.twidere.constant.IntentConstants.EXTRA_ACCOUNT
import org.mariotaku.twidere.model.AccountDetails
@@ -25,10 +24,6 @@ class AccountActionProvider(
return true
}
- override fun onCreateActionView(): View? {
- return null
- }
-
override fun onPrepareSubMenu(subMenu: SubMenu) {
subMenu.removeGroup(MENU_GROUP)
if (accounts == null) return
@@ -51,6 +46,9 @@ class AccountActionProvider(
}
}
+ @Suppress("OverridingDeprecatedMember")
+ override fun onCreateActionView() = null
+
companion object {
val MENU_GROUP = 201
diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/model/ItemCounts.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/model/ItemCounts.kt
index f89353dd3..b81822f2b 100644
--- a/twidere/src/main/kotlin/org/mariotaku/twidere/model/ItemCounts.kt
+++ b/twidere/src/main/kotlin/org/mariotaku/twidere/model/ItemCounts.kt
@@ -20,7 +20,7 @@ class ItemCounts(counts: Int) {
}
fun getItemStartPosition(countIndex: Int): Int {
- return (0..countIndex - 1).sumBy { data[it] }
+ return (0 until countIndex).sumBy { data[it] }
}
val itemCount: Int get() = data.sum()
diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/model/util/ParcelableActivityUtils.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/model/util/ParcelableActivityUtils.kt
index 59a472f89..e852e0b25 100644
--- a/twidere/src/main/kotlin/org/mariotaku/twidere/model/util/ParcelableActivityUtils.kt
+++ b/twidere/src/main/kotlin/org/mariotaku/twidere/model/util/ParcelableActivityUtils.kt
@@ -12,11 +12,11 @@ import org.mariotaku.twidere.model.UserKey
object ParcelableActivityUtils {
/**
- * @param activity Activity for processing
+ * @param sources Source users
* *
* @param filtered Those ids will be removed from source_ids.
* *
- * @param followingOnly Limit following users in sources
+ * @param followingOnly Limit following users in sources
* *
* @return true if source ids changed, false otherwise
*/
diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/preference/ComponentPickerPreference.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/preference/ComponentPickerPreference.kt
index 3c7b479b5..08ddd6ca7 100644
--- a/twidere/src/main/kotlin/org/mariotaku/twidere/preference/ComponentPickerPreference.kt
+++ b/twidere/src/main/kotlin/org/mariotaku/twidere/preference/ComponentPickerPreference.kt
@@ -55,7 +55,7 @@ abstract class ComponentPickerPreference(context: Context, attrs: AttributeSet?
val values = arrayOfNulls