Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PixelDroid
PixelDroid
Commits
4b66d629
Commit
4b66d629
authored
May 22, 2020
by
Andrea Clement
Browse files
can post with boolean replaced by int
parent
be4b9e74
Pipeline
#30
passed with stage
in 7 minutes and 35 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
app/src/main/java/com/h/pixeldroid/PostCreationActivity.kt
View file @
4b66d629
...
...
@@ -45,7 +45,7 @@ class PostCreationActivity : AppCompatActivity() {
private
var
user
:
UserDatabaseEntity
?
=
null
private
var
maxLength
:
Int
=
Instance
.
DEFAULT_MAX_TOOT_CHARS
private
var
isSensitive
=
false
private
var
isSensitive
=
0
private
var
description
:
String
=
""
...
...
@@ -87,7 +87,7 @@ class PostCreationActivity : AppCompatActivity() {
// Listen to sensitive checkBox
findViewById
<
CheckBox
>(
R
.
id
.
checkSensitive
).
setOnClickListener
{
isSensitive
=
!
isSensitive
isSensitive
=
(
isSensitive
+
1
)
%
2
}
// get the description and send the post to PixelFed
...
...
@@ -159,12 +159,15 @@ class PostCreationActivity : AppCompatActivity() {
private
fun
post
(
id
:
String
)
{
if
(
id
.
isEmpty
())
return
pixelfedAPI
.
postStatus
(
val
post
=
pixelfedAPI
.
postStatus
(
authorization
=
"Bearer $accessToken"
,
statusText
=
description
,
media_ids
=
listOf
(
id
),
sensitive
=
isSensitive
).
enqueue
(
object
:
Callback
<
Status
>
{
)
Log
.
e
(
TAG
,
post
.
request
().
toString
())
post
.
enqueue
(
object
:
Callback
<
Status
>
{
override
fun
onFailure
(
call
:
Call
<
Status
>,
t
:
Throwable
)
{
Toast
.
makeText
(
applicationContext
,
"Post upload failed"
,
Toast
.
LENGTH_SHORT
).
show
()
Log
.
e
(
TAG
,
t
.
message
+
call
.
request
())
...
...
app/src/main/java/com/h/pixeldroid/api/PixelfedAPI.kt
View file @
4b66d629
...
...
@@ -98,7 +98,7 @@ interface PixelfedAPI {
@Field
(
"poll[expires_in]"
)
poll_expires
:
List
<
String
>?
=
null
,
@Field
(
"poll[multiple]"
)
poll_multiple
:
List
<
String
>?
=
null
,
@Field
(
"poll[hide_totals]"
)
poll_hideTotals
:
List
<
String
>?
=
null
,
@Field
(
"sensitive"
)
sensitive
:
Boolean
?
=
null
,
@Field
(
"sensitive"
)
sensitive
:
Int
?
=
null
,
@Field
(
"spoiler_text"
)
spoiler_text
:
String
?
=
null
,
@Field
(
"visibility"
)
visibility
:
String
=
"public"
,
@Field
(
"scheduled_at"
)
scheduled_at
:
String
?
=
null
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment