Skip to content

Commit

Permalink
2.1
Browse files Browse the repository at this point in the history
Bug: 減少processingDialog的dismiss 有時候會報錯
Bug: 部分文章瀏覽到底方式變更
功能: 黑名單可以排序
功能: 發文標題可以排序(設定內,VIP)
功能: 表情符號可以排序(設定內,VIP),支援色碼
功能: 表情符號多一個 *[1;33m洽特*[m 讓使用者知道色碼也能當關鍵字用
  • Loading branch information
kodakjerec committed Apr 3, 2024
1 parent ca4b2b4 commit e882c69
Show file tree
Hide file tree
Showing 46 changed files with 1,333 additions and 228 deletions.
8 changes: 8 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
## Changelog
### 2.1
* Bug: 減少processingDialog的dismiss 有時候會報錯
* Bug: 部分文章瀏覽到底方式變更
* 功能: 黑名單可以排序
* 功能: 發文標題可以排序(設定內,VIP)
* 功能: 表情符號可以排序(設定內,VIP),支援色碼
* 功能: 表情符號多一個 `*[1;33m洽特*[m` 讓使用者知道色碼也能當關鍵字用

### 2.0.3
* Bug: 修改超連結死亡的例外處理
* 功能: 無內文文章的作者可以加入黑名單
Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ android {
applicationId "com.kota.Bahamut"
minSdk 26
targetSdk 34
versionCode 11
versionName "2.0.3"
versionCode 12
versionName "2.1"
}

buildTypes {
Expand Down
6 changes: 6 additions & 0 deletions app/src/main/java/com/kota/ASFramework/Dialog/ASDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ public void show() {
this._showing = true;
}

@Override
public void hide() {
super.hide();
this._showing = false;
}

@Override // android.app.Dialog
public boolean isShowing() {
return this._showing;
Expand Down
36 changes: 17 additions & 19 deletions app/src/main/java/com/kota/ASFramework/Dialog/ASListDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

import android.annotation.SuppressLint;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
Expand All @@ -26,9 +28,7 @@ public class ASListDialog extends ASDialog {
private ScrollView _scroll_view = null;
private int _item_text_size = 1;

/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes.dex */
public static class ASListDialogItem {
private static class ASListDialogItem {
public Button button = null;
public String title = null;

Expand Down Expand Up @@ -60,32 +60,32 @@ private View buildContentView() {
frame.setBackgroundResource(R.color.dialog_border_color);
frame.setPadding(frame_padding, frame_padding, frame_padding, frame_padding);
LinearLayout content_view = new LinearLayout(getContext());
content_view.setLayoutParams(new LinearLayout.LayoutParams(-2, -2));
content_view.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
content_view.setBackgroundColor(View.MEASURED_STATE_MASK);
frame.addView(content_view);
content_view.setOrientation(LinearLayout.VERTICAL);
int dialog_width = (((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, this._dialog_width, getContext().getResources().getDisplayMetrics())) / 2) * 2;
this._scroll_view = new ScrollView(getContext());
this._scroll_view.setLayoutParams(new LinearLayout.LayoutParams(dialog_width, -2));
this._scroll_view.setLayoutParams(new LinearLayout.LayoutParams(dialog_width, ViewGroup.LayoutParams.WRAP_CONTENT));
content_view.addView(this._scroll_view);
this._content_view = new LinearLayout(getContext());
this._content_view.setLayoutParams(new FrameLayout.LayoutParams(dialog_width, -2));
this._content_view.setLayoutParams(new FrameLayout.LayoutParams(dialog_width, ViewGroup.LayoutParams.WRAP_CONTENT));
this._content_view.setOrientation(LinearLayout.VERTICAL);
this._content_view.setGravity(17);
this._content_view.setGravity(Gravity.CENTER);
this._scroll_view.addView(this._content_view);
this._title_label = new TextView(getContext());
this._title_label.setLayoutParams(new LinearLayout.LayoutParams(-1, -2));
this._title_label.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
this._title_label.setPadding(padding, padding, padding, padding);
this._title_label.setTextColor(-1);
this._title_label.setTextSize(2, ASLayoutParams.getInstance().getTextSizeLarge());
this._title_label.setText("選項");
this._title_label.setBackgroundColor(-14671840);
this._title_label.setGravity(17);
this._title_label.setGravity(Gravity.CENTER);
this._content_view.addView(this._title_label);
this._item_block = new LinearLayout(getContext());
this._item_block.setLayoutParams(new FrameLayout.LayoutParams(dialog_width, -2));
this._item_block.setLayoutParams(new FrameLayout.LayoutParams(dialog_width, ViewGroup.LayoutParams.WRAP_CONTENT));
this._item_block.setOrientation(LinearLayout.VERTICAL);
this._item_block.setGravity(17);
this._item_block.setGravity(Gravity.CENTER);
this._content_view.addView(this._item_block);
return frame;
}
Expand Down Expand Up @@ -147,9 +147,9 @@ public View createDivider() {

private Button createButton() {
Button button = new Button(getContext());
button.setLayoutParams(new LinearLayout.LayoutParams(-1, -2));
button.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
button.setMinimumHeight((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 60.0f, getContext().getResources().getDisplayMetrics()));
button.setGravity(17);
button.setGravity(Gravity.CENTER);
if (this._item_text_size == 0) {
button.setTextSize(2, ASLayoutParams.getInstance().getTextSizeNormal());
} else if (this._item_text_size == 1) {
Expand All @@ -174,8 +174,7 @@ private int indexOfButton(Button aButton) {
return -1;
}

/* JADX INFO: Access modifiers changed from: private */
public void onItemClicked(Button button) {
private void onItemClicked(Button button) {
if (this._listener != null) {
int index = indexOfButton(button);
if (index != -1) {
Expand All @@ -185,8 +184,7 @@ public void onItemClicked(Button button) {
}
}

/* JADX INFO: Access modifiers changed from: private */
public boolean onItemLongClicked(Button button) {
private boolean onItemLongClicked(Button button) {
int index;
boolean result = false;
if (this._listener != null && (index = indexOfButton(button)) != -1) {
Expand All @@ -201,8 +199,8 @@ public boolean onItemLongClicked(Button button) {
public ASListDialog setDialogWidth(float width) {
this._dialog_width = width;
int dialog_width = (((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, this._dialog_width, getContext().getResources().getDisplayMetrics())) / 2) * 2;
this._scroll_view.setLayoutParams(new LinearLayout.LayoutParams(dialog_width, -2));
this._content_view.setLayoutParams(new FrameLayout.LayoutParams(dialog_width, -2));
this._scroll_view.setLayoutParams(new LinearLayout.LayoutParams(dialog_width, ViewGroup.LayoutParams.WRAP_CONTENT));
this._content_view.setLayoutParams(new FrameLayout.LayoutParams(dialog_width, ViewGroup.LayoutParams.WRAP_CONTENT));
return this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,26 @@ public void run() {
}
}

public static void dismissProcessingDialog() {
if (!ASNavigationController.getCurrentController().isInBackground()) {
new ASRunner() {
@Override
public void run() {
if (_instance != null) {
_instance.dismiss();
releaseInstance();
}
}
}.runInMainThread();
}
}
public static void hideProcessingDialog() {
if (!ASNavigationController.getCurrentController().isInBackground()) {
new ASRunner() { // from class: com.kota.ASFramework.Dialog.ASProcessingDialog.2
@Override // com.kota.ASFramework.Thread.ASRunner
new ASRunner() {
@Override
public void run() {
if (ASProcessingDialog._instance != null) {
ASProcessingDialog._instance.dismiss();
ASProcessingDialog.releaseInstance();
if (_instance != null) {
_instance.hide();
}
}
}.runInMainThread();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ private void animatedPushViewController(final ASViewController sourceController,
@Override // com.kota.ASFramework.PageController.ASNavigationControllerPushAnimation
public void onAnimationFinished() {
if (sourceController != null) {
sourceController.onPageDidDisappear();
sourceController.onPageDidDisappear();
}
if (targetController != null) {
Vector<View> remove_list = new Vector<>();
Expand Down
10 changes: 1 addition & 9 deletions app/src/main/java/com/kota/Bahamut/BahamutController.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@
import static com.kota.Bahamut.Service.MyBillingClient.initBillingClient;

import android.content.Intent;
import android.content.SharedPreferences;
import android.database.Cursor;
import android.database.sqlite.SQLiteCursorDriver;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteQuery;

import com.kota.ASFramework.Dialog.ASAlertDialog;
import com.kota.ASFramework.Dialog.ASAlertDialogListener;
Expand All @@ -23,7 +18,6 @@
import com.kota.ASFramework.UI.ASToast;
import com.kota.Bahamut.DataModels.ArticleTempStore;
import com.kota.Bahamut.DataModels.BookmarkStore;
import com.kota.Bahamut.DataModels.UrlDatabase;
import com.kota.Bahamut.Pages.Model.BoardPageBlock;
import com.kota.Bahamut.Pages.Model.BoardPageItem;
import com.kota.Bahamut.Pages.Model.ClassPageBlock;
Expand All @@ -32,10 +26,9 @@
import com.kota.Bahamut.Pages.Model.MailBoxPageItem;
import com.kota.Bahamut.Pages.StartPage;
import com.kota.Bahamut.Service.BahaBBSBackgroundService;
import com.kota.Bahamut.Service.TempSettings;
import com.kota.Bahamut.Service.UserSettings;
import com.kota.Telnet.TelnetClient;
import com.kota.Telnet.TelnetClientListener;
import com.kota.Bahamut.Service.UserSettings;
import com.kota.TelnetUI.TelnetPage;
import com.kota.TextEncoder.B2UEncoder;
import com.kota.TextEncoder.U2BEncoder;
Expand All @@ -45,7 +38,6 @@
import java.util.TimeZone;
import java.util.Vector;

/* loaded from: classes.dex */
public class BahamutController extends ASNavigationController implements TelnetClientListener {
@Override // com.kota.ASFramework.PageController.ASNavigationController
protected void onControllerWillLoad() {
Expand Down
52 changes: 31 additions & 21 deletions app/src/main/java/com/kota/Bahamut/BahamutStateHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
import com.kota.ASFramework.PageController.ASNavigationController;
import com.kota.ASFramework.Thread.ASRunner;
import com.kota.ASFramework.UI.ASToast;
import com.kota.Bahamut.Command.BahamutCommandLoadArticleEnd;
import com.kota.Bahamut.Command.BahamutCommandLoadArticleEndForSearch;
import com.kota.Bahamut.Command.BahamutCommandLoadMoreArticle;
import com.kota.Bahamut.DataModels.AppDatabase;
import com.kota.Bahamut.Pages.BoardLinkPage;
import com.kota.Bahamut.Pages.BoardPage;
Expand All @@ -27,6 +30,7 @@
import com.kota.TelnetUI.TelnetPage;
import com.kota.TextEncoder.B2UEncoder;
import java.io.ByteArrayOutputStream;
import java.util.Vector;

/* loaded from: classes.dex */
public class BahamutStateHandler extends TelnetStateHandler {
Expand All @@ -36,6 +40,7 @@ public class BahamutStateHandler extends TelnetStateHandler {
private static BahamutStateHandler _instance = null;
public String _article_number;
private int _step = 0;
Vector<TelnetRow> rows = new Vector<>(); // debug用
private String row_string_00 = "";
private String row_string_01 = "";
private String row_string_02 = "";
Expand Down Expand Up @@ -65,6 +70,7 @@ private void loadState() {
this.row_string_01 = getRowString(1).trim();
this.row_string_02 = getRowString(2).trim();
this.row_string_23 = getRowString(23).trim();
this.rows = getRows();
this.first_header = TelnetUtils.getHeader(this.row_string_00);
this.last_header = TelnetUtils.getHeader(this.row_string_23);
}
Expand Down Expand Up @@ -179,7 +185,7 @@ private boolean pass_1() {
}

public void handleLoginPage() {
setCurrentPage(1);
setCurrentPage(BahamutPage.BAHAMUT_LOGIN);
LoginPage page = PageContainer.getInstance().getLoginPage();
if (page.onPagePreload()) {
showPage(page);
Expand All @@ -188,10 +194,10 @@ public void handleLoginPage() {

public void handleMainPage() {
this._step = 1;
if (getCurrentPage() < 5) {
if (getCurrentPage() < BahamutPage.BAHAMUT_MAIN) {
PageContainer.getInstance().getLoginPage().onLoginSuccess();
}
setCurrentPage(5);
setCurrentPage(BahamutPage.BAHAMUT_MAIN);
MainPage page = PageContainer.getInstance().getMainPage();
if (page.onPagePreload()) {
showPage(page);
Expand Down Expand Up @@ -220,7 +226,7 @@ public void run() {
}

public void handleMailBoxPage() {
setCurrentPage(9);
setCurrentPage(BahamutPage.BAHAMUT_MAIL_BOX);
if (this._cursor.column == 1) {
MailBoxPage page = PageContainer.getInstance().getMailBoxPage();
if (page.onPagePreload()) {
Expand All @@ -235,7 +241,7 @@ public void handleSearchBoard() {
TelnetClient.getClient().sendKeyboardInputToServer(67);
} else if (this._cursor.row == 1) {
SearchBoard_Handler.getInstance().read();
byte[] data = TelnetOutputBuilder.create().pushData((byte) 25).pushString("\n\n").build();
byte[] data = TelnetOutputBuilder.create().pushKey(TelnetKeyboard.CTRL_Y).pushString("\n\n").build();
TelnetClient.getClient().sendDataToServer(data);
new ASRunner() { // from class: com.kota.Bahamut.BahamutStateHandler.3
@Override // com.kota.ASFramework.Thread.ASRunner
Expand All @@ -249,14 +255,14 @@ public void run() {

public void handleClassPage() {
ClassPage page;
setCurrentPage(6);
setCurrentPage(BahamutPage.BAHAMUT_CLASS);
if (this._cursor.column == 1 && (page = PageContainer.getInstance().getClassPage()) != null && page.onPagePreload()) {
showPage(page);
}
}

public void handleBoardPage() {
setCurrentPage(10);
setCurrentPage(BahamutPage.BAHAMUT_BOARD);
if (this._cursor.column == 1) {
BoardPage page = PageContainer.getInstance().getBoardPage();
if (page.onPagePreload()) {
Expand All @@ -266,7 +272,7 @@ public void handleBoardPage() {
}

public void handleBoardSearchPage() {
setCurrentPage(13);
setCurrentPage(BahamutPage.BAHAMUT_BOARD_SEARCH);
if (this._cursor.column == 1) {
BoardSearchPage page = PageContainer.getInstance().getBoardSearchPage();
if (page.onPagePreload()) {
Expand All @@ -276,7 +282,7 @@ public void handleBoardSearchPage() {
}

public void handleBoardTitleLinkedPage() {
setCurrentPage(12);
setCurrentPage(BahamutPage.BAHAMUT_BOARD_LINK);
if (this._cursor.column == 1) {
BoardLinkPage page = PageContainer.getInstance().getBoardLinkedTitlePage();
if (page.onPagePreload()) {
Expand All @@ -286,7 +292,7 @@ public void handleBoardTitleLinkedPage() {
}

public void handleArticle() {
setCurrentPage(14);
setCurrentPage(BahamutPage.BAHAMUT_ARTICLE);
if (!this._reading_article) {
onReadArticleStart();
}
Expand All @@ -297,20 +303,24 @@ public void handleState() {
loadState();
this._cursor = TelnetClient.getModel().getCursor();
if (pass_1()) {
if (getCurrentPage() == 6 && this.row_string_23.contains("瀏覽 P.") && this.row_string_23.endsWith("結束")) {
TelnetClient.getClient().sendKeyboardInputToServer(TelnetKeyboard.LEFT_ARROW);
} else if (getCurrentPage() > 9 && this.row_string_23.contains("文章選讀") && this.row_string_23.endsWith("搜尋作者")) {
if (getCurrentPage() == BahamutPage.BAHAMUT_CLASS && this.row_string_23.contains("瀏覽 P.") && this.row_string_23.endsWith("結束")) {
new BahamutCommandLoadMoreArticle().execute();
} else if (getCurrentPage() > BahamutPage.BAHAMUT_MAIL_BOX && this.row_string_23.contains("文章選讀") && this.row_string_23.endsWith("搜尋作者")) {
handleArticle();
onReadArticleFinished();
TelnetClient.getClient().sendKeyboardInputToServer(TelnetKeyboard.LEFT_ARROW);
} else if (getCurrentPage() > 6 && this.row_string_23.contains("魚雁往返") && this.row_string_23.endsWith("標記")) {
// 2024.4.3 部分文章瀏覽到最底部按left arrow還是停留在最底部, 會有問題, 先改用其他方式看看
if (getCurrentPage()==BahamutPage.BAHAMUT_ARTICLE)
new BahamutCommandLoadArticleEndForSearch().execute();
else
new BahamutCommandLoadArticleEnd().execute();
} else if (getCurrentPage() > BahamutPage.BAHAMUT_CLASS && this.row_string_23.contains("魚雁往返") && this.row_string_23.endsWith("標記")) {
handleArticle();
onReadArticleFinished();
TelnetClient.getClient().sendKeyboardInputToServer(TelnetKeyboard.LEFT_ARROW);
} else if (getCurrentPage() > 6 && this.row_string_23.contains("瀏覽 P.") && this.row_string_23.endsWith("結束")) {
new BahamutCommandLoadArticleEnd().execute();
} else if (getCurrentPage() > BahamutPage.BAHAMUT_CLASS && this.row_string_23.contains("瀏覽 P.") && this.row_string_23.endsWith("結束")) {
handleArticle();
onReadArticlePage();
TelnetClient.getClient().sendKeyboardInputToServerInBackground(TelnetKeyboard.PAGE_DOWN, 1);
new BahamutCommandLoadMoreArticle().execute();
} else if (this.first_header.equals("對戰") && getCurrentPage() < 5) {
handleLoginPage();
} else if (this.row_string_00.contains("【主功能表】")) {
Expand Down Expand Up @@ -350,17 +360,17 @@ public void run() {
} else if (this.row_string_23.contains("★ 請閱讀最新公告")) {
TelnetClient.getClient().sendStringToServer("");
} else if (this._step == 0 && this.first_header.equals("--")) {
setCurrentPage(3);
setCurrentPage(BahamutPage.BAHAMUT_INSTRUCTIONS);
if (this.last_header.equals("●請") || this.last_header.equals("請按")) {
TelnetClient.getClient().sendStringToServer("");
}
} else if (this._step == 0 && this.first_header.equals("□□")) {
setCurrentPage(2);
setCurrentPage(BahamutPage.BAHAMUT_SYSTEM_ANNOUNCEMENT);
if (this.last_header.equals("●請") || this.last_header.equals("請按")) {
TelnetClient.getClient().sendStringToServer("");
}
} else if (this.first_header.equals("【過")) {
setCurrentPage(4);
setCurrentPage(BahamutPage.BAHAMUT_PASSED_SIGNATURE);
if (this.last_header.equals("●請") || this.last_header.equals("請按")) {
TelnetClient.getClient().sendStringToServer("");
}
Expand Down
Loading

0 comments on commit e882c69

Please sign in to comment.