From: Bartek Przybylski Date: Tue, 22 May 2012 20:44:57 +0000 (+0200) Subject: making icons bit smaller, making upload progressbar less cpu eating X-Git-Tag: oc-android-1.4.3~397 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/684ae90ca7f9eab8cbd14bc28bab5af265d0a9ac making icons bit smaller, making upload progressbar less cpu eating --- diff --git a/res/layout/list_layout.xml b/res/layout/list_layout.xml index 5f2a43fa..2a0d48b9 100644 --- a/res/layout/list_layout.xml +++ b/res/layout/list_layout.xml @@ -24,7 +24,7 @@ android:layout_height="56dp"> @@ -37,9 +37,9 @@ @@ -55,18 +55,13 @@ android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:layout_marginLeft="4dp" + android:layout_marginRight="4dp" + android:ellipsize="middle" + android:singleLine="true" android:text="TextView" android:textColor="#303030" - android:textSize="20dip" /> + android:textSize="16dip" /> - diff --git a/src/eu/alefzero/owncloud/files/services/FileUploader.java b/src/eu/alefzero/owncloud/files/services/FileUploader.java index a814fa8e..30d91e1c 100644 --- a/src/eu/alefzero/owncloud/files/services/FileUploader.java +++ b/src/eu/alefzero/owncloud/files/services/FileUploader.java @@ -47,7 +47,7 @@ public class FileUploader extends Service implements OnUploadProgressListener { private int mUploadType; private Notification mNotification; private int mTotalDataToSend, mSendData; - private int mCurrentIndexUpload; + private int mCurrentIndexUpload, mPreviousPercent; @Override public IBinder onBind(Intent arg0) { @@ -134,7 +134,7 @@ public class FileUploader extends Service implements OnUploadProgressListener { mAccount.name.lastIndexOf('@')); String password = mAccountManager.getPassword(mAccount); - mTotalDataToSend = mSendData = 0; + mTotalDataToSend = mSendData = mPreviousPercent = 0; mNotification = new Notification( eu.alefzero.owncloud.R.drawable.icon, "Uploading...", @@ -179,9 +179,12 @@ public class FileUploader extends Service implements OnUploadProgressListener { public void OnUploadProgress(long currentProgress) { mSendData += currentProgress; int percent = (int)(100*mSendData/mTotalDataToSend); - String text = String.format("%d%% Uploading %s file", percent, new File(mLocalPaths[mCurrentIndexUpload]).getName()); - mNotification.contentView.setProgressBar(R.id.status_progress, 100, percent, false); - mNotification.contentView.setTextViewText(R.id.status_text, text); - mNotificationManager.notify(42, mNotification); + if (percent != mPreviousPercent) { + String text = String.format("%d%% Uploading %s file", percent, new File(mLocalPaths[mCurrentIndexUpload]).getName()); + mNotification.contentView.setProgressBar(R.id.status_progress, 100, percent, false); + mNotification.contentView.setTextViewText(R.id.status_text, text); + mNotificationManager.notify(42, mNotification); + } + mPreviousPercent = percent; } } diff --git a/src/eu/alefzero/owncloud/ui/activity/FileDisplayActivity.java b/src/eu/alefzero/owncloud/ui/activity/FileDisplayActivity.java index 65f03a39..bdc146cc 100644 --- a/src/eu/alefzero/owncloud/ui/activity/FileDisplayActivity.java +++ b/src/eu/alefzero/owncloud/ui/activity/FileDisplayActivity.java @@ -177,7 +177,6 @@ public class FileDisplayActivity extends SherlockFragmentActivity implements setProgressBarIndeterminateVisibility(false); // if (getSupportFragmentManager().findFragmentById(R.id.fileList) == // null) - Log.e("ASDaaa", "ASDaaa"); setContentView(R.layout.files); } diff --git a/src/eu/alefzero/owncloud/ui/adapter/FileListListAdapter.java b/src/eu/alefzero/owncloud/ui/adapter/FileListListAdapter.java index b1706475..a2f79967 100644 --- a/src/eu/alefzero/owncloud/ui/adapter/FileListListAdapter.java +++ b/src/eu/alefzero/owncloud/ui/adapter/FileListListAdapter.java @@ -99,18 +99,9 @@ public class FileListListAdapter implements ListAdapter { if (mFiles.size() > position) { OCFile file = mFiles.get(position); TextView fileName = (TextView) view.findViewById(R.id.Filename); - TextView ext_text = (TextView) view.findViewById(R.id.Extension); String name = file.getFileName(); - String ext = file.getFileName(); - if (name.lastIndexOf('.') != -1) { - name = name.substring(0, name.lastIndexOf('.')); - ext = ext.substring(ext.lastIndexOf('.')); - } else { - ext = ""; - } fileName.setText(DisplayUtils.HtmlDecode(name)); - ext_text.setText(ext); ImageView fileIcon = (ImageView) view.findViewById(R.id.imageView1); if (!file.getMimetype().equals("DIR")) { fileIcon.setImageResource(R.drawable.file);