Skip to content

Commit

Permalink
LIBcc10913 Inspection
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderLS committed Sep 13, 2018
1 parent 1f56b00 commit cc68312
Show file tree
Hide file tree
Showing 11 changed files with 68 additions and 75 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
* @author Shintaro Katafuchi
*/

@SuppressWarnings("unused")
public class UriHelperTest {

private static final String CHINESE_STORES = "market://details?id=";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
*/

public class AppCompatDialogManager extends DefaultDialogManager implements DialogManager {
/** <p>The WeakReference to the {@link AppCompatDialogManager} singleton object.</p> */
private static volatile WeakReference<DialogManager> singleton = null;

@SuppressWarnings("WeakerAccess")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ static AppInformation getInstance(@NonNull final Context context) {
* @see #getAppVersionCodeMajor()
* @see #getAppLongVersionCode()
*/
@SuppressWarnings({"WeakerAccess", "JavadocReference"})
@SuppressWarnings({"WeakerAccess", "JavadocReference", "unused"})
int getAppVersionCode() {
return (int) (appLongVersionCode & 0b11111111111111111111111111111111L);
}
Expand All @@ -119,7 +119,7 @@ int getAppVersionCode() {
* @see #getAppVersionCode()
* @see #getAppLongVersionCode()
*/
@SuppressWarnings({"WeakerAccess", "JavadocReference"})
@SuppressWarnings({"WeakerAccess", "JavadocReference", "unused"})
int getAppVersionCodeMajor() {
return (int) (appLongVersionCode >>> 32);
}
Expand Down Expand Up @@ -166,6 +166,7 @@ String getAppVersionName() {
* @return the image of the icon, or the default application icon if it could not be found.
* Returns null if the resources for the application could not be loaded.
*/
@SuppressWarnings("unused")
@Nullable
Drawable getAppIcon() {
return appIcon;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public AppRate setLaunchTimes(@SuppressWarnings("SameParameterValue") byte appLa
* @return the {@link AppRate} singleton object
* @see #setTimeToWait(long, short)
*/
@SuppressWarnings("WeakerAccess")
@SuppressWarnings({"WeakerAccess", "unused"})
public AppRate setInstallDays(byte installDate) {
return setTimeToWait(Time.DAY, installDate);
}
Expand Down Expand Up @@ -208,6 +208,7 @@ public AppRate setTimeToWait(@Time.TimeUnits long timeUnit, short timeUnitsNumbe
* @return the {@link AppRate} singleton object
* @see #setRemindTimeToWait(long, short)
*/
@SuppressWarnings({"WeakerAccess", "unused"})
public AppRate setRemindInterval(byte remindInterval) {
return setRemindTimeToWait(Time.DAY, remindInterval);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,56 +63,50 @@
*/

public class DefaultDialogManager implements DialogManager {
/** <p>The WeakReference to the {@link DefaultDialogManager} singleton object.</p> */
private static volatile WeakReference<DefaultDialogManager> singleton = null;
private final StoreOptions storeOptions;
private final OnClickButtonListener listener;
@SuppressWarnings("WeakerAccess")
protected final DialogOptions dialogOptions;
@SuppressWarnings({"WeakerAccess", "UnusedAssignment"})
protected Context context = null;
@SuppressWarnings("WeakerAccess")
protected final DialogInterface.OnShowListener showListener = new DialogInterface.OnShowListener() {
@Override
public void onShow(DialogInterface dialog) {
if (getDialogFirstLaunchTime(context) == 0L) {
setDialogFirstLaunchTime(context);
}
increment365DayPeriodDialogLaunchTimes(context);
if (isLollipop()) {
try {
final Button positiveButton = ((AlertDialog) dialog).getButton(AlertDialog.BUTTON_POSITIVE);
if (positiveButton != null) {
final LinearLayout linearLayout = (LinearLayout) positiveButton.getParent();
if ((linearLayout != null) && (positiveButton.getLeft() + positiveButton.getWidth() > linearLayout.getWidth())) {
final Button neutralButton = ((AlertDialog) dialog).getButton(AlertDialog.BUTTON_NEUTRAL);
final Button negativeButton = ((AlertDialog) dialog).getButton(AlertDialog.BUTTON_NEGATIVE);
linearLayout.setOrientation(LinearLayout.VERTICAL);
linearLayout.setGravity(Gravity.END);
if (neutralButton != null) {
linearLayout.removeView(neutralButton);
if (negativeButton != null) {
linearLayout.removeView(negativeButton);
linearLayout.addView(negativeButton);
}
linearLayout.addView(neutralButton);
} else if (negativeButton != null) {
protected final DialogInterface.OnShowListener showListener = dialog -> {
if (getDialogFirstLaunchTime(context) == 0L) {
setDialogFirstLaunchTime(context);
}
increment365DayPeriodDialogLaunchTimes(context);
if (isLollipop()) {
try {
final Button positiveButton = ((AlertDialog) dialog).getButton(AlertDialog.BUTTON_POSITIVE);
if (positiveButton != null) {
final LinearLayout linearLayout = (LinearLayout) positiveButton.getParent();
if ((linearLayout != null) && (positiveButton.getLeft() + positiveButton.getWidth() > linearLayout.getWidth())) {
final Button neutralButton = ((AlertDialog) dialog).getButton(AlertDialog.BUTTON_NEUTRAL);
final Button negativeButton = ((AlertDialog) dialog).getButton(AlertDialog.BUTTON_NEGATIVE);
linearLayout.setOrientation(LinearLayout.VERTICAL);
linearLayout.setGravity(Gravity.END);
if (neutralButton != null) {
linearLayout.removeView(neutralButton);
if (negativeButton != null) {
linearLayout.removeView(negativeButton);
linearLayout.addView(negativeButton);
}
linearLayout.addView(neutralButton);
} else if (negativeButton != null) {
linearLayout.removeView(negativeButton);
linearLayout.addView(negativeButton);
}
}
} catch (Exception e) {
Log.i(TAG, "Positive button may not fits in the window, can't change layout orientation to vertical");
}
} catch (Exception e) {
Log.i(TAG, "Positive button may not fits in the window, can't change layout orientation to vertical");
}
}
};
@SuppressWarnings("WeakerAccess")
protected final DialogInterface.OnDismissListener dismissListener = new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
AppRate.with(context).clearRateDialog();
}
};
protected final DialogInterface.OnDismissListener dismissListener = dialog -> AppRate.with(context).clearRateDialog();
@SuppressWarnings("WeakerAccess")
protected final DialogInterface.OnClickListener positiveListener = new DialogInterface.OnClickListener() {
@Override
Expand Down Expand Up @@ -228,6 +222,7 @@ protected DefaultDialogManager(final Context context, final DialogOptions dialog
this.listener = dialogOptions.getListener();
}

@SuppressWarnings("WeakerAccess")
protected void setContext(Context context){
this.context = context;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public final class DialogOptions {
DialogOptions() {
}

@SuppressWarnings("WeakerAccess")
public boolean shouldShowNeutralButton() {
return showNeutralButton;
}
Expand All @@ -69,6 +70,7 @@ void setShowNeutralButton(boolean showNeutralButton) {
this.showNeutralButton = showNeutralButton;
}

@SuppressWarnings("WeakerAccess")
public boolean shouldShowNegativeButton() {
return showNegativeButton;
}
Expand All @@ -77,6 +79,7 @@ void setShowNegativeButton(boolean showNegativeButton) {
this.showNegativeButton = showNegativeButton;
}

@SuppressWarnings("WeakerAccess")
public boolean shouldShowTitle() {
return showTitle;
}
Expand All @@ -85,6 +88,7 @@ void setShowTitle(boolean showTitle) {
this.showTitle = showTitle;
}

@SuppressWarnings("WeakerAccess")
public boolean getCancelable() {
return cancelable;
}
Expand Down Expand Up @@ -155,6 +159,7 @@ void setListener(OnClickButtonListener listener) {
this.listener = new SoftReference<>(listener);
}

@SuppressWarnings("WeakerAccess")
public String getTitleText(Context context) {
if (titleText == null) {
return context.getString(textTitleResId);
Expand All @@ -166,6 +171,7 @@ void setTitleText(String titleText) {
this.titleText = titleText;
}

@SuppressWarnings("WeakerAccess")
public String getMessageText(Context context) {
if (messageText == null) {
return context.getString(textMessageResId);
Expand All @@ -177,6 +183,7 @@ void setMessageText(String messageText) {
this.messageText = messageText;
}

@SuppressWarnings("WeakerAccess")
public String getPositiveText(Context context) {
if (positiveText == null) {
return context.getString(textPositiveResId);
Expand All @@ -188,6 +195,7 @@ void setPositiveText(String positiveText) {
this.positiveText = positiveText;
}

@SuppressWarnings("WeakerAccess")
public String getNeutralText(Context context) {
if (neutralText == null) {
return context.getString(textNeutralResId);
Expand All @@ -199,6 +207,7 @@ void setNeutralText(String neutralText) {
this.neutralText = neutralText;
}

@SuppressWarnings("WeakerAccess")
public String getNegativeText(Context context) {
if (negativeText == null) {
return context.getString(textNegativeResId);
Expand All @@ -210,6 +219,7 @@ void setNegativeText(String negativeText) {
this.negativeText = negativeText;
}

@SuppressWarnings("WeakerAccess")
public int getThemeResId() {
return themeResId;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,13 @@
* @author Alexander Savin
*/

@SuppressWarnings({"WeakerAccess", "unused"})
public class DialogType {
/** Apple Rate Dialog */
@SuppressWarnings("WeakerAccess")
public static final int APPLE = 0;
/** Classic Rate Dialog */
@SuppressWarnings("WeakerAccess")
public static final int CLASSIC = 1;
/** Modern Rate Dialog */
@SuppressWarnings("WeakerAccess")
public static final int MODERN = 2;

private DialogType() {
Expand All @@ -41,7 +39,6 @@ private DialogType() {
* <p>Annotated element, represents a logical type and its value should be one of the following
* constants: APPLE, CLASSIC, MODERN.</p>
*/
@SuppressWarnings("WeakerAccess")
@Documented
@Retention(SOURCE)
@IntDef({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ static void increment365DayPeriodDialogLaunchTimes(final Context context) {
currentDay = (short) (currentDay % YEAR_IN_DAYS);
}

if (currentDialogLaunchTimes.matches("(.*):" + currentDay + "y" + currentYear + "-[0-9][0-9]*:")) {
if (currentDialogLaunchTimes != null && currentDialogLaunchTimes.matches("(.*):" + currentDay + "y" + currentYear + "-[0-9][0-9]*:")) {
final short length = (short) currentDialogLaunchTimes.length();
String currentDayCount = "" + currentDialogLaunchTimes.charAt(length - 2);
for (short s = (short) (length - 3); s > 0; s--) {
Expand All @@ -137,7 +137,7 @@ static short get365DayPeriodDialogLaunchTimes(final Context context) {
final byte currentYear = (byte) (currentDay / YEAR_IN_DAYS);
String dialogLaunchTimes = getPreferences(context).getString(PREF_KEY_365_DAY_PERIOD_DIALOG_LAUNCH_TIMES, ":0y0-0:");

dialogLaunchTimes = dialogLaunchTimes.replaceAll(":[0-9][0-9]*" + "y" + currentYear + "-", ":");
dialogLaunchTimes = dialogLaunchTimes != null ? dialogLaunchTimes.replaceAll(":[0-9][0-9]*" + "y" + currentYear + "-", ":") : ":0y0-0:";
if (currentYear > 0) {
currentDay = (short) (currentDay % YEAR_IN_DAYS);
for (short s = currentDay; s < YEAR_IN_DAYS; s++) {
Expand Down
17 changes: 1 addition & 16 deletions library/src/main/java/com/vorlonsoft/android/rate/StoreType.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,45 +22,33 @@
* @author Shintaro Katafuchi
*/

@SuppressWarnings("WeakerAccess")
public class StoreType {
/** Amazon Appstore */
@SuppressWarnings("WeakerAccess")
public static final int AMAZON = 0;
/** Apple App Store */
@SuppressWarnings("WeakerAccess")
public static final int APPLE = 1;
/** Cafe Bazaar */
@SuppressWarnings("WeakerAccess")
public static final int BAZAAR = 2;
/** BlackBerry World */
@SuppressWarnings("WeakerAccess")
public static final int BLACKBERRY = 3;
/** 19 chinese app stores */
@SuppressWarnings("WeakerAccess")
public static final int CHINESESTORES = 4;
/** Google Play */
@SuppressWarnings("WeakerAccess")
public static final int GOOGLEPLAY = 5;
/** Mi Appstore (Xiaomi Market) */
@SuppressWarnings("WeakerAccess")
public static final int MI = 6;
/** Samsung Galaxy Apps */
@SuppressWarnings("WeakerAccess")
public static final int SAMSUNG = 7;
/** SlideME Marketplace */
@SuppressWarnings("WeakerAccess")
public static final int SLIDEME = 8;
/** Tencent App Store */
@SuppressWarnings("WeakerAccess")
public static final int TENCENT = 9;
/** Yandex.Store */
@SuppressWarnings("WeakerAccess")
public static final int YANDEX = 10;
/** Any custom intents */
@SuppressWarnings("WeakerAccess")
public static final int INTENT = 11;
/** Any other Store */
@SuppressWarnings("WeakerAccess")
public static final int OTHER = 12;

private StoreType() {
Expand All @@ -73,7 +61,6 @@ private StoreType() {
* constants: AMAZON, BAZAAR, CHINESESTORES, GOOGLEPLAY, MI, SAMSUNG, SLIDEME, TENCENT,
* YANDEX.</p>
*/
@SuppressWarnings("WeakerAccess")
@Documented
@Retention(SOURCE)
@IntDef({
Expand All @@ -95,7 +82,6 @@ private StoreType() {
* <p>Annotated element, represents a logical type and its value should be one of the following
* constants: APPLE, BLACKBERRY.</p>
*/
@SuppressWarnings("WeakerAccess")
@Documented
@Retention(SOURCE)
@IntDef({
Expand All @@ -111,7 +97,6 @@ private StoreType() {
* constants: AMAZON, APPLE, BAZAAR, BLACKBERRY, CHINESESTORES, GOOGLEPLAY, INTENT, MI, OTHER,
* SAMSUNG, SLIDEME, TENCENT, YANDEX.</p>
*/
@SuppressWarnings("WeakerAccess")
@Documented
@Retention(SOURCE)
@IntDef({
Expand Down
Loading

0 comments on commit cc68312

Please sign in to comment.