dynamite8 / resources-android-dev

Collection of resources for becoming an Android developer
7 stars 7 forks source link

Code Cleanup in various classes and XML files #142

Closed JaeW closed 6 years ago

JaeW commented 6 years ago

Post code-review, the following changes need to be made:

  1. In the manifest.xml file: the code supporting version 4.0 and earlier which defines parent activity can be deleted as our minimum api is 21 (Android 5.0)
  2. In MainActivity.java, the method onStickyClicked(String string) is unnecessary. Move this code into the onTopicItemClick() method.
  3. In MainActivity.java: In onCreateOptionsMenu(Menu menu), instead of calling return Super.onCreateOptionsMenu(menu); simplify by calling return true;
  4. In ResourceListActivity.java: Remove log statements as they are expensive memory-wise in the final APK.
  5. In ResourceListActivity.java: call isConnected() from Utilities class and alert user with Toast that they need to enable a connection instead of the generic toast message in the catch block
  6. In ResourceListAdapter.java: In the onBindViewHolder() method, there is a setTag call to add the resourceId to the viewholder's tag property which is never retrieved. Remove this line.
  7. In ResourceListAdapter.java: In the onBindViewHolder() method, the resourceFormat if/else block would be cleaner and more readable as a switch case block.