@@ -55,66 +55,64 @@ protected void onCreate(Bundle savedInstanceState) {
5555 }
5656
5757 protected void setDefaultActionBar () {
58- ActionBar actionBar = getSupportActionBar ();
58+ final ActionBar actionBar = getSupportActionBar ();
5959 if (actionBar != null ) {
60- @ SuppressLint ("InflateParams" ) RelativeLayout actionBarCustomView = (RelativeLayout ) LayoutInflater .from (this ).inflate (R .layout .mcd_actionbar , null );
61- ActionBar .LayoutParams layoutParams = new ActionBar .LayoutParams (ActionBar .LayoutParams .MATCH_PARENT , ActionBar .LayoutParams .MATCH_PARENT );
60+ final @ SuppressLint ("InflateParams" ) RelativeLayout actionBarCustomView = (RelativeLayout ) LayoutInflater .from (this ).inflate (R .layout .mcd_actionbar , null );
61+ final ActionBar .LayoutParams layoutParams = new ActionBar .LayoutParams (ActionBar .LayoutParams .MATCH_PARENT , ActionBar .LayoutParams .MATCH_PARENT );
6262 layoutParams .gravity = Gravity .CENTER_HORIZONTAL | Gravity .CENTER_VERTICAL ;
6363 actionBar .setDisplayOptions (ActionBar .DISPLAY_SHOW_CUSTOM );
6464 actionBar .setDisplayShowHomeEnabled (false );
6565 actionBar .setDisplayShowCustomEnabled (true );
6666 actionBar .setDisplayShowTitleEnabled (false );
6767 actionBar .setCustomView (actionBarCustomView , layoutParams );
68- Toolbar parent = (Toolbar ) actionBarCustomView .getParent ();
68+ final Toolbar parent = (Toolbar ) actionBarCustomView .getParent ();
6969 parent .setContentInsetsAbsolute (0 , 0 );
7070
71- AppCompatTextView titleTV = actionBarCustomView .findViewById (R .id .mcd_actionbar_title );
71+ final AppCompatTextView titleTV = actionBarCustomView .findViewById (R .id .mcd_actionbar_title );
7272 titleTV .setText (getTitle ());
7373 }
7474 }
7575
7676 @ Override
7777 public void setTitle (int titleId ) {
7878 super .setTitle (titleId );
79-
8079 if (getSupportActionBar () != null ) {
81- View actionBarCustomView = getSupportActionBar ().getCustomView ();
82- AppCompatTextView titleTV = actionBarCustomView .findViewById (R .id .mcd_actionbar_title );
80+ final View actionBarCustomView = getSupportActionBar ().getCustomView ();
81+ final AppCompatTextView titleTV = actionBarCustomView .findViewById (R .id .mcd_actionbar_title );
8382 titleTV .setText (titleId );
8483 }
8584 }
8685
8786 @ Override
8887 public void setTitle (CharSequence title ) {
8988 super .setTitle (title );
90-
9189 if (getSupportActionBar () != null ) {
92- View actionBarCustomView = getSupportActionBar ().getCustomView ();
93- AppCompatTextView titleTV = actionBarCustomView .findViewById (R .id .mcd_actionbar_title );
90+ final View actionBarCustomView = getSupportActionBar ().getCustomView ();
91+ final AppCompatTextView titleTV = actionBarCustomView .findViewById (R .id .mcd_actionbar_title );
9492 titleTV .setText (title );
9593 }
9694 }
9795
9896 protected void setActionBarViewRight (View view ) {
9997 if (getSupportActionBar () != null ) {
100- View actionBarCustomView = getSupportActionBar ().getCustomView ();
101- RelativeLayout layout = actionBarCustomView .findViewById (R .id .mcd_actionbar_ViewRight );
98+ final View actionBarCustomView = getSupportActionBar ().getCustomView ();
99+ final RelativeLayout layout = actionBarCustomView .findViewById (R .id .mcd_actionbar_ViewRight );
102100 layout .removeAllViews ();
103101 layout .addView (view );
104102 }
105103 }
106104
107105 protected void setActionBarViewLeft (View view ) {
108106 if (getSupportActionBar () != null ) {
109- View actionBarCustomView = getSupportActionBar ().getCustomView ();
110- RelativeLayout layout = actionBarCustomView .findViewById (R .id .mcd_actionbar_ViewLeft );
107+ final View actionBarCustomView = getSupportActionBar ().getCustomView ();
108+ final RelativeLayout layout = actionBarCustomView .findViewById (R .id .mcd_actionbar_ViewLeft );
111109 layout .removeAllViews ();
112110 layout .addView (view );
113111 }
114112 }
115113
116114 protected void setActionBarButtonCloseRight () {
117- View buttonClose = getLayoutInflater ().inflate (R .layout .moddedpe_ui_button_close , null );
115+ final View buttonClose = getLayoutInflater ().inflate (R .layout .moddedpe_ui_button_close , null );
118116 buttonClose .findViewById (R .id .moddedpe_ui_button_item_image_button ).setOnClickListener (p1 -> finish ());
119117 setActionBarViewRight (buttonClose );
120118 }
@@ -123,7 +121,6 @@ protected void setActionBarButtonCloseRight() {
123121 @ Override
124122 public void onWindowFocusChanged (boolean hasFocus ) {
125123 super .onWindowFocusChanged (hasFocus );
126-
127124 Bitmap bitmap = BitmapFactory .decodeResource (getResources (), R .drawable .mcd_bg );
128125 bitmap = BitmapRepeater .repeat (getWindowManager ().getDefaultDisplay ().getWidth (), getWindowManager ().getDefaultDisplay ().getHeight (), bitmap );
129126 getWindow ().getDecorView ().setBackground (new BitmapDrawable (bitmap ));
0 commit comments