From e0e32b52b3d62e5f779b398c2e701f0b1de477fd Mon Sep 17 00:00:00 2001 From: ayman abdelghany Date: Fri, 20 May 2016 15:22:11 +0200 Subject: [PATCH] Dead stores should be removed --- .../com/integreight/firmatabluetooth/ArduinoFirmata.java | 6 +++--- .../main/java/com/integreight/firmatabluetooth/Jodem.java | 4 ++-- .../com/integreight/onesheeld/OneSheeldApplication.java | 2 +- .../onesheeld/adapters/MediaAudioFilesListAdapter.java | 2 +- .../onesheeld/adapters/MusicPlayListAdapter.java | 2 +- .../onesheeld/adapters/SelectedShieldsListAdapter.java | 2 +- .../integreight/onesheeld/adapters/ShieldsListAdapter.java | 2 +- .../onesheeld/adapters/TerminalLinesAdapter.java | 2 +- .../com/integreight/onesheeld/appFragments/SheeldsList.java | 2 +- .../main/java/com/integreight/onesheeld/enums/UIShield.java | 2 -- .../onesheeld/shields/controller/CameraShield.java | 1 - .../onesheeld/shields/controller/ClockShield.java | 1 - .../onesheeld/shields/controller/ColorDetectionShield.java | 2 +- .../onesheeld/shields/controller/GlcdShield.java | 2 +- .../onesheeld/shields/controller/InternetShield.java | 2 +- .../shields/controller/utils/CameraHeadService.java | 2 +- .../onesheeld/shields/controller/utils/CameraUtils.java | 4 ++-- .../onesheeld/shields/controller/utils/FoursquareUtils.java | 2 +- .../onesheeld/shields/controller/utils/ImageUtils.java | 1 - .../onesheeld/shields/controller/utils/SmsListener.java | 2 +- .../onesheeld/shields/controller/utils/TwitterDialog.java | 2 +- .../onesheeld/shields/fragments/KeyboardFragment.java | 2 +- .../onesheeld/utils/customviews/AutoResizeTextView.java | 2 +- .../onesheeld/utils/customviews/LockPatternViewEx.java | 2 +- .../main/java/com/viewpagerindicator/IcsLinearLayout.java | 4 ++-- .../configuration/xml/ExtendedXmlConfigParserFactory.java | 2 +- .../library/GoogleStyleProgressLayoutFactory.java | 4 ++-- .../pulltorefresh/library/GoogleStyleViewLayoutFactory.java | 4 ++-- .../pulltorefresh/library/IndicatorLayoutFactory.java | 4 ++-- .../pulltorefresh/library/LoadingLayoutFactory.java | 4 ++-- .../handmark/pulltorefresh/library/PullToRefreshBase.java | 2 +- 31 files changed, 36 insertions(+), 41 deletions(-) diff --git a/oneSheeld/src/main/java/com/integreight/firmatabluetooth/ArduinoFirmata.java b/oneSheeld/src/main/java/com/integreight/firmatabluetooth/ArduinoFirmata.java index 6d0602223..856c6732d 100644 --- a/oneSheeld/src/main/java/com/integreight/firmatabluetooth/ArduinoFirmata.java +++ b/oneSheeld/src/main/java/com/integreight/firmatabluetooth/ArduinoFirmata.java @@ -442,7 +442,7 @@ private void processInput(byte inputData) { System.arraycopy(storedInputData, 1, sysexData, 0, sysexBytesRead - 1); - byte[] fixedSysexData = null; + byte[] fixedSysexData; if (sysexData.length % 2 == 0) { fixedSysexData = new byte[sysexData.length / 2]; for (int i = 0; i < sysexData.length; i += 2) { @@ -585,7 +585,7 @@ public void sendShieldFrame(ShieldFrame frame, boolean waitIfInACallback) { return; } - boolean inACallback = false; + boolean inACallback; synchronized (arduinoCallbacksLock) { inACallback = isInACallback; @@ -803,7 +803,7 @@ private void callbackExited() { exitingCallbacksThread = new Thread(new Runnable() { @Override public void run() { - boolean sent = false; + boolean sent; while (queuedFrames != null && !queuedFrames.isEmpty()) { sent = false; // boolean isInCallback; diff --git a/oneSheeld/src/main/java/com/integreight/firmatabluetooth/Jodem.java b/oneSheeld/src/main/java/com/integreight/firmatabluetooth/Jodem.java index 0bda89126..0b7973b33 100644 --- a/oneSheeld/src/main/java/com/integreight/firmatabluetooth/Jodem.java +++ b/oneSheeld/src/main/java/com/integreight/firmatabluetooth/Jodem.java @@ -183,7 +183,7 @@ private boolean sendFile(byte[] fileArray, int length, int retry) throws Interru int error_count = 0; - int crc_mode = 0; + int crc_mode; int cancel = 0; int crc; while (true) { @@ -220,7 +220,7 @@ private boolean sendFile(byte[] fileArray, int length, int retry) throws Interru byte sequence = 1; while (true) { byte[] data = new byte[packet_size]; - int readCount = 0; + int readCount; readCount = stream.read(data, 0, packet_size); if (readCount <= 0) { Log.d("bootloader", "sending EOT"); diff --git a/oneSheeld/src/main/java/com/integreight/onesheeld/OneSheeldApplication.java b/oneSheeld/src/main/java/com/integreight/onesheeld/OneSheeldApplication.java index 5645b9fbf..65f2f6c69 100644 --- a/oneSheeld/src/main/java/com/integreight/onesheeld/OneSheeldApplication.java +++ b/oneSheeld/src/main/java/com/integreight/onesheeld/OneSheeldApplication.java @@ -259,7 +259,7 @@ private void parseSocialKeys() { } public String loadData(String inFile) throws IOException { - String tContents = ""; + String tContents; InputStream stream = getAssets().open(inFile); int size = stream.available(); byte[] buffer = new byte[size]; diff --git a/oneSheeld/src/main/java/com/integreight/onesheeld/adapters/MediaAudioFilesListAdapter.java b/oneSheeld/src/main/java/com/integreight/onesheeld/adapters/MediaAudioFilesListAdapter.java index e2ac75974..9a4446f99 100644 --- a/oneSheeld/src/main/java/com/integreight/onesheeld/adapters/MediaAudioFilesListAdapter.java +++ b/oneSheeld/src/main/java/com/integreight/onesheeld/adapters/MediaAudioFilesListAdapter.java @@ -48,7 +48,7 @@ public long getItemId(int position) { public View getView(final int position, View convertView, final ViewGroup parent) { View row = convertView; - Holder holder = null; + Holder holder; if (row == null) { row = inflater.inflate(R.layout.music_row, parent, false); diff --git a/oneSheeld/src/main/java/com/integreight/onesheeld/adapters/MusicPlayListAdapter.java b/oneSheeld/src/main/java/com/integreight/onesheeld/adapters/MusicPlayListAdapter.java index 3433db422..56fbe8870 100644 --- a/oneSheeld/src/main/java/com/integreight/onesheeld/adapters/MusicPlayListAdapter.java +++ b/oneSheeld/src/main/java/com/integreight/onesheeld/adapters/MusicPlayListAdapter.java @@ -48,7 +48,7 @@ public long getItemId(int position) { public View getView(final int position, View convertView, final ViewGroup parent) { View row = convertView; - Holder holder = null; + Holder holder; if (row == null) { row = inflater.inflate(R.layout.music_row, parent, false); diff --git a/oneSheeld/src/main/java/com/integreight/onesheeld/adapters/SelectedShieldsListAdapter.java b/oneSheeld/src/main/java/com/integreight/onesheeld/adapters/SelectedShieldsListAdapter.java index e2d74ffcf..d2cdea46e 100644 --- a/oneSheeld/src/main/java/com/integreight/onesheeld/adapters/SelectedShieldsListAdapter.java +++ b/oneSheeld/src/main/java/com/integreight/onesheeld/adapters/SelectedShieldsListAdapter.java @@ -54,7 +54,7 @@ public long getItemId(int position) { public View getView(final int position, View convertView, final ViewGroup parent) { View row = convertView; - Holder holder = null; + Holder holder; if (row == null) { row = inflater.inflate(R.layout.selected_shields_list_item, parent, diff --git a/oneSheeld/src/main/java/com/integreight/onesheeld/adapters/ShieldsListAdapter.java b/oneSheeld/src/main/java/com/integreight/onesheeld/adapters/ShieldsListAdapter.java index d86f899a9..ef00f25c4 100644 --- a/oneSheeld/src/main/java/com/integreight/onesheeld/adapters/ShieldsListAdapter.java +++ b/oneSheeld/src/main/java/com/integreight/onesheeld/adapters/ShieldsListAdapter.java @@ -59,7 +59,7 @@ public long getItemId(int position) { public View getView(final int position, View convertView, final ViewGroup parent) { View row = convertView; - Holder holder = null; + Holder holder; if (row == null) { row = inflater.inflate(R.layout.shield_list_item, parent, false); diff --git a/oneSheeld/src/main/java/com/integreight/onesheeld/adapters/TerminalLinesAdapter.java b/oneSheeld/src/main/java/com/integreight/onesheeld/adapters/TerminalLinesAdapter.java index 59d600b44..ba3c86561 100644 --- a/oneSheeld/src/main/java/com/integreight/onesheeld/adapters/TerminalLinesAdapter.java +++ b/oneSheeld/src/main/java/com/integreight/onesheeld/adapters/TerminalLinesAdapter.java @@ -76,7 +76,7 @@ public void updateLines(List lines) { public View getView(final int position, View convertView, final ViewGroup parent) { View row = convertView; - Holder holder = null; + Holder holder; if (row == null) { row = inflater.inflate(R.layout.terminal_printed_line, parent, diff --git a/oneSheeld/src/main/java/com/integreight/onesheeld/appFragments/SheeldsList.java b/oneSheeld/src/main/java/com/integreight/onesheeld/appFragments/SheeldsList.java index e872aa121..d499ef715 100644 --- a/oneSheeld/src/main/java/com/integreight/onesheeld/appFragments/SheeldsList.java +++ b/oneSheeld/src/main/java/com/integreight/onesheeld/appFragments/SheeldsList.java @@ -488,7 +488,7 @@ public boolean onOptionsItemSelected(MenuItem item) { private void showAboutDialog() { // TODO Auto-generated method stub - String stringDate = null; + String stringDate; try { ApplicationInfo ai = activity.getPackageManager() .getApplicationInfo(activity.getPackageName(), 0); diff --git a/oneSheeld/src/main/java/com/integreight/onesheeld/enums/UIShield.java b/oneSheeld/src/main/java/com/integreight/onesheeld/enums/UIShield.java index 29f972cd2..f8f27ea33 100644 --- a/oneSheeld/src/main/java/com/integreight/onesheeld/enums/UIShield.java +++ b/oneSheeld/src/main/java/com/integreight/onesheeld/enums/UIShield.java @@ -226,14 +226,12 @@ public int compare(UIShield lhs, UIShield rhs) { return lhs.getName().compareToIgnoreCase(rhs.getName()); } }); - vals = null; final ArrayList ret = new ArrayList(); for (UIShield uiShield : valsFiltered) { uiShield.itemBackgroundColor = colors[ret.size()]; ret.add(uiShield); } valsFiltered.clear(); - valsFiltered = null; return ret; } diff --git a/oneSheeld/src/main/java/com/integreight/onesheeld/shields/controller/CameraShield.java b/oneSheeld/src/main/java/com/integreight/onesheeld/shields/controller/CameraShield.java index 3b7b31050..a0d7e635e 100644 --- a/oneSheeld/src/main/java/com/integreight/onesheeld/shields/controller/CameraShield.java +++ b/oneSheeld/src/main/java/com/integreight/onesheeld/shields/controller/CameraShield.java @@ -83,7 +83,6 @@ public void handleMessage(Message msg) { if (img.exists() && eventHandler != null) { eventHandler.updatePreviewButton(lastImageAbsoultePath); } - img = null; } super.handleMessage(msg); } diff --git a/oneSheeld/src/main/java/com/integreight/onesheeld/shields/controller/ClockShield.java b/oneSheeld/src/main/java/com/integreight/onesheeld/shields/controller/ClockShield.java index 23237be88..7af9bc20f 100644 --- a/oneSheeld/src/main/java/com/integreight/onesheeld/shields/controller/ClockShield.java +++ b/oneSheeld/src/main/java/com/integreight/onesheeld/shields/controller/ClockShield.java @@ -292,7 +292,6 @@ public void onReceive(Context context, Intent intent) { calendar.get(Calendar.AM_PM) == Calendar.AM); calendar = null; - frame = null; // set new time } }; diff --git a/oneSheeld/src/main/java/com/integreight/onesheeld/shields/controller/ColorDetectionShield.java b/oneSheeld/src/main/java/com/integreight/onesheeld/shields/controller/ColorDetectionShield.java index bc1898ec9..25c60da38 100644 --- a/oneSheeld/src/main/java/com/integreight/onesheeld/shields/controller/ColorDetectionShield.java +++ b/oneSheeld/src/main/java/com/integreight/onesheeld/shields/controller/ColorDetectionShield.java @@ -435,7 +435,7 @@ public void setColorType(COLOR_TYPE colorType) { } int getColorInRange(int color, ColorPalette palette) { - int i = 0; + int i; if (palette.isGrayscale) { i = palette.getNumberOfBits(); int grayscale = (Color.red(color) + Color.green(color) + Color diff --git a/oneSheeld/src/main/java/com/integreight/onesheeld/shields/controller/GlcdShield.java b/oneSheeld/src/main/java/com/integreight/onesheeld/shields/controller/GlcdShield.java index 3c9bb6439..1c4fec467 100644 --- a/oneSheeld/src/main/java/com/integreight/onesheeld/shields/controller/GlcdShield.java +++ b/oneSheeld/src/main/java/com/integreight/onesheeld/shields/controller/GlcdShield.java @@ -1315,7 +1315,7 @@ public void sendTouch(byte shapeType, int key, byte state, int value) { boolean sendFrame = false; public synchronized boolean doOrder(int order, List params) { - Integer BgColor = WHITE, key = 0, action = 0, touchId = 0, startX = 0, startY = 0, finalX = 0, finalY = 0; + Integer BgColor = WHITE, key, action, touchId, startX, startY, finalX, finalY; switch (order) { case ORDER_SETTOUCH: diff --git a/oneSheeld/src/main/java/com/integreight/onesheeld/shields/controller/InternetShield.java b/oneSheeld/src/main/java/com/integreight/onesheeld/shields/controller/InternetShield.java index c48309601..b9ffaca6f 100644 --- a/oneSheeld/src/main/java/com/integreight/onesheeld/shields/controller/InternetShield.java +++ b/oneSheeld/src/main/java/com/integreight/onesheeld/shields/controller/InternetShield.java @@ -301,7 +301,7 @@ else if (sourceFolderId == CameraUtils.FROM_CAMERA_FOLDER) //////// INTERNET case INTERNET.GET_REQUEST: requestID = frame.getArgumentAsInteger(0); - InternetManager.EXECUTION_TYPE getExecutionType = null; + InternetManager.EXECUTION_TYPE getExecutionType; try { getExecutionType = InternetManager.getInstance().execute(requestID, InternetManager.REQUEST_TYPE.GET, frame.getArgument(1)[0]); //request excutes only in case of success diff --git a/oneSheeld/src/main/java/com/integreight/onesheeld/shields/controller/utils/CameraHeadService.java b/oneSheeld/src/main/java/com/integreight/onesheeld/shields/controller/utils/CameraHeadService.java index 66bff7120..f9bb2947a 100644 --- a/oneSheeld/src/main/java/com/integreight/onesheeld/shields/controller/utils/CameraHeadService.java +++ b/oneSheeld/src/main/java/com/integreight/onesheeld/shields/controller/utils/CameraHeadService.java @@ -436,7 +436,7 @@ private Camera openFrontFacingCameraGingerbread() { mCamera.stopPreview(); mCamera.release(); } - int cameraCount = 0; + int cameraCount; Camera cam = null; Camera.CameraInfo cameraInfo = new Camera.CameraInfo(); cameraCount = Camera.getNumberOfCameras(); diff --git a/oneSheeld/src/main/java/com/integreight/onesheeld/shields/controller/utils/CameraUtils.java b/oneSheeld/src/main/java/com/integreight/onesheeld/shields/controller/utils/CameraUtils.java index 3070f6674..2d6019e61 100644 --- a/oneSheeld/src/main/java/com/integreight/onesheeld/shields/controller/utils/CameraUtils.java +++ b/oneSheeld/src/main/java/com/integreight/onesheeld/shields/controller/utils/CameraUtils.java @@ -102,7 +102,7 @@ public static String getLastCapturedImagePathFromCameraFolder( MediaStore.Images.Media.EXTERNAL_CONTENT_URI, imageColumns, null, null, imageOrderBy); imageCursor.moveToFirst(); - String fullPath = null; + String fullPath; if (imageCursor.getCount() == 0) return null; do { @@ -128,7 +128,7 @@ public static String getLastCapturedImagePathFromOneSheeldFolderInMediaStore( MediaStore.Images.Media.DATA + " like ? ", new String[]{"%OneSheeld%"}, imageOrderBy); imageCursor.moveToFirst(); - String fullPath = null; + String fullPath; if (imageCursor.getCount() == 0) return null; do { diff --git a/oneSheeld/src/main/java/com/integreight/onesheeld/shields/controller/utils/FoursquareUtils.java b/oneSheeld/src/main/java/com/integreight/onesheeld/shields/controller/utils/FoursquareUtils.java index df7b5c688..6e29ab67d 100644 --- a/oneSheeld/src/main/java/com/integreight/onesheeld/shields/controller/utils/FoursquareUtils.java +++ b/oneSheeld/src/main/java/com/integreight/onesheeld/shields/controller/utils/FoursquareUtils.java @@ -161,7 +161,7 @@ public static String openUrl(String url, String method, Bundle params) os.flush(); } - String response = ""; + String response; try { response = read(conn.getInputStream()); } catch (FileNotFoundException e) { diff --git a/oneSheeld/src/main/java/com/integreight/onesheeld/shields/controller/utils/ImageUtils.java b/oneSheeld/src/main/java/com/integreight/onesheeld/shields/controller/utils/ImageUtils.java index 8bdcf106f..c6ecbedaa 100644 --- a/oneSheeld/src/main/java/com/integreight/onesheeld/shields/controller/utils/ImageUtils.java +++ b/oneSheeld/src/main/java/com/integreight/onesheeld/shields/controller/utils/ImageUtils.java @@ -103,7 +103,6 @@ public static Bitmap decodeBitmap(byte[] data, Matrix matrix) { bitmap.getHeight(), matrix, true); if (matrix != null) matrix.reset(); - matrix = null; System.gc(); return bitmap; diff --git a/oneSheeld/src/main/java/com/integreight/onesheeld/shields/controller/utils/SmsListener.java b/oneSheeld/src/main/java/com/integreight/onesheeld/shields/controller/utils/SmsListener.java index de5780c33..32977ae0c 100644 --- a/oneSheeld/src/main/java/com/integreight/onesheeld/shields/controller/utils/SmsListener.java +++ b/oneSheeld/src/main/java/com/integreight/onesheeld/shields/controller/utils/SmsListener.java @@ -17,7 +17,7 @@ public void onReceive(Context context, Intent intent) { .equals("android.provider.Telephony.SMS_RECEIVED")) { Bundle bundle = intent.getExtras(); // ---get the SMS message passed // in--- - SmsMessage[] msgs = null; + SmsMessage[] msgs; String msg_from = ""; String msgBody = ""; if (bundle != null) { diff --git a/oneSheeld/src/main/java/com/integreight/onesheeld/shields/controller/utils/TwitterDialog.java b/oneSheeld/src/main/java/com/integreight/onesheeld/shields/controller/utils/TwitterDialog.java index dd57ee421..4bd41de87 100644 --- a/oneSheeld/src/main/java/com/integreight/onesheeld/shields/controller/utils/TwitterDialog.java +++ b/oneSheeld/src/main/java/com/integreight/onesheeld/shields/controller/utils/TwitterDialog.java @@ -248,7 +248,7 @@ public void showHTML(String html) throws TwitterException { } String pinCode = null; - String name = null; + String name; String endSearchList = ""; String startSearchList = ""; diff --git a/oneSheeld/src/main/java/com/integreight/onesheeld/shields/fragments/KeyboardFragment.java b/oneSheeld/src/main/java/com/integreight/onesheeld/shields/fragments/KeyboardFragment.java index bca0c2792..658f819b2 100644 --- a/oneSheeld/src/main/java/com/integreight/onesheeld/shields/fragments/KeyboardFragment.java +++ b/oneSheeld/src/main/java/com/integreight/onesheeld/shields/fragments/KeyboardFragment.java @@ -191,7 +191,7 @@ private void hideDefaultKeyboard() { private void addText(View v) { if (isEdit1 == true) { - String b = ""; + String b; b = (String) v.getTag(); if (b != null) { // adding text in Edittext diff --git a/oneSheeld/src/main/java/com/integreight/onesheeld/utils/customviews/AutoResizeTextView.java b/oneSheeld/src/main/java/com/integreight/onesheeld/utils/customviews/AutoResizeTextView.java index 07cd69ec6..6e23b662e 100644 --- a/oneSheeld/src/main/java/com/integreight/onesheeld/utils/customviews/AutoResizeTextView.java +++ b/oneSheeld/src/main/java/com/integreight/onesheeld/utils/customviews/AutoResizeTextView.java @@ -252,7 +252,7 @@ private static int binarySearch(int start, int end, SizeTester sizeTester, int lastBest = start; int lo = start; int hi = end - 1; - int mid = 0; + int mid; while (lo <= hi) { mid = (lo + hi) >>> 1; int midValCmp = sizeTester.onTestSize(mid, availableSpace); diff --git a/oneSheeld/src/main/java/com/integreight/onesheeld/utils/customviews/LockPatternViewEx.java b/oneSheeld/src/main/java/com/integreight/onesheeld/utils/customviews/LockPatternViewEx.java index 104a4f52d..5a1d3fa02 100644 --- a/oneSheeld/src/main/java/com/integreight/onesheeld/utils/customviews/LockPatternViewEx.java +++ b/oneSheeld/src/main/java/com/integreight/onesheeld/utils/customviews/LockPatternViewEx.java @@ -506,7 +506,7 @@ protected void onSizeChanged(int w, int h, int oldw, int oldh) { } private int resolveMeasured(int measureSpec, int desired) { - int result = 0; + int result; int specSize = MeasureSpec.getSize(measureSpec); switch (MeasureSpec.getMode(measureSpec)) { case MeasureSpec.UNSPECIFIED: diff --git a/pagerIndicator/src/main/java/com/viewpagerindicator/IcsLinearLayout.java b/pagerIndicator/src/main/java/com/viewpagerindicator/IcsLinearLayout.java index cbf619e42..90ab66dd6 100644 --- a/pagerIndicator/src/main/java/com/viewpagerindicator/IcsLinearLayout.java +++ b/pagerIndicator/src/main/java/com/viewpagerindicator/IcsLinearLayout.java @@ -113,7 +113,7 @@ private void drawDividersVertical(Canvas canvas) { if (hasDividerBeforeChildAt(count)) { final View child = getChildAt(count - 1); - int bottom = 0; + int bottom; if (child == null) { bottom = getHeight() - getPaddingBottom() - mDividerHeight; } else { @@ -140,7 +140,7 @@ private void drawDividersHorizontal(Canvas canvas) { if (hasDividerBeforeChildAt(count)) { final View child = getChildAt(count - 1); - int right = 0; + int right; if (child == null) { right = getWidth() - getPaddingRight() - mDividerWidth; } else { diff --git a/pullToRefreshlibrary/src/main/java/com/handmark/pulltorefresh/configuration/xml/ExtendedXmlConfigParserFactory.java b/pullToRefreshlibrary/src/main/java/com/handmark/pulltorefresh/configuration/xml/ExtendedXmlConfigParserFactory.java index 66901bec4..bdecfcc30 100644 --- a/pullToRefreshlibrary/src/main/java/com/handmark/pulltorefresh/configuration/xml/ExtendedXmlConfigParserFactory.java +++ b/pullToRefreshlibrary/src/main/java/com/handmark/pulltorefresh/configuration/xml/ExtendedXmlConfigParserFactory.java @@ -48,7 +48,7 @@ class ExtendedConfigXmlParserFactory { */ public static XmlPullParser createParser(Context context) { AssetManager am = context.getAssets(); - XmlPullParser parser = null; + XmlPullParser parser; try { InputStream is = am.open(XML_PATH_IN_ASSETS); parser = XmlPullParserFactory.newInstance().newPullParser(); diff --git a/pullToRefreshlibrary/src/main/java/com/handmark/pulltorefresh/library/GoogleStyleProgressLayoutFactory.java b/pullToRefreshlibrary/src/main/java/com/handmark/pulltorefresh/library/GoogleStyleProgressLayoutFactory.java index d5d677459..1edb27274 100644 --- a/pullToRefreshlibrary/src/main/java/com/handmark/pulltorefresh/library/GoogleStyleProgressLayoutFactory.java +++ b/pullToRefreshlibrary/src/main/java/com/handmark/pulltorefresh/library/GoogleStyleProgressLayoutFactory.java @@ -54,7 +54,7 @@ public static Class createGoogleStyleProgre @SuppressWarnings("unchecked") public static Class createGoogleStyleProgressLayoutClazz( String clazzName) { - Class googleStyleProgressLayoutClazz = null; + Class googleStyleProgressLayoutClazz; if ( clazzName == null ) { googleStyleProgressLayoutClazz = DefaultGoogleStyleProgressLayoutFactory.createGoogleStyleProgressLayoutClazz(clazzName); return googleStyleProgressLayoutClazz; @@ -88,7 +88,7 @@ public static GoogleStyleProgressLayout createGoogleStyleProgressLayout(String l */ public static GoogleStyleProgressLayout createGoogleStyleProgressLayout( Class clazz, Context context, TypedArray attrs) { - GoogleStyleProgressLayout layout = null; + GoogleStyleProgressLayout layout; // Prevent NullPointerException if ( clazz == null ) { Log.i(LOG_TAG, "The Class token of the GoogleStyleProgressLayout is missing. Default google style progress layout will be used."); diff --git a/pullToRefreshlibrary/src/main/java/com/handmark/pulltorefresh/library/GoogleStyleViewLayoutFactory.java b/pullToRefreshlibrary/src/main/java/com/handmark/pulltorefresh/library/GoogleStyleViewLayoutFactory.java index e7e8832d4..e915ef0fe 100644 --- a/pullToRefreshlibrary/src/main/java/com/handmark/pulltorefresh/library/GoogleStyleViewLayoutFactory.java +++ b/pullToRefreshlibrary/src/main/java/com/handmark/pulltorefresh/library/GoogleStyleViewLayoutFactory.java @@ -56,7 +56,7 @@ public static Class createGoogleStyleViewLayout @SuppressWarnings("unchecked") public static Class createGoogleStyleViewLayoutClazz( String clazzName) { - Class googleStyleViewLayoutClazz = null; + Class googleStyleViewLayoutClazz; if ( clazzName == null ) { googleStyleViewLayoutClazz = DefaultGoogleStyleViewLayoutFactory.createGoogleStyleViewLayoutClazz(clazzName); return googleStyleViewLayoutClazz; @@ -90,7 +90,7 @@ public static GoogleStyleViewLayout createGoogleStyleViewLayout(String layoutCod */ public static GoogleStyleViewLayout createGoogleStyleViewLayout( Class clazz, Context context, TypedArray attrs) { - GoogleStyleViewLayout layout = null; + GoogleStyleViewLayout layout; // Prevent NullPointerException if ( clazz == null ) { Log.i(LOG_TAG, "The Class token of the GoogleStyleViewLayout is missing. Default google style view layout will be used."); diff --git a/pullToRefreshlibrary/src/main/java/com/handmark/pulltorefresh/library/IndicatorLayoutFactory.java b/pullToRefreshlibrary/src/main/java/com/handmark/pulltorefresh/library/IndicatorLayoutFactory.java index d206a78d1..0d0f864b5 100644 --- a/pullToRefreshlibrary/src/main/java/com/handmark/pulltorefresh/library/IndicatorLayoutFactory.java +++ b/pullToRefreshlibrary/src/main/java/com/handmark/pulltorefresh/library/IndicatorLayoutFactory.java @@ -51,7 +51,7 @@ public static Class createIndicatorLayoutClazzByLayou */ @SuppressWarnings("unchecked") public static Class createIndicatorLayoutClazz(String clazzName) { - Class clazz = null; + Class clazz; if (clazzName == null) { clazz = DefaultIndicatorLayoutFactory.createIndicatorLayoutClazz(clazzName); return clazz; @@ -88,7 +88,7 @@ public static IndicatorLayout createIndicatorLayout(String layoutCode, Context c */ public static IndicatorLayout createIndicatorLayout( Class clazz, Context context, Mode mode) { - IndicatorLayout layout = null; + IndicatorLayout layout; // Prevent NullPointerException if ( clazz == null ) { Log.i(LOG_TAG, "The Class token of the Indicator Layout is missing. Default Indicator Layout will be used."); diff --git a/pullToRefreshlibrary/src/main/java/com/handmark/pulltorefresh/library/LoadingLayoutFactory.java b/pullToRefreshlibrary/src/main/java/com/handmark/pulltorefresh/library/LoadingLayoutFactory.java index 02b9b0da9..63cec9152 100644 --- a/pullToRefreshlibrary/src/main/java/com/handmark/pulltorefresh/library/LoadingLayoutFactory.java +++ b/pullToRefreshlibrary/src/main/java/com/handmark/pulltorefresh/library/LoadingLayoutFactory.java @@ -57,7 +57,7 @@ public static Class createLoadingLayoutClazzByLayoutCod @SuppressWarnings("unchecked") public static Class createLoadingLayoutClazz( String clazzName) { - Class loadingLayoutClazz = null; + Class loadingLayoutClazz; if ( clazzName == null ) { loadingLayoutClazz = DefaultLoadingLayoutFactory.createLoadingLayoutClazz(clazzName); return loadingLayoutClazz; @@ -95,7 +95,7 @@ public static LoadingLayout createLoadingLayout(String layoutCode, Context conte public static LoadingLayout createLoadingLayout( Class clazz, Context context, Mode mode, Orientation orientation, TypedArray attrs) { - LoadingLayout layout = null; + LoadingLayout layout; // Prevent NullPointerException if ( clazz == null ) { Log.i(LOG_TAG, "The Class token of the Loading Layout is missing. Default Loading Layout will be used."); diff --git a/pullToRefreshlibrary/src/main/java/com/handmark/pulltorefresh/library/PullToRefreshBase.java b/pullToRefreshlibrary/src/main/java/com/handmark/pulltorefresh/library/PullToRefreshBase.java index b854f2f84..b12e34d02 100644 --- a/pullToRefreshlibrary/src/main/java/com/handmark/pulltorefresh/library/PullToRefreshBase.java +++ b/pullToRefreshlibrary/src/main/java/com/handmark/pulltorefresh/library/PullToRefreshBase.java @@ -1633,7 +1633,7 @@ private void initTopViewGroup() { } View view = this.getRootView(); - ViewGroup topViewGroup = null; + ViewGroup topViewGroup; Context context = getContext(); if (view instanceof ViewGroup == false) { Log.w(LOG_TAG, "Current root view is not ViewGroup type. Google Style Pull To Refresh mode will be disabled.");