Unverified Commit f034fb00 authored by Vitalii Koshura's avatar Vitalii Koshura Committed by GitHub

Merge pull request #3994 from Isira-Seneviratne/Fix_event_log_issue

[Android] Fix onNewIntent() warning in the event log.
parents a7886d9c 1acf4a9f
......@@ -142,9 +142,8 @@ class BOINCActivity : AppCompatActivity() {
if (targetFragId < 0 && savedInstanceState != null) {
targetFragId = savedInstanceState.getInt("navBarSelectionId")
}
val item: NavDrawerItem?
item = if (targetFragId < 0) {
// if non of the above, go to default
val item: NavDrawerItem? = if (targetFragId < 0) {
// if none of the above, go to default
mDrawerListAdapter.getItem(0)
} else {
mDrawerListAdapter.getItemForId(targetFragId)
......@@ -185,12 +184,13 @@ class BOINCActivity : AppCompatActivity() {
if (Logging.DEBUG) {
Log.d(Logging.TAG, "BOINCActivity onNewIntent() for target fragment: $id")
}
val item = mDrawerListAdapter.getItemForId(id)
if (item != null) {
dispatchNavBarOnClick(item, false)
} else if (Logging.WARNING) {
Log.w(Logging.TAG, "onNewIntent: requested target fragment is null, for id: $id")
val item: NavDrawerItem? = if (id < 0) {
// if ID is -1, go to default
mDrawerListAdapter.getItem(0)
} else {
mDrawerListAdapter.getItemForId(id)
}
dispatchNavBarOnClick(item, false)
}
override fun onResume() { // gets called by system every time activity comes to front. after onCreate upon first creation
......
......@@ -29,6 +29,7 @@ import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import org.apache.commons.lang3.StringUtils;
......@@ -87,6 +88,7 @@ public class NavDrawerListAdapter extends BaseAdapter {
return navDrawerItems.get(position).id;
}
@Nullable
public NavDrawerItem getItemForId(int id) {
for(NavDrawerItem item : navDrawerItems) {
if(item.id == id) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment