<commit_before>package com.oasisfeng.android.databinding.adapters;

import android.databinding.BindingAdapter;
import android.support.annotation.MenuRes;
import android.support.v7.widget.ActionMenuView;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuInflater;

import static android.os.Build.VERSION.SDK_INT;
import static android.os.Build.VERSION_CODES.LOLLIPOP;

/**
 * Binding adapter for menu in {@link Toolbar} and {@link ActionMenuView} (support-v7 version)
 *
 * Created by Oasis on 2016/12/28.
 */
public class SupportMenuBindingAdapter {

	@BindingAdapter("menu") public static void inflateMenu(final Toolbar toolbar, final @MenuRes int old_menu, final @MenuRes int new_menu) {
		if (SDK_INT < LOLLIPOP) return;
		if (new_menu == old_menu) return;
		final Menu menu = toolbar.getMenu();
		menu.clear();
		toolbar.inflateMenu(new_menu);
	}

	@BindingAdapter("menu") public static void inflateMenu(final ActionMenuView amv, final @MenuRes int old_menu, final @MenuRes int new_menu) {
		if (SDK_INT < LOLLIPOP) return;
		if (new_menu == old_menu) return;<commit_msg>FIX: SupportMenuBindingAdapter is not working on Android 4.x.<commit_after>package com.oasisfeng.android.databinding.adapters;

import android.databinding.BindingAdapter;
import android.support.annotation.MenuRes;
import android.support.v7.widget.ActionMenuView;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuInflater;

/**
 * Binding adapter for menu in {@link Toolbar} and {@link ActionMenuView} (support-v7 version)
 *
 * Created by Oasis on 2016/12/28.
 */
public class SupportMenuBindingAdapter {

	@BindingAdapter("menu") public static void inflateMenu(final Toolbar toolbar, final @MenuRes int old_menu, final @MenuRes int new_menu) {
		if (new_menu == old_menu) return;
		final Menu menu = toolbar.getMenu();
		menu.clear();
		toolbar.inflateMenu(new_menu);
	}

	@BindingAdapter("menu") public static void inflateMenu(final ActionMenuView amv, final @MenuRes int old_menu, final @MenuRes int new_menu) {
		if (new_menu == old_menu) return;
{'fraction_non_alphanumeric': 0.104739336492891, 'fraction_numerical': 0.010900473933649289, 'mean_word_length': 5.617554858934169, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1378833', 'n_tokens_mistral': 699, 'n_tokens_neox': 650, 'n_words': 176}