populate article fragment in a runnable

This commit is contained in:
Andrew Dolgov 2013-05-23 14:27:57 +04:00
parent 5554b5c254
commit 327f1af0ba
2 changed files with 247 additions and 231 deletions

View File

@ -1,4 +1,4 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout 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:layout_height="fill_parent" android:layout_height="fill_parent"
@ -96,4 +96,4 @@
</LinearLayout> </LinearLayout>
</org.fox.ttrss.TitleWebView> </org.fox.ttrss.TitleWebView>
</LinearLayout> </FrameLayout>

View File

@ -20,6 +20,7 @@ import android.content.SharedPreferences;
import android.graphics.Typeface; import android.graphics.Typeface;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.text.Html; import android.text.Html;
@ -87,14 +88,22 @@ public class ArticleFragment extends Fragment implements GestureDetector.OnDoubl
@SuppressLint("NewApi") @SuppressLint("NewApi")
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
m_activity.setProgressBarVisibility(true); m_activity.setProgressBarVisibility(true);
if (savedInstanceState != null) { if (savedInstanceState != null) {
m_article = savedInstanceState.getParcelable("article"); m_article = savedInstanceState.getParcelable("article");
} }
View view = inflater.inflate(R.layout.article_fragment, container, false); final View view = inflater.inflate(R.layout.article_fragment, container, false);
View content = view.findViewById(R.id.content);
if (content != null) content.setVisibility(View.INVISIBLE);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
if (isAdded()) {
if (m_article != null) { if (m_article != null) {
@ -289,6 +298,8 @@ public class ArticleFragment extends Fragment implements GestureDetector.OnDoubl
if (m_activity.isSmallScreen()) if (m_activity.isSmallScreen())
web.setOnTouchListener(m_gestureListener); web.setOnTouchListener(m_gestureListener);
web.setVisibility(View.VISIBLE);
} }
TextView dv = (TextView)view.findViewById(R.id.date); TextView dv = (TextView)view.findViewById(R.id.date);
@ -329,6 +340,11 @@ public class ArticleFragment extends Fragment implements GestureDetector.OnDoubl
} }
} }
}
}
}, 50);
return view; return view;
} }