]> gitweb.fperrin.net Git - Dictionary.git/blobdiff - src/com/hughes/android/dictionary/DictionaryActivity.java
Fix some code inspection warnings.
[Dictionary.git] / src / com / hughes / android / dictionary / DictionaryActivity.java
index 3062b7249a14e2c4f4ab31b6d98bcd76a37ef628..0637f165ff275410e30c3b8f365fced678ee3291 100644 (file)
@@ -1285,7 +1285,7 @@ public class DictionaryActivity extends AppCompatActivity {
             Log.d(LOG, "Trying to hide soft keyboard.");
             final InputMethodManager inputManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
             View focus = getCurrentFocus();
-            if (focus != null) {
+            if (inputManager != null && focus != null) {
                 inputManager.hideSoftInputFromWindow(focus.getWindowToken(),
                                                      InputMethodManager.HIDE_NOT_ALWAYS);
             }
@@ -1436,7 +1436,7 @@ public class DictionaryActivity extends AppCompatActivity {
                     Log.d(LOG, "interrupted, skipping searchFinished.");
                 }
             } catch (Exception e) {
-                Log.e(LOG, "Failure during search (can happen during Activity close.");
+                Log.e(LOG, "Failure during search (can happen during Activity close): " + e.getMessage());
             } finally {
                 synchronized (this) {
                     done = true;
@@ -1501,7 +1501,7 @@ public class DictionaryActivity extends AppCompatActivity {
                 DisplayMetrics dm = new DisplayMetrics();
                 getWindowManager().getDefaultDisplay().getMetrics(dm);
                 scale = dm.density;
-            } catch (NullPointerException e)
+            } catch (NullPointerException ignored)
             {}
             // Convert the dps to pixels, based on density scale
             mPaddingDefault = (int) (PADDING_DEFAULT_DP * scale + 0.5f);