Skip to content

Commit

Permalink
searchview added to toolbar
Browse files Browse the repository at this point in the history
  • Loading branch information
rijogeorge7 committed May 14, 2018
1 parent 9daddb4 commit 074fe1e
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.view.MenuItemCompat;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.SearchView;
import android.support.v7.widget.Toolbar;
Expand Down Expand Up @@ -55,7 +54,6 @@ public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_main, menu);
final MenuItem searchItem = menu.findItem(R.id.action_search);
final SearchView searchView = (SearchView) searchItem.getActionView();
MenuItemCompat.collapseActionView(searchItem);

searchItem.setOnActionExpandListener(new MenuItem.OnActionExpandListener() {
@Override
Expand Down Expand Up @@ -86,8 +84,6 @@ public boolean onQueryTextChange(String newText) {
}
});



return true;
}

Expand All @@ -109,8 +105,6 @@ public void onMovieClicked(Movie movie) {
}
}



private void startMovieActivity(Movie movie) {
Intent intent = new Intent(this, MovieDetailsActivity.class);
Bundle extras = new Bundle();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ public void onMovieClicked(Movie movie) {
callback.onMovieClicked(movie);
}


@Override
public void onDestroyView() {
super.onDestroyView();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.esoxjem.movieguide.listing;

import android.support.annotation.NonNull;
import com.esoxjem.movieguide.Movie;
import com.esoxjem.movieguide.MoviesWraper;
import com.esoxjem.movieguide.favorites.FavoritesInteractor;
Expand Down Expand Up @@ -55,7 +56,7 @@ public Observable<List<Movie>> fetchMovies(int page) {
}

@Override
public Observable<List<Movie>> searchMovie(String searchQuery) {
public Observable<List<Movie>> searchMovie(@NonNull String searchQuery) {
return tmdbWebService.searchMovies(searchQuery).map(MoviesWraper::getMovieList);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,4 @@ public interface MoviesListingPresenter
void searchMovieBackPressed();

void destroy();

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.esoxjem.movieguide.listing;

import android.support.annotation.NonNull;

import com.esoxjem.movieguide.Movie;
import com.esoxjem.movieguide.util.RxUtils;

Expand All @@ -20,8 +22,6 @@ class MoviesListingPresenterImpl implements MoviesListingPresenter {
private Disposable movieSearchSubscription;
private int currentPage = 1;
private List<Movie> loadedMovies = new ArrayList<>();


private boolean showingSearchResult = false;

MoviesListingPresenterImpl(MoviesListingInteractor interactor) {
Expand All @@ -36,7 +36,6 @@ public void setView(MoviesListingView view) {
}
}


@Override
public void destroy() {
view = null;
Expand All @@ -51,7 +50,7 @@ private void displayMovies() {
.subscribe(this::onMovieFetchSuccess, this::onMovieFetchFailed);
}

private void displayMovieSearchResult(String searchText) {
private void displayMovieSearchResult(@NonNull final String searchText) {
showingSearchResult = true;
showLoading();
movieSearchSubscription = moviesInteractor.searchMovie(searchText)
Expand Down Expand Up @@ -96,7 +95,6 @@ public void searchMovieBackPressed() {
}
}


private void showLoading() {
if (isViewAttached()) {
view.loadingStarted();
Expand Down

0 comments on commit 074fe1e

Please sign in to comment.