private void showHelperInRangeDialog(Context context, Task task) { UserInterface userInterface = task.getHelpee(); final Dialog dialog = new Dialog(context); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.dialog_help_er_in_range); dialog.setCancelable(false); ImageView imageView; TextView text; String string; Button button; imageView = (ImageView) dialog.findViewById(R.id.dialog_helper_in_range_picture); imageView.setImageDrawable( new LayerDrawable(ImageUtility.retrieveDrawables(context, userInterface.getPicture()))); text = (TextView) dialog.findViewById(R.id.dialog_helper_in_range_title); string = context.getString(R.string.helper_in_range_title); string = string.replace("[Name]", userInterface.getName()); text.setText(Html.fromHtml(string)); text = (TextView) dialog.findViewById(R.id.dialog_helper_in_range_text); string = context.getString(R.string.helper_in_range_text); if (userInterface.getGender().equalsIgnoreCase("female")) { string = string.replace("[gender]", context.getString(R.string.her)); } else { string = string.replace("[gender]", context.getString(R.string.him)); } text.setText(Html.fromHtml(string)); button = (Button) dialog.findViewById(R.id.dialog_helper_in_range_button); button.setText("OK"); button.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { startActivity( new Intent( getApplicationContext(), com.indago.helpme.gui.dashboard.HelpERControlcenterActivity.class)); finish(); } }); dialog.show(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_help_er_call_details); Bundle extras = getIntent().getExtras(); String userID = extras.getString("USER_ID"); UserInterface mUser = UserManager.getInstance().getUserById(userID); if (mUser == null) { throw new NullPointerException( LOGTAG + ": User with ID " + userID + " could not be retrieved from Extras-Bundle at onCreate()"); } TextView name = (TextView) findViewById(R.id.tv_help_ee_name); name.setText(Html.fromHtml(name.getText() + " " + mUser.getName())); TextView age = (TextView) findViewById(R.id.tv_help_ee_age); age.setText(Html.fromHtml(age.getText() + " " + mUser.getAge())); TextView gender = (TextView) findViewById(R.id.tv_help_ee_gender); if (mUser.getGender().equalsIgnoreCase("female")) { gender.setText(Html.fromHtml(gender.getText() + " " + getString(R.string.female))); } else { gender.setText(Html.fromHtml(gender.getText() + " " + getString(R.string.male))); } ImageView picture = (ImageView) findViewById(R.id.iv_help_ee_picture); picture.setImageDrawable( new LayerDrawable( ImageUtility.retrieveDrawables(getApplicationContext(), mUser.getPicture()))); picture.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { setZoomLevel(); } }); mHandler = new Handler(); initMaps(mUser); TaskManager.getInstance().addTaskEventListener(this); }