<commit_before>package com.kickstarter.ui.views;

import android.content.Context;
import android.content.Intent;
import android.support.annotation.ColorInt;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.widget.PopupMenu;
import android.support.v7.widget.Toolbar;
import android.util.AttributeSet;
import android.view.View;
import android.widget.TextView;

import com.kickstarter.KSApplication;
import com.kickstarter.R;
import com.kickstarter.libs.CurrentUser;
import com.kickstarter.libs.utils.DiscoveryUtils;
import com.kickstarter.libs.Logout;
import com.kickstarter.models.User;
import com.kickstarter.services.DiscoveryParams;
import com.kickstarter.ui.activities.ActivityFeedActivity;
import com.kickstarter.ui.activities.DiscoveryActivity;
import com.kickstarter.ui.activities.LoginToutActivity;
import com.kickstarter.ui.activities.SearchActivity;

import javax.inject.Inject;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;
import rx.Observable;
import rx.Subscription;
import rx.android.schedulers.AndroidSchedulers;

public class DiscoveryToolbar extends Toolbar {
  @Bind(R.id.activity_feed_button) TextView activityFeedButton;
  @Bind(R.id.current_user_button) TextView currentUserButton;
  @Bind(R.id.filter_expand_more_button) TextView filterExpandMoreButton;
  @Bind(R.id.filter_text_view) TextView filterTextView;
  @Bind(R.id.login_button) TextView loginButton;
  @Bind(R.id.search_button) TextView searchButton;
  @Inject CurrentUser currentUser;
  @Inject Logout logout;

  Subscription loginSubscription;

  public DiscoveryToolbar(@NonNull final Context context) {
    super(context);
  }

  public DiscoveryToolbar(@NonNull final Context context, @Nullable final AttributeSet attrs) {
    super(context, attrs);
  }

  public DiscoveryToolbar(@NonNull final Context context, @Nullable final AttributeSet attrs, final int defStyleAttr) {
    super(context, attrs, defStyleAttr);
  }

  @Override
  protected void onFinishInflate() {
    super.onFinishInflate();

    if (isInEditMode()) {
      return;
    }

    ButterKnife.bind(this);
    ((KSApplication) getContext().getApplicationContext()).component().inject(this);

    activityFeedButton.setOnClickListener(v -> {
      final Context context = getContext();
      context.startActivity(new Intent(context, ActivityFeedActivity.class));
    });
  }

  @OnClick(R.id.filter_button)
  public void filterButtonClick(@NonNull final View view) {
    final DiscoveryActivity activity = (DiscoveryActivity) getContext();
    activity.presenter().filterButtonClick();
  }

  public void loadParams(@NonNull final DiscoveryParams params) {
    final Context context = getContext();

    this.setBackgroundColor(DiscoveryUtils.primaryColor(context, params));

    filterTextView.setText(params.filterString(context));

    final Observable<TextView> views = Observable.just(activityFeedButton,
      currentUserButton,
      filterExpandMoreButton,
      filterTextView,
      loginButton);

    final @ColorInt int overlayTextColor = DiscoveryUtils.overlayTextColor(context, params);

    views.subscribe(view -> view.setTextColor(overlayTextColor));
  }

  @OnClick(R.id.search_button)
  public void searchButtonClick(@NonNull final View view) {
    final Context context = getContext();<commit_msg>Fix search button color on light bgs<commit_after>package com.kickstarter.ui.views;

import android.content.Context;
import android.content.Intent;
import android.support.annotation.ColorInt;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.widget.PopupMenu;
import android.support.v7.widget.Toolbar;
import android.util.AttributeSet;
import android.view.View;
import android.widget.TextView;

import com.kickstarter.KSApplication;
import com.kickstarter.R;
import com.kickstarter.libs.CurrentUser;
import com.kickstarter.libs.utils.DiscoveryUtils;
import com.kickstarter.libs.Logout;
import com.kickstarter.models.User;
import com.kickstarter.services.DiscoveryParams;
import com.kickstarter.ui.activities.ActivityFeedActivity;
import com.kickstarter.ui.activities.DiscoveryActivity;
import com.kickstarter.ui.activities.LoginToutActivity;
import com.kickstarter.ui.activities.SearchActivity;

import javax.inject.Inject;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;
import rx.Observable;
import rx.Subscription;
import rx.android.schedulers.AndroidSchedulers;

public class DiscoveryToolbar extends Toolbar {
  @Bind(R.id.activity_feed_button) TextView activityFeedButton;
  @Bind(R.id.current_user_button) TextView currentUserButton;
  @Bind(R.id.filter_expand_more_button) TextView filterExpandMoreButton;
  @Bind(R.id.filter_text_view) TextView filterTextView;
  @Bind(R.id.login_button) TextView loginButton;
  @Bind(R.id.search_button) TextView searchButton;
  @Inject CurrentUser currentUser;
  @Inject Logout logout;

  Subscription loginSubscription;

  public DiscoveryToolbar(@NonNull final Context context) {
    super(context);
  }

  public DiscoveryToolbar(@NonNull final Context context, @Nullable final AttributeSet attrs) {
    super(context, attrs);
  }

  public DiscoveryToolbar(@NonNull final Context context, @Nullable final AttributeSet attrs, final int defStyleAttr) {
    super(context, attrs, defStyleAttr);
  }

  @Override
  protected void onFinishInflate() {
    super.onFinishInflate();

    if (isInEditMode()) {
      return;
    }

    ButterKnife.bind(this);
    ((KSApplication) getContext().getApplicationContext()).component().inject(this);

    activityFeedButton.setOnClickListener(v -> {
      final Context context = getContext();
      context.startActivity(new Intent(context, ActivityFeedActivity.class));
    });
  }

  @OnClick(R.id.filter_button)
  public void filterButtonClick(@NonNull final View view) {
    final DiscoveryActivity activity = (DiscoveryActivity) getContext();
    activity.presenter().filterButtonClick();
  }

  public void loadParams(@NonNull final DiscoveryParams params) {
    final Context context = getContext();

    this.setBackgroundColor(DiscoveryUtils.primaryColor(context, params));

    filterTextView.setText(params.filterString(context));

    final Observable<TextView> views = Observable.just(activityFeedButton,
      currentUserButton,
      filterExpandMoreButton,
      filterTextView,
      loginButton,
      searchButton);

    final @ColorInt int overlayTextColor = DiscoveryUtils.overlayTextColor(context, params);

    views.subscribe(view -> view.setTextColor(overlayTextColor));
  }

  @OnClick(R.id.search_button)
  public void searchButtonClick(@NonNull final View view) {
    final Context context = getContext();
{'fraction_non_alphanumeric': 0.09580573951434879, 'fraction_numerical': 0.0005886681383370125, 'mean_word_length': 5.4600760456273765, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '2403663', 'n_tokens_mistral': 1983, 'n_tokens_neox': 1908, 'n_words': 392}