// Show install layout
  private void showBasicInstallLayout() {
    setContentView(R.layout.basic_install);
    currentContentView = R.layout.basic_install;
    final Button buttonInstall = (Button) findViewById(R.id.basicinstallbutton);
    final Button buttonAdvanced = (Button) findViewById(R.id.showadvancedoptionsbutton);
    handler = new MyMessageHandler(this);

    String referrer =
        ReferralReceiver.retrieveReferralParams(getApplicationContext()).get("utm_content");
    if (referrer == null) referrer = "Altruistic donation";
    else referrer = "Donate to: " + referrer;
    final TextView referrerView = (TextView) findViewById(R.id.referrerview);
    referrerView.setText(referrer);

    donate = DEFAULT_DONATE;
    // Set up install button listener
    buttonInstall.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            Intent i = new Intent(getBaseContext(), InstallerService.class);
            i.putExtra(RESOURCES_TO_DONATE, donate);
            startService(i);
            showInstallingLayout();
          }
        });
    buttonAdvanced.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            showAdvancedInstallLayout();
          }
        });
  }
  // Show install layout
  private void showAdvancedInstallLayout() {
    setContentView(R.layout.install);
    currentContentView = R.layout.install;

    final Button buttonBasic = (Button) findViewById(R.id.showbasicoptionsbutton);
    buttonBasic.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            showBasicInstallLayout();
          }
        });

    final Button button = (Button) findViewById(R.id.buttonInstall);
    handler = new MyMessageHandler(this);
    final TextView tw = (TextView) findViewById(R.id.textView6);
    final String donateString = this.getString(R.string.resource_donate);
    // Set up donation-percentage seekbar
    final SeekBar sb = (SeekBar) findViewById(R.id.seekBar1);
    sb.setMax(MAXIMUM_SEEKBAR);
    sb.setOnSeekBarChangeListener(
        new OnSeekBarChangeListener() {
          @Override
          public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            // Update on changes to the seekbar
            donate = progress + MINIMUM_DONATE;
            if (donate > MAXIMUM_DONATE) donate = MAXIMUM_DONATE;
            tw.setText(donateString + ": " + Integer.toString(donate));
          }

          @Override
          public void onStartTrackingTouch(SeekBar seekBar) {}

          @Override
          public void onStopTrackingTouch(SeekBar seekBar) {}
        });

    String referrer =
        ReferralReceiver.retrieveReferralParams(getApplicationContext()).get("utm_content");
    if (referrer == null) referrer = "Altruistic donation";
    else referrer = "Donate to: " + referrer;

    final TextView referrerView = (TextView) findViewById(R.id.referview);
    referrerView.setText(referrer);

    String DownloadURLString =
        ReferralReceiver.retrieveReferralParams(getApplicationContext()).get("utm_source");
    if (DownloadURLString == null) DownloadURLString = Common.DEFAULT_DOWNLOAD_URL;
    final TextView downloadView = (TextView) findViewById(R.id.downloadview);
    downloadView.setText("URL: " + DownloadURLString);

    // If donation was not yet set, default to DEFAULT_DONATE
    if (donate == -1) donate = DEFAULT_DONATE;
    tw.setText(donateString + ": " + Integer.toString(donate));
    sb.setProgress(donate - MINIMUM_DONATE);

    final EditText permittedInterfaces = (EditText) findViewById(R.id.permittedInterfaces);
    final TextView permView = (TextView) findViewById(R.id.permifView);
    final CheckBox allBox = (CheckBox) findViewById(R.id.checkBox1);
    allBox.setChecked(true);
    permittedInterfaces.setVisibility(View.INVISIBLE);
    permView.setVisibility(View.INVISIBLE);

    final EditText optionalArgs = (EditText) findViewById(R.id.optionalEdit);

    allBox.setOnCheckedChangeListener(
        new OnCheckedChangeListener() {

          @Override
          public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
              permittedInterfaces.setVisibility(View.INVISIBLE);
              permView.setVisibility(View.INVISIBLE);
            } else {
              permittedInterfaces.setVisibility(View.VISIBLE);
              permView.setVisibility(View.VISIBLE);
            }
          }
        });

    String iflist = null;

    Enumeration<NetworkInterface> networkInterfaces;
    try {
      networkInterfaces = NetworkInterface.getNetworkInterfaces();
      while (networkInterfaces.hasMoreElements()) {
        NetworkInterface networkInterface = networkInterfaces.nextElement();
        if (iflist == null) iflist = networkInterface.getName();
        else iflist += "," + networkInterface.getName();
      }
    } catch (SocketException e) {
      iflist = null;
      Log.e(Common.LOG_TAG, Common.LOG_EXCEPTION_GETTING_IFS, e);
    }

    permittedInterfaces.setText(iflist);

    // Set up install button listener
    button.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            final Intent i = new Intent(getBaseContext(), InstallerService.class);
            i.putExtra(RESOURCES_TO_DONATE, donate);
            String permlist[] = null;
            if (!allBox.isChecked()) {
              String intlist = permittedInterfaces.getText().toString();
              if (intlist.trim().compareTo("") != 0) permlist = intlist.split(",");
              i.putExtra(PERMITTED_INTERFACES, permlist);
            }
            i.putExtra(OPTIONAL_ARGUMENTS, optionalArgs.getText().toString());

            startService(i);

            showInstallingLayout();
          }
        });
  }