Skip to content

Commit

Permalink
enabled automatic status reply loading, bug fix, layout fix, gradle u…
Browse files Browse the repository at this point in the history
…pdate
  • Loading branch information
nuclearfog committed Feb 20, 2024
1 parent d57ed18 commit d1e8c95
Show file tree
Hide file tree
Showing 25 changed files with 25 additions and 85 deletions.
6 changes: 3 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ dependencies {
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
implementation 'androidx.media3:media3-exoplayer:1.2.0'
implementation 'androidx.media3:media3-ui:1.2.0'
implementation 'androidx.media3:media3-datasource-okhttp:1.2.0'
implementation 'androidx.media3:media3-exoplayer:1.2.1'
implementation 'androidx.media3:media3-ui:1.2.1'
implementation 'androidx.media3:media3-datasource-okhttp:1.2.1'
implementation 'androidx.viewpager2:viewpager2:1.0.0'
//noinspection GradleDependency
implementation 'com.squareup.okhttp3:okhttp:4.12.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,6 @@ protected Result doInBackground(@NonNull Param param) {
}
return new Result(statuses, param.pos, null);

case Param.REPLIES_LOCAL:
statuses = db.getReplies(param.id);
return new Result(statuses, param.pos, null);

case Param.REPLIES:
if (param.minId == Param.NO_ID && param.maxId == Param.NO_ID) {
statuses = db.getReplies(param.id);
Expand Down Expand Up @@ -166,7 +162,6 @@ public static class Param {
public static final int USER_REPLIES = 3;
public static final int FAVORIT = 4;
public static final int REPLIES = 5;
public static final int REPLIES_LOCAL = 6;
public static final int SEARCH = 7;
public static final int USERLIST = 8;
public static final int PUBLIC = 9;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,6 @@ public UserListUpdate(UserList list) {
isExclusive = false; // todo implement this
}

/**
* set ID of an existing list to update
*
* @param listId ID of an existing list
*/
public void setId(long listId) {
this.listId = listId;
}

/**
* get ID of the list
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ else if (v.getId() == R.id.page_profile_post_button) {


@Override
public void onConfirm(int type, boolean remember) {
public void onConfirm(int type) {
if (user != null) {
// confirmed unfollowing user
if (type == ConfirmDialog.PROFILE_UNFOLLOW) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ public void onTextChanged(InputView inputView, String text) {


@Override
public void onConfirm(int type, boolean remember) {
public void onConfirm(int type) {
// leave without settings
if (type == ConfirmDialog.PROFILE_EDITOR_LEAVE) {
finish();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ public void onRequestPermissionsResult(int requestCode, @NonNull String[] permis


@Override
public void onConfirm(int type, boolean remember) {
public void onConfirm(int type) {
// remove account from database
if (type == ConfirmDialog.APP_LOG_OUT) {
settings.setLogin(null, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
repost_name_button = findViewById(R.id.page_status_reposter_reference);
translate_text = findViewById(R.id.page_status_text_translate);
spoiler_hint = findViewById(R.id.page_status_text_sensitive_hint);
//card_container = findViewById(R.id.page_status_cards_container);

clip = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
statusLoader = new StatusAction(this);
Expand Down Expand Up @@ -666,7 +665,7 @@ else if (v.getId() == R.id.page_status_location_name) {


@Override
public void onConfirm(int type, boolean remember) {
public void onConfirm(int type) {
if (type == ConfirmDialog.DELETE_STATUS) {
if (status != null) {
long id = status.getId();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ public void stopProgress() {


@Override
public void onConfirm(int type, boolean remember) {
public void onConfirm(int type) {
// retry uploading status
if (type == ConfirmDialog.STATUS_EDITOR_ERROR) {
updateStatus();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ public void onBackPressed() {


@Override
public void onConfirm(int type, boolean remember) {
public void onConfirm(int type) {
// delete user list
if (type == ConfirmDialog.LIST_DELETE && userList != null) {
if (listLoaderAsync.isIdle()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ public View getView(int position, View convertView, ViewGroup parent) {
textItem = convertView.findViewById(R.id.dropdown_textitem);
textItem.setTextColor(settings.getTextColor());
textItem.setTypeface(settings.getTypeFace());
textItem.setBackgroundColor(settings.getCardColor());
} else {
textItem = convertView.findViewById(R.id.dropdown_textitem);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.TextView;

import androidx.annotation.NonNull;
Expand Down Expand Up @@ -172,7 +171,6 @@ public class ConfirmDialog extends DialogFragment implements OnClickListener {

private TextView title, message;
private Button confirm, cancel;
private CompoundButton remember;

private int type = 0;
private String messageStr = "";
Expand All @@ -193,7 +191,6 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c
cancel = view.findViewById(R.id.confirm_no);
title = view.findViewById(R.id.confirm_title);
message = view.findViewById(R.id.confirm_message);
remember = view.findViewById(R.id.confirm_remember);
GlobalSettings settings = GlobalSettings.get(requireContext());

if (savedInstanceState == null)
Expand Down Expand Up @@ -228,9 +225,9 @@ public void onClick(View v) {
int type = (int) tag;
// get parent activity or fragment inplementing OnConfirmListener and return result
if (getParentFragment() instanceof OnConfirmListener) {
((OnConfirmListener) getParentFragment()).onConfirm(type, remember.isChecked());
((OnConfirmListener) getParentFragment()).onConfirm(type);
} else if (getActivity() instanceof OnConfirmListener) {
((OnConfirmListener) getActivity()).onConfirm(type, remember.isChecked());
((OnConfirmListener) getActivity()).onConfirm(type);
}
}
dismiss();
Expand Down Expand Up @@ -425,9 +422,8 @@ public interface OnConfirmListener {
/**
* called when the positive button was clicked
*
* @param type type of dialog
* @param remember true if "remember choice" is checked
* @param type type of dialog
*/
void onConfirm(int type, boolean remember);
void onConfirm(int type);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import androidx.annotation.Nullable;
import androidx.fragment.app.DialogFragment;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;

import org.joda.time.DateTime;
Expand Down Expand Up @@ -134,15 +133,6 @@ public static void show(Fragment fragment, long time) {
}
}

/**
* show timepicker with default value
*
* @param time selected time or '0' to select the current time
*/
public static void show(FragmentActivity activity, long time) {
show(activity.getSupportFragmentManager(), time);
}

/**
*
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public void onAccountRemove(Account account) {


@Override
public void onConfirm(int type, boolean remember) {
public void onConfirm(int type) {
if (type == ConfirmDialog.REMOVE_ACCOUNT) {
if (selection != null) {
AccountAction.Param param = new AccountAction.Param(AccountAction.Param.REMOVE, selection);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ protected void onReset() {


@Override
public void onConfirm(int type, boolean remember) {
public void onConfirm(int type) {
if (type == ConfirmDialog.ANNOUNCEMENT_DISMISS) {
AnnouncementAction.Param param = new AnnouncementAction.Param(AnnouncementAction.Param.MODE_DISMISS, selectedId);
announcementAction.execute(param, announcementResult);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public boolean onPlaceholderClick(int index, long cursor) {


@Override
public void onConfirm(int type, boolean remember) {
public void onConfirm(int type) {
if (type == ConfirmDialog.DOMAIN_BLOCK_REMOVE) {
DomainAction.Param param = new DomainAction.Param(DomainAction.Param.MODE_UNBLOCK, selectedDomain);
domainAction.execute(param, domainResult);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public void onFilterRemove(Filter filter) {


@Override
public void onConfirm(int type, boolean remember) {
public void onConfirm(int type) {
if (type == ConfirmDialog.FILTER_REMOVE) {
StatusFilterAction.Param param = new StatusFilterAction.Param(StatusFilterAction.Param.DELETE, selection.getId(), null);
filterAction.execute(param, filterRemoveCallback);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ public void onActivityResult(ActivityResult result) {


@Override
public void onConfirm(int type, boolean remember) {
public void onConfirm(int type) {
if (type == ConfirmDialog.NOTIFICATION_DISMISS) {
if (select != null) {
NotificationAction.Param param = new NotificationAction.Param(NotificationAction.Param.DISMISS, select.getId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public boolean onPlaceholderClick(long min_id, long max_id, int position) {


@Override
public void onConfirm(int type, boolean remember) {
public void onConfirm(int type) {
if (type == ConfirmDialog.SCHEDULE_REMOVE) {
if (selection != null) {
ScheduleAction.Param param = new ScheduleAction.Param(ScheduleAction.Param.REMOVE, selection.getId(), 0L);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,10 +284,7 @@ private void load(long sinceId, long maxId, int index) {
break;

case MODE_REPLY:
if (index == CLEAR_LIST)
request = new StatusLoader.Param(StatusLoader.Param.REPLIES_LOCAL, id, sinceId, maxId, CLEAR_LIST, search);
else
request = new StatusLoader.Param(StatusLoader.Param.REPLIES, id, sinceId, maxId, CLEAR_LIST, search);
request = new StatusLoader.Param(StatusLoader.Param.REPLIES, id, sinceId, maxId, CLEAR_LIST, search);
break;

case MODE_SEARCH:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ public boolean onPlaceholderClick(long cursor, int index) {


@Override
public void onConfirm(int type, boolean remember) {
public void onConfirm(int type) {
if (selection != null) {
if (type == ConfirmDialog.UNFOLLOW_TAG) {
TagAction.Param param = new TagAction.Param(TagAction.Param.UNFOLLOW, selection.getName(), selection.getId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ public void onResult(@NonNull UsersLoader.Result result) {


@Override
public void onConfirm(int type, boolean remember) {
public void onConfirm(int type) {
// remove user from list
if (type == ConfirmDialog.LIST_REMOVE_USER) {
if (selectedUser != null) {
Expand Down
29 changes: 2 additions & 27 deletions app/src/main/res/layout/dialog_confirm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,31 +33,6 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/confirm_title" />


<com.kyleduo.switchbutton.SwitchButton
android:id="@+id/confirm_remember"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
android:layout_margin="@dimen/confirm_button_margin"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/confirm_message" />

<TextView
android:id="@+id/confirm_remember_label"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:visibility="gone"
android:lines="1"
android:text="@string/confirm_remember"
android:textSize="@dimen/confirm_button_fontsize"
android:layout_marginStart="@dimen/confirm_text_margin"
android:layout_marginEnd="@dimen/confirm_text_margin"
app:layout_constraintStart_toEndOf="@id/confirm_remember"
app:layout_constraintTop_toTopOf="@id/confirm_remember"
app:layout_constraintBottom_toBottomOf="@id/confirm_remember"
app:layout_constraintEnd_toEndOf="parent" />

<Button
android:id="@+id/confirm_no"
android:layout_width="wrap_content"
Expand All @@ -70,7 +45,7 @@
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintHorizontal_bias="1"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/confirm_remember"
app:layout_constraintTop_toBottomOf="@id/confirm_message"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/confirm_yes"
style="@style/FeedbackButton" />
Expand All @@ -85,7 +60,7 @@
android:text="@android:string/ok"
android:textSize="@dimen/confirm_button_fontsize"
app:layout_constraintStart_toEndOf="@id/confirm_no"
app:layout_constraintTop_toBottomOf="@id/confirm_remember"
app:layout_constraintTop_toBottomOf="@id/confirm_message"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
style="@style/FeedbackButton" />
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@
<string name="toolbar_title_filter">Status-Filter</string>
<string name="status_translate_text">übersetzen</string>
<string name="field_verified">verifiziert:\u0020</string>
<string name="confirm_remember">Entscheidung merken</string>
<string name="confirm_remove_account">Account aus der Liste entfernen?</string>
<string name="menu_select_account">Accounts</string>
<string name="menu_instance_show_all">zeige alle Benachrichtigungen</string>
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,6 @@
<string name="status_translate_source">Translated by:\u0020</string>
<string name="status_translate_source_language">Language:\u0020</string>
<string name="field_verified">verified:\u0020</string>
<string name="confirm_remember">remember choice</string>
<string name="confirm_tag_unfollow">unfollow hashtag?</string>
<string name="confirm_tag_unfeature">unfeature hashtag?</string>
<string name="confirm_schedule_remove">cancel scheduled post?</string>
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:8.2.0'
classpath 'com.android.tools.build:gradle:8.2.2'
}
}

Expand Down

0 comments on commit d1e8c95

Please sign in to comment.