Skip to content
This repository was archived by the owner on Feb 22, 2022. It is now read-only.

Commit ef17e02

Browse files
committed
A new demo to address #51
1 parent 2c3308f commit ef17e02

File tree

9 files changed

+152
-5
lines changed

9 files changed

+152
-5
lines changed
2.28 KB
Binary file not shown.

FlipView/Demo/AndroidManifest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
<activity android:name="com.aphidmobile.flip.demo.FlipDynamicAdapterActivity"/>
3131
<activity android:name="com.aphidmobile.flip.demo.FlipWebViewActivity"/>
3232
<activity android:name="com.aphidmobile.flip.demo.FlipDeleteAdapterActivity"/>
33+
<activity android:name="com.aphidmobile.flip.demo.Issue51Activity"/>
3334

3435
</application>
3536

FlipView/Demo/res/layout/page1.xml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
3+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
4+
android:orientation="vertical"
5+
android:layout_width="fill_parent"
6+
android:layout_height="fill_parent">
7+
8+
<TextView
9+
android:layout_width="fill_parent"
10+
android:layout_height="fill_parent"
11+
android:text="red"
12+
android:textSize="@dimen/textSize"
13+
android:background="@color/red"
14+
android:gravity="center"
15+
/>
16+
17+
</LinearLayout>

FlipView/Demo/res/layout/page2.xml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
3+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
4+
android:orientation="vertical"
5+
android:layout_width="fill_parent"
6+
android:layout_height="fill_parent">
7+
8+
<TextView
9+
android:layout_width="fill_parent"
10+
android:layout_height="fill_parent"
11+
android:text="green"
12+
android:textSize="@dimen/textSize"
13+
android:background="@color/green"
14+
android:gravity="center"
15+
/>
16+
17+
</LinearLayout>

FlipView/Demo/res/layout/page3.xml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
3+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
4+
android:orientation="vertical"
5+
android:layout_width="fill_parent"
6+
android:layout_height="fill_parent">
7+
8+
<TextView
9+
android:layout_width="fill_parent"
10+
android:layout_height="fill_parent"
11+
android:text="blue"
12+
android:textSize="@dimen/textSize"
13+
android:background="@color/blue"
14+
android:gravity="center"
15+
/>
16+
17+
</LinearLayout>

FlipView/Demo/res/values/colors.xml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,12 @@
1717
-->
1818

1919
<resources>
20-
21-
<color name="transparentBlack">#6D000000</color>
22-
<color name="white">#FFFFFF</color>
23-
<color name="darkgrey">#949494</color>
24-
20+
21+
<color name="transparentBlack">#6D000000</color>
22+
<color name="white">#FFFFFF</color>
23+
<color name="darkgrey">#949494</color>
24+
<color name="red">#FF0000</color>
25+
<color name="green">#00FF00</color>
26+
<color name="blue">#0000FF</color>
27+
2528
</resources>
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
package com.aphidmobile.flip.demo;
2+
3+
import android.app.Activity;
4+
import android.content.Context;
5+
import android.graphics.Bitmap;
6+
import android.os.Bundle;
7+
import android.view.LayoutInflater;
8+
import android.view.View;
9+
import android.view.ViewGroup;
10+
import android.widget.BaseAdapter;
11+
import com.aphidmobile.flip.FlipViewController;
12+
import com.aphidmobile.flip.demo.adapter.TravelAdapter;
13+
import com.aphidmobile.flipview.demo.R;
14+
15+
/*
16+
Copyright 2012 Aphid Mobile
17+
18+
Licensed under the Apache License, Version 2.0 (the "License");
19+
you may not use this file except in compliance with the License.
20+
You may obtain a copy of the License at
21+
22+
http://www.apache.org/licenses/LICENSE-2.0
23+
24+
Unless required by applicable law or agreed to in writing, software
25+
distributed under the License is distributed on an "AS IS" BASIS,
26+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
27+
See the License for the specific language governing permissions and
28+
limitations under the License.
29+
30+
*/
31+
public class Issue51Activity extends Activity {
32+
private FlipViewController flipView;
33+
34+
@Override
35+
protected void onCreate(Bundle savedInstanceState) {
36+
super.onCreate(savedInstanceState);
37+
setTitle(R.string.activity_title);
38+
39+
flipView = new FlipViewController(this);
40+
41+
flipView.setAdapter(new MyBaseAdapter(this));
42+
43+
setContentView(flipView);
44+
}
45+
46+
@Override
47+
protected void onResume() {
48+
super.onResume();
49+
flipView.onResume();
50+
}
51+
52+
@Override
53+
protected void onPause() {
54+
super.onPause();
55+
flipView.onPause();
56+
}
57+
58+
private static class MyBaseAdapter extends BaseAdapter {
59+
private LayoutInflater inflater;
60+
61+
private MyBaseAdapter(Context context) {
62+
inflater = LayoutInflater.from(context);
63+
}
64+
65+
@Override
66+
public int getCount() {
67+
return 3;
68+
}
69+
70+
@Override
71+
public Object getItem(int position) {
72+
return position;
73+
}
74+
75+
@Override
76+
public long getItemId(int position) {
77+
return position;
78+
}
79+
80+
@Override
81+
public View getView(int position, View convertView, ViewGroup parent) {
82+
if (position == 0)
83+
return inflater.inflate(R.layout.page1, null);
84+
else if (position == 1)
85+
return inflater.inflate(R.layout.page2, null);
86+
else
87+
return inflater.inflate(R.layout.page3, null);
88+
}
89+
}
90+
}

FlipView/Demo/src/com/aphidmobile/flip/demo/MainActivity.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ protected void onListItemClick(ListView l, View v, int position, long id) {
7979
addItem(data, "Dynamic Adapter Size", FlipDynamicAdapterActivity.class);
8080
addItem(data, "WebView", FlipWebViewActivity.class);
8181
addItem(data, "Delete page", FlipDeleteAdapterActivity.class);
82+
addItem(data, "Issue #51", Issue51Activity.class);
8283

8384
return data;
8485
}

FlipView/FlipView.ipr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@
163163
<inspection_tool class="RequiredAttributes" enabled="false" level="WARNING" enabled_by_default="false">
164164
<option name="myAdditionalRequiredHtmlAttributes" value="" />
165165
</inspection_tool>
166+
<inspection_tool class="RubyUnnecessaryReturnStatement" enabled="false" level="WARNING" enabled_by_default="false" />
166167
<inspection_tool class="SimplifiableIfStatement" enabled="false" level="WARNING" enabled_by_default="false" />
167168
<inspection_tool class="UnresolvedReference" enabled="false" level="ERROR" enabled_by_default="false" />
168169
<inspection_tool class="UnusedDeclaration" enabled="false" level="WARNING" enabled_by_default="false">

0 commit comments

Comments
 (0)