|
@@ -82,9 +82,7 @@ public class MainActivity extends AppCompatActivity
|
82
|
82
|
|
83
|
83
|
if (locations.isEmpty())
|
84
|
84
|
{
|
85
|
|
- Intent intent = new Intent(Settings.ACTION_ADD_ACCOUNT);
|
86
|
|
- intent.putExtra(Settings.EXTRA_AUTHORITIES, new String[]{getResources().getString(R.string.account_type)});
|
87
|
|
- startActivityForResult(intent, REQUEST_CODE_ADD_ACCOUNT);
|
|
85
|
+ startActivityForResult(new Intent(this, AddAccountActivity.class), REQUEST_CODE_ADD_ACCOUNT);
|
88
|
86
|
return;
|
89
|
87
|
}
|
90
|
88
|
|
|
@@ -135,7 +133,15 @@ public class MainActivity extends AppCompatActivity
|
135
|
133
|
super.onActivityResult(requestCode, resultCode, data);
|
136
|
134
|
if (requestCode == REQUEST_CODE_ADD_ACCOUNT)
|
137
|
135
|
{
|
138
|
|
- init();
|
|
136
|
+ if (resultCode == RESULT_OK) {
|
|
137
|
+ init();
|
|
138
|
+ }
|
|
139
|
+ else {
|
|
140
|
+ List<LocationDbo> locations = CamotionBusiness.getLocations(MainActivity.this);
|
|
141
|
+ if (locations.size() == 0) {
|
|
142
|
+ finish();
|
|
143
|
+ }
|
|
144
|
+ }
|
139
|
145
|
}
|
140
|
146
|
}
|
141
|
147
|
|
|
@@ -227,6 +233,9 @@ public class MainActivity extends AppCompatActivity
|
227
|
233
|
if (id == R.id.nav_cameras || id == R.id.nav_sensors || id == R.id.nav_commands) {
|
228
|
234
|
showView(id);
|
229
|
235
|
}
|
|
236
|
+ else if (id == R.id.nav_add_account) {
|
|
237
|
+ startActivityForResult(new Intent(this, AddAccountActivity.class), REQUEST_CODE_ADD_ACCOUNT);
|
|
238
|
+ }
|
230
|
239
|
|
231
|
240
|
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
|
232
|
241
|
drawer.closeDrawer(GravityCompat.START);
|