Loading app/src/main/java/app/fedilab/android/mastodon/activities/FollowedTagActivity.java +7 −1 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import androidx.recyclerview.widget.LinearLayoutManager; import com.google.android.material.dialog.MaterialAlertDialogBuilder; import java.util.ArrayList; import java.util.Objects; import app.fedilab.android.BaseMainActivity; import app.fedilab.android.R; Loading Loading @@ -145,6 +146,11 @@ public class FollowedTagActivity extends BaseBarActivity implements FollowedTagA dialogBuilder.setView(popupAddFollowedTagtBinding.getRoot()); popupAddFollowedTagtBinding.addTag.setFilters(new InputFilter[]{new InputFilter.LengthFilter(255)}); dialogBuilder.setPositiveButton(R.string.validate, (dialog, id) -> { String name = Objects.requireNonNull(popupAddFollowedTagtBinding.addTag.getText()).toString().trim(); if(tagList.contains(new Tag(name))) { Toasty.error(FollowedTagActivity.this, getString(R.string.tag_already_followed), Toasty.LENGTH_LONG).show(); return; } if (popupAddFollowedTagtBinding.addTag.getText() != null && popupAddFollowedTagtBinding.addTag.getText().toString().trim().length() > 0) { tagVM.follow(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, popupAddFollowedTagtBinding.addTag.getText().toString().trim()) .observe(FollowedTagActivity.this, newTag -> { Loading @@ -162,7 +168,7 @@ public class FollowedTagActivity extends BaseBarActivity implements FollowedTagA tagList.add(0, newTag); followedTagAdapter.notifyItemInserted(0); } else { Toasty.error(FollowedTagActivity.this, getString(R.string.toast_feature_not_supported), Toasty.LENGTH_LONG).show(); Toasty.error(FollowedTagActivity.this, getString(R.string.not_valid_tag_name), Toasty.LENGTH_LONG).show(); } }); dialog.dismiss(); Loading app/src/main/java/app/fedilab/android/mastodon/client/entities/api/Tag.java +6 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,12 @@ public class Tag implements Serializable { @SerializedName("following") public boolean following = false; public Tag() {} public Tag(String name) { this.name = name; } public int getWeight() { int weight = 0; if (history != null && history.size() > 0) { Loading app/src/main/res/values/strings.xml +1 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ <string name="clipboard">The content of the message has been copied to the clipboard</string> <string name="clipboard_url">The URL of the message has been copied to the clipboard</string> <string name="clipboard_version">Information have been copied to the clipboard</string> <string name="tag_already_followed">You already follow that tag!</string> <string name="camera">Camera</string> <string name="delete_all">Delete all</string> <string name="schedule">Schedule</string> Loading Loading
app/src/main/java/app/fedilab/android/mastodon/activities/FollowedTagActivity.java +7 −1 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import androidx.recyclerview.widget.LinearLayoutManager; import com.google.android.material.dialog.MaterialAlertDialogBuilder; import java.util.ArrayList; import java.util.Objects; import app.fedilab.android.BaseMainActivity; import app.fedilab.android.R; Loading Loading @@ -145,6 +146,11 @@ public class FollowedTagActivity extends BaseBarActivity implements FollowedTagA dialogBuilder.setView(popupAddFollowedTagtBinding.getRoot()); popupAddFollowedTagtBinding.addTag.setFilters(new InputFilter[]{new InputFilter.LengthFilter(255)}); dialogBuilder.setPositiveButton(R.string.validate, (dialog, id) -> { String name = Objects.requireNonNull(popupAddFollowedTagtBinding.addTag.getText()).toString().trim(); if(tagList.contains(new Tag(name))) { Toasty.error(FollowedTagActivity.this, getString(R.string.tag_already_followed), Toasty.LENGTH_LONG).show(); return; } if (popupAddFollowedTagtBinding.addTag.getText() != null && popupAddFollowedTagtBinding.addTag.getText().toString().trim().length() > 0) { tagVM.follow(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, popupAddFollowedTagtBinding.addTag.getText().toString().trim()) .observe(FollowedTagActivity.this, newTag -> { Loading @@ -162,7 +168,7 @@ public class FollowedTagActivity extends BaseBarActivity implements FollowedTagA tagList.add(0, newTag); followedTagAdapter.notifyItemInserted(0); } else { Toasty.error(FollowedTagActivity.this, getString(R.string.toast_feature_not_supported), Toasty.LENGTH_LONG).show(); Toasty.error(FollowedTagActivity.this, getString(R.string.not_valid_tag_name), Toasty.LENGTH_LONG).show(); } }); dialog.dismiss(); Loading
app/src/main/java/app/fedilab/android/mastodon/client/entities/api/Tag.java +6 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,12 @@ public class Tag implements Serializable { @SerializedName("following") public boolean following = false; public Tag() {} public Tag(String name) { this.name = name; } public int getWeight() { int weight = 0; if (history != null && history.size() > 0) { Loading
app/src/main/res/values/strings.xml +1 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ <string name="clipboard">The content of the message has been copied to the clipboard</string> <string name="clipboard_url">The URL of the message has been copied to the clipboard</string> <string name="clipboard_version">Information have been copied to the clipboard</string> <string name="tag_already_followed">You already follow that tag!</string> <string name="camera">Camera</string> <string name="delete_all">Delete all</string> <string name="schedule">Schedule</string> Loading