making icons bit smaller, making upload progressbar less cpu eating

This commit is contained in:
Bartek Przybylski 2012-05-22 22:44:57 +02:00
parent 5d7a57ec18
commit 684ae90ca7
4 changed files with 17 additions and 29 deletions

View File

@ -24,7 +24,7 @@
android:layout_height="56dp">
<FrameLayout
android:layout_width="56dp"
android:layout_width="wrap_content"
android:layout_height="56dp"
android:focusable="false"
android:focusableInTouchMode="false">
@ -37,9 +37,9 @@
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="48dp"
android:layout_gravity="center_vertical"
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_gravity="center_vertical|center"
android:layout_margin="4dp"
android:src="@drawable/ic_menu_archive" />
@ -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" />
<TextView
android:id="@+id/Extension"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="TextView"
android:textColor="#D0D0D0"
android:textSize="20dip" />
</LinearLayout>
</LinearLayout>

View File

@ -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;
}
}

View File

@ -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);
}

View File

@ -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);