/docs/weixin_7.0.4_source/反编译源码/未反混淆/src/main/java/com/tencent/mm/plugin/webview/ui/tools/game/menu/d.java

https://github.com/HelloHuDi/AndroidReverseNotes · Java · 210 lines · 200 code · 10 blank · 0 comment · 52 complexity · 3972f79e6f068e44cdd53e2600b567a0 MD5 · raw file

  1. package com.tencent.mm.plugin.webview.ui.tools.game.menu;
  2. import android.annotation.TargetApi;
  3. import android.app.Activity;
  4. import android.content.Context;
  5. import android.content.DialogInterface;
  6. import android.content.DialogInterface.OnDismissListener;
  7. import android.os.Build.VERSION;
  8. import android.support.v4.widget.j;
  9. import android.util.DisplayMetrics;
  10. import android.view.View;
  11. import android.view.ViewGroup;
  12. import android.view.ViewTreeObserver;
  13. import android.view.ViewTreeObserver.OnGlobalLayoutListener;
  14. import com.tencent.matrix.trace.core.AppMethodBeat;
  15. import com.tencent.mm.opensdk.modelmsg.WXMediaMessage;
  16. import com.tencent.mm.plugin.webview.luggage.d;
  17. import com.tencent.mm.plugin.webview.ui.tools.game.menu.b.a;
  18. import com.tencent.mm.plugin.webview.ui.tools.game.menu.b.b;
  19. import com.tencent.mm.plugin.webview.ui.tools.game.menu.b.c;
  20. import com.tencent.mm.protocal.protobuf.bbb;
  21. import com.tencent.mm.ui.base.l;
  22. public final class d implements OnGlobalLayoutListener {
  23. private ViewTreeObserver aaM;
  24. private Context mContext;
  25. private View pP;
  26. private l rBn;
  27. private e uEI;
  28. public b uEJ = new b() {
  29. public final void a(l lVar) {
  30. AppMethodBeat.i(135894);
  31. c cVar = c.this;
  32. b bVar = cVar.mUn;
  33. d dVar = cVar.mUm;
  34. for (bbb bbb : bVar.mUj) {
  35. if (bbb == null) {
  36. lVar.e(-1, "");
  37. } else {
  38. a aVar = (a) bVar.mUk.get(Integer.valueOf(bbb.wkB));
  39. if (aVar != null) {
  40. aVar.a(dVar, lVar, bbb);
  41. }
  42. }
  43. }
  44. AppMethodBeat.o(135894);
  45. }
  46. };
  47. private GameMenuView uEK;
  48. private f uEL;
  49. private boolean uEM = false;
  50. private boolean uEN;
  51. public boolean uEO;
  52. public boolean uEP = false;
  53. public final void onGlobalLayout() {
  54. AppMethodBeat.i(8819);
  55. if (isShowing()) {
  56. View view = this.pP;
  57. if (view == null || !view.isShown()) {
  58. cpE();
  59. AppMethodBeat.o(8819);
  60. return;
  61. } else if (isShowing() && this.uEM != isLandscape()) {
  62. cpE();
  63. }
  64. }
  65. AppMethodBeat.o(8819);
  66. }
  67. public d(Context context) {
  68. AppMethodBeat.i(8820);
  69. this.mContext = context;
  70. if (this.mContext instanceof Activity) {
  71. ViewGroup viewGroup = (ViewGroup) ((Activity) this.mContext).getWindow().getDecorView();
  72. if (viewGroup.getChildCount() > 0) {
  73. this.pP = viewGroup.getChildAt(0);
  74. } else {
  75. this.pP = viewGroup;
  76. }
  77. }
  78. Context context2 = this.mContext;
  79. this.rBn = new l(context2);
  80. this.uEI = new e(context2);
  81. this.uEK = new GameMenuView(context2);
  82. this.uEL = new f(context2);
  83. this.uEK.setAdapter(this.uEL);
  84. this.uEM = isLandscape();
  85. this.uEI.setContentView(this.uEK);
  86. AppMethodBeat.o(8820);
  87. }
  88. @TargetApi(23)
  89. private void dcd() {
  90. AppMethodBeat.i(8821);
  91. if (VERSION.SDK_INT >= 23 && this.uEI != null) {
  92. this.uEI.getWindow().getDecorView().setSystemUiVisibility(9216);
  93. this.uEI.getWindow().setStatusBarColor(0);
  94. }
  95. AppMethodBeat.o(8821);
  96. }
  97. public final void cpD() {
  98. int i = 0;
  99. AppMethodBeat.i(8822);
  100. this.uEM = isLandscape();
  101. if (this.uEJ != null) {
  102. this.uEJ.a(this.rBn);
  103. }
  104. if (this.uEI != null) {
  105. if (this.uEL != null) {
  106. this.uEL.b(this.rBn);
  107. }
  108. if (VERSION.SDK_INT >= 21) {
  109. this.uEI.getWindow().addFlags(j.INVALID_ID);
  110. }
  111. if (this.uEN) {
  112. dcd();
  113. }
  114. if (this.uEO) {
  115. this.uEI.getWindow().addFlags(WXMediaMessage.DESCRIPTION_LENGTH_LIMIT);
  116. }
  117. if (this.uEP) {
  118. this.uEI.getWindow().setFlags(8, 8);
  119. this.uEI.getWindow().addFlags(131200);
  120. this.uEI.getWindow().getDecorView().setSystemUiVisibility(6);
  121. } else {
  122. this.uEI.getWindow().clearFlags(8);
  123. this.uEI.getWindow().clearFlags(WXMediaMessage.MINI_PROGRAM__THUMB_LENGHT);
  124. this.uEI.getWindow().clearFlags(128);
  125. this.uEI.getWindow().getDecorView().setSystemUiVisibility(0);
  126. }
  127. if (this.pP != null) {
  128. if (this.aaM == null) {
  129. i = 1;
  130. }
  131. this.aaM = this.pP.getViewTreeObserver();
  132. if (i != 0) {
  133. this.aaM.addOnGlobalLayoutListener(this);
  134. }
  135. }
  136. this.uEI.setOnDismissListener(new OnDismissListener() {
  137. public final void onDismiss(DialogInterface dialogInterface) {
  138. AppMethodBeat.i(8817);
  139. d.this.cpE();
  140. AppMethodBeat.o(8817);
  141. }
  142. });
  143. if (this.uEK != null) {
  144. this.uEK.setDismissListener(new a() {
  145. public final void onDismiss() {
  146. AppMethodBeat.i(8818);
  147. d.this.cpE();
  148. AppMethodBeat.o(8818);
  149. }
  150. });
  151. }
  152. this.uEI.show();
  153. }
  154. AppMethodBeat.o(8822);
  155. }
  156. public final void cpE() {
  157. AppMethodBeat.i(8823);
  158. if (this.aaM != null) {
  159. if (!this.aaM.isAlive()) {
  160. this.aaM = this.pP.getViewTreeObserver();
  161. }
  162. this.aaM.removeGlobalOnLayoutListener(this);
  163. this.aaM = null;
  164. }
  165. if (this.uEI != null) {
  166. this.uEI.dismiss();
  167. }
  168. AppMethodBeat.o(8823);
  169. }
  170. private boolean isShowing() {
  171. AppMethodBeat.i(8824);
  172. if (this.uEI == null) {
  173. AppMethodBeat.o(8824);
  174. return false;
  175. } else if (this.uEI.isShowing()) {
  176. AppMethodBeat.o(8824);
  177. return true;
  178. } else {
  179. AppMethodBeat.o(8824);
  180. return false;
  181. }
  182. }
  183. public final void a(c cVar) {
  184. AppMethodBeat.i(8825);
  185. if (this.uEK != null) {
  186. this.uEK.setGameMenuItemSelectedListener(cVar);
  187. }
  188. AppMethodBeat.o(8825);
  189. }
  190. private boolean isLandscape() {
  191. AppMethodBeat.i(8826);
  192. DisplayMetrics displayMetrics = this.mContext.getResources().getDisplayMetrics();
  193. if (displayMetrics.widthPixels > displayMetrics.heightPixels) {
  194. AppMethodBeat.o(8826);
  195. return true;
  196. }
  197. AppMethodBeat.o(8826);
  198. return false;
  199. }
  200. }