bug fix, layout fix
This commit is contained in:
parent
2624d992c3
commit
63881a6e4e
|
@ -1,7 +1,6 @@
|
|||
package org.nuclearfog.twidda.backend.api.twitter.v2;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
|
@ -231,9 +230,10 @@ public class TwitterV2 extends TwitterV1 {
|
|||
try {
|
||||
Status item = new TweetV2(data.getJSONObject(i), userMap, mediaMap, pollMap, locationMap, host, null);
|
||||
tweets.add(item);
|
||||
} catch (JSONException e) {
|
||||
} catch (JSONException exception) {
|
||||
// skip tweet
|
||||
if (BuildConfig.DEBUG) {
|
||||
Log.w("tweet-v2", e);
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -273,9 +273,10 @@ public class TwitterV2 extends TwitterV1 {
|
|||
for (int i = 0; i < array.length(); i++) {
|
||||
try {
|
||||
users.add(new UserV2(array.getJSONObject(i), homeId));
|
||||
} catch (JSONException err) {
|
||||
} catch (JSONException exception) {
|
||||
if (BuildConfig.DEBUG) {
|
||||
Log.w("user-v2", err);
|
||||
// skip user
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,6 +37,9 @@ public class PollUpdate implements Serializable {
|
|||
*/
|
||||
public PollUpdate(Poll poll) {
|
||||
multipleChoice = poll.multipleChoiceEnabled();
|
||||
if (System.currentTimeMillis() < poll.getEndTime()) {
|
||||
duration = (int) (poll.getEndTime() - System.currentTimeMillis());
|
||||
}
|
||||
for (Poll.Option option : poll.getOptions()) {
|
||||
options.add(option.getTitle());
|
||||
}
|
||||
|
|
|
@ -130,26 +130,9 @@ public class StatusUpdate implements Serializable, Closeable {
|
|||
mediaKeys.add(media.getKey());
|
||||
previews.add(media.getUrl());
|
||||
}
|
||||
switch (status.getMedia()[0].getMediaType()) {
|
||||
case Media.GIF:
|
||||
attachment = MEDIA_GIF;
|
||||
if (instance != null && mediaKeys.size() == instance.getGifLimit())
|
||||
attachmentLimitReached = true;
|
||||
break;
|
||||
|
||||
case Media.PHOTO:
|
||||
attachment = MEDIA_IMAGE;
|
||||
if (instance != null && mediaKeys.size() == instance.getImageLimit())
|
||||
attachmentLimitReached = true;
|
||||
break;
|
||||
|
||||
case Media.VIDEO:
|
||||
attachment = MEDIA_VIDEO;
|
||||
if (instance != null && mediaKeys.size() == instance.getVideoLimit())
|
||||
attachmentLimitReached = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// fixme it's not possible to add more media items when editing a status
|
||||
attachmentLimitReached = true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -19,7 +19,6 @@ public class PushNotificationReceiver extends MessagingReceiver {
|
|||
|
||||
@Override
|
||||
public void onMessage(@NonNull Context context, @NonNull byte[] message, @NonNull String instance) {
|
||||
super.onMessage(context, message, instance);
|
||||
GlobalSettings settings = GlobalSettings.getInstance(context);
|
||||
if (settings.pushEnabled()) {
|
||||
// todo add manual synchonization
|
||||
|
@ -29,7 +28,6 @@ public class PushNotificationReceiver extends MessagingReceiver {
|
|||
|
||||
@Override
|
||||
public void onNewEndpoint(@NonNull Context context, @NonNull String endpoint, @NonNull String instance) {
|
||||
super.onNewEndpoint(context, endpoint, instance);
|
||||
PushUpdater pushUpdater = new PushUpdater(context);
|
||||
PushUpdate update = new PushUpdate(instance);
|
||||
pushUpdater.execute(update, null);
|
||||
|
|
|
@ -31,6 +31,7 @@ import org.nuclearfog.twidda.backend.utils.ErrorUtils;
|
|||
import org.nuclearfog.twidda.config.GlobalSettings;
|
||||
import org.nuclearfog.twidda.model.Emoji;
|
||||
import org.nuclearfog.twidda.model.Instance;
|
||||
import org.nuclearfog.twidda.model.Media;
|
||||
import org.nuclearfog.twidda.model.Status;
|
||||
import org.nuclearfog.twidda.ui.adapter.IconAdapter;
|
||||
import org.nuclearfog.twidda.ui.adapter.IconAdapter.OnMediaClickListener;
|
||||
|
@ -165,12 +166,10 @@ public class StatusEditor extends MediaActivity implements OnClickListener, OnPr
|
|||
if (editStatus) {
|
||||
statusUpdate.setStatus(status);
|
||||
statusText.append(status.getText());
|
||||
int mediaType = statusUpdate.getAttachmentType();
|
||||
if (mediaType != StatusUpdate.EMPTY) {
|
||||
for (int i = 0 ; i < statusUpdate.getMediaKeys().length ; i++) {
|
||||
addMedia(mediaType);
|
||||
}
|
||||
for (Media media : status.getMedia()) {
|
||||
addMedia(media.getMediaType());
|
||||
}
|
||||
mediaBtn.setVisibility(View.GONE);
|
||||
} else {
|
||||
statusUpdate.addReplyStatusId(status.getId());
|
||||
statusUpdate.setVisibility(status.getVisibility());
|
||||
|
@ -415,18 +414,22 @@ public class StatusEditor extends MediaActivity implements OnClickListener, OnPr
|
|||
*/
|
||||
private void addMedia(int mediaType) {
|
||||
switch (mediaType) {
|
||||
case Media.PHOTO:
|
||||
case StatusUpdate.MEDIA_IMAGE:
|
||||
adapter.addImageItem();
|
||||
break;
|
||||
|
||||
case Media.GIF:
|
||||
case StatusUpdate.MEDIA_GIF:
|
||||
adapter.addGifItem();
|
||||
break;
|
||||
|
||||
case Media.VIDEO:
|
||||
case StatusUpdate.MEDIA_VIDEO:
|
||||
adapter.addVideoItem();
|
||||
break;
|
||||
|
||||
case Media.AUDIO:
|
||||
case StatusUpdate.MEDIA_AUDIO:
|
||||
adapter.addAudioItem();
|
||||
break;
|
||||
|
|
|
@ -127,6 +127,16 @@ public class PollDialog extends Dialog implements OnClickListener {
|
|||
optionAdapter.replaceItems(poll.getOptions());
|
||||
multiple_choice.setCheckedImmediately(poll.multipleChoiceEnabled());
|
||||
hide_votes.setCheckedImmediately(poll.hideTotalVotes());
|
||||
if (poll.getDuration() > 86400000L) {
|
||||
durationInput.setText(Long.toString(Math.round(poll.getDuration() / 86400000d)));
|
||||
timeUnitSelector.setSelection(2);
|
||||
} else if (poll.getDuration() > 3600000L) {
|
||||
durationInput.setText(Long.toString(Math.round(poll.getDuration() / 3600000d)));
|
||||
timeUnitSelector.setSelection(1);
|
||||
} else if (poll.getDuration() > 60000L) {
|
||||
durationInput.setText(Long.toString(Math.round(poll.getDuration() / 60000d)));
|
||||
timeUnitSelector.setSelection(0);
|
||||
}
|
||||
this.poll = poll;
|
||||
} else {
|
||||
this.poll = new PollUpdate();
|
||||
|
|
|
@ -80,10 +80,6 @@ public class WebPushDialog extends Dialog implements OnCheckedChangeListener, On
|
|||
case WebPush.POLICY_FOLLOWER:
|
||||
policySelector.setSelection(2);
|
||||
break;
|
||||
|
||||
case WebPush.POLICY_NONE:
|
||||
policySelector.setSelection(3);
|
||||
break;
|
||||
}
|
||||
AppStyles.setTheme(root);
|
||||
|
||||
|
@ -155,10 +151,6 @@ public class WebPushDialog extends Dialog implements OnCheckedChangeListener, On
|
|||
case 2:
|
||||
update.setPolicy(WebPush.POLICY_FOLLOWER);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
update.setPolicy(WebPush.POLICY_NONE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/dialog_push_mention"
|
||||
android:layout_marginStart="@dimen/dialog_push_label_margin"
|
||||
app:layout_constraintStart_toEndOf="@id/dialog_push_mention"
|
||||
app:layout_constraintTop_toTopOf="@id/dialog_push_mention"
|
||||
app:layout_constraintBottom_toBottomOf="@id/dialog_push_mention"
|
||||
|
@ -57,6 +58,7 @@
|
|||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/dialog_push_repost"
|
||||
android:layout_marginStart="@dimen/dialog_push_label_margin"
|
||||
app:layout_constraintStart_toEndOf="@id/dialog_push_repost"
|
||||
app:layout_constraintTop_toTopOf="@id/dialog_push_repost"
|
||||
app:layout_constraintBottom_toBottomOf="@id/dialog_push_repost"
|
||||
|
@ -75,6 +77,7 @@
|
|||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/dialog_push_favorite"
|
||||
android:layout_marginStart="@dimen/dialog_push_label_margin"
|
||||
app:layout_constraintStart_toEndOf="@id/dialog_push_favorite"
|
||||
app:layout_constraintTop_toTopOf="@id/dialog_push_favorite"
|
||||
app:layout_constraintBottom_toBottomOf="@id/dialog_push_favorite"
|
||||
|
@ -93,6 +96,7 @@
|
|||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/dialog_push_poll_finished"
|
||||
android:layout_marginStart="@dimen/dialog_push_label_margin"
|
||||
app:layout_constraintStart_toEndOf="@id/dialog_push_poll"
|
||||
app:layout_constraintTop_toTopOf="@id/dialog_push_poll"
|
||||
app:layout_constraintBottom_toBottomOf="@id/dialog_push_poll"
|
||||
|
@ -111,6 +115,7 @@
|
|||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/dialog_push_new_follower"
|
||||
android:layout_marginStart="@dimen/dialog_push_label_margin"
|
||||
app:layout_constraintStart_toEndOf="@id/dialog_push_follow"
|
||||
app:layout_constraintTop_toTopOf="@id/dialog_push_follow"
|
||||
app:layout_constraintBottom_toBottomOf="@id/dialog_push_follow"
|
||||
|
@ -129,6 +134,7 @@
|
|||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/dialog_push_follow_request"
|
||||
android:layout_marginStart="@dimen/dialog_push_label_margin"
|
||||
app:layout_constraintStart_toEndOf="@id/dialog_push_follow_request"
|
||||
app:layout_constraintTop_toTopOf="@id/dialog_push_follow_request"
|
||||
app:layout_constraintBottom_toBottomOf="@id/dialog_push_follow_request"
|
||||
|
@ -147,6 +153,7 @@
|
|||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/dialog_push_new_status"
|
||||
android:layout_marginStart="@dimen/dialog_push_label_margin"
|
||||
app:layout_constraintStart_toEndOf="@id/dialog_push_new_status"
|
||||
app:layout_constraintTop_toTopOf="@id/dialog_push_new_status"
|
||||
app:layout_constraintBottom_toBottomOf="@id/dialog_push_new_status"
|
||||
|
@ -165,6 +172,7 @@
|
|||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/dialog_push_edit_status"
|
||||
android:layout_marginStart="@dimen/dialog_push_label_margin"
|
||||
app:layout_constraintStart_toEndOf="@id/dialog_push_edit_status"
|
||||
app:layout_constraintTop_toTopOf="@id/dialog_push_edit_status"
|
||||
app:layout_constraintBottom_toBottomOf="@id/dialog_push_edit_status"
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
<item>Alles anzeigen</item>
|
||||
<item>nur Following</item>
|
||||
<item>nur Follower</item>
|
||||
<item>deaktivieren</item>
|
||||
</string-array>
|
||||
|
||||
</resources>
|
|
@ -75,7 +75,6 @@
|
|||
<item>show all</item>
|
||||
<item>Following only</item>
|
||||
<item>Followers only</item>
|
||||
<item>disabled</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="visibility">
|
||||
|
|
|
@ -321,6 +321,7 @@
|
|||
<dimen name="dialog_push_button_height">28sp</dimen>
|
||||
<dimen name="dialog_push_button_padding">5dp</dimen>
|
||||
<dimen name="dialog_push_layout_margin">5dp</dimen>
|
||||
<dimen name="dialog_push_label_margin">10sp</dimen>
|
||||
<dimen name="dialog_push_root_padding">5dp</dimen>
|
||||
<dimen name="dialog_push_spinner_height">22sp</dimen>
|
||||
|
||||
|
|
Loading…
Reference in New Issue