Skip to content

Set status - #7149

Merged
AndyScherzinger merged 23 commits into
masterfrom
setStatus
Oct 29, 2020
Merged

AndyScherzinger merged 23 commits into
masterfrom
setStatus

Conversation

@tobiasKaminsky

Copy link
Copy Markdown
Member

Fix #7016

Testing

Writing tests is very important. Please try to write some tests for your PR.
If you need help, please do not hesitate to ask in this PR for help.

unit tests
instrumented tests
UI tests

  • Tests written, or not not needed

Copy link
Copy Markdown
Collaborator

Codacy Here is an overview of what got changed by this pull request:

Issues
======
- Added 10
           

Complexity increasing per file
==============================
- src/main/java/com/owncloud/android/ui/StatusDrawable.java  5
- src/main/java/com/owncloud/android/ui/asynctasks/RetrieveStatusAsyncTask.java  2
- src/main/java/com/owncloud/android/providers/FileContentProvider.java  3
- src/main/java/com/owncloud/android/providers/UsersAndGroupsSearchProvider.java  13
- src/main/java/com/owncloud/android/utils/DisplayUtils.java  2
         

Clones added
============
- src/main/java/com/nextcloud/ui/SetStatusTask.kt  1
- src/main/java/com/nextcloud/ui/SetUserDefinedCustomStatusTask.kt  4
- src/main/java/com/nextcloud/ui/SetPredefinedCustomStatusTask.kt  2
- src/main/java/com/nextcloud/ui/ClearStatusTask.kt  1
         

See the complete overview on Codacy

NextcloudClient client = clientFactory.createNextcloudClient(user);
RemoteOperationResult result = new GetStatusRemoteOperation().execute(client);

return (com.owncloud.android.lib.resources.users.Status) result.getSingleData();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


default:
// do not show
backgroundPaint = null;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

statusObject.isNull("icon") ? "" : statusObject.getString("icon"),
statusObject.isNull("clearAt") ? -1 : statusObject.getLong("clearAt"));
} else {
status = new Status(StatusType.OFFLINE, "", "", -1);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

byte[] bitmapData = bos.toByteArray();

//write the bytes in file
try (FileOutputStream fos = new FileOutputStream(f)) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

case USER:
displayName = userName;
icon = R.drawable.ic_user;
subline = status.getMessage().isEmpty() ? null : status.getMessage();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*/
private float mRadius;

private boolean bigText = false;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}

@Override
protected void onPostExecute(com.owncloud.android.lib.resources.users.Status status) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JSONObject statusObject = item.optJSONObject("status");

if (statusObject != null) {
status = new Status(StatusType.valueOf(statusObject.getString("status")),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}

@Override
protected com.owncloud.android.lib.resources.users.Status doInBackground(Void... voids) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return (com.owncloud.android.lib.resources.users.Status) result.getSingleData();

} catch (ClientFactory.CreationException e) {
return new com.owncloud.android.lib.resources.users.Status(StatusType.OFFLINE, "", "", -1);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tobiasKaminsky and others added 12 commits October 29, 2020 20:27
Signed-off-by: tobiasKaminsky <[email protected]>
Signed-off-by: Andy Scherzinger <[email protected]>
Signed-off-by: Andy Scherzinger <[email protected]>
Signed-off-by: Andy Scherzinger <[email protected]>
Signed-off-by: Andy Scherzinger <[email protected]>
Signed-off-by: Andy Scherzinger <[email protected]>
Signed-off-by: Andy Scherzinger <[email protected]>
Signed-off-by: tobiasKaminsky <[email protected]>
Signed-off-by: tobiasKaminsky <[email protected]>
Signed-off-by: tobiasKaminsky <[email protected]>
Signed-off-by: tobiasKaminsky <[email protected]>
Signed-off-by: tobiasKaminsky <[email protected]>
tobiasKaminsky and others added 5 commits October 29, 2020 20:27
Signed-off-by: tobiasKaminsky <[email protected]>
Signed-off-by: tobiasKaminsky <[email protected]>
Signed-off-by: Andy Scherzinger <[email protected]>
Signed-off-by: tobiasKaminsky <[email protected]>
Signed-off-by: tobiasKaminsky <[email protected]>
AndyScherzinger and others added 5 commits October 29, 2020 20:28
Signed-off-by: Andy Scherzinger <[email protected]>
Signed-off-by: tobiasKaminsky <[email protected]>
Signed-off-by: tobiasKaminsky <[email protected]>
Signed-off-by: tobiasKaminsky <[email protected]>
Signed-off-by: Andy Scherzinger <[email protected]>
@nextcloud-android-bot

Copy link
Copy Markdown
Collaborator

APK file: https://www.kaminsky.me/nc-dev/android-artifacts/16384.apk

qrcode

To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud app.

@nextcloud-android-bot

Copy link
Copy Markdown
Collaborator

@nextcloud-android-bot

Copy link
Copy Markdown
Collaborator

Codacy

Lint

TypemasterPR
Warnings337334
Errors00

SpotBugs (new)

Warning TypeNumber
Bad practice Warnings27
Correctness Warnings53
Internationalization Warnings9
Multithreaded correctness Warnings9
Performance Warnings72
Security Warnings43
Dodgy code Warnings102
Total315

SpotBugs (master)

Warning TypeNumber
Bad practice Warnings27
Correctness Warnings53
Internationalization Warnings9
Multithreaded correctness Warnings9
Performance Warnings72
Security Warnings43
Dodgy code Warnings102
Total315

@nextcloud-android-bot

Copy link
Copy Markdown
Collaborator

@nextcloud-android-bot

Copy link
Copy Markdown
Collaborator

@nextcloud-android-bot

Copy link
Copy Markdown
Collaborator

@nextcloud-android-bot

Copy link
Copy Markdown
Collaborator

@AndyScherzinger
AndyScherzinger merged commit fb7fd8c into master Oct 29, 2020
@delete-merged-branch
delete-merged-branch Bot deleted the setStatus branch October 29, 2020 22:56
thelittlefireman pushed a commit to thelittlefireman/android that referenced this pull request Mar 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

User status

3 participants