react-native-navigation的迁移库

TitleBarLeftButtonParamsParser.java 1.0KB

123456789101112131415161718192021222324252627282930
  1. package com.reactnativenavigation.params.parsers;
  2. import android.os.Bundle;
  3. import com.balysv.materialmenu.MaterialMenuDrawable;
  4. import com.reactnativenavigation.params.TitleBarLeftButtonParams;
  5. public class TitleBarLeftButtonParamsParser extends TitleBarButtonParamsParser {
  6. public TitleBarLeftButtonParams parseSingleButton(Bundle params) {
  7. TitleBarLeftButtonParams leftButtonParams = new TitleBarLeftButtonParams(super.parseSingleButton(params));
  8. leftButtonParams.iconState = getIconStateFromId(leftButtonParams.eventId);
  9. return leftButtonParams;
  10. }
  11. private MaterialMenuDrawable.IconState getIconStateFromId(String id) {
  12. switch (id) {
  13. case "back":
  14. return MaterialMenuDrawable.IconState.ARROW;
  15. case "cancel":
  16. return MaterialMenuDrawable.IconState.X;
  17. case "accept":
  18. return MaterialMenuDrawable.IconState.CHECK;
  19. case "sideMenu":
  20. default:
  21. return MaterialMenuDrawable.IconState.BURGER;
  22. }
  23. }
  24. }