Adding the local timelines feature and some polishes

This commit is contained in:
LucasGGamerM 2023-02-20 14:00:55 -03:00
parent 1ada4c9f46
commit d8cd151c7e
2 changed files with 20 additions and 1 deletions

View File

@ -15,6 +15,7 @@ import android.view.SubMenu;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.EditText; import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.ImageButton; import android.widget.ImageButton;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
@ -50,6 +51,7 @@ import me.grishka.appkit.api.Callback;
import me.grishka.appkit.api.ErrorResponse; import me.grishka.appkit.api.ErrorResponse;
import me.grishka.appkit.fragments.BaseRecyclerFragment; import me.grishka.appkit.fragments.BaseRecyclerFragment;
import me.grishka.appkit.utils.BindableViewHolder; import me.grishka.appkit.utils.BindableViewHolder;
import me.grishka.appkit.utils.V;
import me.grishka.appkit.views.UsableRecyclerView; import me.grishka.appkit.views.UsableRecyclerView;
public class EditTimelinesFragment extends BaseRecyclerFragment<TimelineDefinition> implements ScrollableToTop { public class EditTimelinesFragment extends BaseRecyclerFragment<TimelineDefinition> implements ScrollableToTop {
@ -145,7 +147,23 @@ public class EditTimelinesFragment extends BaseRecyclerFragment<TimelineDefiniti
} }
private void addNewLocalTimeline() { private void addNewLocalTimeline() {
FrameLayout inputWrap = new FrameLayout(getContext());
EditText input = new EditText(getContext());
input.setHint(R.string.sk_example_domain);
input.setText(GlobalUserPreferences.publishButtonText.trim());
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
params.setMargins(V.dp(16), V.dp(4), V.dp(16), V.dp(16));
input.setLayoutParams(params);
inputWrap.addView(input);
new M3AlertDialogBuilder(getContext()).setTitle(R.string.mo_add_custom_server_local_timeline).setView(inputWrap)
.setPositiveButton(R.string.save, (d, which) -> {
TimelineDefinition tl = TimelineDefinition.ofCustomLocalTimeline(input.getText().toString().trim());
data.add(tl);
saveTimelines();
})
.setNegativeButton(R.string.cancel, (d, which) -> {
})
.show();
} }
private void addTimelineToOptions(TimelineDefinition tl, Menu menu) { private void addTimelineToOptions(TimelineDefinition tl, Menu menu) {

View File

@ -25,6 +25,7 @@
<string name="mo_filtered">Filtered: %s</string> <string name="mo_filtered">Filtered: %s</string>
<string name="mo_disable_relocate_publish_button_to_enable_customization">Disable "Relocate publish button" to allow customization</string> <string name="mo_disable_relocate_publish_button_to_enable_customization">Disable "Relocate publish button" to allow customization</string>
<string name="mo_disable_reminder_to_add_alt_text">Disable reminder to add alt text</string> <string name="mo_disable_reminder_to_add_alt_text">Disable reminder to add alt text</string>
<string name="mo_add_custom_server_local_timeline">Add a custom server\'s local timeline</string>
<!-- accessibility labels--> <!-- accessibility labels-->
<string name="mo_poll_option_add">Add new poll option</string> <string name="mo_poll_option_add">Add new poll option</string>