use of cl.smartcities.isci.transportinspector.gamification.ui.listener.AccountLogOutListener in project androidApp by InspectorIncognito.
the class UserFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.activity_account_user_fragment, container, false);
progressImage = view.findViewById(R.id.activity_account_user_fragment_level_progress_image);
userName = view.findViewById(R.id.activity_account_user_fragment_user_name);
score = view.findViewById(R.id.activity_account_user_fragment_user_score);
level = view.findViewById(R.id.activity_account_user_fragment_user_level);
userBusAvatarTitle = view.findViewById(R.id.user_bus_avatar_title);
levelBackground = view.findViewById(R.id.level_background);
levelName = view.findViewById(R.id.level_name);
rankingFrame = view.findViewById(R.id.ranking_frame);
rankingPosition = view.findViewById(R.id.ranking_position);
rankingButton = view.findViewById(R.id.ranking_layout);
rankingProgressBar = view.findViewById(R.id.ranking_progress_bar);
rankingProgressBar.getIndeterminateDrawable().setColorFilter(ContextCompat.getColor(getContext(), R.color.green_button), android.graphics.PorterDuff.Mode.SRC_IN);
View busPickerButton = view.findViewById(R.id.bus_layout);
userBusAvatarView = view.findViewById(R.id.user_bus_avatar);
View closeSessionButton = view.findViewById(R.id.close_session_button);
closeSessionButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
CloseSessionDialog dialog = new CloseSessionDialog();
dialog.setListener(new CloseSessionDialog.OnButtonClickListener() {
@Override
public void onPositiveButtonClick() {
TranSappAccountManager.logOut(new AccountLogOutListener() {
@Override
public void onLoggedOut() {
callback.onLogout();
}
@Override
public void onError(ServerStatusCode error) {
// TODO(aantoine): show error message
callback.onLogout();
}
});
}
@Override
public void onNegativeButtonClick() {
}
});
dialog.show(getFragmentManager(), dialog.getClass().getSimpleName());
}
});
View editButton = view.findViewById(R.id.edit_button);
editButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivityForResult(new Intent(getActivity(), AccountSettingsActivity.class), USER_SETTINGS_CODE);
}
});
busPickerButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivityForResult(new Intent(getActivity(), AccountBusPickerActivity.class), USER_BUS_PICKER_CODE);
}
});
updateUI();
return view;
}
use of cl.smartcities.isci.transportinspector.gamification.ui.listener.AccountLogOutListener in project androidApp by InspectorIncognito.
the class UserFragment method onOptionsItemSelected.
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (super.onOptionsItemSelected(item)) {
return true;
}
switch(item.getItemId()) {
case R.id.action_settings:
startActivity(new Intent(this.getActivity(), AccountSettingsActivity.class));
return true;
case R.id.action_close_session:
CloseSessionDialog dialog = new CloseSessionDialog();
dialog.setListener(new CloseSessionDialog.OnButtonClickListener() {
@Override
public void onPositiveButtonClick() {
TranSappAccountManager.logOut(new AccountLogOutListener() {
@Override
public void onLoggedOut() {
callback.onLogout();
}
@Override
public void onError(ServerStatusCode error) {
// TODO(aantoine): show error message
callback.onLogout();
}
});
}
@Override
public void onNegativeButtonClick() {
}
});
dialog.show(getFragmentManager(), dialog.getClass().getSimpleName());
return true;
default:
return super.onOptionsItemSelected(item);
}
}
Aggregations