- // make sure our text doesn't exceed our layout width
- Rect bounds = new Rect();
- Paint textPaint = m_Filename.getPaint();
- textPaint.getTextBounds(full_text, 0, full_text.length(), bounds);
-
- while (bounds.width() > getResources().getDisplayMetrics().widthPixels * 0.7) {
- if (todisplay.length() < 2) {
- break;
- }
- todisplay = todisplay.substring(1);
- full_text = "scanning " + todisplay + " ...";
- textPaint.getTextBounds(full_text, 0, full_text.length(), bounds);
- shortened = true;
- }
-
- if (! shortened) {
- m_Filename.setText(full_text);
- }
- else {
- m_Filename.setText("scanning .." + todisplay + " ...");
- }