|
|
@@ -14,6 +14,7 @@ import android.view.View;
|
|
|
import android.view.ViewGroup;
|
|
|
import android.widget.ImageView;
|
|
|
import android.widget.ProgressBar;
|
|
|
+import android.widget.RadioButton;
|
|
|
import android.widget.RadioGroup;
|
|
|
import android.widget.TextView;
|
|
|
|
|
|
@@ -70,8 +71,6 @@ public class ActionBarManager {
|
|
|
|
|
|
private IActionBarListener.Scroll scrollListener;
|
|
|
|
|
|
- private IActionBarListener.CategoryClick categoryListener;
|
|
|
-
|
|
|
private ActionBarManager() {
|
|
|
}
|
|
|
|
|
|
@@ -170,17 +169,6 @@ public class ActionBarManager {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public void setClickCategoryListener(IActionBarListener.CategoryClick categoryListener) {
|
|
|
- this.categoryListener = categoryListener;
|
|
|
- categoryMainTab.setOnCheckedChangeListener((radioGroup, i) -> {
|
|
|
- int selectIndex = categoryMainTab.indexOfChild(appBarLayout.findViewById(categoryMainTab.getCheckedRadioButtonId()));
|
|
|
- //Log.e("APP# ActionBarManager | init", "|" + selectIndex);
|
|
|
- this.categoryListener.onClick(actionBar, selectIndex);
|
|
|
-
|
|
|
- });
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* Progress bar 의 진행율 설정
|
|
|
*
|
|
|
@@ -427,14 +415,14 @@ public class ActionBarManager {
|
|
|
layoutCategoryTab.setVisibility(View.GONE);
|
|
|
buttonArrow.setImageResource(R.drawable.icon_h_down);
|
|
|
|
|
|
- if (builder.isVisibleArrow != newBuilder.isVisibleArrow) {
|
|
|
- setArrowVisible(newBuilder.isVisibleArrow);
|
|
|
+ if (builder.isVisibleCategoryArrow != newBuilder.isVisibleCategoryArrow) {
|
|
|
+ setArrowVisible(newBuilder.isVisibleCategoryArrow);
|
|
|
|
|
|
buttonArrow.setOnClickListener(view1 -> {
|
|
|
layoutCategoryTab.setVisibility(layoutCategoryTab.getVisibility() == View.GONE ? View.VISIBLE : View.GONE);
|
|
|
buttonArrow.setImageResource(layoutCategoryTab.getVisibility() == View.GONE ? R.drawable.icon_h_down : R.drawable.icon_header_up);
|
|
|
});
|
|
|
- if (newBuilder.isVisibleArrow) {
|
|
|
+ if (newBuilder.isVisibleCategoryArrow) {
|
|
|
actionBarTitle.setOnClickListener(view1 -> {
|
|
|
layoutCategoryTab.setVisibility(layoutCategoryTab.getVisibility() == View.GONE ? View.VISIBLE : View.GONE);
|
|
|
buttonArrow.setImageResource(layoutCategoryTab.getVisibility() == View.GONE ? R.drawable.icon_h_down : R.drawable.icon_header_up);
|
|
|
@@ -444,6 +432,15 @@ public class ActionBarManager {
|
|
|
actionBarTitle.setOnClickListener(null);
|
|
|
}
|
|
|
|
|
|
+ ((RadioButton) categoryMainTab.getChildAt(newBuilder.selectedCategoryIndex)).setChecked(true);
|
|
|
+ categoryMainTab.setOnCheckedChangeListener((radioGroup, i) -> {
|
|
|
+ int selectIndex = categoryMainTab.indexOfChild(appBarLayout.findViewById(radioGroup.getCheckedRadioButtonId()));
|
|
|
+ //Log.e("APP# ActionBarManager | init", "|" + selectIndex);
|
|
|
+ if (null != newBuilder.categoryListener) {
|
|
|
+ newBuilder.categoryListener.onClick(actionBar, selectIndex);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
}
|
|
|
|
|
|
if (builder.isVisibleMenu != newBuilder.isVisibleMenu || builder.menuListener != newBuilder.menuListener) {
|
|
|
@@ -568,7 +565,7 @@ public class ActionBarManager {
|
|
|
private boolean isVisibleSearch = false;
|
|
|
private boolean isVisibleMenu = false;
|
|
|
private boolean isVisibleProgress = false;
|
|
|
- private boolean isVisibleArrow = false;
|
|
|
+ private boolean isVisibleCategoryArrow = false;
|
|
|
private boolean isScrollable = false;
|
|
|
private int title = R.string.empty_string;
|
|
|
private boolean isTransparentBackground = false;
|
|
|
@@ -582,6 +579,8 @@ public class ActionBarManager {
|
|
|
private boolean isVisibleTextButton = false;
|
|
|
private int text = R.string.empty_string;
|
|
|
|
|
|
+ private int selectedCategoryIndex = -1;
|
|
|
+
|
|
|
private IActionBarListener.Click backListener = null;
|
|
|
private IActionBarListener.Click bookmarkListener = null;
|
|
|
private IActionBarListener.Click likeListener = null;
|
|
|
@@ -595,6 +594,7 @@ public class ActionBarManager {
|
|
|
private IActionBarListener.Click settingListener = null;
|
|
|
private IActionBarListener.Click closeListener = null;
|
|
|
private IActionBarListener.Click textButtonListener = null;
|
|
|
+ private IActionBarListener.CategoryClick categoryListener = null;
|
|
|
|
|
|
|
|
|
public Builder() {
|
|
|
@@ -675,8 +675,10 @@ public class ActionBarManager {
|
|
|
*
|
|
|
* @return Builder
|
|
|
*/
|
|
|
- public Builder category() {
|
|
|
- isVisibleArrow = true;
|
|
|
+ public Builder category(int index, IActionBarListener.CategoryClick categoryListener) {
|
|
|
+ isVisibleCategoryArrow = true;
|
|
|
+ selectedCategoryIndex = index;
|
|
|
+ this.categoryListener = categoryListener;
|
|
|
return this;
|
|
|
}
|
|
|
|