experimental use of titlebarwebview

This commit is contained in:
Andrew Dolgov 2012-12-31 03:51:06 +04:00
parent f0db07f0cb
commit 369ad45bf5
2 changed files with 25 additions and 13 deletions

View File

@ -1,8 +1,8 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/article_fragment" android:id="@+id/article_fragment"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:padding="5sp"
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:padding="5sp"
android:orientation="vertical" > android:orientation="vertical" >
<LinearLayout <LinearLayout
@ -10,8 +10,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="0" android:layout_weight="0"
android:orientation="vertical" android:orientation="vertical" >
android:paddingBottom="5sp" >
<TextView <TextView
android:id="@+id/title" android:id="@+id/title"
@ -56,21 +55,23 @@
android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="?android:attr/textAppearanceSmall"
android:textSize="13sp" /> android:textSize="13sp" />
</LinearLayout> </LinearLayout>
</LinearLayout>
<ImageView <ImageView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="0" android:layout_weight="0"
android:background="?horizontalDivider" android:background="?horizontalDivider"
android:layout_marginBottom="5sp"
android:paddingTop="2dip" /> android:paddingTop="2dip" />
<WebView </LinearLayout>
<com.nobu_games.android.view.web.TitleBarWebView
android:id="@+id/content" android:id="@+id/content"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:padding="5sp" /> />
<LinearLayout <LinearLayout
android:id="@+id/attachments_holder" android:id="@+id/attachments_holder"

View File

@ -13,6 +13,8 @@ import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element; import org.jsoup.nodes.Element;
import org.jsoup.select.Elements; import org.jsoup.select.Elements;
import com.nobu_games.android.view.web.TitleBarWebView;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.app.ActionBar; import android.app.ActionBar;
import android.app.Activity; import android.app.Activity;
@ -40,6 +42,7 @@ import android.webkit.WebSettings.LayoutAlgorithm;
import android.webkit.WebView; import android.webkit.WebView;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.Button; import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.Spinner; import android.widget.Spinner;
import android.widget.TextView; import android.widget.TextView;
@ -171,9 +174,17 @@ public class ArticleFragment extends Fragment implements GestureDetector.OnDoubl
} }
} }
WebView web = (WebView)view.findViewById(R.id.content); TitleBarWebView web = (TitleBarWebView)view.findViewById(R.id.content);
if (web != null) { if (web != null) {
if (m_activity.isSmallScreen()) {
View header = view.findViewById(R.id.article_header);
LinearLayout article = (LinearLayout)view.findViewById(R.id.article_fragment);
article.removeView(header);
web.setEmbeddedTitleBarCompat(header);
}
web.setWebChromeClient(new WebChromeClient() { web.setWebChromeClient(new WebChromeClient() {
@Override @Override
public void onProgressChanged(WebView view, int progress) { public void onProgressChanged(WebView view, int progress) {