implement closing of articlepanel

This commit is contained in:
Andrew Dolgov 2011-11-24 15:08:02 +03:00
parent 1fe01350a5
commit 4776a5d439
3 changed files with 25 additions and 10 deletions

View File

@ -1,17 +1,17 @@
<ViewFlipper xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" android:id="@+id/main_flipper">
<FrameLayout android:id="@+id/sync_splash" android:layout_height="match_parent" android:layout_width="match_parent" android:layout_gravity="center_vertical">
<LinearLayout android:id="@+id/linearLayout1" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center">
<ProgressBar android:id="@+id/loading_progress" android:layout_width="wrap_content" style="?android:attr/progressBarStyleLarge" android:layout_height="wrap_content"></ProgressBar>
<TextView android:textAppearance="?android:attr/textAppearanceLarge" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/loading_message" android:text="@string/loading_message"></TextView>
<LinearLayout android:layout_height="fill_parent" android:orientation="horizontal" android:id="@+id/main" android:layout_width="fill_parent">
<FrameLayout android:layout_height="match_parent" android:layout_width="300dp" android:layout_weight="0" android:id="@+id/feeds_fragment"></FrameLayout>
<FrameLayout android:layout_height="match_parent" android:layout_width="0dp" android:layout_weight="0.5" android:id="@+id/headlines_fragment"></FrameLayout>
<FrameLayout android:layout_height="match_parent" android:layout_width="0dp" android:layout_weight="0.5" android:id="@+id/article_fragment"></FrameLayout>
</LinearLayout>
<FrameLayout android:layout_gravity="center_vertical" android:layout_height="match_parent" android:layout_width="match_parent" android:id="@+id/sync_splash">
<LinearLayout android:layout_width="match_parent" android:gravity="center" android:layout_height="match_parent" android:id="@+id/linearLayout1">
<ProgressBar android:layout_height="wrap_content" android:layout_width="wrap_content" style="?android:attr/progressBarStyleLarge" android:id="@+id/loading_progress"></ProgressBar>
<TextView android:id="@+id/loading_message" android:text="@string/loading_message" android:textAppearance="?android:attr/textAppearanceLarge" android:layout_height="wrap_content" android:layout_width="wrap_content"></TextView>
</LinearLayout>
</FrameLayout>
<LinearLayout android:orientation="horizontal" android:id="@+id/main" android:layout_height="fill_parent" android:layout_width="fill_parent">
<FrameLayout android:id="@+id/feeds_fragment" android:layout_weight="0" android:layout_width="300dp" android:layout_height="match_parent"></FrameLayout>
<FrameLayout android:id="@+id/headlines_fragment" android:layout_weight="0.5" android:layout_width="match_parent" android:layout_height="match_parent"></FrameLayout>
<FrameLayout android:id="@+id/article_fragment" android:layout_weight="0.5" android:layout_width="match_parent" android:layout_height="match_parent"></FrameLayout>
</LinearLayout>
</ViewFlipper>

View File

@ -4,15 +4,17 @@ import java.net.URLEncoder;
import android.app.Activity;
import android.app.Fragment;
import android.app.FragmentTransaction;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebView;
import android.widget.Button;
import android.widget.TextView;
public class ArticleFragment extends Fragment {
public class ArticleFragment extends Fragment implements View.OnClickListener {
private final String TAG = this.getClass().getSimpleName();
protected SharedPreferences m_prefs;
@ -50,6 +52,12 @@ public class ArticleFragment extends Fragment {
web.loadData(content, "text/html", "utf-8");
}
Button btn = (Button)view.findViewById(R.id.close_button);
if (btn != null) {
btn.setOnClickListener(this);
}
}
return view;
@ -79,4 +87,10 @@ public class ArticleFragment extends Fragment {
}
@Override
public void onClick(View v) {
getActivity().findViewById(R.id.article_fragment).setVisibility(View.GONE);
getActivity().findViewById(R.id.feeds_fragment).setVisibility(View.VISIBLE);
}
}

View File

@ -317,6 +317,7 @@ public class MainActivity extends Activity implements FeedsFragment.OnFeedSelect
ft.addToBackStack(null);
ft.commit();
findViewById(R.id.feeds_fragment).setVisibility(View.GONE);
findViewById(R.id.article_fragment).setVisibility(View.VISIBLE);
}