diff options
| author | Andrew Dolgov <fox@fakecake.org> | 2025-05-11 09:32:55 +0300 |
|---|---|---|
| committer | Andrew Dolgov <fox@fakecake.org> | 2025-05-11 09:32:55 +0300 |
| commit | 118a8394e726bc2038dc992c49cf888b55629f03 (patch) | |
| tree | 14d48019636a7eaf7dbb109172ce29554f35d92a /org.fox.ttrss | |
| parent | 878a914b6210876d0fecd2f45cc3ebb0ca70f103 (diff) | |
drop chrome fs custom view stuff
Diffstat (limited to 'org.fox.ttrss')
| -rwxr-xr-x | org.fox.ttrss/src/main/java/org/fox/ttrss/ArticleFragment.java | 99 | ||||
| -rwxr-xr-x | org.fox.ttrss/src/main/res/layout/fragment_article.xml | 232 |
2 files changed, 110 insertions, 221 deletions
diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticleFragment.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticleFragment.java index 33abc714..987c12d0 100755 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticleFragment.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticleFragment.java @@ -47,10 +47,6 @@ public class ArticleFragment extends androidx.fragment.app.Fragment { protected Article m_article; private DetailActivity m_activity; private WebView m_web; - protected View m_customView; - protected FrameLayout m_customViewContainer; - protected View m_contentView; - protected FSVideoChromeClient m_chromeClient; //protected View m_fab; protected int m_articleFontSize; protected int m_articleSmallFontSize; @@ -59,68 +55,6 @@ public class ArticleFragment extends androidx.fragment.app.Fragment { m_article = article; } - private class FSVideoChromeClient extends WebChromeClient { - //protected View m_videoChildView; - - private CustomViewCallback m_callback; - - public FSVideoChromeClient(View container) { - super(); - - } - - @Override - public void onShowCustomView(View view, CustomViewCallback callback) { - m_activity.getSupportActionBar().hide(); - - // if a view already exists then immediately terminate the new one - if (m_customView != null) { - callback.onCustomViewHidden(); - return; - } - m_customView = view; - m_contentView.setVisibility(View.GONE); - - m_customViewContainer.setVisibility(View.VISIBLE); - m_customViewContainer.addView(view); - - //if (m_fab != null) m_fab.setVisibility(View.GONE); - - m_activity.showSidebar(false); - - m_callback = callback; - } - - @Override - public void onHideCustomView() { - super.onHideCustomView(); - - m_activity.getSupportActionBar().show(); - - if (m_customView == null) - return; - - m_contentView.setVisibility(View.VISIBLE); - m_customViewContainer.setVisibility(View.GONE); - - // Hide the custom view. - m_customView.setVisibility(View.GONE); - - // Remove the custom view from its container. - m_customViewContainer.removeView(m_customView); - m_callback.onCustomViewHidden(); - - /*if (m_fab != null && m_prefs.getBoolean("enable_article_fab", true)) - m_fab.setVisibility(View.VISIBLE);*/ - - m_customView = null; - - m_activity.showSidebar(true); - } - } - - //private View.OnTouchListener m_gestureListener; - @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { @@ -170,13 +104,6 @@ public class ArticleFragment extends androidx.fragment.app.Fragment { m_activity.finish(); } - /* if (m_fsviewShown) { - view.findViewById(R.id.article_fullscreen_video).setVisibility(View.VISIBLE); - view.findViewById(R.id.article_scrollview).setVisibility(View.INVISIBLE); - } */ - - m_customViewContainer = view.findViewById(R.id.article_fullscreen_video); - /* if (m_article.id == HeadlinesFragment.ARTICLE_SPECIAL_TOP_CHANGED) { TextView statusMessage = (TextView) view.findViewById(R.id.article_status_message); statusMessage.setText(R.string.headlines_row_top_changed); @@ -391,8 +318,6 @@ public class ArticleFragment extends androidx.fragment.app.Fragment { ws.setJavaScriptEnabled(false); - m_chromeClient = new FSVideoChromeClient(getView()); - m_web.setWebChromeClient(m_chromeClient); m_web.setBackgroundColor(Color.TRANSPARENT); ws.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); @@ -492,30 +417,6 @@ public class ArticleFragment extends androidx.fragment.app.Fragment { if (m_web != null) m_web.onResume(); } - public boolean inCustomView() { - return (m_customView != null); - } - - @Override - public void onStop() { - super.onStop(); - - if (inCustomView()) { - hideCustomView(); - } - } - - public void hideCustomView() { - if (m_chromeClient != null) { - m_chromeClient.onHideCustomView(); - } - } - - @Override - public void onDestroy() { - super.onDestroy(); - } - @Override public void onAttach(Activity activity) { super.onAttach(activity); diff --git a/org.fox.ttrss/src/main/res/layout/fragment_article.xml b/org.fox.ttrss/src/main/res/layout/fragment_article.xml index 5696e889..eba96d75 100755 --- a/org.fox.ttrss/src/main/res/layout/fragment_article.xml +++ b/org.fox.ttrss/src/main/res/layout/fragment_article.xml @@ -1,157 +1,145 @@ -<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" +<com.otaliastudios.nestedscrollcoordinatorlayout.NestedScrollCoordinatorLayout + xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" - android:id="@+id/article_fragment" - android:layout_width="fill_parent" android:background="?colorSurfaceContainer" + android:layout_width="match_parent" android:layout_height="match_parent"> - <FrameLayout - android:id="@+id/article_fullscreen_video" - android:visibility="invisible" - android:layout_width="fill_parent" - android:layout_height="fill_parent"/> - - <com.otaliastudios.nestedscrollcoordinatorlayout.NestedScrollCoordinatorLayout + <com.google.android.material.appbar.AppBarLayout android:layout_width="match_parent" - android:layout_height="match_parent"> + android:background="?colorSurfaceContainer" + android:layout_height="wrap_content"> - <com.google.android.material.appbar.AppBarLayout + <com.google.android.material.card.MaterialCardView + app:layout_scrollFlags="scroll|enterAlways" + app:strokeWidth="0dp" + app:shapeAppearance="@style/ShapeAppearanceArticleHeader" android:layout_width="match_parent" - android:background="?colorSurfaceContainer" android:layout_height="wrap_content"> - <com.google.android.material.card.MaterialCardView - app:layout_scrollFlags="scroll|enterAlways" - app:strokeWidth="0dp" - app:shapeAppearance="@style/ShapeAppearanceArticleHeader" - android:layout_width="match_parent" - android:layout_height="wrap_content"> + <LinearLayout + android:id="@+id/article_header" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical"> <LinearLayout - android:id="@+id/article_header" + android:orientation="horizontal" + android:layout_marginStart="16dp" + android:layout_marginEnd="16dp" android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical"> + android:layout_height="match_parent"> - <LinearLayout - android:orientation="horizontal" - android:layout_marginStart="16dp" - android:layout_marginEnd="16dp" + <TextView + android:id="@+id/title" android:layout_width="match_parent" - android:layout_height="match_parent"> + android:layout_height="wrap_content" + android:layout_weight="1" + android:textColor="?colorPrimary" + tools:text="Unreasonably long article title blah blah blah blah blah blah" + android:textSize="18sp" + android:gravity="start" /> - <TextView - android:id="@+id/title" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_weight="1" - android:textColor="?colorPrimary" - tools:text="Unreasonably long article title blah blah blah blah blah blah" - android:textSize="18sp" - android:gravity="start" /> + </LinearLayout> - </LinearLayout> + <TextView + android:id="@+id/comments" + android:layout_marginStart="16dp" + android:layout_marginEnd="16dp" + tools:text="comments" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:textAlignment="viewStart" + android:layout_weight="1" + android:fontFamily="sans-serif-light" + android:layout_marginTop="8dp" + android:textColor="?colorPrimary" + android:textSize="12sp" /> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginStart="16dp" + android:layout_marginEnd="16dp" + android:layout_marginBottom="8dp" + android:layout_marginTop="8dp"> <TextView - android:id="@+id/comments" - android:layout_marginStart="16dp" - android:layout_marginEnd="16dp" - tools:text="comments" - android:layout_width="match_parent" + android:id="@+id/tags" + tools:text="alpha, beta, gamma" + android:layout_width="0dp" android:layout_height="wrap_content" + android:layout_weight="0.7" + android:ellipsize="middle" android:textAlignment="viewStart" - android:layout_weight="1" + android:singleLine="true" android:fontFamily="sans-serif-light" - android:layout_marginTop="8dp" - android:textColor="?colorPrimary" + android:textColor="?colorSecondary" android:textSize="12sp" /> - <LinearLayout - android:layout_width="match_parent" + <TextView + android:id="@+id/date" + tools:text="Jan 01, 1970" + android:layout_width="0dp" android:layout_height="wrap_content" - android:layout_marginStart="16dp" - android:layout_marginEnd="16dp" - android:layout_marginBottom="8dp" - android:layout_marginTop="8dp"> - - <TextView - android:id="@+id/tags" - tools:text="alpha, beta, gamma" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_weight="0.7" - android:ellipsize="middle" - android:textAlignment="viewStart" - android:singleLine="true" - android:fontFamily="sans-serif-light" - android:textColor="?colorSecondary" - android:textSize="12sp" /> - - <TextView - android:id="@+id/date" - tools:text="Jan 01, 1970" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_weight="0.3" - android:textAlignment="viewEnd" - android:fontFamily="sans-serif-light" - android:textAppearance="?android:attr/textAppearanceSmall" - android:textColor="?colorSecondary" - android:textSize="12sp" /> - - </LinearLayout> - - <LinearLayout + android:layout_weight="0.3" + android:textAlignment="viewEnd" + android:fontFamily="sans-serif-light" + android:textAppearance="?android:attr/textAppearanceSmall" + android:textColor="?colorSecondary" + android:textSize="12sp" /> + + </LinearLayout> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content"> + + <com.google.android.material.card.MaterialCardView + android:id="@+id/note_container" android:layout_width="match_parent" - android:layout_height="wrap_content"> + app:cardBackgroundColor="?colorTertiaryContainer" + android:layout_margin="8dp" + app:strokeWidth="0dp" + android:layout_height="match_parent"> - <com.google.android.material.card.MaterialCardView - android:id="@+id/note_container" + <LinearLayout android:layout_width="match_parent" - app:cardBackgroundColor="?colorTertiaryContainer" android:layout_margin="8dp" - app:strokeWidth="0dp" - android:layout_height="match_parent"> + android:layout_height="wrap_content"> - <LinearLayout + <TextView + android:id="@+id/note" + tools:text="Article note (if any...)" + android:layout_gravity="center_vertical" android:layout_width="match_parent" - android:layout_margin="8dp" - android:layout_height="wrap_content"> - - <TextView - android:id="@+id/note" - tools:text="Article note (if any...)" - android:layout_gravity="center_vertical" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginEnd="8dp" - android:textColor="?colorOnTertiaryContainer" - android:layout_weight="1" - android:textSize="12sp"/> - - <ImageView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center_vertical" - app:tint="?colorOnTertiaryContainer" - android:src="@drawable/baseline_note_24"/> - - </LinearLayout> - </com.google.android.material.card.MaterialCardView> - - </LinearLayout> - </LinearLayout> - </com.google.android.material.card.MaterialCardView> + android:layout_height="wrap_content" + android:layout_marginEnd="8dp" + android:textColor="?colorOnTertiaryContainer" + android:layout_weight="1" + android:textSize="12sp"/> + + <ImageView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_vertical" + app:tint="?colorOnTertiaryContainer" + android:src="@drawable/baseline_note_24"/> + + </LinearLayout> + </com.google.android.material.card.MaterialCardView> - </com.google.android.material.appbar.AppBarLayout> + </LinearLayout> + </LinearLayout> + </com.google.android.material.card.MaterialCardView> - <com.telefonica.nestedscrollwebview.NestedScrollWebView - android:id="@+id/article_content" - app:layout_behavior="@string/appbar_scrolling_view_behavior" - android:layout_width="match_parent" - android:layout_height="match_parent" /> + </com.google.android.material.appbar.AppBarLayout> - </com.otaliastudios.nestedscrollcoordinatorlayout.NestedScrollCoordinatorLayout> + <com.telefonica.nestedscrollwebview.NestedScrollWebView + android:id="@+id/article_content" + app:layout_behavior="@string/appbar_scrolling_view_behavior" + android:layout_width="match_parent" + android:layout_height="match_parent" /> -</FrameLayout>
\ No newline at end of file +</com.otaliastudios.nestedscrollcoordinatorlayout.NestedScrollCoordinatorLayout> |