Revert "Delete right button"

This reverts commit d8cbb904adf1f013b0b8b0ad6d377b35caaec006.
This commit is contained in:
Mario Danic 2017-07-26 07:18:19 +02:00 committed by AndyScherzinger
parent 2092a010b1
commit cb5ef79176
No known key found for this signature in database
GPG key ID: 6CADC7E3523C308B
2 changed files with 57 additions and 0 deletions

View file

@ -29,6 +29,7 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseExpandableListAdapter;
import android.widget.ExpandableListView;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
@ -332,6 +333,40 @@ public class ExpandableUploadListAdapter extends BaseExpandableListAdapter imple
}
statusTextView.setText(status);
/// bind listeners to perform actions
/// bind listeners to perform actions
ImageButton rightButton = (ImageButton) view.findViewById(R.id.upload_right_button);
if (upload.getUploadStatus() == UploadStatus.UPLOAD_IN_PROGRESS) {
//Cancel
rightButton.setImageResource(R.drawable.ic_action_cancel_grey);
rightButton.setVisibility(View.VISIBLE);
rightButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
FileUploader.FileUploaderBinder uploaderBinder = mParentActivity.getFileUploaderBinder();
if (uploaderBinder != null) {
uploaderBinder.cancel(upload);
refreshView();
}
}
});
} else if (upload.getUploadStatus() == UploadStatus.UPLOAD_FAILED) {
//Delete
rightButton.setImageResource(R.drawable.ic_action_delete_grey);
rightButton.setVisibility(View.VISIBLE);
rightButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mUploadsStorageManager.removeUpload(upload);
refreshView();
}
});
} else { // UploadStatus.UPLOAD_SUCCESS
rightButton.setVisibility(View.INVISIBLE);
}
view.setOnClickListener(null);
/// Set icon or thumbnail

View file

@ -102,4 +102,26 @@
android:textSize="@dimen/upload_list_item_text_size_independent"/>
</LinearLayout>
<FrameLayout
android:layout_width="@dimen/min_list_item_size"
android:layout_height="@dimen/standard_list_item_size"
android:focusable="false"
android:focusableInTouchMode="false"
android:layout_gravity="center_vertical"
android:paddingLeft="@dimen/standard_half_padding"
>
<ImageButton
android:id="@+id/upload_right_button"
android:layout_width="@dimen/upload_list_item_image_size"
android:layout_height="@dimen/upload_list_item_image_size"
android:layout_gravity="center"
android:background="@android:color/transparent"
/>
</FrameLayout>
</LinearLayout>