Skip to content

Commit 69f3235

Browse files
committed
minor fixes in the sample project
1 parent b4fac4d commit 69f3235

3 files changed

Lines changed: 17 additions & 23 deletions

File tree

sample/src/main/java/com/ms/square/android/expandabletextview/sample/DemoActivity.java

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
* @author Manabu-GT
2626
*/
2727
public class DemoActivity extends AppCompatActivity {
28-
public static String POSITION = "POSITION";
28+
29+
private static final String POSITION = "POSITION";
2930

3031
/**
3132
* The {@link android.support.v4.view.PagerAdapter} that will provide
@@ -35,21 +36,20 @@ public class DemoActivity extends AppCompatActivity {
3536
* may be best to switch to a
3637
* {@link android.support.v4.app.FragmentStatePagerAdapter}.
3738
*/
38-
SectionsPagerAdapter mSectionsPagerAdapter;
39+
private SectionsPagerAdapter mSectionsPagerAdapter;
3940

4041
/**
4142
* The {@link ViewPager} that will host the section contents.
4243
*/
43-
ViewPager mViewPager;
44+
private ViewPager mViewPager;
4445

45-
TabLayout mTabLayout;
46+
private TabLayout mTabLayout;
4647

4748
@Override
4849
protected void onCreate(Bundle savedInstanceState) {
4950
super.onCreate(savedInstanceState);
5051
setContentView(R.layout.activity_demo);
5152

52-
5353
// Create the adapter that will return a fragment for each of the three
5454
// primary sections of the activity.
5555
mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
@@ -58,9 +58,6 @@ protected void onCreate(Bundle savedInstanceState) {
5858
mViewPager = (ViewPager) findViewById(R.id.container);
5959
mViewPager.setAdapter(mSectionsPagerAdapter);
6060

61-
// When swiping between different sections, select the corresponding
62-
// tab. We can also use ActionBar.Tab#select() to do this if we have
63-
// a reference to the Tab.
6461
mTabLayout = (TabLayout) findViewById(R.id.tabs);
6562
mTabLayout.setupWithViewPager(mViewPager);
6663
setupTabLayout(mTabLayout);
@@ -86,7 +83,7 @@ public boolean onOptionsItemSelected(MenuItem item) {
8683
return super.onOptionsItemSelected(item);
8784
}
8885

89-
public void setupTabLayout(TabLayout tabLayout) {
86+
private void setupTabLayout(TabLayout tabLayout) {
9087
tabLayout.setTabMode(TabLayout.MODE_FIXED);
9188
tabLayout.setTabGravity(TabLayout.GRAVITY_FILL);
9289
tabLayout.setupWithViewPager(mViewPager);
@@ -104,12 +101,11 @@ protected void onRestoreInstanceState(Bundle savedInstanceState) {
104101
mViewPager.setCurrentItem(savedInstanceState.getInt(POSITION));
105102
}
106103

107-
108104
/**
109105
* A {@link FragmentPagerAdapter} that returns a fragment corresponding to
110106
* one of the sections/tabs/pages.
111107
*/
112-
public class SectionsPagerAdapter extends FragmentPagerAdapter {
108+
class SectionsPagerAdapter extends FragmentPagerAdapter {
113109

114110
public SectionsPagerAdapter(FragmentManager fm) {
115111
super(fm);
@@ -142,7 +138,6 @@ public CharSequence getPageTitle(int position) {
142138
}
143139

144140
public static class Demo1Fragment extends Fragment {
145-
146141
@Override
147142
public View onCreateView(LayoutInflater inflater, ViewGroup container,
148143
Bundle savedInstanceState) {
@@ -171,7 +166,6 @@ public void onExpandStateChanged(TextView textView, boolean isExpanded) {
171166
}
172167

173168
public static class Demo2Fragment extends ListFragment {
174-
175169
@Override
176170
public void onViewCreated(View view, Bundle savedInstanceState) {
177171
super.onViewCreated(view, savedInstanceState);

sample/src/main/res/layout/activity_demo.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
android:layout_width="match_parent"
77
android:layout_height="match_parent"
88
android:fitsSystemWindows="true"
9-
tools:context="com.ms.square.android.expandabletextview.sample">
9+
tools:context="com.ms.square.android.expandabletextview.sample.DemoActivity">
1010

1111
<android.support.design.widget.AppBarLayout
1212
android:id="@+id/appbar"

sample/src/main/res/layout/list_item.xml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,33 @@
33
xmlns:expandableTextView="http://schemas.android.com/apk/res-auto"
44
android:layout_width="match_parent"
55
android:layout_height="match_parent"
6-
android:orientation="vertical" >
6+
android:orientation="vertical">
77

88
<com.ms.square.android.expandabletextview.ExpandableTextView
99
android:id="@+id/expand_text_view"
1010
android:layout_width="match_parent"
1111
android:layout_height="wrap_content"
12-
expandableTextView:maxCollapsedLines="4"
13-
expandableTextView:animAlphaStart="1">
12+
expandableTextView:animAlphaStart="1"
13+
expandableTextView:maxCollapsedLines="4">
1414

1515
<TextView
1616
android:id="@id/expandable_text"
1717
android:layout_width="match_parent"
1818
android:layout_height="wrap_content"
19-
android:layout_marginTop="8dp"
2019
android:layout_marginLeft="10dp"
2120
android:layout_marginRight="10dp"
21+
android:layout_marginTop="8dp"
2222
android:fontFamily="sans-serif-light"
23-
android:textSize="16sp"
24-
android:textColor="#666666" />
23+
android:textColor="#666666"
24+
android:textSize="16sp" />
2525

2626
<ImageButton
2727
android:id="@id/expand_collapse"
2828
android:layout_width="wrap_content"
2929
android:layout_height="wrap_content"
30-
android:padding="16dp"
31-
android:layout_gravity="right|bottom"
32-
android:background="@android:color/transparent"/>
30+
android:layout_gravity="end|bottom"
31+
android:background="@android:color/transparent"
32+
android:padding="16dp" />
3333
</com.ms.square.android.expandabletextview.ExpandableTextView>
3434

3535
</LinearLayout>

0 commit comments

Comments
 (0)