Skip to content

Commit c1d0bef

Browse files
✨ Package name fixes
1 parent 5bb82d4 commit c1d0bef

File tree

4 files changed

+17
-11
lines changed

4 files changed

+17
-11
lines changed

app/src/main/AndroidManifest.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3-
package="in.goodiebag.example.carouselview">
3+
package="in.goodiebag.example">
44

55
<application
66
android:allowBackup="true"

app/src/main/java/in/goodiebag/example/MainActivity.java

+7-7
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import java.util.List;
1010

1111
import in.goodiebag.carouselpicker.CarouselPicker;
12-
import in.goodiebag.example.carouselview.R;
12+
import in.goodiebag.example.R;
1313

1414
public class MainActivity extends AppCompatActivity {
1515
CarouselPicker imageCarousel, textCarousel, mixCarousel;
@@ -25,10 +25,10 @@ protected void onCreate(Bundle savedInstanceState) {
2525
tvSelected = (TextView) findViewById(R.id.tvSelectedItem);
2626

2727
List<CarouselPicker.PickerItem> imageItems = new ArrayList<>();
28-
imageItems.add(new CarouselPicker.DrawableItem(R.drawable.icon_checkbox_tune));
29-
imageItems.add(new CarouselPicker.DrawableItem(R.drawable.icon_checkbox_tune));
30-
imageItems.add(new CarouselPicker.DrawableItem(R.drawable.icon_checkbox_tune));
31-
imageItems.add(new CarouselPicker.DrawableItem(R.drawable.icon_checkbox_tune));
28+
imageItems.add(new CarouselPicker.DrawableItem(R.drawable.i1));
29+
imageItems.add(new CarouselPicker.DrawableItem(R.drawable.i2));
30+
imageItems.add(new CarouselPicker.DrawableItem(R.drawable.i3));
31+
imageItems.add(new CarouselPicker.DrawableItem(R.drawable.i4));
3232
CarouselPicker.CarouselViewAdapter imageAdapter = new CarouselPicker.CarouselViewAdapter(this, imageItems, 0);
3333
imageCarousel.setAdapter(imageAdapter);
3434

@@ -41,9 +41,9 @@ protected void onCreate(Bundle savedInstanceState) {
4141
textCarousel.setAdapter(textAdapter);
4242

4343
List<CarouselPicker.PickerItem> mixItems = new ArrayList<>();
44-
mixItems.add(new CarouselPicker.DrawableItem(R.drawable.icon_checkbox_tune));
44+
mixItems.add(new CarouselPicker.DrawableItem(R.drawable.i1));
4545
mixItems.add(new CarouselPicker.TextItem("hi", 20));
46-
mixItems.add(new CarouselPicker.DrawableItem(R.drawable.icon_checkbox_tune));
46+
mixItems.add(new CarouselPicker.DrawableItem(R.drawable.i2));
4747
mixItems.add(new CarouselPicker.TextItem("hi", 20));
4848

4949
CarouselPicker.CarouselViewAdapter mixAdapter = new CarouselPicker.CarouselViewAdapter(this, mixItems, 0);

app/src/main/res/layout/activity_main.xml

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
2+
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
33
xmlns:app="http://schemas.android.com/apk/res-auto"
44
xmlns:tools="http://schemas.android.com/tools"
55
android:id="@+id/activity_main"
@@ -20,6 +20,7 @@
2020

2121
<in.goodiebag.carouselpicker.CarouselPicker
2222
android:id="@+id/textCarousel"
23+
android:layout_below="@id/imageCarousel"
2324
android:layout_marginBottom="20dp"
2425
android:layout_width="match_parent"
2526
android:layout_height="wrap_content"
@@ -28,6 +29,7 @@
2829

2930
<in.goodiebag.carouselpicker.CarouselPicker
3031
android:id="@+id/mixCarousel"
32+
android:layout_below="@id/textCarousel"
3133
android:layout_marginBottom="20dp"
3234
android:layout_width="match_parent"
3335
android:layout_height="wrap_content"
@@ -36,6 +38,7 @@
3638

3739
<TextView
3840
android:id="@+id/tvSelectedItem"
41+
android:layout_below="@id/mixCarousel"
3942
android:layout_width="match_parent"
4043
android:layout_height="wrap_content" />
41-
</LinearLayout>
44+
</RelativeLayout>

carouselpicker/src/main/java/in/goodiebag/carouselpicker/CarouselPicker.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ private void init() {
7171

7272
@Override
7373
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
74+
7475
int height = 0;
7576
for(int i = 0; i < getChildCount(); i++) {
7677
View child = getChildAt(i);
@@ -80,11 +81,12 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
8081
}
8182

8283
heightMeasureSpec = MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY);
83-
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
84+
8485
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
8586
int w = getMeasuredWidth();
8687
setPageMargin((int) (-w / divisor));
8788

89+
8890
}
8991

9092
@Override
@@ -120,6 +122,7 @@ public Object instantiateItem(ViewGroup container, int position) {
120122
ImageView iv = (ImageView) view.findViewById(R.id.iv);
121123
TextView tv = (TextView) view.findViewById(R.id.tv);
122124
PickerItem pickerItem = items.get(position);
125+
iv.setVisibility(VISIBLE);
123126
if (pickerItem.hasDrawable()) {
124127
iv.setVisibility(VISIBLE);
125128
tv.setVisibility(GONE);

0 commit comments

Comments
 (0)