init: library wrapper done

This commit is contained in:
Leo
2026-04-07 02:03:25 +02:00
commit 4680be3ba9
8 changed files with 853 additions and 0 deletions

107
DiscordActivity.java Normal file
View File

@@ -0,0 +1,107 @@
package com.leohabrom.discord;
import java.util.Objects;
public class DiscordActivity {
// Basic Info
public String name = null;
public String state = null;
public String stateUrl = null;
public String details = null;
public String detailsUrl = null;
public int type = -1;
public int status = -1;
public int platform = -1;
// Assets
public String largeImage = null;
public String largeText = null;
public String largeUrl = null;
public String smallImage = null;
public String smallText = null;
public String smallUrl = null;
public String inviteCoverImage = null;
// Party
public String partyId = null;
public int partyCurrentSize = -1;
public int partyMaxSize = -1;
public int partyPrivacy = -1;
// Timestamps (Unix milliseconds)
public long startTimestamp = -1;
public long endTimestamp = -1;
//Buttons
public String firstButtonLabel = null;
public String firstButtonUrl = null;
public String secondButtonLabel = null;
public String secondButtonUrl = null;
public String joinSecret = null;
// Constants
public static final int TYPE_PLAYING = 0;
//public static final int TYPE_STREAMING = 1;
public static final int TYPE_LISTENING = 2;
public static final int TYPE_WATCHING = 3;
public static final int TYPE_COMPETING = 4;
//public static final int TYPE_CUSTOM = 5;
//public static final int TYPE_HANG = 6;
public static final int STATUS_NAME = 0;
public static final int STATUS_STATE = 1;
public static final int STATUS_DETAIL = 2;
public static final int PLATFORM_ANDROID = 0;
public static final int PLATFOTM_DESKTOP = 1;
public static final int PLATFORM_EMBEDDED = 2;
public static final int PLATFORM_IOS = 3;
public static final int PLATFORM_PS4 = 4;
public static final int PLATFORM_PS5 = 5;
public static final int PLATFORM_SAMSUNG = 6;
public static final int PLATFORM_XBOX = 7;
public static final int PARTY_PRIVATE = 0;
public static final int PARTY_PUBLIC = 0;
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
DiscordActivity that = (DiscordActivity) o;
return type == that.type &&
status == that.status &&
// small tolerance for timestamps to account for drift
Math.abs(startTimestamp - that.startTimestamp) < 500 &&
Math.abs(endTimestamp - that.endTimestamp) < 500 &&
Objects.equals(name, that.name) &&
Objects.equals(state, that.state) &&
Objects.equals(stateUrl, that.stateUrl) &&
Objects.equals(details, that.details) &&
Objects.equals(detailsUrl, that.detailsUrl) &&
Objects.equals(largeImage, that.largeImage) &&
Objects.equals(largeUrl, that.largeUrl) &&
Objects.equals(largeText, that.largeText) &&
Objects.equals(smallImage, that.smallImage) &&
Objects.equals(smallUrl, that.smallUrl) &&
Objects.equals(smallText, that.smallText) &&
Objects.equals(inviteCoverImage, that.inviteCoverImage) &&
Objects.equals(platform, that.platform) &&
Objects.equals(partyId, that.partyId) &&
Objects.equals(partyCurrentSize, that.partyCurrentSize) &&
Objects.equals(partyMaxSize, that.partyMaxSize) &&
Objects.equals(partyPrivacy, that.partyPrivacy) &&
Objects.equals(firstButtonLabel, that.firstButtonLabel) &&
Objects.equals(firstButtonUrl, that.firstButtonUrl) &&
Objects.equals(secondButtonLabel, that.secondButtonLabel) &&
Objects.equals(secondButtonUrl, that.secondButtonUrl) &&
Objects.equals(joinSecret, that.joinSecret);
}
@Override
public int hashCode() {
return Objects.hash(name, state, stateUrl, details, detailsUrl, type, status, platform, largeImage, largeText, largeUrl, smallImage, smallText, smallUrl, inviteCoverImage, partyId, partyCurrentSize, partyMaxSize, partyPrivacy, startTimestamp, endTimestamp, firstButtonLabel, firstButtonUrl, secondButtonLabel, secondButtonUrl, joinSecret);
}
}