Added teasers

This commit is contained in:
Vladislav Khorev 2014-10-24 04:31:52 +00:00
parent 02064fcf94
commit 4116fe0867
50 changed files with 483 additions and 128 deletions

View File

@ -14,23 +14,11 @@
android:label="@string/app_name" android:label="@string/app_name"
android:theme="@style/AppTheme" android:theme="@style/AppTheme"
android:hardwareAccelerated="true" > android:hardwareAccelerated="true" >
<activity
android:name=".LoadingActivity"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar" >
<intent-filter>
</intent-filter>
</activity>
<activity
android:name=".WelcomeActivity"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar" >
<intent-filter>
</intent-filter>
</activity>
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"
android:label="@string/app_name" > android:label="@string/app_name"
android:configChanges="orientation"
android:screenOrientation="portrait" >
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:state_focused="true" android:state_pressed="false" android:drawable="@drawable/agro_teaser" />
<item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/agro_teaser_darken" />
<item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/agro_teaser_darken" />
<item android:drawable="@drawable/agro_teaser" />
</selector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 MiB

After

Width:  |  Height:  |  Size: 192 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:state_focused="true" android:state_pressed="false" android:drawable="@drawable/culture_teaser" />
<item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/culture_teaser_darken" />
<item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/culture_teaser_darken" />
<item android:drawable="@drawable/culture_teaser" />
</selector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:state_focused="true" android:state_pressed="false" android:drawable="@drawable/economics_teaser" />
<item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/economics_teaser_darken" />
<item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/economics_teaser_darken" />
<item android:drawable="@drawable/economics_teaser" />
</selector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:state_focused="true" android:state_pressed="false" android:drawable="@drawable/education_teaser" />
<item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/education_teaser_darken" />
<item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/education_teaser_darken" />
<item android:drawable="@drawable/education_teaser" />
</selector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:state_focused="true" android:state_pressed="false" android:drawable="@drawable/medicine_teaser" />
<item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/medicine_teaser_darken" />
<item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/medicine_teaser_darken" />
<item android:drawable="@drawable/medicine_teaser" />
</selector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 KiB

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:state_focused="true" android:state_pressed="false" android:drawable="@drawable/sport_teaser" />
<item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/sport_teaser_darken" />
<item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/sport_teaser_darken" />
<item android:drawable="@drawable/sport_teaser" />
</selector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 328 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:state_focused="true" android:state_pressed="false" android:drawable="@drawable/test_teaser_bkg" />
<item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/test_teaser_bkg_darken" />
<item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/test_teaser_bkg_darken" />
<item android:drawable="@drawable/test_teaser_bkg" />
</selector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:state_focused="true" android:state_pressed="false" android:drawable="@drawable/tourism_teaser" />
<item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/tourism_teaser_darken" />
<item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/tourism_teaser_darken" />
<item android:drawable="@drawable/tourism_teaser" />
</selector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:state_focused="true" android:state_pressed="false" android:drawable="@drawable/transport_teaser" />
<item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/transport_teaser_darken" />
<item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/transport_teaser_darken" />
<item android:drawable="@drawable/transport_teaser" />
</selector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -0,0 +1,12 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/fragment_proto_container"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<fragment android:name="fishrungames.bashgid.MainPageFragment"
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</FrameLayout>

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/LinearLayout2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:orientation="horizontal" >
<ImageView
android:id="@+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="4dp"
android:src="@drawable/test_drawer_icon" />
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="4dp"
android:text="TextView"
android:textColor="@color/text_white"
android:textSize="24sp" />
</LinearLayout>

View File

@ -2,6 +2,7 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_margin="0dp"
android:background="@drawable/background" android:background="@drawable/background"
android:orientation="vertical" android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin" android:paddingBottom="@dimen/activity_vertical_margin"
@ -10,10 +11,19 @@
android:paddingTop="@dimen/activity_vertical_margin" android:paddingTop="@dimen/activity_vertical_margin"
tools:context="fishrungames.bashgid.MainPageFragment" > tools:context="fishrungames.bashgid.MainPageFragment" >
<ListView <GridView
android:id="@+id/teaserListView" android:id="@+id/teaserGridView"
android:layout_width="match_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" > android:layout_height="wrap_content"
</ListView> android:alwaysDrawnWithCache="true"
android:gravity="center_horizontal"
android:horizontalSpacing="10dp"
android:numColumns="2"
android:scrollingCache="true"
android:smoothScrollbar="true"
android:stretchMode="columnWidth"
android:verticalSpacing="10dp" >
</GridView>
</LinearLayout> </LinearLayout>

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/light_grey"
android:orientation="vertical" >
<ListView
android:id="@+id/listView"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</ListView>
</LinearLayout>

View File

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:orientation="vertical" >
<TextView
android:id="@+id/headerTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:text="TextView"
android:textSize="16sp"
android:textStyle="bold" />
<TextView
android:id="@+id/subHeaderTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:text="TextView" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="5dp" >
<ImageView
android:id="@+id/imageView"
android:layout_width="204dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="5dp"
android:adjustViewBounds="true"
android:scaleType="fitCenter"
android:src="@drawable/economics_teaser" />
<TextView
android:id="@+id/imageTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:text="TextView"
android:visibility="gone" />
</LinearLayout>
<TextView
android:id="@+id/footerTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:text="TextView" />
</LinearLayout>

View File

@ -7,101 +7,14 @@
android:orientation="vertical" android:orientation="vertical"
android:showDividers="middle" > android:showDividers="middle" >
<LinearLayout <Button
android:id="@+id/teaserElement"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="120dp"
android:layout_margin="4dp" android:background="@drawable/test_teaser_bkg_button"
android:background="@color/light_grey" > android:text="Промышленность"
android:textColor="@color/text_white"
<TextView android:textSize="18sp"
android:id="@+id/textTeaserHeader" android:textStyle="bold" />
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Заголовок" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_margin="4dp"
android:background="@color/light_grey" >
<ImageView
android:id="@+id/imageTeaser1"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:adjustViewBounds="true"
android:scaleType="fitCenter"
android:src="@drawable/russia_icon" />
<TextView
android:id="@+id/textTeaser1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="6dp"
android:text="TextView" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_margin="4dp"
android:background="@color/light_grey" >
<ImageView
android:id="@+id/imageTeaser2"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:adjustViewBounds="true"
android:scaleType="fitCenter"
android:src="@drawable/russia_icon" />
<TextView
android:id="@+id/textTeaser2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="6dp"
android:text="TextView" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_margin="4dp"
android:background="@color/light_grey" >
<ImageView
android:id="@+id/imageTeaser3"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:adjustViewBounds="true"
android:scaleType="fitCenter"
android:src="@drawable/russia_icon" />
<TextView
android:id="@+id/textTeaser3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="6dp"
android:text="TextView" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="4dp"
android:background="@color/light_grey" >
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView" />
</LinearLayout>
</LinearLayout> </LinearLayout>

View File

@ -4,10 +4,13 @@
<string name="app_name">Bashgid</string> <string name="app_name">Bashgid</string>
<color name="light_grey">#60E0E0E0</color> <color name="light_grey">#E0E0E0</color>
<color name="light_grey_1">#60d0d0d0</color> <color name="light_grey_1">#60d0d0d0</color>
<color name="text_white">#F0F0F0</color>
<color name="teaser_color">#2B517F</color>
</resources> </resources>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<string name="app_name">Bashgid</string> <string name="app_name">Гид РБ</string>
<string name="title_section1">Section 1</string> <string name="title_section1">Section 1</string>
<string name="title_section2">Section 2</string> <string name="title_section2">Section 2</string>
<string name="title_section3">Section 3</string> <string name="title_section3">Section 3</string>

View File

@ -23,20 +23,27 @@ import android.widget.TextView;
public class MainActivity extends ActionBarActivity { public class MainActivity extends ActionBarActivity {
static MainActivity instance = null;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main); setContentView(R.layout.activity_main);
getSupportActionBar().hide(); getSupportActionBar().hide();
getSupportFragmentManager().beginTransaction().add(R.id.fragment_proto_container, new WelcomeFragment()).commit(); getSupportFragmentManager().beginTransaction().add(R.id.fragment_proto_container, new WelcomeFragment()).commit();
instance = this;
} }
public static MainActivity getInstance()
{
return instance;
}
public void OnSelectEnglish(View view) public void OnSelectEnglish(View view)
@ -54,10 +61,15 @@ public class MainActivity extends ActionBarActivity {
OpenMainScreen(); OpenMainScreen();
} }
public void OnSelectSemiDetails(Integer pos)
{
getSupportFragmentManager().beginTransaction().add(R.id.fragment_container, new SemiDetailsFragment()).addToBackStack(null).commit();
}
public void OpenMainScreen() public void OpenMainScreen()
{ {
getSupportActionBar().show(); //getSupportActionBar().show();
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_proto_container, new MainFragment()).commit(); getSupportFragmentManager().beginTransaction().replace(R.id.fragment_proto_container, new MainFragment()).commit();

View File

@ -1,17 +1,83 @@
package fishrungames.bashgid; package fishrungames.bashgid;
import android.content.Context;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
public class MainFragment extends Fragment { public class MainFragment extends Fragment {
ListView left_drawer;
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_main, container, false); View rootView = inflater.inflate(R.layout.fragment_main, container, false);
left_drawer = (ListView) rootView.findViewById(R.id.left_drawer);
left_drawer.setAdapter(new DrawerAdapter(getActivity()));
return rootView; return rootView;
} }
public class DrawerAdapter extends BaseAdapter {
private Context mContext;
public DrawerAdapter(Context c) {
mContext = c;
}
public int getCount() {
return 3;
}
public Object getItem(int position) {
return null;
}
public long getItemId(int position) {
return 0;
}
// create a new ImageView for each item referenced by the Adapter
public View getView(int position, View convertView, ViewGroup parent) {
View view;
if (convertView == null) { // if it's not recycled, initialize some attributes
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
view = inflater.inflate(R.layout.drawer_list_element, null);
} else {
view = convertView;
}
TextView textView = (TextView) view.findViewById(R.id.textView);
if (position == 0)
{
textView.setText("Справочник");
}
else if (position == 1)
{
textView.setText("Новости");
}
else
{
textView.setText("Карта");
}
return view;
}
}
} }

View File

@ -7,20 +7,47 @@ import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.BaseAdapter; import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.GridView;
import android.widget.ListView; import android.widget.ListView;
public class MainPageFragment extends Fragment { public class MainPageFragment extends Fragment {
ListView teaserListView;
final Integer[] teaserIcons = {
R.drawable.economics_teaser_button,
R.drawable.test_teaser_bkg_button,
R.drawable.agro_teaser_button,
R.drawable.transport_teaser_button,
R.drawable.education_teaser_button,
R.drawable.tourism_teaser_button,
R.drawable.medicine_teaser_button,
R.drawable.sport_teaser_button,
};
final String[] teaserText = {
"Экономика",
"Промышленность",
"Сельское хозяйство ",
"Транспорт",
"Образование",
"Туризм",
"Медицина",
"Спорт",
};
GridView teaserGridView;
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_main_page, container, false); View rootView = inflater.inflate(R.layout.fragment_main_page, container, false);
teaserListView = (ListView) rootView.findViewById(R.id.teaserListView); teaserGridView = (GridView) rootView.findViewById(R.id.teaserGridView);
teaserGridView.setAdapter(new SlideListAdapter(getActivity()));
teaserListView.setAdapter(new SlideListAdapter(getActivity()));
return rootView; return rootView;
} }
@ -34,7 +61,7 @@ public class MainPageFragment extends Fragment {
} }
public int getCount() { public int getCount() {
return 7; return teaserIcons.length;
} }
public Object getItem(int position) { public Object getItem(int position) {
@ -53,11 +80,27 @@ public class MainPageFragment extends Fragment {
if (convertView == null) { // if it's not recycled, initialize some attributes if (convertView == null) { // if it's not recycled, initialize some attributes
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
view = inflater.inflate(R.layout.teaser_list_element, null); view = inflater.inflate(R.layout.teaser_list_element, null);
} else { } else {
view = convertView; view = convertView;
} }
Button button = (Button) view.findViewById(R.id.teaserElement);
button.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v) {
MainActivity.getInstance().OnSelectSemiDetails(0);
}
}
);
//button.setBackground(mContext.getResources().getDrawable(teaserIcons[position]));
button.setBackgroundResource(teaserIcons[position]);
button.setText(teaserText[position]);
return view; return view;
} }

View File

@ -0,0 +1,130 @@
package fishrungames.bashgid;
import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
public class SemiDetailsFragment extends Fragment {
ListView semidetailsGridView;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_semidetails_page, container, false);
semidetailsGridView = (ListView) rootView.findViewById(R.id.listView);
semidetailsGridView.setAdapter(new SemidetailsAdapter(getActivity()));
return rootView;
}
public class SemidetailsAdapter extends BaseAdapter {
private Context mContext;
public SemidetailsAdapter(Context c) {
mContext = c;
}
public int getCount() {
return 2;
}
public Object getItem(int position) {
return null;
}
public long getItemId(int position) {
return 0;
}
// create a new ImageView for each item referenced by the Adapter
public View getView(int position, View convertView, ViewGroup parent) {
View view;
if (convertView == null) { // if it's not recycled, initialize some attributes
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
view = inflater.inflate(R.layout.semidetails_element, null);
} else {
view = convertView;
}
TextView headerTextView = (TextView)view.findViewById(R.id.headerTextView);
TextView subHeaderTextView = (TextView)view.findViewById(R.id.subHeaderTextView);
ImageView imageView = (ImageView)view.findViewById(R.id.imageView);
TextView imageTextView = (TextView)view.findViewById(R.id.imageTextView);
TextView footerTextView = (TextView)view.findViewById(R.id.footerTextView);
if (position == 0)
{
headerTextView.setVisibility(View.VISIBLE);
headerTextView.setText("Структура промышленности Башкортостана");
subHeaderTextView.setText("Важнейшие отрасли промышленности Башкортостана — нефтедобыча, нефтепереработка, химия и нефтехимия.");
subHeaderTextView.setVisibility(View.VISIBLE);
imageView.setImageResource(R.drawable.test_promstruct_rb);
LayoutParams params = imageView.getLayoutParams();
params.width = LayoutParams.MATCH_PARENT;
imageView.setLayoutParams(params);
imageTextView.setVisibility(View.GONE);
footerTextView.setText("");
}
else
{
headerTextView.setVisibility(View.VISIBLE);
headerTextView.setText("УМПО");
subHeaderTextView.setVisibility(View.VISIBLE);
subHeaderTextView.setText("Стремимся к вершинам!");
imageView.setImageResource(R.drawable.test_umpo);
LayoutParams params = imageView.getLayoutParams();
params.width = 200;
imageView.setLayoutParams(params);
imageTextView.setVisibility(View.VISIBLE);
imageTextView.setText("УМПО - российское предприятие, производитель авиационных двигателей. Основано в 1925 году. В объединении работают более 15 тысяч человек.");
footerTextView.setText("Нажмите сюда для подробностей");
}
//Button button = (Button) view.findViewById(R.id.teaserElement);
//button.setBackground(mContext.getResources().getDrawable(teaserIcons[position]));
//button.setBackgroundResource(teaserIcons[position]);
//button.setText(teaserText[position]);
return view;
}
}
}