]> git.lizzy.rs Git - minetest.git/commitdiff
Android: shorten initial progress bar text way more simple
authorSapier <sapier AT gmx dot net>
Fri, 18 Dec 2015 19:05:13 +0000 (20:05 +0100)
committerSapier <sapier AT gmx dot net>
Wed, 23 Dec 2015 20:01:35 +0000 (21:01 +0100)
build/android/res/layout/assetcopy.xml
build/android/src/net/minetest/minetest/MinetestAssetCopy.java

index ade4b0c985de565f9df734baac8028fc7a8d9e44..8ec14bdc260d72af09197ee77c6bfc3f58783fe1 100644 (file)
 
     <TextView
         android:id="@+id/textView1"
-        android:layout_width="wrap_content"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
+        android:ellipsize="middle" 
+        android:singleLine="true"
         android:layout_gravity="center_horizontal"
         android:text="preparing media ..."
         android:textAppearance="?android:attr/textAppearanceSmall" />
index 5776e77b538b4c8a8063f8c4be38c323045f3c0b..eb92acb6308b6a5fee440a54ee944ddd1782e2af 100644 (file)
@@ -254,54 +254,14 @@ public class MinetestAssetCopy extends Activity
                                boolean shortened = false;
                                String todisplay = m_tocopy.get(progress[0]);
                                m_ProgressBar.setProgress(progress[0]);
-                               
-                               // make sure our text doesn't exceed our layout width
-                               Rect bounds = new Rect();
-                               Paint textPaint = m_Filename.getPaint();
-                               textPaint.getTextBounds(todisplay, 0, todisplay.length(), bounds);
-                               
-                               while (bounds.width() > getResources().getDisplayMetrics().widthPixels * 0.7) {
-                                       if (todisplay.length() < 2) {
-                                               break;
-                                       }
-                                       todisplay = todisplay.substring(1);
-                                       textPaint.getTextBounds(todisplay, 0, todisplay.length(), bounds);
-                                       shortened = true;
-                               }
-                               
-                               if (! shortened) {
-                                       m_Filename.setText(todisplay);
-                               }
-                               else {
-                                       m_Filename.setText(".." + todisplay);
-                               }
+                               m_Filename.setText(todisplay);
                        }
                        else
                        {
                                boolean shortened = false;
                                String todisplay = m_Foldername;
                                String full_text = "scanning " + todisplay + " ...";
-                               // 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 + " ...");
-                               }
+                               m_Filename.setText(full_text);
                        }
                }