7
7
import android .support .v4 .app .Fragment ;
8
8
import android .support .v4 .app .FragmentTransaction ;
9
9
import android .support .v7 .app .ActionBar ;
10
- import android .support .v7 .app .ActionBarActivity ;
10
+ import android .support .v7 .app .AppCompatActivity ;
11
11
import android .support .v7 .widget .DefaultItemAnimator ;
12
12
import android .support .v7 .widget .LinearLayoutManager ;
13
13
import android .support .v7 .widget .RecyclerView ;
28
28
import com .melnykov .fab .ObservableScrollView ;
29
29
import com .melnykov .fab .ScrollDirectionListener ;
30
30
31
- public class MainActivity extends ActionBarActivity {
31
+ public class MainActivity extends AppCompatActivity {
32
32
33
33
@ Override
34
34
protected void onCreate (Bundle savedInstanceState ) {
@@ -42,53 +42,53 @@ private void initActionBar() {
42
42
ActionBar actionBar = getSupportActionBar ();
43
43
actionBar .setNavigationMode (ActionBar .NAVIGATION_MODE_TABS );
44
44
actionBar .addTab (actionBar .newTab ()
45
- .setText ("ListView" )
46
- .setTabListener (new ActionBar .TabListener () {
47
- @ Override
48
- public void onTabSelected (ActionBar .Tab tab , FragmentTransaction fragmentTransaction ) {
49
- fragmentTransaction .replace (android .R .id .content , new ListViewFragment ());
50
- }
51
-
52
- @ Override
53
- public void onTabUnselected (ActionBar .Tab tab , FragmentTransaction fragmentTransaction ) {
54
- }
55
-
56
- @ Override
57
- public void onTabReselected (ActionBar .Tab tab , FragmentTransaction fragmentTransaction ) {
58
- }
59
- }));
45
+ .setText ("ListView" )
46
+ .setTabListener (new ActionBar .TabListener () {
47
+ @ Override
48
+ public void onTabSelected (ActionBar .Tab tab , FragmentTransaction fragmentTransaction ) {
49
+ fragmentTransaction .replace (android .R .id .content , new ListViewFragment ());
50
+ }
51
+
52
+ @ Override
53
+ public void onTabUnselected (ActionBar .Tab tab , FragmentTransaction fragmentTransaction ) {
54
+ }
55
+
56
+ @ Override
57
+ public void onTabReselected (ActionBar .Tab tab , FragmentTransaction fragmentTransaction ) {
58
+ }
59
+ }));
60
60
actionBar .addTab (actionBar .newTab ()
61
- .setText ("RecyclerView" )
62
- .setTabListener (new ActionBar .TabListener () {
63
- @ Override
64
- public void onTabSelected (ActionBar .Tab tab , FragmentTransaction fragmentTransaction ) {
65
- fragmentTransaction .replace (android .R .id .content , new RecyclerViewFragment ());
66
- }
67
-
68
- @ Override
69
- public void onTabUnselected (ActionBar .Tab tab , FragmentTransaction fragmentTransaction ) {
70
- }
71
-
72
- @ Override
73
- public void onTabReselected (ActionBar .Tab tab , FragmentTransaction fragmentTransaction ) {
74
- }
75
- }));
61
+ .setText ("RecyclerView" )
62
+ .setTabListener (new ActionBar .TabListener () {
63
+ @ Override
64
+ public void onTabSelected (ActionBar .Tab tab , FragmentTransaction fragmentTransaction ) {
65
+ fragmentTransaction .replace (android .R .id .content , new RecyclerViewFragment ());
66
+ }
67
+
68
+ @ Override
69
+ public void onTabUnselected (ActionBar .Tab tab , FragmentTransaction fragmentTransaction ) {
70
+ }
71
+
72
+ @ Override
73
+ public void onTabReselected (ActionBar .Tab tab , FragmentTransaction fragmentTransaction ) {
74
+ }
75
+ }));
76
76
actionBar .addTab (actionBar .newTab ()
77
- .setText ("ScrollView" )
78
- .setTabListener (new ActionBar .TabListener () {
79
- @ Override
80
- public void onTabSelected (ActionBar .Tab tab , FragmentTransaction fragmentTransaction ) {
81
- fragmentTransaction .replace (android .R .id .content , new ScrollViewFragment ());
82
- }
83
-
84
- @ Override
85
- public void onTabUnselected (ActionBar .Tab tab , FragmentTransaction fragmentTransaction ) {
86
- }
87
-
88
- @ Override
89
- public void onTabReselected (ActionBar .Tab tab , FragmentTransaction fragmentTransaction ) {
90
- }
91
- }));
77
+ .setText ("ScrollView" )
78
+ .setTabListener (new ActionBar .TabListener () {
79
+ @ Override
80
+ public void onTabSelected (ActionBar .Tab tab , FragmentTransaction fragmentTransaction ) {
81
+ fragmentTransaction .replace (android .R .id .content , new ScrollViewFragment ());
82
+ }
83
+
84
+ @ Override
85
+ public void onTabUnselected (ActionBar .Tab tab , FragmentTransaction fragmentTransaction ) {
86
+ }
87
+
88
+ @ Override
89
+ public void onTabReselected (ActionBar .Tab tab , FragmentTransaction fragmentTransaction ) {
90
+ }
91
+ }));
92
92
}
93
93
}
94
94
@@ -105,15 +105,15 @@ public boolean onOptionsItemSelected(MenuItem item) {
105
105
content .setMovementMethod (LinkMovementMethod .getInstance ());
106
106
content .setText (Html .fromHtml (getString (R .string .about_body )));
107
107
new AlertDialog .Builder (this )
108
- .setTitle (R .string .about )
109
- .setView (content )
110
- .setInverseBackgroundForced (true )
111
- .setPositiveButton (android .R .string .ok , new DialogInterface .OnClickListener () {
112
- @ Override
113
- public void onClick (DialogInterface dialog , int which ) {
114
- dialog .dismiss ();
115
- }
116
- }).create ().show ();
108
+ .setTitle (R .string .about )
109
+ .setView (content )
110
+ .setInverseBackgroundForced (true )
111
+ .setPositiveButton (android .R .string .ok , new DialogInterface .OnClickListener () {
112
+ @ Override
113
+ public void onClick (DialogInterface dialog , int which ) {
114
+ dialog .dismiss ();
115
+ }
116
+ }).create ().show ();
117
117
}
118
118
return super .onOptionsItemSelected (item );
119
119
}
@@ -127,7 +127,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
127
127
128
128
ListView list = (ListView ) root .findViewById (android .R .id .list );
129
129
ListViewAdapter listAdapter = new ListViewAdapter (getActivity (),
130
- getResources ().getStringArray (R .array .countries ));
130
+ getResources ().getStringArray (R .array .countries ));
131
131
list .setAdapter (listAdapter );
132
132
133
133
FloatingActionButton fab = (FloatingActionButton ) root .findViewById (R .id .fab );
@@ -169,7 +169,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
169
169
recyclerView .addItemDecoration (new DividerItemDecoration (getActivity (), DividerItemDecoration .VERTICAL_LIST ));
170
170
171
171
RecyclerViewAdapter adapter = new RecyclerViewAdapter (getActivity (), getResources ()
172
- .getStringArray (R .array .countries ));
172
+ .getStringArray (R .array .countries ));
173
173
recyclerView .setAdapter (adapter );
174
174
175
175
FloatingActionButton fab = (FloatingActionButton ) root .findViewById (R .id .fab );
0 commit comments