|
|
@@ -2,8 +2,10 @@ package kr.co.zumo.app.lifeplus.manager;
|
|
|
|
|
|
import android.app.Activity;
|
|
|
import android.support.annotation.StringRes;
|
|
|
+import android.support.design.widget.AppBarLayout;
|
|
|
import android.support.v7.app.ActionBar;
|
|
|
import android.support.v7.widget.Toolbar;
|
|
|
+import android.util.Log;
|
|
|
import android.view.LayoutInflater;
|
|
|
import android.view.View;
|
|
|
import android.widget.ProgressBar;
|
|
|
@@ -30,6 +32,7 @@ public class ActionBarManager implements IActionBarListener {
|
|
|
}
|
|
|
|
|
|
private ActionBar actionBar;
|
|
|
+ private Toolbar toolbar;
|
|
|
private TextView actionBarTitle;
|
|
|
private View imageBi;
|
|
|
private View buttonBack;
|
|
|
@@ -59,6 +62,8 @@ public class ActionBarManager implements IActionBarListener {
|
|
|
public void init(Activity activity, ActionBar actionBar) {
|
|
|
this.actionBar = actionBar;
|
|
|
|
|
|
+// disableShowHideAnimation(actionBar);
|
|
|
+
|
|
|
LayoutInflater inflater = LayoutInflater.from(activity);
|
|
|
View view = inflater.inflate(R.layout.action_bar, null);
|
|
|
|
|
|
@@ -108,7 +113,6 @@ public class ActionBarManager implements IActionBarListener {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* actionbar 제목 설정
|
|
|
*
|
|
|
@@ -122,14 +126,22 @@ public class ActionBarManager implements IActionBarListener {
|
|
|
* actionbar hide
|
|
|
*/
|
|
|
public void hide() {
|
|
|
+ Log.i("APP# ActionBarManager | hide", "|" + "~~~~~~~~~~~~~~~~~~~~~~`");
|
|
|
actionBar.hide();
|
|
|
+ if (toolbar.getParent() instanceof AppBarLayout) {
|
|
|
+ ((AppBarLayout) toolbar.getParent()).setExpanded(false, false);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* show
|
|
|
*/
|
|
|
public void show() {
|
|
|
+ Log.i("APP# ActionBarManager | show", "|" + "~~~~~~~~~~~~~~~~~~~~~~`");
|
|
|
actionBar.show();
|
|
|
+ if (toolbar.getParent() instanceof AppBarLayout) {
|
|
|
+ ((AppBarLayout) toolbar.getParent()).setExpanded(true, false);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -146,10 +158,10 @@ public class ActionBarManager implements IActionBarListener {
|
|
|
actionBar.setDisplayShowHomeEnabled(false); //홈 아이콘을 숨김처리합니다.
|
|
|
actionBar.setCustomView(view);
|
|
|
|
|
|
- Toolbar parent = (Toolbar) view.getParent();
|
|
|
- parent.setPadding(0, 0, 0, 0);//for tab otherwise give space in tab
|
|
|
- parent.setContentInsetsAbsolute(0, 0);
|
|
|
-// parent.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT));
|
|
|
+ toolbar = (Toolbar) view.getParent();
|
|
|
+ toolbar.setPadding(0, 0, 0, 0);//for tab otherwise give space in tab
|
|
|
+ toolbar.setContentInsetsAbsolute(0, 0);
|
|
|
+// toolbar.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT));
|
|
|
|
|
|
setDisplayOptions(android.app.ActionBar.DISPLAY_SHOW_CUSTOM);
|
|
|
setElevation(0);
|
|
|
@@ -167,6 +179,29 @@ public class ActionBarManager implements IActionBarListener {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+// 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){
|
|
|
+// //....
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+
|
|
|
/**
|
|
|
* progress bar 보이기/안보이기
|
|
|
*
|