aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/ml
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2021-07-09 00:54:59 +0000
committerAlex Ning <chineseperson5@gmail.com>2021-07-09 00:54:59 +0000
commit5fc3212f98a8ca8652fc7d370946d10b477a251c (patch)
tree632a2247d374780a1ce8f37877e9628c486385cc /app/src/main/java/ml
parent1352a8268ec4e54a8d4845ecfec3823864c750ee (diff)
downloadinfinity-for-reddit-5fc3212f98a8ca8652fc7d370946d10b477a251c.tar
infinity-for-reddit-5fc3212f98a8ca8652fc7d370946d10b477a251c.tar.gz
infinity-for-reddit-5fc3212f98a8ca8652fc7d370946d10b477a251c.tar.bz2
infinity-for-reddit-5fc3212f98a8ca8652fc7d370946d10b477a251c.tar.lz
infinity-for-reddit-5fc3212f98a8ca8652fc7d370946d10b477a251c.tar.xz
infinity-for-reddit-5fc3212f98a8ca8652fc7d370946d10b477a251c.tar.zst
infinity-for-reddit-5fc3212f98a8ca8652fc7d370946d10b477a251c.zip
Implement a search panel in ViewPostDetailActivity.
Diffstat (limited to 'app/src/main/java/ml')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPostDetailActivity.java24
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewPostDetailFragment.java2
2 files changed, 25 insertions, 1 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPostDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPostDetailActivity.java
index 34fbc55a..f093c1f6 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPostDetailActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPostDetailActivity.java
@@ -11,6 +11,7 @@ import android.view.MenuItem;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
+import android.widget.ImageView;
import android.widget.Toast;
import androidx.annotation.NonNull;
@@ -27,8 +28,11 @@ import com.evernote.android.state.State;
import com.github.piasy.biv.BigImageViewer;
import com.github.piasy.biv.loader.glide.GlideImageLoader;
import com.google.android.material.appbar.AppBarLayout;
+import com.google.android.material.card.MaterialCardView;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.snackbar.Snackbar;
+import com.google.android.material.textfield.TextInputEditText;
+import com.google.android.material.textfield.TextInputLayout;
import com.livefront.bridge.Bridge;
import com.r0adkll.slidr.Slidr;
import com.r0adkll.slidr.model.SlidrInterface;
@@ -89,6 +93,18 @@ public class ViewPostDetailActivity extends BaseActivity implements SortTypeSele
ViewPager2 viewPager2;
@BindView(R.id.fab_view_post_detail_activity)
FloatingActionButton fab;
+ @BindView(R.id.search_panel_material_card_view_view_post_detail_activity)
+ MaterialCardView searchPanelMaterialCardView;
+ @BindView(R.id.search_text_input_layout_view_post_detail_activity)
+ TextInputLayout searchTextInputLayout;
+ @BindView(R.id.search_text_input_edit_text_view_post_detail_activity)
+ TextInputEditText searchTextInputEditText;
+ @BindView(R.id.previous_result_image_view_view_post_detail_activity)
+ ImageView previousResultImageView;
+ @BindView(R.id.next_result_image_view_view_post_detail_activity)
+ ImageView nextResultImageView;
+ @BindView(R.id.close_search_panel_image_view_view_post_detail_activity)
+ ImageView closeSearchPanelImageView;
@Inject
@Named("oauth")
Retrofit mOauthRetrofit;
@@ -372,6 +388,14 @@ public class ViewPostDetailActivity extends BaseActivity implements SortTypeSele
}
}
+ public void toggleSearchPanelVisibility() {
+ if (searchPanelMaterialCardView.getVisibility() == View.GONE) {
+ searchPanelMaterialCardView.setVisibility(View.VISIBLE);
+ } else {
+ searchPanelMaterialCardView.setVisibility(View.GONE);
+ }
+ }
+
@Subscribe
public void onAccountSwitchEvent(SwitchAccountEvent event) {
if (!getClass().getName().equals(event.excludeActivityClassName)) {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewPostDetailFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewPostDetailFragment.java
index 589326ee..509ce597 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewPostDetailFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewPostDetailFragment.java
@@ -780,7 +780,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
int itemId = item.getItemId();
if (itemId == R.id.action_search_view_post_detail_fragment) {
-
+ activity.toggleSearchPanelVisibility();
} else if (itemId == R.id.action_refresh_view_post_detail_fragment) {
refresh(true, true);
return true;