aboutsummaryrefslogtreecommitdiff
path: root/app
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
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 '')
-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
-rw-r--r--app/src/main/res/layout/activity_view_post_detail.xml69
3 files changed, 94 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;
diff --git a/app/src/main/res/layout/activity_view_post_detail.xml b/app/src/main/res/layout/activity_view_post_detail.xml
index d16899f3..f44fd823 100644
--- a/app/src/main/res/layout/activity_view_post_detail.xml
+++ b/app/src/main/res/layout/activity_view_post_detail.xml
@@ -47,4 +47,73 @@
app:tint="@android:color/white"
app:srcCompat="@drawable/ic_keyboard_arrow_down_24dp" />
+ <com.google.android.material.card.MaterialCardView
+ android:id="@+id/search_panel_material_card_view_view_post_detail_activity"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_gravity="bottom"
+ android:backgroundTint="#FFFFFF"
+ android:visibility="gone"
+ app:cardElevation="16dp">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+
+ <com.google.android.material.textfield.TextInputLayout
+ android:id="@+id/search_text_input_layout_view_post_detail_activity"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+
+ android:paddingTop="8dp"
+ android:paddingBottom="8dp"
+ android:paddingStart="16dp"
+ android:paddingEnd="16dp"
+ style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox">
+
+ <com.google.android.material.textfield.TextInputEditText
+ android:id="@+id/search_text_input_edit_text_view_post_detail_activity"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:fontFamily="?attr/font_family"
+ android:textSize="?attr/font_default"
+ android:hint="@string/post_filter_name_hint" />
+
+ </com.google.android.material.textfield.TextInputLayout>
+
+ <ImageView
+ android:id="@+id/previous_result_image_view_view_post_detail_activity"
+ android:layout_width="24dp"
+ android:layout_height="24dp"
+ android:layout_gravity="center_vertical"
+ android:src="@drawable/ic_arrow_upward_black_24dp"
+ android:background="?actionBarItemBackground"
+ android:clickable="true"
+ android:focusable="true" />
+
+ <ImageView
+ android:id="@+id/next_result_image_view_view_post_detail_activity"
+ android:layout_width="24dp"
+ android:layout_height="24dp"
+ android:layout_gravity="center_vertical"
+ android:src="@drawable/ic_arrow_downward_black_24dp"
+ android:background="?actionBarItemBackground"
+ android:clickable="true"
+ android:focusable="true" />
+
+ <ImageView
+ android:id="@+id/close_search_panel_image_view_view_post_detail_activity"
+ android:layout_width="24dp"
+ android:layout_height="24dp"
+ android:layout_gravity="center_vertical"
+ android:src="@drawable/ic_close_black_24dp"
+ android:background="?actionBarItemBackground"
+ android:clickable="true"
+ android:focusable="true" />
+
+ </LinearLayout>
+
+ </com.google.android.material.card.MaterialCardView>
+
</androidx.coordinatorlayout.widget.CoordinatorLayout> \ No newline at end of file