From 71f4cde4ec3a1a13e46bac88e929caf4c3d146b6 Mon Sep 17 00:00:00 2001 From: absolutelycold Date: Thu, 19 Mar 2020 12:06:43 +0800 Subject: [PATCH] update: You can search related video now. --- .../com/absolutelycold/axgle/AllVideosFragment.java | 10 ++++++++++ .../com/absolutelycold/axgle/EmbedVideoActivity.java | 8 ++++++-- .../com/absolutelycold/axgle/OrderDialogFragment.java | 2 +- build.gradle | 2 +- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/absolutelycold/axgle/AllVideosFragment.java b/app/src/main/java/com/absolutelycold/axgle/AllVideosFragment.java index 1eb1a59..cc61ef7 100644 --- a/app/src/main/java/com/absolutelycold/axgle/AllVideosFragment.java +++ b/app/src/main/java/com/absolutelycold/axgle/AllVideosFragment.java @@ -102,6 +102,7 @@ public void AdditionalBoxClicked(int position, View view) { selectedCardPosition = position; ArrayList options = new ArrayList<>(); options.add("Add to ur own collection"); + options.add("Search Related Videos"); OrderDialogFragment.newInstance(options).show(getChildFragmentManager(), OrderDialogFragment.TAG); } @@ -120,6 +121,15 @@ public void onSortOptionSelected(int position) { Toast.makeText(getActivity(), "Fail to add. Please to wait for the database loading.", Toast.LENGTH_SHORT).show(); } break; + case 1: + String keyWords = allVideosInfo.getKeyword(selectedCardPosition); + Intent intent = new Intent(getContext(), SearchResultActivity.class); + intent.putExtra("search_content", keyWords); + intent.putStringArrayListExtra("categories_data", null); + intent.putExtra("needBlur", needBlur); + startActivity(intent); + Toast.makeText(getContext(), "Recommand clicked", Toast.LENGTH_SHORT).show(); + break; } } diff --git a/app/src/main/java/com/absolutelycold/axgle/EmbedVideoActivity.java b/app/src/main/java/com/absolutelycold/axgle/EmbedVideoActivity.java index e6d1b39..e4d9052 100644 --- a/app/src/main/java/com/absolutelycold/axgle/EmbedVideoActivity.java +++ b/app/src/main/java/com/absolutelycold/axgle/EmbedVideoActivity.java @@ -35,11 +35,9 @@ protected void onCreate(Bundle savedInstanceState) { decorView = getWindow().getDecorView(); decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN); decorView.setBackgroundColor(Color.BLACK); - webView = findViewById(R.id.embed_video_web_view); webView.setBackgroundColor(Color.TRANSPARENT); - webView.getSettings().setJavaScriptEnabled(true); webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true); webView.getSettings().setSupportMultipleWindows(true); @@ -62,4 +60,10 @@ public void onWindowFocusChanged(boolean hasFocus) { super.onWindowFocusChanged(hasFocus); decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN); } + + @Override + protected void onSaveInstanceState(@NonNull Bundle outState) { + super.onSaveInstanceState(outState); + outState.putString("embedded_url", embeddedUrl); + } } diff --git a/app/src/main/java/com/absolutelycold/axgle/OrderDialogFragment.java b/app/src/main/java/com/absolutelycold/axgle/OrderDialogFragment.java index fe992fa..fdf96b6 100644 --- a/app/src/main/java/com/absolutelycold/axgle/OrderDialogFragment.java +++ b/app/src/main/java/com/absolutelycold/axgle/OrderDialogFragment.java @@ -87,7 +87,7 @@ private class ViewHolder extends RecyclerView.ViewHolder { @Override public void onClick(View v) { if (mListener != null) { - mListener.onSortOptionSelected(getAdapterPosition()); + mListener. onSortOptionSelected(getAdapterPosition()); dismiss(); } } diff --git a/build.gradle b/build.gradle index a914d7e..89f2b3e 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:3.6.0' + classpath 'com.android.tools.build:gradle:3.6.1' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files