From 33d01d6b000392e7bb3309233e5c4386133c03c1 Mon Sep 17 00:00:00 2001 From: Sheng Xuan Date: Tue, 14 Feb 2017 22:17:12 +0800 Subject: [PATCH] Fix bug that cannot search movie after auto login. --- .../example/team_pigeon/movie_pigeon/SearchPageFragment.java | 2 +- .../team_pigeon/movie_pigeon/SearchRequestHttpBuilder.java | 2 +- .../org/example/team_pigeon/movie_pigeon/StartActivity.java | 4 +--- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/frontend/Movie_Pigeon/app/src/main/java/org/example/team_pigeon/movie_pigeon/SearchPageFragment.java b/frontend/Movie_Pigeon/app/src/main/java/org/example/team_pigeon/movie_pigeon/SearchPageFragment.java index 934715a..5d9734f 100644 --- a/frontend/Movie_Pigeon/app/src/main/java/org/example/team_pigeon/movie_pigeon/SearchPageFragment.java +++ b/frontend/Movie_Pigeon/app/src/main/java/org/example/team_pigeon/movie_pigeon/SearchPageFragment.java @@ -79,7 +79,7 @@ public void onClick(View v) { } else { searchTask = new SearchTask(); - searchTask.execute(etSearch.getText().toString(),getActivity().getIntent().getExtras().getString("Token")); + searchTask.execute(etSearch.getText().toString(), getActivity().getIntent().getExtras().getString("Token").trim()); } } }); diff --git a/frontend/Movie_Pigeon/app/src/main/java/org/example/team_pigeon/movie_pigeon/SearchRequestHttpBuilder.java b/frontend/Movie_Pigeon/app/src/main/java/org/example/team_pigeon/movie_pigeon/SearchRequestHttpBuilder.java index ce8e546..c4da9ff 100644 --- a/frontend/Movie_Pigeon/app/src/main/java/org/example/team_pigeon/movie_pigeon/SearchRequestHttpBuilder.java +++ b/frontend/Movie_Pigeon/app/src/main/java/org/example/team_pigeon/movie_pigeon/SearchRequestHttpBuilder.java @@ -17,6 +17,6 @@ public SearchRequestHttpBuilder(String keywords, String token){ } public Request getRequest() { - return new Request.Builder().url(url).header("title", keywords).addHeader("Authorization", "Bearer "+ token).build(); + return new Request.Builder().url(url).header("title", keywords).addHeader("Authorization", "Bearer "+ token.trim()).build(); } } diff --git a/frontend/Movie_Pigeon/app/src/main/java/org/example/team_pigeon/movie_pigeon/StartActivity.java b/frontend/Movie_Pigeon/app/src/main/java/org/example/team_pigeon/movie_pigeon/StartActivity.java index cf1d076..bbd5038 100644 --- a/frontend/Movie_Pigeon/app/src/main/java/org/example/team_pigeon/movie_pigeon/StartActivity.java +++ b/frontend/Movie_Pigeon/app/src/main/java/org/example/team_pigeon/movie_pigeon/StartActivity.java @@ -41,9 +41,7 @@ protected void onCreate(Bundle savedInstanceState) { Intent homePageIntent = new Intent(this, HomePageActivity.class); // pass token to the new activity - Bundle bundle = new Bundle(); - bundle.putString("Token", token); - homePageIntent.putExtras(bundle); + homePageIntent.putExtra("Token", token); this.startActivity(homePageIntent); finish();