Skip to content
Snippets Groups Projects
Commit 768c53c4 authored by Lesik's avatar Lesik
Browse files

= removed addHeaderView because odd glitching, not sure why

parent 02ca859f
No related branches found
No related tags found
No related merge requests found
......@@ -18,7 +18,8 @@
android:theme="@style/AppTheme" >
<activity
android:name=".NewsActivity"
android:label="@string/app_name" >
android:label="@string/app_name"
android:configChanges="orientation|screenSize" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
......
......@@ -6,18 +6,39 @@
android:paddingLeft="8dp"
android:paddingRight="0dp">
<ListView
android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:scrollbarStyle="outsideInset"
android:clickable="false"
android:listSelector="@android:color/transparent"
android:drawSelectorOnTop="false"
android:divider="@null"
android:dividerHeight="10dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:background="@drawable/news_bubble"
android:paddingBottom="20dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="5dp"
android:text="@string/str_header"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@android:color/white" />
<ListView
android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:clickable="false"
android:divider="@null"
android:dividerHeight="10dp"
android:drawSelectorOnTop="false"
android:listSelector="@android:color/transparent"
android:scrollbarStyle="outsideInset" >
</ListView>
</LinearLayout>
<include layout="@layout/error" />
</LinearLayout>
package org.androidfromfrankfurt.archnews;
import com.negusoft.holoaccent.activity.AccentActivity;
import android.app.Activity;
import android.app.ActionBar;
import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
import android.os.Build;
import com.negusoft.holoaccent.activity.AccentActivity;
public class NewsActivity extends AccentActivity {
......@@ -28,8 +21,9 @@ public class NewsActivity extends AccentActivity {
}
@Override
protected void onResume() {
super.onResume();
protected void onPause() {
// super.onBackPressed();
super.onPause();
}
@Override
......
......@@ -24,13 +24,13 @@ public class NewsFragment extends ListFragment {
private static NewsFragment instance;
private View listView;
private View headerView;
// private View headerView;
private View errorView;
private TextView tvError;
private Button btnReload;
private ProgressDialog loadingDialog;
private boolean listVisible;
private boolean currentlyLoading;
private boolean newActivity = true;
public NewsFragment() {
instance = this;
......@@ -43,7 +43,7 @@ public class NewsFragment extends ListFragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_news, container, false);
headerView = inflater.inflate(R.layout.header, null);
// headerView = inflater.inflate(R.layout.header, null, false);
tvError = (TextView)rootView.findViewById(R.id.tv_errormessage);
btnReload = (Button)rootView.findViewById(R.id.btn_reload);
return rootView;
......@@ -53,27 +53,16 @@ public class NewsFragment extends ListFragment {
public void onStart() {
super.onStart();
initialize();
startLoading();
}
@Override
public void onDestroyView() {
// setListAdapter(null);
super.onDestroyView();
}
@Override
public void onResume() {
super.onResume();
if(newActivity) {
startLoading();
}
}
private void initialize() {
listView = getListView();
if(headerView != null) {
this.getListView().addHeaderView(headerView);
}
// if(headerView != null) {
// this.getListView().addHeaderView(headerView);
// }
errorView = getListView().getEmptyView();
errorView.setVisibility(View.GONE);;
btnReload.setOnClickListener(new OnClickListener() {
......@@ -112,13 +101,12 @@ public class NewsFragment extends ListFragment {
public void startLoading() {
loadingDialog.show();
currentlyLoading = true;
parseRss();
}
private void loadingSuccessful(boolean success, String errorMessage) {
newActivity = false;
loadingDialog.dismiss();
currentlyLoading = false;
if (!success && errorMessage != null) {
showError();
showErrorMessage(errorMessage);
......@@ -164,9 +152,4 @@ public class NewsFragment extends ListFragment {
listView.setVisibility(View.VISIBLE);
}
}
public boolean isCurrentlyLoading() {
return currentlyLoading;
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment