@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.generic_toolbar); String user = getIntent().getStringExtra(USER); setTitle(getString(R.string.title_activity_repos_starred, user)); StarredReposFragment reposFragment = StarredReposFragment.newInstance(user); FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); ft.replace(R.id.content, reposFragment); ft.commit(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.github_enterprise_login); ButterKnife.bind(this); enterpriseToken.addTextChangedListener( new TextWatcher() { @Override public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {} @Override public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { enterpriseLogin.setEnabled(true); } @Override public void afterTextChanged(Editable editable) {} }); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_repo_detail); if (getIntent().getExtras() != null) { RepoInfo repoInfo = getIntent().getExtras().getParcelable(REPO_INFO); setTitle(repoInfo.name); slidingTabLayout = (SlidingTabLayout) findViewById(R.id.tabStrip); slidingTabLayout.setSelectedIndicatorColors(AttributesUtils.getAccentColor(this)); slidingTabLayout.setDividerColors(getResources().getColor(R.color.primary_dark_alpha)); viewPager = (ViewPager) findViewById(R.id.pager); load(repoInfo); } else { finish(); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_search); setTitle(""); searchView = (EditText) findViewById(R.id.searchView); final TabLayout tabLayout = (TabLayout) findViewById(R.id.tabStrip); ViewPager viewPager = (ViewPager) findViewById(R.id.pager); searchReposFragment = SearchReposFragment.newInstance(null); searchUsersFragment = SearchUsersFragment.newInstance(null); List<Fragment> listFragments = new ArrayList<>(); listFragments.add(searchReposFragment); listFragments.add(searchUsersFragment); viewPager.setAdapter( new NavigationPagerAdapter(getSupportFragmentManager(), getResources(), listFragments)); tabLayout.setupWithViewPager(viewPager); searchView.setOnEditorActionListener( new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView textView, int actionId, KeyEvent keyEvent) { if (textView.length() > 0) { switch (actionId) { case EditorInfo.IME_ACTION_DONE: case EditorInfo.IME_ACTION_SEARCH: case EditorInfo.IME_ACTION_SEND: case EditorInfo.IME_ACTION_NEXT: case EditorInfo.IME_ACTION_GO: if (textView.getText() != null) { search(textView.getText().toString()); } break; } } return false; } }); subscription = RxTextView.textChanges(searchView) .filter( new Func1<CharSequence, Boolean>() { @Override public Boolean call(CharSequence s) { return s.length() >= 3; } }) .throttleLast(100, TimeUnit.MILLISECONDS) .debounce(250, TimeUnit.MILLISECONDS) .subscribeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread()) .subscribe( new Subscriber<CharSequence>() { @Override public void onCompleted() {} @Override public void onError(Throwable e) {} @Override public void onNext(CharSequence charSequence) { search(charSequence.toString()); } }); }