Example usage for android.graphics Color BLACK

List of usage examples for android.graphics Color BLACK

Introduction

In this page you can find the example usage for android.graphics Color BLACK.

Prototype

int BLACK

To view the source code for android.graphics Color BLACK.

Click Source Link

Usage

From source file:com.spoiledmilk.ibikecph.navigation.SMRouteNavigationMapFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    currentlyRouting = false;//from   w ww.j  a  v  a 2  s .co m

    pathOverlay = new PathOverlay(getRouteColor(), getActivity());

    if (getActivity().getIntent().getExtras() != null) {
        startLocation = Util.locationFromCoordinates(
                getActivity().getIntent().getExtras().getDouble("start_lat"),
                getActivity().getIntent().getExtras().getDouble("start_lng"));
        endLocation = Util.locationFromCoordinates(getActivity().getIntent().getExtras().getDouble("end_lat"),
                getActivity().getIntent().getExtras().getDouble("end_lng"));
        if (getActivity().getIntent().getExtras().containsKey("json_root"))
            jsonRoot = Util.stringToJsonNode(getActivity().getIntent().getExtras().getString("json_root"));
        source = getActivity().getIntent().getExtras().getString("source");
        destination = getActivity().getIntent().getExtras().getString("destination");
    }

    getMapActivity().stopTrackingUser();
    if (getActivity().getIntent().getExtras().containsKey("start_name"))
        this.startName = getActivity().getIntent().getExtras().getString("start_name");
    if (getActivity().getIntent().getExtras().containsKey("end_name"))
        this.endName = getActivity().getIntent().getExtras().getString("end_name");
    start(startLocation, endLocation, jsonRoot, startName, endName);
    mSensorManager = (SensorManager) getActivity().getSystemService(Context.SENSOR_SERVICE);
    mAccelerometer = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
    mMagnetometer = mSensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD);

    textA = new TextView(getActivity());
    textA.setBackgroundResource(R.drawable.rounded_rectangle_22);
    textA.setTypeface(IbikeApplication.getNormalFont());
    textA.setTextColor(Color.BLACK);
    textA.setGravity(Gravity.CENTER);
    textA.setPadding(Util.dp2px(5), Util.dp2px(5), Util.dp2px(5), Util.dp2px(5));
    textA.setVisibility(View.GONE);
    textA.setTextSize(16);
    textA.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            textA.setVisibility(View.GONE);
        }
    });
    mapView.addView(textA);
    textB = new TextView(getActivity());
    textB.setBackgroundResource(R.drawable.rounded_rectangle_22);
    textB.setTypeface(IbikeApplication.getNormalFont());
    textB.setTextColor(Color.BLACK);
    textB.setGravity(Gravity.CENTER);
    textB.setPadding(Util.dp2px(5), Util.dp2px(5), Util.dp2px(5), Util.dp2px(5));
    textB.setVisibility(View.GONE);
    textB.setTextSize(16);
    textB.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            textB.setVisibility(View.GONE);
        }
    });
    mapView.addView(textB);

    locationOverlay.setMapFragment(this);

    mapView.directionShown = true;
    mapView.isNavigation = true;

}

From source file:com.coupondunia.restaurants.offers.views.SlidingTabLayout.java

/**
 * Create a default view to be used for tabs. This is called if a custom tab view is not set via
 * {@link #setCustomTabView(int, int)}./*from  www  .jav  a2  s  . c om*/
 */
protected TextView createDefaultTabView(Context context) {
    TextView textView = new TextView(context);
    textView.setGravity(Gravity.CENTER);
    textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, TAB_VIEW_TEXT_SIZE_SP);
    textView.setTypeface(Typeface.DEFAULT_BOLD);
    textView.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.WRAP_CONTENT));

    TypedValue outValue = new TypedValue();
    getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground, outValue, true);
    textView.setBackgroundResource(outValue.resourceId);
    textView.setTextColor(Color.BLACK);
    textView.setAllCaps(true);

    int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density);
    textView.setPadding(padding, padding, padding, padding);

    return textView;
}

From source file:com.aegiswallet.utils.BasicUtils.java

public static Bitmap encodeAsBitmap(String contents, BarcodeFormat format, int dimension) {

    Bitmap bitmap = null;/*from w ww  . j  ava2 s .  c om*/

    try {
        final Hashtable<EncodeHintType, Object> hints = new Hashtable<EncodeHintType, Object>();
        //hints.put(EncodeHintType.MARGIN, 0);
        hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H);
        final BitMatrix result = qrCodeWriter.encode(contents, BarcodeFormat.QR_CODE, dimension, dimension,
                hints);

        final int width = result.getWidth();
        final int height = result.getHeight();
        final int[] pixels = new int[width * height];

        for (int y = 0; y < height; y++) {
            final int offset = y * width;
            for (int x = 0; x < width; x++) {
                pixels[offset + x] = result.get(x, y) ? Color.BLACK : Color.WHITE;
            }
        }

        bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
        bitmap.setPixels(pixels, 0, width, 0, 0, width, height);
        return bitmap;

    } catch (WriterException e) {
        Log.e("Basic Utils", "cannot write to bitmap " + e.getMessage());
    }
    return bitmap;
}

From source file:com.mk4droid.IMC_Activities.Fragment_List.java

private void SetComplementaryButtons() {

    if (MyIssuesSW)
        MyIssuesSW = false;// w w w.j  ava2s  .  com
    else
        MyIssuesSW = true;

    handlerBroadcastListRefresh.sendMessage(new Message());

    savePreferences("MyIssuesSW", MyIssuesSW, "boolean");

    if (MyIssuesSW) {
        // _-1
        btListMyIss.setCompoundDrawablesWithIntrinsicBounds(
                resources.getDrawable(R.drawable.my_issues_icon_white32), null, null, null);
        btListMyIss.setBackgroundDrawable(resources.getDrawable(R.drawable.bt_custom_click_orange));
        btListMyIss.setTextColor(Color.WHITE);
        btListMyIss.setClickable(false);

        // 0-_
        btListAllIss.setCompoundDrawablesWithIntrinsicBounds(
                resources.getDrawable(R.drawable.all_issues_icon_gray32), null, null, null);
        btListAllIss.setBackgroundDrawable(resources.getDrawable(android.R.drawable.btn_default));
        btListAllIss.setTextColor(Color.BLACK);
        btListAllIss.setClickable(true);

    } else {
        // _-0
        btListMyIss.setCompoundDrawablesWithIntrinsicBounds(
                resources.getDrawable(R.drawable.my_issues_icon_gray32), null, null, null);
        btListMyIss.setBackgroundDrawable(resources.getDrawable(android.R.drawable.btn_default));
        btListMyIss.setTextColor(Color.BLACK);
        btListMyIss.setClickable(true);

        // 1-_
        btListAllIss.setCompoundDrawablesWithIntrinsicBounds(
                resources.getDrawable(R.drawable.all_issues_icon_white32), null, null, null);
        btListAllIss.setBackgroundDrawable(resources.getDrawable(R.drawable.bt_custom_click_orange));
        btListAllIss.setTextColor(Color.WHITE);
        btListAllIss.setClickable(false);
    }

}

From source file:com.cyrilmottier.android.polaris2demo.CircleDemoActivity.java

private void setUpMap() {
    mColorBar.setOnSeekBarChangeListener(this);
    mAlphaBar.setOnSeekBarChangeListener(this);
    mWidthBar.setOnSeekBarChangeListener(this);
    mMap.setOnMarkerDragListener(this);
    mMap.setOnMapLongClickListener(this);

    mFillColor = Color.HSVToColor(mAlphaBar.getProgress(), new float[] { mColorBar.getProgress(), 1, 1 });
    mStrokeColor = Color.BLACK;

    DraggableCircle circle = new DraggableCircle(SYDNEY, DEFAULT_RADIUS);
    mCircles.add(circle);// w  ww.  ja va  2s  .c om

    // Move the map so that it is centered on the initial circle
    mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(SYDNEY, 4.0f));
}

From source file:com.ezartech.ezar.videooverlay.ezAR.java

@Override
public void initialize(final CordovaInterface cordova, final CordovaWebView cvWebView) {
    super.initialize(cordova, cvWebView);

    webViewView = cvWebView.getView();/*  w  ww .  j  a  v a  2  s. com*/

    activity = cordova.getActivity();
    activity.runOnUiThread(new Runnable() {
        @Override
        public void run() {

            //configure webview
            webViewView.setKeepScreenOn(true);

            Log.d(TAG, "WebView HW accelerated: " + webViewView.isHardwareAccelerated());
            // if (webViewView.isHardwareAccelerated()) {
            //    webViewView.setLayerType(WebView.LAYER_TYPE_HARDWARE, null);
            // } else {
            //    webViewView.setLayerType(WebView.LAYER_TYPE_SOFTWARE, null);
            // }

            //temporarily remove webview from view stack
            ((ViewGroup) webViewView.getParent()).removeView(webViewView);

            cordovaViewContainer = new FrameLayout(activity);
            cordovaViewContainer.setBackgroundColor(Color.BLACK);
            activity.setContentView(cordovaViewContainer,
                    new ViewGroup.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));

            //create & add videoOverlay to view stack

            cameraView = new TextureView(activity);
            cameraView.setSurfaceTextureListener(mSurfaceTextureListener);
            cordovaViewContainer.addView(cameraView,
                    new ViewGroup.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));

            //add webview on top of videoOverlay
            cordovaViewContainer.addView(webViewView,
                    new ViewGroup.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
            if ("org.xwalk.core.XWalkView".equals(webViewView.getClass().getName())
                    || "org.crosswalk.engine.XWalkCordovaView".equals(webViewView.getClass().getName())) {
                try {
                    /* view.setZOrderOnTop(true)
                     * Called just in time as with root.setBackground(...) the color
                     * come in front and take the whoel screen */
                    webViewView.getClass().getMethod("setZOrderOnTop", boolean.class).invoke(webViewView, true);
                } catch (Exception e) {
                }
            }
            ((FrameLayout) cordovaViewContainer.getParent()).addOnLayoutChangeListener(layoutChangeListener);
            ((FrameLayout) cordovaViewContainer.getParent()).setBackgroundColor(Color.BLACK);
        }
    });
}

From source file:com.keylesspalace.tusky.ViewMediaActivity.java

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_view_media);

    supportPostponeEnterTransition();//from ww  w.j a  v  a  2s.co  m

    // Obtain the views.
    toolbar = findViewById(R.id.toolbar);
    viewPager = findViewById(R.id.view_pager);
    anyView = toolbar;

    // Gather the parameters.
    Intent intent = getIntent();
    attachments = intent.getParcelableArrayListExtra(EXTRA_ATTACHMENTS);
    int initialPosition = intent.getIntExtra(EXTRA_ATTACHMENT_INDEX, 0);

    final PagerAdapter adapter;

    if (attachments != null) {
        List<Attachment> realAttachs = CollectionsKt.map(attachments, AttachmentViewData::getAttachment);
        // Setup the view pager.
        adapter = new ImagePagerAdapter(getSupportFragmentManager(), realAttachs, initialPosition);

    } else {
        String avatarUrl = intent.getStringExtra(EXTRA_AVATAR_URL);

        if (avatarUrl == null) {
            throw new IllegalArgumentException("attachment list or avatar url has to be set");
        }

        adapter = new AvatarImagePagerAdapter(getSupportFragmentManager(), avatarUrl);
    }

    viewPager.setAdapter(adapter);
    viewPager.setCurrentItem(initialPosition);
    viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
        @Override
        public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
        }

        @Override
        public void onPageSelected(int position) {
            CharSequence title = adapter.getPageTitle(position);
            toolbar.setTitle(title);
        }

        @Override
        public void onPageScrollStateChanged(int state) {
        }
    });

    // Setup the toolbar.
    setSupportActionBar(toolbar);
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayShowHomeEnabled(true);
        actionBar.setTitle(adapter.getPageTitle(initialPosition));
    }
    toolbar.setNavigationOnClickListener(v -> supportFinishAfterTransition());
    toolbar.setOnMenuItemClickListener(item -> {
        int id = item.getItemId();
        switch (id) {
        case R.id.action_download:
            downloadImage();
            break;
        case R.id.action_open_status:
            onOpenStatus();
            break;
        }
        return true;
    });

    View decorView = getWindow().getDecorView();
    int uiOptions = View.SYSTEM_UI_FLAG_LOW_PROFILE;
    decorView.setSystemUiVisibility(uiOptions);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        getWindow().setStatusBarColor(Color.BLACK);
    }
}

From source file:com.gumgoose.app.quakebuddy.QuakeAdapter.java

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    // Check if the existing view is being reused, otherwise inflate the view
    View listItemView = convertView;
    if (listItemView == null) {
        listItemView = LayoutInflater.from(getContext()).inflate(R.layout.earthquake_list_item, parent, false);
    }// w w w . jav a2s  .  c  o m

    // Initiate user's shared preferences for customising the ListView item
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());

    // Get the Quake object at this position in the list
    Quake currentEarthquake = getItem(position);

    // Get the original location String from the Quake object
    String originalLocation = currentEarthquake.getQuakeLocation();

    // If the original location String (i.e. "10km SSW of Basilisa, Philippines") contains
    // a primary location (i.e. "Basilisa, Philippines") and an offset (i.e. "10km SSW of "),
    // store the primary location and the offset separately into 2 different Strings
    String primaryLocation;
    String locationOffset;

    // Check whether the originalLocation String contains the " of " text
    if (originalLocation.contains(LOCATION_SEPARATOR)) {
        // Split the String into different parts based on the " of " text;
        // String #1 shows as "10km SSW" and String #2 shows as "Basilisa, Philippines"
        String[] parts = originalLocation.split(LOCATION_SEPARATOR);
        // Location offset should be "10km SSW" + " of " --> "10km SSW of "
        locationOffset = parts[0] + LOCATION_SEPARATOR;
        // Primary location should be "Basilisa, Philippines"
        primaryLocation = parts[1];
    } else {
        // No " of " text detected in the originalLocation String, instead display "Near the"
        locationOffset = getContext().getString(R.string.near_the);
        // The primary location will be the full location String
        primaryLocation = originalLocation;
    }

    // Find a reference to the list_location_city TextView
    TextView primaryTextView = (TextView) listItemView.findViewById(R.id.list_location_city);
    // Populate the primaryTextView with the earthquake's location
    primaryTextView.setText(primaryLocation);

    // Find a reference to the list_location_heading TextView
    TextView secondaryTextView = (TextView) listItemView.findViewById(R.id.list_location_heading);
    // Change the secondaryTextView color to textColorEarthquakeDetails
    secondaryTextView.setTextColor(ContextCompat.getColor(getContext(), R.color.textColorEarthquakeDetails));
    // Populate the secondaryTextView with the earthquake's location offset
    secondaryTextView.setText(locationOffset);

    // Find a reference to the list_magnitude TextView
    TextView magnitudeView = (TextView) listItemView.findViewById(R.id.list_magnitude);
    // Format the magnitude to show 1 decimal place
    String formattedMagnitude = formatMagnitude(currentEarthquake.getQuakeMagnitude());
    // Populate the magnitudeView with the earthquake's magnitude
    magnitudeView.setText(formattedMagnitude);

    // Find a reference to the list_time TextView
    TextView thirdView = (TextView) listItemView.findViewById(R.id.list_time);
    // Find a reference to the list_date TextView
    TextView fourthView = (TextView) listItemView.findViewById(R.id.list_date);
    // Obtain user's preference on how to display the earthquake times
    String timePref = prefs.getString("time_preference", "ago");

    if (timePref.equals("ago")) {
        // Populate the thirdView TextView with the earthquake time in "Ago" format
        thirdView.setText(getTimeAgo(currentEarthquake.getQuakeUnixTime()));
        // Empty the fourthView TextView
        fourthView.setText("");
    } else {
        // Populate the thirdView TextView with the earthquake time
        thirdView.setText(getStandardTime(currentEarthquake.getQuakeUnixTime()));
        // Populate the fourthView TextView with the earthquake date
        fourthView.setText(getDate(currentEarthquake.getQuakeUnixTime()));
    }

    // Obtain user's preference on whether to display 'Tsunami Watch' theme
    String tsunamiPref = prefs.getString("tsunami_watch_theme", "enabled");
    // Find a reference to the drawable circle object
    GradientDrawable magnitudeCircle = (GradientDrawable) magnitudeView.getBackground();

    if (tsunamiPref.equals("enabled") && currentEarthquake.getTsunamiWarning() == 1) {
        // Display current Tsunami watches within the last 24 hours
        if (DateUtils.isToday(currentEarthquake.getQuakeUnixTime())) {
            // Change the circle color to black
            magnitudeCircle.setColor(Color.BLACK);
            // Change the secondaryTextView color to colorAccent
            secondaryTextView.setTextColor(ContextCompat.getColor(getContext(), R.color.colorAccent));
            // Populate the secondaryTextView to "Check for Tsunamis"
            secondaryTextView.setText(R.string.tsunami_header);
        }
    } else {
        // Reference the circle color with respect to the magnitude
        int magnitudeColor = getMagnitudeColor(currentEarthquake.getQuakeMagnitude());
        // Change the circle color
        magnitudeCircle.setColor(magnitudeColor);
    }
    // Return the whole list item layout so it can be displayed
    return listItemView;
}

From source file:com.nxp.nfc_demo.fragments.NdefFragment.java

public void onClick(View v) {
    switch (v.getId()) {
    case R.id.readNdefButton:
        // Reset the values of the view
        MainActivity.demo.NDEFReadFinish();
        ndefPerformance.setText(getResources().getString(R.string.layout_input_ndef_read));
        ndefCallback.setText(getResources().getString(R.string.readNdefMsg));
        readNdefButton.setBackgroundResource(R.drawable.btn_blue);
        writeNdefButton.setBackgroundColor(Color.BLACK);
        ndefWriteOptions.setVisibility(View.GONE);
        ndefReadType.setVisibility(View.VISIBLE);
        linearBt.setVisibility(View.GONE);
        linearSp.setVisibility(View.GONE);
        ndefEditText.setVisibility(View.GONE);
        ndefText.setVisibility(View.VISIBLE);
        ndefReadLoop.setVisibility(View.VISIBLE);
        writeChosen = false;//from www  .j av a  2 s  .  co m

        // Read content
        if (MainActivity.demo.isReady()) {
            MainActivity.demo.finishAllTasks();
            MainActivity.launchNdefDemo(MainActivity.getAuthStatus(), MainActivity.getPassword());
        }

        // Make the writeDefaultButtons and AAR checkbox invisible
        writeDefaultNdefButton.setVisibility(View.GONE);
        addAar.setVisibility(View.GONE);

        break;

    case R.id.writeNdefButton:
        // Make the writeDefaultButtons and AAR checkbox visible
        writeDefaultNdefButton.setVisibility(View.VISIBLE);
        addAar.setVisibility(View.VISIBLE);
        ndefPerformance.setText(getResources().getString(R.string.layout_input_ndef_write));
        ndefCallback.setText(getResources().getString(R.string.writeNdefMsg));

        // Close the ReadNdef Taks
        MainActivity.demo.NDEFReadFinish();

        if (writeChosen == true) {
            if (MainActivity.demo.isReady()) {
                MainActivity.demo.finishAllTasks();
                MainActivity.launchNdefDemo(MainActivity.getAuthStatus(), MainActivity.getPassword());
            }
        } else {
            ndefCallback.setText(getResources().getString(R.string.writeNdefMsg));
            writeNdefButton.setBackgroundResource(R.drawable.btn_blue);
            readNdefButton.setBackgroundColor(Color.BLACK);
            ndefWriteOptions.setVisibility(View.VISIBLE);
            ndefReadType.setVisibility(View.GONE);
            ndefReadLoop.setVisibility(View.GONE);
            if (getNdefType().equals(getResources().getString(R.string.radio_btpair))) {
                linearBt.setVisibility(View.VISIBLE);
                linearSp.setVisibility(View.GONE);
                ndefEditText.setVisibility(View.GONE);
            } else if (getNdefType().equals(getResources().getString(R.string.radio_sp))) {
                linearBt.setVisibility(View.GONE);
                linearSp.setVisibility(View.VISIBLE);
                ndefEditText.setVisibility(View.GONE);
            } else {
                linearBt.setVisibility(View.GONE);
                linearSp.setVisibility(View.GONE);
                ndefEditText.setVisibility(View.VISIBLE);
            }
            ndefText.setVisibility(View.GONE);
            writeChosen = true;
        }

        break;

    case R.id.writeDefaultButton:
        ndefCallback.setText(getResources().getString(R.string.writeNdefMsg));
        writeNdefButton.setBackgroundResource(R.drawable.btn_blue);
        readNdefButton.setBackgroundColor(Color.BLACK);
        ndefWriteOptions.setVisibility(View.VISIBLE);
        ndefReadType.setVisibility(View.GONE);
        RadioButton uri = (RadioButton) ndefWriteOptions.getChildAt(6);
        uri.setChecked(true);
        linearSp.setVisibility(View.VISIBLE);
        linearBt.setVisibility(View.GONE);
        ndefEditText.setVisibility(View.GONE);
        ndefEditTitle.setText(getResources().getString(R.string.ndef_default_text));
        ndefEditLink.setText(getResources().getString(R.string.ndef_default_uri));
        ndefText.setVisibility(View.GONE);
        addAar.setChecked(true);
        writeChosen = true;

        // Write content
        if (MainActivity.demo.isReady()) {
            MainActivity.demo.finishAllTasks();
            MainActivity.launchNdefDemo(MainActivity.getAuthStatus(), MainActivity.getPassword());
        }
        break;
    default:
        break;
    }
}

From source file:com.google.dotorg.crisisresponse.translationcards.RecordingActivity.java

private void moveToLabelStep() {
    setContentView(R.layout.recording_label);
    recycleBitmap();/*from   w  ww . ja v  a  2  s .  c o m*/
    currentBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.recording_label_image);
    currentBitmapView = (ImageView) findViewById(R.id.recording_label_image);
    currentBitmapView.setImageBitmap(currentBitmap);
    final EditText labelField = (EditText) findViewById(R.id.recording_label_field);
    if (label != null) {
        labelField.setText(label);
        labelField.setTextColor(Color.BLACK);
        labelField.setSelection(label.length());
        setLabelNextButtonEnabled(true);
    }
    if (inEditMode) {
        ImageView deleteButton = (ImageView) findViewById(R.id.recording_label_delete_image);
        deleteButton.setVisibility(View.VISIBLE);
        deleteButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                DbManager dbm = new DbManager(RecordingActivity.this);
                dbm.deleteTranslation(translationId);
                if (!isAsset) {
                    File oldFile = new File(filename);
                    oldFile.delete();
                    if (!savedIsAsset && (savedFilename != null) && !savedFilename.equals(filename)) {
                        oldFile = new File(savedFilename);
                        oldFile.delete();
                    }
                }
                setResult(RESULT_OK);
                finish();
            }
        });
        findViewById(R.id.recording_label_step_marker).setVisibility(View.GONE);
    }
    labelField.setOnFocusChangeListener(new View.OnFocusChangeListener() {
        @Override
        public void onFocusChange(View v, boolean hasFocus) {
            if (hasFocus
                    && labelField.getText().toString().equals(getString(R.string.recording_label_hint_text))) {
                labelField.setText("");
                labelField.setTextColor(Color.BLACK);
            } else if (!hasFocus && labelField.getText().toString().equals("")) {
                labelField.setText(getString(R.string.recording_label_hint_text));
                labelField.setTextColor(getResources().getColor(R.color.borderColor));
            }
            if (hasFocus) {
                InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(
                        Context.INPUT_METHOD_SERVICE);
                inputMethodManager.toggleSoftInputFromWindow(labelField.getApplicationWindowToken(),
                        InputMethodManager.SHOW_FORCED, 0);
            }
        }
    });
    labelField.addTextChangedListener(new TextWatcher() {
        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
            // Do nothing here.
        }

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
            if (s.length() != 0 && !s.equals(getString(R.string.recording_label_hint_text))) {
                setLabelNextButtonEnabled(true);
            } else {
                setLabelNextButtonEnabled(false);
            }
        }

        @Override
        public void afterTextChanged(Editable s) {
            // Do nothing here.
        }
    });
    View nextButton = (View) findViewById(R.id.recording_label_next);
    nextButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            label = labelField.getText().toString();
            if (label.length() == 0 || label.equals(getString(R.string.recording_label_hint_text))) {
                return;
            }
            moveToAudioStep();
        }
    });
    stepHistory.push(Step.LABEL);
}