@@ -23,9 +23,9 @@ namespace AndroidXamarinChat
23
23
public class MainActivity : AppCompatActivity
24
24
{
25
25
public const string BaseUrl = "http://chat.servicestack.net/" ;
26
- private ChatActionBarDrawerToggle mDrawerToggle ;
27
- private DrawerLayout mDrawerLayout ;
28
- private ListView mRightDrawer ;
26
+ private ChatActionBarDrawerToggle drawerToggle ;
27
+ private DrawerLayout drawerLayout ;
28
+ private ListView rightDrawer ;
29
29
private NavigationView navigationView ;
30
30
31
31
private EditText messageBox ;
@@ -58,16 +58,16 @@ protected override void OnCreate(Bundle bundle)
58
58
// and attach an event to it
59
59
Button sendButton = FindViewById < Button > ( Resource . Id . sendMessageButton ) ;
60
60
messageBox = FindViewById < EditText > ( Resource . Id . message ) ;
61
- SupportToolbar mToolbar = FindViewById < SupportToolbar > ( Resource . Id . toolbar ) ;
62
- mDrawerLayout = FindViewById < DrawerLayout > ( Resource . Id . drawer_layout ) ;
61
+ SupportToolbar toolbar = FindViewById < SupportToolbar > ( Resource . Id . toolbar ) ;
62
+ drawerLayout = FindViewById < DrawerLayout > ( Resource . Id . drawer_layout ) ;
63
63
navigationView = FindViewById < NavigationView > ( Resource . Id . nav_view ) ;
64
- mRightDrawer = FindViewById < ListView > ( Resource . Id . right_drawer ) ;
64
+ rightDrawer = FindViewById < ListView > ( Resource . Id . right_drawer ) ;
65
65
var messageHistoryList = FindViewById < ListView > ( Resource . Id . messageHistory ) ;
66
66
var chatBackground = FindViewById < ImageView > ( Resource . Id . chat_background ) ;
67
67
InitDefaultBackground ( chatBackground ) ;
68
68
69
69
navigationView . Tag = 0 ;
70
- mRightDrawer . Tag = 1 ;
70
+ rightDrawer . Tag = 1 ;
71
71
72
72
var messageHistoryAdapter = new MessageListViewAdapter ( this , new List < ChatMessage > ( ) , ( ) => this . subscriberList ) ;
73
73
messageHistoryList . Adapter = messageHistoryAdapter ;
@@ -111,33 +111,33 @@ protected override void OnCreate(Bundle bundle)
111
111
client . RegisterNamedReceiver < TvReciever > ( "tv" ) ;
112
112
client . RegisterNamedReceiver < CssReceiver > ( "css" ) ;
113
113
114
- SetSupportActionBar ( mToolbar ) ;
114
+ SetSupportActionBar ( toolbar ) ;
115
115
116
- var mRightDataSet = new List < string > ( commands . Keys ) ;
117
- var mRightAdapter = new ActionListViewAdapter ( this , mRightDataSet ) ;
118
- mRightDrawer . Adapter = mRightAdapter ;
119
- mRightDrawer . ItemClick += ( sender , args ) =>
116
+ var rightDataSet = new List < string > ( commands . Keys ) ;
117
+ var rightAdapter = new ActionListViewAdapter ( this , rightDataSet ) ;
118
+ rightDrawer . Adapter = rightAdapter ;
119
+ rightDrawer . ItemClick += ( sender , args ) =>
120
120
{
121
121
Application . SynchronizationContext . Post ( _ =>
122
122
{
123
- messageBox . Text = commands [ mRightDataSet [ args . Position ] ] ;
124
- mDrawerLayout . CloseDrawer ( mRightDrawer ) ;
123
+ messageBox . Text = commands [ rightDataSet [ args . Position ] ] ;
124
+ drawerLayout . CloseDrawer ( rightDrawer ) ;
125
125
} , null ) ;
126
126
} ;
127
127
128
- mDrawerToggle = new ChatActionBarDrawerToggle (
128
+ drawerToggle = new ChatActionBarDrawerToggle (
129
129
this , //Host Activity
130
- mDrawerLayout , //DrawerLayout
131
- mToolbar , // Instance of toolbar, if you use other ctor, the hamburger icon/arrow animation won't work..
130
+ drawerLayout , //DrawerLayout
131
+ toolbar , // Instance of toolbar, if you use other ctor, the hamburger icon/arrow animation won't work..
132
132
Resource . String . openDrawer , //Opened Message
133
133
Resource . String . closeDrawer //Closed Message
134
134
) ;
135
135
136
136
SupportActionBar . SetHomeButtonEnabled ( true ) ;
137
137
SupportActionBar . SetDisplayShowTitleEnabled ( true ) ;
138
138
139
- mDrawerLayout . SetDrawerListener ( mDrawerToggle ) ;
140
- mDrawerToggle . SyncState ( ) ;
139
+ drawerLayout . SetDrawerListener ( drawerToggle ) ;
140
+ drawerToggle . SyncState ( ) ;
141
141
142
142
navigationView . NavigationItemSelected += OnChannelClick ;
143
143
sendButton . Click += OnSendClick ;
@@ -179,7 +179,7 @@ public void OnChannelClick(object sender, NavigationView.NavigationItemSelectedE
179
179
//Change channel
180
180
client . ChangeChannel ( itemText , cmdReceiver ) ;
181
181
}
182
- mDrawerLayout . CloseDrawer ( navigationView ) ;
182
+ drawerLayout . CloseDrawer ( navigationView ) ;
183
183
}
184
184
185
185
public void OnSendClick ( object sender , EventArgs e )
@@ -233,16 +233,16 @@ public override bool OnOptionsItemSelected(IMenuItem item)
233
233
switch ( item . ItemId )
234
234
{
235
235
case Resource . Id . action_help :
236
- if ( mDrawerLayout . IsDrawerOpen ( mRightDrawer ) )
236
+ if ( drawerLayout . IsDrawerOpen ( rightDrawer ) )
237
237
{
238
238
//Right Drawer is already open, close it
239
- mDrawerLayout . CloseDrawer ( mRightDrawer ) ;
239
+ drawerLayout . CloseDrawer ( rightDrawer ) ;
240
240
}
241
241
else
242
242
{
243
243
//Right Drawer is closed, open it and just in case close left drawer
244
- mDrawerLayout . OpenDrawer ( mRightDrawer ) ;
245
- mDrawerLayout . CloseDrawer ( navigationView ) ;
244
+ drawerLayout . OpenDrawer ( rightDrawer ) ;
245
+ drawerLayout . CloseDrawer ( navigationView ) ;
246
246
}
247
247
return true ;
248
248
default :
@@ -262,15 +262,15 @@ protected override void OnPostCreate(Bundle savedInstanceState)
262
262
263
263
this . UpdateCookiesFromIntent ( client ) ;
264
264
265
- mDrawerToggle . SyncState ( ) ;
265
+ drawerToggle . SyncState ( ) ;
266
266
UiHelpers . ResetChannelDrawer ( this , navigationView , client . Channels ) ;
267
267
client . Connect ( ) . ConfigureAwait ( false ) ;
268
268
}
269
269
270
270
public override void OnConfigurationChanged ( Android . Content . Res . Configuration newConfig )
271
271
{
272
272
base . OnConfigurationChanged ( newConfig ) ;
273
- mDrawerToggle . OnConfigurationChanged ( newConfig ) ;
273
+ drawerToggle . OnConfigurationChanged ( newConfig ) ;
274
274
}
275
275
276
276
protected override void OnDestroy ( )
0 commit comments