Commit ac81c9b6 authored by Luboš Horáček's avatar Luboš Horáček

#317 & #318 Chyby při volbě položky nového uživatele

parent aa80ade5
......@@ -661,7 +661,7 @@ public class Tablexia extends com.activeandroid.app.Application {
@Override
public void onAnimationEnd(Animator animation) {
((Activity) getCurrentMenuActivity()).startActivityForResult(intent, 0);
((Activity) getCurrentMenuActivity()).startActivityForResult(intent, MainActivity.REQUEST_CODE_NEW_USER);
// TODO remove TestFlight.log("Create user button");
}
});
......
......@@ -49,8 +49,8 @@ import cz.nic.tablexia.menu.mainmenu.screen.AbstractMenuFragment.MenuFragmentVis
import cz.nic.tablexia.menu.mainmenu.screen.LoaderFragment;
import cz.nic.tablexia.menu.usermenu.User;
import cz.nic.tablexia.newusers.fragment.AnimationContainerFragment;
import cz.nic.tablexia.util.MintHelper;
import cz.nic.tablexia.util.MediaPlayerHelper;
import cz.nic.tablexia.util.MintHelper;
import cz.nic.tablexia.widget.TablexiaDrawerLayout;
/**
......@@ -63,6 +63,10 @@ public class MainActivity extends FragmentActivity implements MenuActivity {
private static final String TAG = MainActivity.class.getSimpleName();
public static final int REQUEST_CODE_NEW_USER = 1000;
public static final int REQUEST_CODE_GAME = 2000;
public static final int RESULT_CODE_NEW_USER = 1000;
private static final int START_PRELOADER_ANIM_DURATION = 2000;
private static final int MAIN_SCREEN_CONTAINER_ID = R.id.main_screen_container;
private static final int MAIN_SCREEN_PRELOADER_ID = R.id.main_screen_preloader;
......@@ -178,7 +182,7 @@ public class MainActivity extends FragmentActivity implements MenuActivity {
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if ((requestCode == 0) && (data != null) && (resultCode == Activity.RESULT_OK)) {
if ((requestCode == REQUEST_CODE_NEW_USER) && (data != null) && (resultCode == Activity.RESULT_OK)) {
hideLoadingScreen(false);
LocalBroadcastManager.getInstance(this).sendBroadcast(new Intent("cz.nic.tablexia.action.NEW_USER_CREATED"));
......@@ -190,6 +194,10 @@ public class MainActivity extends FragmentActivity implements MenuActivity {
closeMenuDrawer();
}
}
if ((requestCode == REQUEST_CODE_GAME) && (data != null) && (resultCode == RESULT_CODE_NEW_USER)) {
// TODO show new user dialog
Log.d(TAG, "Start new user sequence");
}
getTablexiaContext().initMenu();
}
......
......@@ -45,9 +45,11 @@ import cz.nic.tablexia.R;
import cz.nic.tablexia.Tablexia;
import cz.nic.tablexia.audio.SoundControl;
import cz.nic.tablexia.audio.resources.PermanentSounds;
import cz.nic.tablexia.game.GameActivity;
import cz.nic.tablexia.game.games.GamesDefinition;
import cz.nic.tablexia.main.MainActivity;
import cz.nic.tablexia.menu.AbstractMenu;
import cz.nic.tablexia.menu.MenuActivity;
import cz.nic.tablexia.menu.MenuEnum;
import cz.nic.tablexia.util.Utility;
import cz.nic.tablexia.widget.TablexiaDrawerLayout.DrawerListenerAdapter;
......@@ -336,17 +338,37 @@ public class MainMenu extends AbstractMenu implements OnGroupClickListener, OnCh
@Override
public void positiveAction() {
// tablexiaContext.showNewUserScreen();
// TODO add code for starting animation on new user click from game menu while user logged in
// TODO add code for starting animation on new user click from game menu while user logged in/home/lhoracek/Downloads/Prago Union - Vážná Hudba (2013)
Bundle args = new Bundle();
args.putString("NEWUSER_GAMEMENU", "NEWUSER_GAMEMENU");
((MainActivity) tablexiaContext.getCurrentMenuActivity()).showLoadingScreen(true, args);
((MainActivity) tablexiaContext.getCurrentMenuActivity()).lockCloseMenuDrawer();
// HACK to create new user from game
MenuActivity activity = tablexiaContext.getCurrentMenuActivity();
if (activity instanceof MainActivity) {
((MainActivity) tablexiaContext.getCurrentMenuActivity()).showLoadingScreen(true, args);
((MainActivity) tablexiaContext.getCurrentMenuActivity()).lockCloseMenuDrawer();
}
tablexiaContext.changeMenu(AbstractMenu.USER_MENU);
userSpinner.setSelection(userSpinnerAdapter.getUserPositionInList(tablexiaContext.getCurrentMenuActivity().getTablexiaContext().getSelectedUser().getNickName()));
tablexiaContext.getTablexiaState().setAndSaveActiveUser(null);
if (activity instanceof GameActivity) {
tablexiaContext.hardResetUser();
// changeMenuItem(MainMenuDefinition.LOGOUT, false, false);
((GameActivity) activity).setResult(MainActivity.RESULT_CODE_NEW_USER);
// ((GameActivity) activity).finish();
}
super.positiveAction();
}
@Override
public void negativeAction() {
userSpinner.setSelection(userSpinnerAdapter.getUserPositionInList(tablexiaContext.getCurrentMenuActivity().getTablexiaContext().getSelectedUser().getNickName()));
super.negativeAction();
};
}.show(((Activity) tablexiaContext.getCurrentMenuActivity()).getFragmentManager(), null);
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment