···11+// Top-level build file where you can add configuration options common to all sub-projects/modules.
22+buildscript {
33+ repositories {
44+ google()
55+ mavenCentral()
66+ }
77+ dependencies {
88+ classpath "com.android.tools.build:gradle:7.0.4"
99+1010+ // NOTE: Do not place your application dependencies here; they belong
1111+ // in the individual module build.gradle files
1212+ }
1313+}
1414+1515+task clean(type: Delete) {
1616+ delete rootProject.buildDir
1717+}
+19
gradle.properties
···11+# Project-wide Gradle settings.
22+# IDE (e.g. Android Studio) users:
33+# Gradle settings configured through the IDE *will override*
44+# any settings specified in this file.
55+# For more details on how to configure your build environment visit
66+# http://www.gradle.org/docs/current/userguide/build_environment.html
77+# Specifies the JVM arguments used for the daemon process.
88+# The setting is particularly useful for tweaking memory settings.
99+org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
1010+# When configured, Gradle will run in incubating parallel mode.
1111+# This option should only be used with decoupled projects. More details, visit
1212+# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
1313+# org.gradle.parallel=true
1414+# AndroidX package structure to make it clearer which packages are bundled with the
1515+# Android operating system, and which are packaged with your app"s APK
1616+# https://developer.android.com/topic/libraries/support-library/androidx-rn
1717+android.useAndroidX=true
1818+# Automatically convert third-party libraries to use AndroidX
1919+android.enableJetifier=true
···11+#!/usr/bin/env sh
22+33+#
44+# Copyright 2015 the original author or authors.
55+#
66+# Licensed under the Apache License, Version 2.0 (the "License");
77+# you may not use this file except in compliance with the License.
88+# You may obtain a copy of the License at
99+#
1010+# https://www.apache.org/licenses/LICENSE-2.0
1111+#
1212+# Unless required by applicable law or agreed to in writing, software
1313+# distributed under the License is distributed on an "AS IS" BASIS,
1414+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1515+# See the License for the specific language governing permissions and
1616+# limitations under the License.
1717+#
1818+1919+##############################################################################
2020+##
2121+## Gradle start up script for UN*X
2222+##
2323+##############################################################################
2424+2525+# Attempt to set APP_HOME
2626+# Resolve links: $0 may be a link
2727+PRG="$0"
2828+# Need this for relative symlinks.
2929+while [ -h "$PRG" ] ; do
3030+ ls=`ls -ld "$PRG"`
3131+ link=`expr "$ls" : '.*-> \(.*\)$'`
3232+ if expr "$link" : '/.*' > /dev/null; then
3333+ PRG="$link"
3434+ else
3535+ PRG=`dirname "$PRG"`"/$link"
3636+ fi
3737+done
3838+SAVED="`pwd`"
3939+cd "`dirname \"$PRG\"`/" >/dev/null
4040+APP_HOME="`pwd -P`"
4141+cd "$SAVED" >/dev/null
4242+4343+APP_NAME="Gradle"
4444+APP_BASE_NAME=`basename "$0"`
4545+4646+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
4747+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
4848+4949+# Use the maximum available, or set MAX_FD != -1 to use that value.
5050+MAX_FD="maximum"
5151+5252+warn () {
5353+ echo "$*"
5454+}
5555+5656+die () {
5757+ echo
5858+ echo "$*"
5959+ echo
6060+ exit 1
6161+}
6262+6363+# OS specific support (must be 'true' or 'false').
6464+cygwin=false
6565+msys=false
6666+darwin=false
6767+nonstop=false
6868+case "`uname`" in
6969+ CYGWIN* )
7070+ cygwin=true
7171+ ;;
7272+ Darwin* )
7373+ darwin=true
7474+ ;;
7575+ MINGW* )
7676+ msys=true
7777+ ;;
7878+ NONSTOP* )
7979+ nonstop=true
8080+ ;;
8181+esac
8282+8383+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
8484+8585+8686+# Determine the Java command to use to start the JVM.
8787+if [ -n "$JAVA_HOME" ] ; then
8888+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
8989+ # IBM's JDK on AIX uses strange locations for the executables
9090+ JAVACMD="$JAVA_HOME/jre/sh/java"
9191+ else
9292+ JAVACMD="$JAVA_HOME/bin/java"
9393+ fi
9494+ if [ ! -x "$JAVACMD" ] ; then
9595+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
9696+9797+Please set the JAVA_HOME variable in your environment to match the
9898+location of your Java installation."
9999+ fi
100100+else
101101+ JAVACMD="java"
102102+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
103103+104104+Please set the JAVA_HOME variable in your environment to match the
105105+location of your Java installation."
106106+fi
107107+108108+# Increase the maximum file descriptors if we can.
109109+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
110110+ MAX_FD_LIMIT=`ulimit -H -n`
111111+ if [ $? -eq 0 ] ; then
112112+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
113113+ MAX_FD="$MAX_FD_LIMIT"
114114+ fi
115115+ ulimit -n $MAX_FD
116116+ if [ $? -ne 0 ] ; then
117117+ warn "Could not set maximum file descriptor limit: $MAX_FD"
118118+ fi
119119+ else
120120+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
121121+ fi
122122+fi
123123+124124+# For Darwin, add options to specify how the application appears in the dock
125125+if $darwin; then
126126+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
127127+fi
128128+129129+# For Cygwin or MSYS, switch paths to Windows format before running java
130130+if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
131131+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
132132+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
133133+134134+ JAVACMD=`cygpath --unix "$JAVACMD"`
135135+136136+ # We build the pattern for arguments to be converted via cygpath
137137+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
138138+ SEP=""
139139+ for dir in $ROOTDIRSRAW ; do
140140+ ROOTDIRS="$ROOTDIRS$SEP$dir"
141141+ SEP="|"
142142+ done
143143+ OURCYGPATTERN="(^($ROOTDIRS))"
144144+ # Add a user-defined pattern to the cygpath arguments
145145+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
146146+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
147147+ fi
148148+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
149149+ i=0
150150+ for arg in "$@" ; do
151151+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
152152+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
153153+154154+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
155155+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
156156+ else
157157+ eval `echo args$i`="\"$arg\""
158158+ fi
159159+ i=`expr $i + 1`
160160+ done
161161+ case $i in
162162+ 0) set -- ;;
163163+ 1) set -- "$args0" ;;
164164+ 2) set -- "$args0" "$args1" ;;
165165+ 3) set -- "$args0" "$args1" "$args2" ;;
166166+ 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
167167+ 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
168168+ 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
169169+ 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
170170+ 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
171171+ 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
172172+ esac
173173+fi
174174+175175+# Escape application args
176176+save () {
177177+ for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
178178+ echo " "
179179+}
180180+APP_ARGS=`save "$@"`
181181+182182+# Collect all arguments for the java command, following the shell quoting and substitution rules
183183+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
184184+185185+exec "$JAVACMD" "$@"
+89
gradlew.bat
···11+@rem
22+@rem Copyright 2015 the original author or authors.
33+@rem
44+@rem Licensed under the Apache License, Version 2.0 (the "License");
55+@rem you may not use this file except in compliance with the License.
66+@rem You may obtain a copy of the License at
77+@rem
88+@rem https://www.apache.org/licenses/LICENSE-2.0
99+@rem
1010+@rem Unless required by applicable law or agreed to in writing, software
1111+@rem distributed under the License is distributed on an "AS IS" BASIS,
1212+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313+@rem See the License for the specific language governing permissions and
1414+@rem limitations under the License.
1515+@rem
1616+1717+@if "%DEBUG%" == "" @echo off
1818+@rem ##########################################################################
1919+@rem
2020+@rem Gradle startup script for Windows
2121+@rem
2222+@rem ##########################################################################
2323+2424+@rem Set local scope for the variables with windows NT shell
2525+if "%OS%"=="Windows_NT" setlocal
2626+2727+set DIRNAME=%~dp0
2828+if "%DIRNAME%" == "" set DIRNAME=.
2929+set APP_BASE_NAME=%~n0
3030+set APP_HOME=%DIRNAME%
3131+3232+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
3333+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
3434+3535+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
3636+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
3737+3838+@rem Find java.exe
3939+if defined JAVA_HOME goto findJavaFromJavaHome
4040+4141+set JAVA_EXE=java.exe
4242+%JAVA_EXE% -version >NUL 2>&1
4343+if "%ERRORLEVEL%" == "0" goto execute
4444+4545+echo.
4646+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
4747+echo.
4848+echo Please set the JAVA_HOME variable in your environment to match the
4949+echo location of your Java installation.
5050+5151+goto fail
5252+5353+:findJavaFromJavaHome
5454+set JAVA_HOME=%JAVA_HOME:"=%
5555+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
5656+5757+if exist "%JAVA_EXE%" goto execute
5858+5959+echo.
6060+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
6161+echo.
6262+echo Please set the JAVA_HOME variable in your environment to match the
6363+echo location of your Java installation.
6464+6565+goto fail
6666+6767+:execute
6868+@rem Setup the command line
6969+7070+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
7171+7272+7373+@rem Execute Gradle
7474+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
7575+7676+:end
7777+@rem End local scope for the variables with windows NT shell
7878+if "%ERRORLEVEL%"=="0" goto mainEnd
7979+8080+:fail
8181+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
8282+rem the _cmd.exe /c_ return code!
8383+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
8484+exit /b 1
8585+8686+:mainEnd
8787+if "%OS%"=="Windows_NT" endlocal
8888+8989+:omega
···11+# Add project specific ProGuard rules here.
22+# You can control the set of applied configuration files using the
33+# proguardFiles setting in build.gradle.
44+#
55+# For more details, see
66+# http://developer.android.com/guide/developing/tools/proguard.html
77+88+# If your project uses WebView with JS, uncomment the following
99+# and specify the fully qualified class name to the JavaScript interface
1010+# class:
1111+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
1212+# public *;
1313+#}
1414+1515+# Uncomment this to preserve the line number information for
1616+# debugging stack traces.
1717+#-keepattributes SourceFile,LineNumberTable
1818+1919+# If you keep the line number information, uncomment this to
2020+# hide the original source file name.
2121+#-renamesourcefileattribute SourceFile
···11+package org.joinmastodon.android.model;
22+33+import org.joinmastodon.android.api.ObjectValidationException;
44+import org.joinmastodon.android.api.RequiredField;
55+66+import java.time.Instant;
77+import java.time.LocalDate;
88+import java.util.List;
99+1010+/**
1111+ * Represents a user of Mastodon and their associated profile.
1212+ */
1313+public class Account extends BaseModel{
1414+ // Base attributes
1515+1616+ /**
1717+ * The account id
1818+ */
1919+ @RequiredField
2020+ public String id;
2121+ /**
2222+ * The username of the account, not including domain.
2323+ */
2424+ @RequiredField
2525+ public String username;
2626+ /**
2727+ * The Webfinger account URI. Equal to username for local users, or username@domain for remote users.
2828+ */
2929+ @RequiredField
3030+ public String acct;
3131+ /**
3232+ * The location of the user's profile page.
3333+ */
3434+ @RequiredField
3535+ public String url;
3636+3737+ // Display attributes
3838+3939+ /**
4040+ * The profile's display name.
4141+ */
4242+ @RequiredField
4343+ public String displayName;
4444+ /**
4545+ * The profile's bio / description.
4646+ */
4747+ @RequiredField
4848+ public String note;
4949+ /**
5050+ * An image icon that is shown next to statuses and in the profile.
5151+ */
5252+ @RequiredField
5353+ public String avatar;
5454+ /**
5555+ * A static version of the avatar. Equal to avatar if its value is a static image; different if avatar is an animated GIF.
5656+ */
5757+ public String avatarStatic;
5858+ /**
5959+ * An image banner that is shown above the profile and in profile cards.
6060+ */
6161+ @RequiredField
6262+ public String header;
6363+ /**
6464+ * A static version of the header. Equal to header if its value is a static image; different if header is an animated GIF.
6565+ */
6666+ public String headerStatic;
6767+ /**
6868+ * Whether the account manually approves follow requests.
6969+ */
7070+ public boolean locked;
7171+ /**
7272+ * Custom emoji entities to be used when rendering the profile. If none, an empty array will be returned.
7373+ */
7474+ public List<Emoji> emojis;
7575+ /**
7676+ * Whether the account has opted into discovery features such as the profile directory.
7777+ */
7878+ public boolean discoverable;
7979+8080+ // Statistical attributes
8181+8282+ /**
8383+ * When the account was created.
8484+ */
8585+ @RequiredField
8686+ public Instant createdAt;
8787+ /**
8888+ * When the most recent status was posted.
8989+ */
9090+// @RequiredField
9191+ public LocalDate lastStatusAt;
9292+ /**
9393+ * How many statuses are attached to this account.
9494+ */
9595+ public int statusesCount;
9696+ /**
9797+ * The reported followers of this profile.
9898+ */
9999+ public int followersCount;
100100+ /**
101101+ * The reported follows of this profile.
102102+ */
103103+ public int followingCount;
104104+105105+ // Optional attributes
106106+107107+ /**
108108+ * Indicates that the profile is currently inactive and that its user has moved to a new account.
109109+ */
110110+ public Account moved;
111111+ /**
112112+ * Additional metadata attached to a profile as name-value pairs.
113113+ */
114114+ public List<AccountField> fields;
115115+ /**
116116+ * A presentational flag. Indicates that the account may perform automated actions, may not be monitored, or identifies as a robot.
117117+ */
118118+ public boolean bot;
119119+ /**
120120+ * An extra entity to be used with API methods to verify credentials and update credentials.
121121+ */
122122+ public Source source;
123123+ /**
124124+ * An extra entity returned when an account is suspended.
125125+ */
126126+ public boolean suspended;
127127+ /**
128128+ * When a timed mute will expire, if applicable.
129129+ */
130130+ public Instant muteExpiresAt;
131131+132132+133133+ @Override
134134+ public void postprocess() throws ObjectValidationException{
135135+ super.postprocess();
136136+ if(fields!=null){
137137+ for(AccountField f:fields)
138138+ f.postprocess();
139139+ }
140140+ if(emojis!=null){
141141+ for(Emoji e:emojis)
142142+ e.postprocess();
143143+ }
144144+ if(moved!=null)
145145+ moved.postprocess();
146146+ }
147147+148148+ @Override
149149+ public String toString(){
150150+ return "Account{"+
151151+ "id='"+id+'\''+
152152+ ", username='"+username+'\''+
153153+ ", acct='"+acct+'\''+
154154+ ", url='"+url+'\''+
155155+ ", displayName='"+displayName+'\''+
156156+ ", note='"+note+'\''+
157157+ ", avatar='"+avatar+'\''+
158158+ ", avatarStatic='"+avatarStatic+'\''+
159159+ ", header='"+header+'\''+
160160+ ", headerStatic='"+headerStatic+'\''+
161161+ ", locked="+locked+
162162+ ", emojis="+emojis+
163163+ ", discoverable="+discoverable+
164164+ ", createdAt="+createdAt+
165165+ ", lastStatusAt="+lastStatusAt+
166166+ ", statusesCount="+statusesCount+
167167+ ", followersCount="+followersCount+
168168+ ", followingCount="+followingCount+
169169+ ", moved="+moved+
170170+ ", fields="+fields+
171171+ ", bot="+bot+
172172+ ", source="+source+
173173+ ", suspended="+suspended+
174174+ ", muteExpiresAt="+muteExpiresAt+
175175+ '}';
176176+ }
177177+}
···11+package org.joinmastodon.android.model;
22+33+import org.joinmastodon.android.api.RequiredField;
44+55+import java.time.Instant;
66+77+/**
88+ * Represents a profile field as a name-value pair with optional verification.
99+ */
1010+public class AccountField extends BaseModel{
1111+ /**
1212+ * The key of a given field's key-value pair.
1313+ */
1414+ @RequiredField
1515+ public String name;
1616+ /**
1717+ * The value associated with the name key.
1818+ */
1919+ @RequiredField
2020+ public String value;
2121+ /**
2222+ * Timestamp of when the server verified a URL value for a rel="me” link.
2323+ */
2424+ public Instant verifiedAt;
2525+}
···11+package org.joinmastodon.android.model;
22+33+import org.joinmastodon.android.api.RequiredField;
44+55+/**
66+ * Represents a custom emoji.
77+ */
88+public class Emoji extends BaseModel{
99+ /**
1010+ * The name of the custom emoji.
1111+ */
1212+ @RequiredField
1313+ public String shortcode;
1414+ /**
1515+ * A link to the custom emoji.
1616+ */
1717+ @RequiredField
1818+ public String url;
1919+ /**
2020+ * A link to a static copy of the custom emoji.
2121+ */
2222+ @RequiredField
2323+ public String staticUrl;
2424+ /**
2525+ * Whether this Emoji should be visible in the picker or unlisted.
2626+ */
2727+ @RequiredField
2828+ public boolean visibleInPicker;
2929+ /**
3030+ * Used for sorting custom emoji in the picker.
3131+ */
3232+ public String category;
3333+}
···11+package org.joinmastodon.android.model;
22+33+import org.joinmastodon.android.api.ObjectValidationException;
44+import org.joinmastodon.android.api.RequiredField;
55+66+import java.util.List;
77+88+/**
99+ * Represents display or publishing preferences of user's own account. Returned as an additional entity when verifying and updated credentials, as an attribute of Account.
1010+ */
1111+public class Source extends BaseModel{
1212+ /**
1313+ * Profile bio.
1414+ */
1515+ @RequiredField
1616+ public String note;
1717+ /**
1818+ * Metadata about the account.
1919+ */
2020+ @RequiredField
2121+ public List<AccountField> fields;
2222+ /**
2323+ * The default post privacy to be used for new statuses.
2424+ */
2525+ public StatusPrivacy privacy;
2626+ /**
2727+ * Whether new statuses should be marked sensitive by default.
2828+ */
2929+ public boolean sensitive;
3030+ /**
3131+ * The default posting language for new statuses.
3232+ */
3333+ public String language;
3434+ /**
3535+ * The number of pending follow requests.
3636+ */
3737+ public int followRequestCount;
3838+3939+ @Override
4040+ public void postprocess() throws ObjectValidationException{
4141+ super.postprocess();
4242+ for(AccountField f:fields)
4343+ f.postprocess();
4444+ }
4545+}
···11+package org.joinmastodon.android.model;
22+33+import org.joinmastodon.android.api.AllFieldsAreRequired;
44+55+/**
66+ * Represents an OAuth token used for authenticating with the API and performing actions.
77+ */
88+@AllFieldsAreRequired
99+public class Token extends BaseModel{
1010+ /**
1111+ * An OAuth token to be used for authorization.
1212+ */
1313+ public String accessToken;
1414+ /**
1515+ * The OAuth token type. Mastodon uses Bearer tokens.
1616+ */
1717+ public String tokenType;
1818+ /**
1919+ * The OAuth scopes granted by this token, space-separated.
2020+ */
2121+ public String scope;
2222+ /**
2323+ * When the token was generated.
2424+ * (unixtime)
2525+ */
2626+ public long createdAt;
2727+}