|
|
@@ -96,11 +96,11 @@ public class ActionBarManager implements IActionBarListener {
|
|
|
LayoutInflater inflater = LayoutInflater.from(activity);
|
|
|
View view = inflater.inflate(R.layout.action_bar, null);
|
|
|
|
|
|
+ progressBar = appBarLayout.findViewById(R.id.progress_bar);
|
|
|
actionBarTitle = view.findViewById(R.id.action_bar_title);
|
|
|
imageBi = view.findViewById(R.id.image_bi);
|
|
|
buttonSearch = view.findViewById(R.id.button_search);
|
|
|
buttonMenu = view.findViewById(R.id.button_menu);
|
|
|
- progressBar = view.findViewById(R.id.progress_bar);
|
|
|
|
|
|
buttonBack = view.findViewById(R.id.button_back);
|
|
|
buttonBack.setOnClickListener(v -> {
|
|
|
@@ -114,6 +114,12 @@ public class ActionBarManager implements IActionBarListener {
|
|
|
});
|
|
|
|
|
|
setCustomView(view);
|
|
|
+
|
|
|
+ toolbar = (Toolbar) view.getParent();
|
|
|
+ toolbar.setPadding(0, 0, 0, 0);//for tab otherwise give space in tab
|
|
|
+ toolbar.setContentInsetsAbsolute(0, 0);
|
|
|
+
|
|
|
+ Log.i("APP# ActionBarManager | init", "|" + "progressBar: " + progressBar);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -188,7 +194,20 @@ public class ActionBarManager implements IActionBarListener {
|
|
|
* @param isVisible
|
|
|
*/
|
|
|
public void setProgressVisible(boolean isVisible) {
|
|
|
- setViewVisible(progressBar, isVisible);
|
|
|
+ setViewVisible(progressBar, isVisible, View.GONE);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Progress bar 의 진행율 설정
|
|
|
+ *
|
|
|
+ * @param percent 0~100
|
|
|
+ */
|
|
|
+ public void setProgress(int percent) {
|
|
|
+ Log.i("APP# ActionBarManager | setProgress", "|" + progressBar);
|
|
|
+ if (null != progressBar) {
|
|
|
+ Log.i("APP# ActionBarManager | setProgress", "|" + "percent: " + percent);
|
|
|
+ progressBar.setProgress(percent);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private void setViewVisible(View view, boolean isVisible) {
|
|
|
@@ -248,56 +267,8 @@ public class ActionBarManager implements IActionBarListener {
|
|
|
actionBar.setDisplayShowHomeEnabled(false); //홈 아이콘을 숨김처리합니다.
|
|
|
actionBar.setCustomView(view);
|
|
|
|
|
|
- toolbar = (Toolbar) view.getParent();
|
|
|
- toolbar.setPadding(0, 0, 0, 0);//for tab otherwise give space in tab
|
|
|
- toolbar.setContentInsetsAbsolute(0, 0);
|
|
|
-// toolbar.setLayoutParams(new AppBarLayout.LayoutParams(AppBarLayout.LayoutParams.MATCH_PARENT, AppBarLayout.LayoutParams.MATCH_PARENT));
|
|
|
-
|
|
|
- setDisplayOptions(android.app.ActionBar.DISPLAY_SHOW_CUSTOM);
|
|
|
- setElevation(0);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * Progress bar 의 진행율 설정
|
|
|
- *
|
|
|
- * @param percent 0~100
|
|
|
- */
|
|
|
- public void setProgress(int percent) {
|
|
|
- View customView = actionBar.getCustomView();
|
|
|
- if (null != customView) {
|
|
|
- progressBar.setProgress(percent);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-// private void disableShowHideAnimation(ActionBar actionBar) {
|
|
|
-// try
|
|
|
-// {
|
|
|
-// actionBar.getClass().getDeclaredMethod("setShowHideAnimationEnabled", boolean.class).invoke(actionBar, false);
|
|
|
-// }
|
|
|
-// catch (Exception exception)
|
|
|
-// {
|
|
|
-// try {
|
|
|
-// Field mActionBarField = actionBar.getClass().getSuperclass().getDeclaredField("mActionBar");
|
|
|
-// mActionBarField.setAccessible(true);
|
|
|
-// Object icsActionBar = mActionBarField.get(actionBar);
|
|
|
-// Field mShowHideAnimationEnabledField = icsActionBar.getClass().getDeclaredField("mShowHideAnimationEnabled");
|
|
|
-// mShowHideAnimationEnabledField.setAccessible(true);
|
|
|
-// mShowHideAnimationEnabledField.set(icsActionBar,false);
|
|
|
-// Field mCurrentShowAnimField = icsActionBar.getClass().getDeclaredField("mCurrentShowAnim");
|
|
|
-// mCurrentShowAnimField.setAccessible(true);
|
|
|
-// mCurrentShowAnimField.set(icsActionBar,null);
|
|
|
-// }catch (Exception e){
|
|
|
-// //....
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-
|
|
|
- private void setDisplayOptions(int displayOptions) {
|
|
|
- actionBar.setDisplayOptions(displayOptions);
|
|
|
- }
|
|
|
-
|
|
|
- private void setElevation(int elevation) {
|
|
|
- actionBar.setElevation(elevation);
|
|
|
+ actionBar.setDisplayOptions(android.app.ActionBar.DISPLAY_SHOW_CUSTOM);
|
|
|
+ actionBar.setElevation(0);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -357,7 +328,7 @@ public class ActionBarManager implements IActionBarListener {
|
|
|
if (null != appBarLayout) {
|
|
|
appBarLayout = null;
|
|
|
if (null != scrollListener) {
|
|
|
- appBarLayout.addOnOffsetChangedListener(onOffsetChangedListener);
|
|
|
+ appBarLayout.removeOnOffsetChangedListener(onOffsetChangedListener);
|
|
|
}
|
|
|
}
|
|
|
|