Java Code Examples for androidx.appcompat.widget.SwitchCompat#setOnCheckedChangeListener()

The following examples show how to use androidx.appcompat.widget.SwitchCompat#setOnCheckedChangeListener() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DragSwipeListActivity.java    From SwipeRecyclerView with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mHeaderView = getLayoutInflater().inflate(R.layout.layout_header_switch, mRecyclerView, false);
    mRecyclerView.addHeaderView(mHeaderView);

    SwitchCompat switchCompat = mHeaderView.findViewById(R.id.switch_compat);
    switchCompat.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            // 控制是否可以侧滑删除。
            mRecyclerView.setItemViewSwipeEnabled(isChecked);
        }
    });

    mRecyclerView.setLongPressDragEnabled(true); // 长按拖拽,默认关闭。
    mRecyclerView.setItemViewSwipeEnabled(false); // 滑动删除,默认关闭。
}
 
Example 2
Source File: SliderContinuousDemoFragment.java    From material-components-android with Apache License 2.0 6 votes vote down vote up
private void setUpSlider(
    View view,
    @IdRes int switchId,
    @IdRes int sliderId,
    @IdRes int valueId,
    final String valueFormat) {
  final TextView sliderValue = view.findViewById(valueId);
  final Slider slider = view.findViewById(sliderId);
  slider.addOnChangeListener(
      (slider1, value, fromUser) -> sliderValue.setText(String.format(valueFormat, value)));
  slider.setValue(slider.getValueFrom());
  SwitchCompat switchButton = view.findViewById(switchId);
  switchButton.setOnCheckedChangeListener(
      (buttonView, isChecked) -> slider.setEnabled(isChecked));
  switchButton.setChecked(true);
}
 
Example 3
Source File: DefineActivity.java    From SwipeRecyclerView with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    View header = getLayoutInflater().inflate(R.layout.layout_header_switch, mRecyclerView, false);
    mRecyclerView.addHeaderView(header);

    SwitchCompat switchCompat = header.findViewById(R.id.switch_compat);
    switchCompat.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            // 控制是否可以侧滑删除。
            mRecyclerView.setItemViewSwipeEnabled(isChecked);
        }
    });

    mRecyclerView.setLongPressDragEnabled(true); // 长按拖拽,默认关闭。
    mRecyclerView.setItemViewSwipeEnabled(false); // 滑动删除,默认关闭。

    // 自定义拖拽控制参数。
    mRecyclerView.setOnItemMovementListener(mItemMovementListener);
}
 
Example 4
Source File: SwitcherFragment.java    From SmartPack-Kernel-Manager with GNU General Public License v3.0 6 votes vote down vote up
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
                         @Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_switcher, container, false);
    if (mTitle != null) {
        ((TextView) view.findViewById(R.id.title)).setText(mTitle);
    }
    if (mSummary != null) {
        ((TextView) view.findViewById(R.id.summary)).setText(mSummary);
    }
    SwitchCompat mSwitch = view.findViewById(R.id.switcher);
    mSwitch.setChecked(mChecked);
    mSwitch.setOnCheckedChangeListener(mOnCheckedChangeListener);
    return view;
}
 
Example 5
Source File: ImageFormatKeyframesFragment.java    From fresco with MIT License 6 votes vote down vote up
@RequiresApi(api = Build.VERSION_CODES.HONEYCOMB)
private void initAnimation(View view) {
  mSimpleDraweeView = (SimpleDraweeView) view.findViewById(R.id.drawee_view);
  mSimpleDraweeView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
  DraweeController controller =
      Fresco.newDraweeControllerBuilder()
          .setOldController(mSimpleDraweeView.getController())
          .setUri(sampleUris().createKeyframesUri())
          .setAutoPlayAnimations(true)
          .build();
  mSimpleDraweeView.setController(controller);

  final SwitchCompat switchBackground = (SwitchCompat) view.findViewById(R.id.switch_background);
  switchBackground.setOnCheckedChangeListener(
      new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
          mSimpleDraweeView
              .getHierarchy()
              .setBackgroundImage(isChecked ? new CheckerBoardDrawable(getResources()) : null);
        }
      });
}
 
Example 6
Source File: SwitcherFragment.java    From MTweaks-KernelAdiutorMOD with GNU General Public License v3.0 6 votes vote down vote up
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater,
                         @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_switcher, container, false);

    String title = getArguments().getString(INTENT_TITLE);
    String summary = getArguments().getString(INTENT_SUMMARY);
    boolean checked = getArguments().getBoolean(INTENT_CHECKED);

    ((TextView) view.findViewById(R.id.title)).setText(title);
    ((TextView) view.findViewById(R.id.summary)).setText(summary);
    SwitchCompat mSwitch = view.findViewById(R.id.switcher);
    mSwitch.setChecked(checked);
    mSwitch.setOnCheckedChangeListener(mOnCheckedChangeListener);
    return view;
}
 
Example 7
Source File: ProfileFragment.java    From MTweaks-KernelAdiutorMOD with GNU General Public License v3.0 5 votes vote down vote up
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater,
                         @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_apply_on_boot, container, false);

    ((TextView) rootView.findViewById(R.id.title)).setText(getString(R.string.profile_tasker_toast));
    SwitchCompat switchCompat = rootView.findViewById(R.id.switcher);
    switchCompat.setChecked(AppSettings.isShowTaskerToast(getActivity()));
    switchCompat.setOnCheckedChangeListener((compoundButton, b)
            -> AppSettings.saveShowTaskerToast(b, getActivity()));

    return rootView;
}
 
Example 8
Source File: RunStopIndicatorPopupWindow.java    From PhoneProfilesPlus with Apache License 2.0 5 votes vote down vote up
RunStopIndicatorPopupWindow(final DataWrapper dataWrapper, final Activity activity) {
    super(R.layout.popup_window_run_stop_indicator, R.string.editor_activity_targetHelps_trafficLightIcon_title, activity);

    // Disable default animation
    //setAnimationStyle(0);

    final TextView textView = popupView.findViewById(R.id.run_stop_indicator_popup_window_important_info);
    textView.setClickable(true);
    textView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intentLaunch = new Intent(activity, ImportantInfoActivity.class);
            intentLaunch.putExtra(ImportantInfoActivity.EXTRA_SHOW_QUICK_GUIDE, false);
            intentLaunch.putExtra(ImportantInfoActivity.EXTRA_SCROLL_TO, R.id.activity_info_notification_event_not_started);
            activity.startActivity(intentLaunch);

            dismiss();
        }
    });

    final SwitchCompat checkBox = popupView.findViewById(R.id.run_stop_indicator_popup_window_checkbox);
    checkBox.setChecked(Event.getGlobalEventsRunning());
    checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) {
            if (dataWrapper != null)
                dataWrapper.runStopEventsWithAlert(activity, checkBox, isChecked);
        }
    });
}
 
Example 9
Source File: SliderDiscreteDemoFragment.java    From material-components-android with Apache License 2.0 5 votes vote down vote up
private void setUpSlider(
    View view, @IdRes int switchId, @IdRes int sliderId, Slider.LabelFormatter labelFormatter) {
  final Slider slider = view.findViewById(sliderId);
  slider.setLabelFormatter(labelFormatter);
  SwitchCompat switchButton = view.findViewById(switchId);
  switchButton.setOnCheckedChangeListener(
      (buttonView, isChecked) -> slider.setEnabled(isChecked));
  switchButton.setChecked(true);
}
 
Example 10
Source File: FolderActivity.java    From syncthing-android with Mozilla Public License 2.0 5 votes vote down vote up
private void addDeviceViewAndSetListener(Device device, LayoutInflater inflater) {
    inflater.inflate(R.layout.item_device_form, mDevicesContainer);
    SwitchCompat deviceView = (SwitchCompat) mDevicesContainer.getChildAt(mDevicesContainer.getChildCount()-1);
    deviceView.setOnCheckedChangeListener(null);
    deviceView.setChecked(mFolder.getDevice(device.deviceID) != null);
    deviceView.setText(device.getDisplayName());
    deviceView.setTag(device);
    deviceView.setOnCheckedChangeListener(mCheckedListener);
}
 
Example 11
Source File: ProfileFragment.java    From SmartPack-Kernel-Manager with GNU General Public License v3.0 5 votes vote down vote up
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
                         @Nullable Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_apply_on_boot, container, false);

    ((TextView) rootView.findViewById(R.id.title)).setText(getString(R.string.profile_tasker_toast));
    SwitchCompat switchCompat = rootView.findViewById(R.id.switcher);
    switchCompat.setChecked(Prefs.getBoolean("showtaskertoast", true, getActivity()));
    switchCompat.setOnCheckedChangeListener((compoundButton, b) -> Prefs.saveBoolean("showtaskertoast", b, getActivity()));

    return rootView;
}
 
Example 12
Source File: EncodingDialog.java    From turbo-editor with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {

    final View view = getActivity().getLayoutInflater().inflate(R.layout.dialog_encoding_list, null);
    list = (ListView) view.findViewById(android.R.id.list);
    SwitchCompat autoencoding = (SwitchCompat) view.findViewById(android.R.id.checkbox);
    autoencoding.setChecked(PreferenceHelper.getAutoEncoding(getActivity()));

    autoencoding.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            PreferenceHelper.setAutoencoding(getActivity(), isChecked);
        }
    });

    list.setAdapter(new ArrayAdapter<>(getActivity(), R.layout.item_single_choice, encodings));
    list.setOnItemClickListener(this);

    String currentEncoding = PreferenceHelper.getEncoding(getActivity());

    for (int i = 0; i < encodings.length; i++) {
        if (currentEncoding.equals(encodings[i])) {
            list.setItemChecked(i, true);
        }

    }

    return new AlertDialog.Builder(getActivity())
            .setView(view)
            .create();
}
 
Example 13
Source File: NetFragment.java    From pandora with Apache License 2.0 5 votes vote down vote up
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    getToolbar().setTitle(R.string.pd_name_network);
    getToolbar().getMenu().add(-1, R.id.pd_menu_id_1, 0, "")
            .setActionView(new SwitchCompat(getContext()))
            .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
    getToolbar().getMenu().add(-1, R.id.pd_menu_id_2, 1, R.string.pd_name_search)
            .setActionView(new SearchView(getContext()))
            .setIcon(R.drawable.pd_search)
            .setShowAsAction(MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);
    getToolbar().getMenu().add(-1, R.id.pd_menu_id_3, 2, R.string.pd_name_clear);
    setSearchView();
    getToolbar().setOnMenuItemClickListener(this);
    SwitchCompat switchCompat = ((SwitchCompat) getToolbar()
            .getMenu().findItem(R.id.pd_menu_id_1).getActionView());
    switchCompat.setOnCheckedChangeListener(this);
    if (Config.isNetLogEnable()) {
        switchCompat.setChecked(true);
    } else {
        showOpenLogHint();
    }
    Pandora.get().getInterceptor().setListener(this);
    getAdapter().setListener(new UniversalAdapter.OnItemClickListener() {
        @Override
        public void onItemClick(int position, BaseItem item) {
            if (item instanceof NetItem) {
                Bundle bundle = new Bundle();
                bundle.putLong(PARAM1, ((Summary)item.data).id);
                launch(NetSummaryFragment.class, bundle);
            }
        }
    });
}
 
Example 14
Source File: NeopixelComponentSelectorFragment.java    From Bluefruit_LE_Connect_Android_V2 with MIT License 5 votes vote down vote up
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    // Dismiss on click outside
    AppCompatDialog dialog = (AppCompatDialog) getDialog();
    if (dialog != null) {
        dialog.setCanceledOnTouchOutside(true);
    }

    // UI
    Context context = getContext();
    if (context != null) {
        RecyclerView standardComponentsRecyclerView = view.findViewById(R.id.standardComponentsRecyclerView);
        standardComponentsRecyclerView.setHasFixedSize(true);
        standardComponentsRecyclerView.setLayoutManager(new LinearLayoutManager(context, RecyclerView.VERTICAL, false));
        RecyclerView.Adapter standardBoardSizesAdapter = new StandardComponentsAdapter(mSelectedComponent, components -> {
            mSelectedComponent = components;
            if (mListener != null) {
                mListener.onComponentsSelected(components, mIs400KhzEnabled);
                dismiss();
            }
        });
        standardComponentsRecyclerView.setAdapter(standardBoardSizesAdapter);


        SwitchCompat mode400HhzSwitch = view.findViewById(R.id.mode400HhzSwitch);
        mode400HhzSwitch.setChecked(mIs400KhzEnabled);
        mode400HhzSwitch.setOnCheckedChangeListener((buttonView, isChecked) -> {
            if (buttonView.isPressed()) {
                mIs400KhzEnabled = isChecked;
                if (mListener != null) {
                    mListener.onComponentsSelected(mSelectedComponent, mIs400KhzEnabled);
                }
            }
        });
    }
}
 
Example 15
Source File: HelpActivity.java    From InviZible with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_help);

    Objects.requireNonNull(getSupportActionBar()).setDisplayHomeAsUpEnabled(true);

    etLogsPath = findViewById(R.id.etLogsPath);
    etLogsPath.setOnClickListener(this);
    Button btnSaveLogs = findViewById(R.id.btnSaveLogs);
    btnSaveLogs.setOnClickListener(this);
    btnSaveLogs.requestFocus();
    SwitchCompat swRootCommandsLog = findViewById(R.id.swRootCommandsLog);
    swRootCommandsLog.setChecked(new PrefManager(this).getBoolPref("swRootCommandsLog"));
    swRootCommandsLog.setOnCheckedChangeListener(this);

    Handler mHandler = new Handler();

    PathVars pathVars = PathVars.getInstance(this);
    appDataDir = pathVars.getAppDataDir();
    busyboxPath = pathVars.getBusyboxPath();
    pathToSaveLogs = pathVars.getDefaultBackupPath();
    iptables = pathVars.getIptablesPath();
    appUID = new PrefManager(this).getStrPref("appUID");

    br = new HelpActivityReceiver(mHandler, appDataDir, pathToSaveLogs);

    modulesStatus = ModulesStatus.getInstance();

    if (modulesStatus.isRootAvailable()) {
        IntentFilter intentFilter = new IntentFilter(RootExecService.COMMAND_RESULT);
        LocalBroadcastManager.getInstance(this).registerReceiver(br, intentFilter);
    }

}
 
Example 16
Source File: EventStatusPopupWindow.java    From PhoneProfilesPlus with Apache License 2.0 4 votes vote down vote up
@SuppressLint("SetTextI18n")
EventStatusPopupWindow(final EditorEventListFragment fragment, Event event) {
    super(R.layout.popup_window_event_status, R.string.editor_event_list_item_event_status, fragment.getActivity());

    // Disable default animation
    //setAnimationStyle(0);

    final TextView textView = popupView.findViewById(R.id.event_status_popup_window_text7);
    textView.setClickable(true);
    textView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (fragment.getActivity() != null) {
                Intent intentLaunch = new Intent(fragment.getActivity(), ImportantInfoActivity.class);
                intentLaunch.putExtra(ImportantInfoActivity.EXTRA_SHOW_QUICK_GUIDE, false);
                intentLaunch.putExtra(ImportantInfoActivity.EXTRA_SCROLL_TO, R.id.activity_info_notification_events);
                fragment.getActivity().startActivity(intentLaunch);
            }

            dismiss();
        }
    });

    if (event != null) {
        final Event _event = event;

        TextView eventName = popupView.findViewById(R.id.event_status_popup_window_text0);
        eventName.setText(fragment.getString(R.string.event_string_0)+": "+event._name);

        final SwitchCompat checkBox = popupView.findViewById(R.id.event_status_popup_window_checkbox);
        checkBox.setChecked(event.getStatus() != Event.ESTATUS_STOP);
        checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) {
                //noinspection ConstantConditions
                if (fragment != null) {
                    if (!fragment.runStopEvent(_event))
                        checkBox.setChecked(false);
                }
            }
        });
    }
}
 
Example 17
Source File: DataBindingLambdaActivity.java    From sa-sdk-android with Apache License 2.0 4 votes vote down vote up
private void testCompoundButton() {
    SwitchCompat switchCompat = findViewById(R.id.switch_compat);
    switchCompat.setOnCheckedChangeListener((compoundButton, b) -> {

    });
}
 
Example 18
Source File: StartFragment.java    From SSLSocks with MIT License 4 votes vote down vote up
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
	final SwitchCompat startSwitch = Objects.requireNonNull(getView()).findViewById(R.id.start_switch);
	startSwitch.setEnabled(true);
	startSwitch.setText(R.string.run_status_not_running);

	final CompoundButton.OnCheckedChangeListener changeListener = new CompoundButton.OnCheckedChangeListener() {
		@Override
		public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) {
			if (isChecked) {
				if (mListener != null) {
					startSwitch.setText(R.string.run_status_starting);
					mListener.onFragmentStartInteraction();
				}
			} else {
				if (mListener != null) {
					startSwitch.setText(R.string.run_status_stopping);
					mListener.onFragmentStopInteraction();
				}
			}
		}
	};
	startSwitch.setOnCheckedChangeListener(changeListener);

	FragmentActivity act = getActivity();
	if (act == null) {
		return;
	}
	StunnelIntentService.isRunning.observe(getViewLifecycleOwner(), new Observer<Boolean>() {
		@Override
		public void onChanged(Boolean aBoolean) {
			if (aBoolean) {
				startSwitch.setText(R.string.run_status_running);
				startSwitch.setOnCheckedChangeListener(null);
				startSwitch.setChecked(true);
				startSwitch.setOnCheckedChangeListener(changeListener);
			} else {
				startSwitch.setText(R.string.run_status_not_running);
				startSwitch.setOnCheckedChangeListener(null);
				startSwitch.setChecked(false);
				startSwitch.setOnCheckedChangeListener(changeListener);
			}
		}
	});
}
 
Example 19
Source File: SearchLayout.java    From EhViewer with Apache License 2.0 4 votes vote down vote up
@SuppressLint("InflateParams")
private void init(Context context) {
    Resources resources = context.getResources();
    mInflater = LayoutInflater.from(context);

    mLayoutManager = new LinearLayoutManager(context);
    mAdapter = new SearchAdapter();
    setLayoutManager(mLayoutManager);
    setAdapter(mAdapter);
    setHasFixedSize(true);
    setClipToPadding(false);
    int interval = resources.getDimensionPixelOffset(R.dimen.search_layout_interval);
    int paddingH = resources.getDimensionPixelOffset(R.dimen.search_layout_margin_h);
    int paddingV = resources.getDimensionPixelOffset(R.dimen.search_layout_margin_v);
    MarginItemDecoration decoration = new MarginItemDecoration(
            interval, paddingH, paddingV, paddingH, paddingV);
    addItemDecoration(decoration);
    decoration.applyPaddings(this);

    // Create normal view
    View normalView = mInflater.inflate(R.layout.search_normal, null);
    mNormalView = normalView;
    mCategoryTable = (CategoryTable) normalView.findViewById(R.id.search_category_table);
    mNormalSearchMode = (RadioGridGroup) normalView.findViewById(R.id.normal_search_mode);
    mNormalSearchModeHelp = (ImageView) normalView.findViewById(R.id.normal_search_mode_help);
    mEnableAdvanceSwitch = (SwitchCompat) normalView.findViewById(R.id.search_enable_advance);
    mNormalSearchModeHelp.setOnClickListener(this);
    Ripple.addRipple(mNormalSearchModeHelp, !AttrResources.getAttrBoolean(context, R.attr.isLightTheme));
    mEnableAdvanceSwitch.setOnCheckedChangeListener(SearchLayout.this);
    mEnableAdvanceSwitch.setSwitchPadding(resources.getDimensionPixelSize(R.dimen.switch_padding));

    // Create advance view
    mAdvanceView = mInflater.inflate(R.layout.search_advance, null);
    mTableAdvanceSearch = (AdvanceSearchTable) mAdvanceView.findViewById(R.id.search_advance_search_table);

    // Create image view
    mImageView = (ImageSearchLayout) mInflater.inflate(R.layout.search_image, null);
    mImageView.setHelper(this);

    // Create action view
    mActionView = mInflater.inflate(R.layout.search_action, null);
    mAction = (TextView) mActionView.findViewById(R.id.action);
    mAction.setOnClickListener(this);
}
 
Example 20
Source File: SearchLayout.java    From MHViewer with Apache License 2.0 4 votes vote down vote up
@SuppressLint("InflateParams")
private void init(Context context) {
    Resources resources = context.getResources();
    mInflater = LayoutInflater.from(context);

    mLayoutManager = new LinearLayoutManager(context);
    mAdapter = new SearchAdapter();
    setLayoutManager(mLayoutManager);
    setAdapter(mAdapter);
    setHasFixedSize(true);
    setClipToPadding(false);
    int interval = resources.getDimensionPixelOffset(R.dimen.search_layout_interval);
    int paddingH = resources.getDimensionPixelOffset(R.dimen.search_layout_margin_h);
    int paddingV = resources.getDimensionPixelOffset(R.dimen.search_layout_margin_v);
    MarginItemDecoration decoration = new MarginItemDecoration(
            interval, paddingH, paddingV, paddingH, paddingV);
    addItemDecoration(decoration);
    decoration.applyPaddings(this);

    // Create normal view
    View normalView = mInflater.inflate(R.layout.search_normal, null);
    mNormalView = normalView;
    mCategoryTable = (CategoryTable) normalView.findViewById(R.id.search_category_table);
    mNormalSearchMode = (RadioGridGroup) normalView.findViewById(R.id.normal_search_mode);
    mNormalSearchModeHelp = (ImageView) normalView.findViewById(R.id.normal_search_mode_help);
    mEnableAdvanceSwitch = (SwitchCompat) normalView.findViewById(R.id.search_enable_advance);
    mNormalSearchModeHelp.setOnClickListener(this);
    Ripple.addRipple(mNormalSearchModeHelp, !AttrResources.getAttrBoolean(context, R.attr.isLightTheme));
    mEnableAdvanceSwitch.setOnCheckedChangeListener(SearchLayout.this);
    mEnableAdvanceSwitch.setSwitchPadding(resources.getDimensionPixelSize(R.dimen.switch_padding));

    // Create advance view
    mAdvanceView = mInflater.inflate(R.layout.search_advance, null);
    mTableAdvanceSearch = (AdvanceSearchTable) mAdvanceView.findViewById(R.id.search_advance_search_table);

    // Create image view
    mImageView = (ImageSearchLayout) mInflater.inflate(R.layout.search_image, null);
    mImageView.setHelper(this);

    // Create action view
    mActionView = mInflater.inflate(R.layout.search_action, null);
    mAction = (TextView) mActionView.findViewById(R.id.action);
    mAction.setOnClickListener(this);
}