toolbar NPE fix

This commit is contained in:
veliymolfar 2020-04-17 10:28:05 +03:00
parent d906e35cae
commit 1bb2e1621e

View file

@ -21,6 +21,8 @@ import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.appbar.AppBarLayout;
import net.osmand.AndroidUtils;
import net.osmand.PlatformUtil;
import net.osmand.plus.ApplicationMode;
@ -169,11 +171,10 @@ public class ConfigureMenuItemsFragment extends BaseOsmAndFragment
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable final ViewGroup container, @Nullable Bundle savedInstanceState) {
View root = mInflater.inflate(R.layout.edit_arrangement_list_fragment, container, false);
Toolbar toolbar = root.findViewById(R.id.toolbar);
TextView toolbarTitle = root.findViewById(R.id.toolbar_title);
ImageButton toolbarButton = root.findViewById(R.id.close_button);
RecyclerView recyclerView = root.findViewById(R.id.profiles_list);
recyclerView.setPadding(0, 0, 0, (int) app.getResources().getDimension(R.dimen.dialog_button_ex_min_width));
AppBarLayout appbar = root.findViewById(R.id.appbar);
View toolbar = mInflater.inflate(R.layout.global_preference_toolbar, container, false);
TextView toolbarTitle = toolbar.findViewById(R.id.toolbar_title);
ImageButton toolbarButton = toolbar.findViewById(R.id.close_button);
toolbar.setBackgroundColor(nightMode
? getResources().getColor(R.color.list_background_color_dark)
: getResources().getColor(R.color.list_background_color_light));
@ -188,8 +189,9 @@ public class ConfigureMenuItemsFragment extends BaseOsmAndFragment
exitFragment();
}
});
appbar.addView(toolbar);
RecyclerView recyclerView = root.findViewById(R.id.profiles_list);
recyclerView.setPadding(0, 0, 0, (int) app.getResources().getDimension(R.dimen.dialog_button_ex_min_width));
rearrangeAdapter = new RearrangeMenuItemsAdapter(app, getAdapterItems());
recyclerView.setLayoutManager(new LinearLayoutManager(app));
final ItemTouchHelper touchHelper = new ItemTouchHelper(new ReorderItemTouchHelperCallback(rearrangeAdapter));