More stuff to do
This commit is contained in:
parent
24e2c76bea
commit
1fb07ff884
13
android/res/drawable/button_background.xml
Normal file
13
android/res/drawable/button_background.xml
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle" >
|
||||
|
||||
<corners android:radius="3dp" />
|
||||
|
||||
<solid android:color="#000000" />
|
||||
|
||||
<stroke
|
||||
android:width="2px"
|
||||
android:color="#ffffff" />
|
||||
|
||||
</shape>
|
12
android/res/layout/fragment_photo_page.xml
Normal file
12
android/res/layout/fragment_photo_page.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<?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:orientation="vertical" >
|
||||
|
||||
<android.support.v4.view.ViewPager
|
||||
android:id="@+id/pager"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent" />
|
||||
|
||||
</LinearLayout>
|
14
android/res/layout/photo_page_element.xml
Normal file
14
android/res/layout/photo_page_element.xml
Normal file
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/LinearLayout1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:scaleType="fitCenter" />
|
||||
|
||||
</LinearLayout>
|
72
android/src/fishrungames/bashgid/PhotoFragment.java
Normal file
72
android/src/fishrungames/bashgid/PhotoFragment.java
Normal file
@ -0,0 +1,72 @@
|
||||
package fishrungames.bashgid;
|
||||
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import fishrungames.bashgid.core.AlbumManager.AlbumFullData;
|
||||
|
||||
public class PhotoFragment extends Fragment
|
||||
{
|
||||
|
||||
AlbumFullData album;
|
||||
String albumName;
|
||||
int currentPhoto;
|
||||
|
||||
PhotoFragmentAdapter listAdapter;
|
||||
|
||||
public PhotoFragment()
|
||||
{
|
||||
album = null;
|
||||
albumName = "";
|
||||
currentPhoto = -1;
|
||||
}
|
||||
|
||||
public PhotoFragment(String albumName, int currentPhoto)
|
||||
{
|
||||
this.albumName = albumName;
|
||||
this.currentPhoto = currentPhoto;
|
||||
RestoreAlbum();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(final Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
outState.putString("albumName", albumName);
|
||||
outState.putInt("currentPhoto", currentPhoto);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
|
||||
if (savedInstanceState != null) {
|
||||
albumName = savedInstanceState.getString("albumName");
|
||||
currentPhoto = savedInstanceState.getInt("currentPhoto");
|
||||
RestoreAlbum();
|
||||
}
|
||||
|
||||
View rootView = inflater.inflate(R.layout.fragment_photo_page, container, false);
|
||||
|
||||
listAdapter = new PhotoFragmentAdapter(getActivity(), album/*, currentPhoto*/);
|
||||
|
||||
ViewPager pager = (ViewPager) rootView.findViewById(R.id.pager);
|
||||
|
||||
pager.setAdapter(listAdapter);
|
||||
|
||||
pager.setCurrentItem(currentPhoto);
|
||||
|
||||
return rootView;
|
||||
}
|
||||
|
||||
void RestoreAlbum()
|
||||
{
|
||||
album = MainActivity.getInstance().albumDataSource.GetAlbumFullData(albumName);
|
||||
}
|
||||
|
||||
}
|
66
android/src/fishrungames/bashgid/PhotoFragmentAdapter.java
Normal file
66
android/src/fishrungames/bashgid/PhotoFragmentAdapter.java
Normal file
@ -0,0 +1,66 @@
|
||||
package fishrungames.bashgid;
|
||||
|
||||
import fishrungames.bashgid.core.AlbumManager.AlbumFullData;
|
||||
|
||||
import fishrungames.networkutils.ImageManager;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import android.support.v4.view.PagerAdapter;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
public class PhotoFragmentAdapter extends PagerAdapter {
|
||||
|
||||
private Context context;
|
||||
|
||||
AlbumFullData album;
|
||||
|
||||
//int currentPhoto;
|
||||
|
||||
public PhotoFragmentAdapter(Context context, AlbumFullData album/*, int currentPhoto*/) {
|
||||
this.context = context;
|
||||
this.album = album;
|
||||
//this.currentPhoto = currentPhoto;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return album.photoRecordArr.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isViewFromObject(View view, Object object) {
|
||||
return view == ((LinearLayout) object);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object instantiateItem(ViewGroup container, int position) {
|
||||
|
||||
|
||||
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
|
||||
View viewLayout = inflater.inflate(R.layout.photo_page_element, container,
|
||||
false);
|
||||
|
||||
ImageView image = (ImageView) viewLayout.findViewById(R.id.image);
|
||||
|
||||
ImageManager.getInstance().ApplyImageToImageView(image, album.photoRecordArr.get(position).imageUrl);
|
||||
|
||||
((ViewPager) container).addView(viewLayout);
|
||||
|
||||
return viewLayout;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroyItem(ViewGroup container, int position, Object object) {
|
||||
((ViewPager) container).removeView((LinearLayout) object);
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user