Ejemplo n.º 1
1
  @TargetApi(Build.VERSION_CODES.HONEYCOMB)
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_sketch_properties);

    // StackOverflow: http://stackoverflow.com/a/27455330/1628609
    LinearLayout root =
        (LinearLayout) findViewById(android.R.id.list).getParent().getParent().getParent();
    toolbar = (Toolbar) LayoutInflater.from(this).inflate(R.layout.settings_toolbar, root, false);
    root.addView(toolbar, 0);

    toolbar.setNavigationOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            finish();
          }
        });

    initOptionsMenu(toolbar.getMenu());
    toolbar.setOnMenuItemClickListener(this);

    toolbar.setTitle(getGlobalState().getSketchName());

    getGlobalState().setProperties(this);

    getWindow()
        .getDecorView()
        .setBackgroundColor(getResources().getColor(R.color.activity_background));
  }
Ejemplo n.º 2
0
  @SuppressWarnings("deprecation")
  private void configureToolbar() {
    Toolbar toolbar = getToolbar();

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
      toolbar.setBackground(
          getResources().getDrawable(R.drawable.ccw_action_bar_gradient_colors, null));
    else
      toolbar.setBackground(getResources().getDrawable(R.drawable.ccw_action_bar_gradient_colors));

    if (toolbar.getMenu() != null) toolbar.getMenu().clear();
  }
  private void configureToolbar() {
    Toolbar toolbar = getToolbar();

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
      toolbar.setBackground(
          getResources().getDrawable(R.drawable.cbw_action_bar_gradient_colors, null));
    else
      toolbar.setBackground(getResources().getDrawable(R.drawable.cbw_action_bar_gradient_colors));

    toolbar.setTitleTextColor(Color.WHITE);
    if (toolbar.getMenu() != null) toolbar.getMenu().clear();
  }
Ejemplo n.º 4
0
  private void createSaveButton() {
    mToolbar = ((MainActivity) getActivity()).getToolbar();
    mToolbar.inflateMenu(R.menu.menu_save);

    ImageButton saveButton =
        (ImageButton) mToolbar.getMenu().findItem(R.id.save_view).getActionView();
    saveButton.setImageDrawable(
        ContextCompat.getDrawable(getActivity(), R.drawable.ic_action_save));
    saveButton.setBackgroundColor(ContextCompat.getColor(getActivity(), R.color.ColorPrimaryDark));
    saveButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            if (isReadyToSave()) {
              saveUpdatedProfile();
              Toast.makeText(getActivity(), "Successfully saved", Toast.LENGTH_SHORT).show();
              InputMethodManager imm =
                  (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
              imm.hideSoftInputFromWindow(
                  view.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
              ((MainActivity) getActivity()).setupProfileOnDrawer();
              ((MainActivity) getActivity()).openDrawer();
            }
          }
        });
  }
  /**
   * Fills the list with the available recordings. Only the recordings that are scheduled are added
   * to the list.
   */
  private void populateList() {
    // Clear the list and add the recordings
    adapter.clear();
    TVHClientApplication app = (TVHClientApplication) activity.getApplication();
    for (SeriesRecording srec : app.getSeriesRecordings()) {
      adapter.add(srec);
    }
    // Show the newest scheduled recordings first
    adapter.sort(Constants.RECORDING_SORT_DESCENDING);
    adapter.notifyDataSetChanged();

    if (toolbar != null) {
      onPrepareToolbarMenu(toolbar.getMenu());
      toolbar.setTitle(getString(R.string.series_recordings));
      if (adapter.getCount() > 0) {
        toolbar.setSubtitle(adapter.getCount() + " " + getString(R.string.items_available));
      } else {
        toolbar.setSubtitle(R.string.no_recordings_scheduled);
      }
    }
    // Inform the listeners that the channel list is populated.
    // They could then define the preselected list item.
    if (fragmentStatusInterface != null) {
      fragmentStatusInterface.onListPopulated(TAG);
    }
  }
Ejemplo n.º 6
0
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    MenuInflater inflater = getMenuInflater();
    Menu toolbar_menu = toolbar.getMenu();
    toolbar_menu.clear();
    inflater.inflate(R.menu.log_menu, toolbar_menu);
    toolbar.setOnMenuItemClickListener(
        new Toolbar.OnMenuItemClickListener() {
          @Override
          public boolean onMenuItemClick(MenuItem item) {
            switch (item.getItemId()) {
                // Respond to the action bar's Up/Home button

              case R.id.menu_share:
                sendLog();
                return true;
            }
            return true;
          }
        });
    return true;
  }
 @Override
 public void onCreateToolbar(Toolbar toolbar) {
   super.onCreateToolbar(toolbar);
   if (shouldAddActionItems()) {
     toolbar.inflateMenu(R.menu.feeditem_overflow);
     mMenu = toolbar.getMenu();
     configureOverflow(mFavorited);
   }
 }
 public void updateChat() {
   ContactTitleInflater.updateTitle(contactTitleView, getActivity(), abstractContact);
   toolbar.setBackgroundColor(accountPainter.getAccountMainColor(account));
   int itemCountBeforeUpdate = chatMessageAdapter.getItemCount();
   chatMessageAdapter.onChange();
   scrollChat(itemCountBeforeUpdate);
   setUpOptionsMenu(toolbar.getMenu());
   updateSecurityButton();
 }
Ejemplo n.º 9
0
  void inflateMenuFromFragment(int menuResId) {
    if (mAppBar == null) {
      return;
    }

    mAppBar.getMenu().clear();
    if (menuResId != 0) {
      mAppBar.inflateMenu(menuResId);
    }
    mAppBar.inflateMenu(R.menu.settings);
  }
Ejemplo n.º 10
0
 /**
  * Shows the Cast First Time User experience to the user (an overlay that explains what is the
  * Cast icon)
  */
 private void showFtu() {
   Menu menu = mToolbar.getMenu();
   View view = menu.findItem(R.id.media_route_menu_item).getActionView();
   if (view != null && view instanceof MediaRouteButton) {
     new ShowcaseView.Builder(this)
         .setTarget(new ViewTarget(view))
         .setContentTitle(R.string.touch_to_cast)
         .hideOnTouchOutside()
         .build();
   }
 }
Ejemplo n.º 11
0
  public void drawMenu(MenuOption... options) {
    for (MenuOption option : options) {
      switch (option.groupView) {
        case EDIT_DELETE:
          toolbarBottom.getMenu().setGroupVisible(R.id.group_edit_delete, option.show);
          break;

        case MARKER_COMPONENTS:
          toolbarBottom.getMenu().setGroupVisible(R.id.group_marker_components, option.show);
          break;

        case MARKER_MOVE:
          toolbarBottom.getMenu().setGroupVisible(R.id.group_marker_move, option.show);
          break;

        case MARKER_NAVIGATION:
          toolbarTop.getMenu().setGroupVisible(R.id.group_marker_navigation, option.show);
          break;

        case MAP_COMPONENTS:
          toolbarTop.getMenu().setGroupVisible(R.id.group_map_components, option.show);
          break;

        case MAP_ZOOMING:
          toolbarTop.getMenu().setGroupVisible(R.id.group_map_zooming, option.show);
          break;
      }
    }
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    if (Intent.ACTION_VIEW.equals(getIntent().getAction())
        || Intent.ACTION_SEND.equals(getIntent().getAction())
        || Intent.ACTION_SENDTO.equals(getIntent().getAction())
        || Intent.ACTION_CREATE_SHORTCUT.equals(getIntent().getAction())) {
      ActivityManager.getInstance().startNewTask(this);
    }
    super.onCreate(savedInstanceState);

    if (isFinishing()) {
      return;
    }

    setContentView(R.layout.contact_list);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_default);
    toolbar.setOnClickListener(this);

    drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    drawerToggle =
        new ActionBarDrawerToggle(
            this,
            drawerLayout,
            toolbar,
            R.string.application_title_short,
            R.string.application_title_short);
    drawerLayout.setDrawerListener(drawerToggle);

    toolbar.inflateMenu(R.menu.contact_list);
    optionsMenu = toolbar.getMenu();
    setUpSearchView(optionsMenu);
    toolbar.setOnMenuItemClickListener(this);

    barPainter = new BarPainter(this, toolbar);
    barPainter.setDefaultColor();

    toolbar.setTitle(R.string.application_title_full);

    if (savedInstanceState != null) {
      sendText = savedInstanceState.getString(SAVED_SEND_TEXT);
      action = savedInstanceState.getString(SAVED_ACTION);
    } else {
      getSupportFragmentManager()
          .beginTransaction()
          .add(R.id.container, new ContactListFragment(), CONTACT_LIST_TAG)
          .commit();

      sendText = null;
      action = getIntent().getAction();
    }
    getIntent().setAction(null);
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    View rootView = inflater.inflate(R.layout.fragment_instituciones, container, false);

    Toolbar toolbar;
    toolbar = (Toolbar) this.getActivity().findViewById(R.id.toolbar);
    toolbar.setTitle("Instituciones");
    toolbar.getMenu().clear();

    callAPI();
    return rootView;
  }
Ejemplo n.º 14
0
 private void updateTextInputButtonsVisibility() {
   final Menu menu = mToolbar.getMenu();
   final MenuItem keypadToggleItem = menu.findItem(R.id.action_ime_dialpad_toggle);
   final MenuItem deleteTextItem = menu.findItem(R.id.action_delete_text);
   if (mContactPickingMode == MODE_PICK_INITIAL_CONTACT) {
     if (TextUtils.isEmpty(mRecipientTextView.getText())) {
       deleteTextItem.setVisible(false);
       keypadToggleItem.setVisible(true);
     } else {
       deleteTextItem.setVisible(true);
       keypadToggleItem.setVisible(false);
     }
   } else {
     deleteTextItem.setVisible(false);
     keypadToggleItem.setVisible(false);
   }
 }
Ejemplo n.º 15
0
 private void setupToolbar(View rootView) {
   mToolbar = (Toolbar) rootView.findViewById(R.id.toolbar);
   if (mToolbarContainer != null) {
     mToolbarContainer.setBackgroundColor(C.ThemedColors[C.colorPrimary]);
   }
   mToolbar.inflateMenu(R.menu.menu_edit);
   mToolbar
       .getMenu()
       .getItem(0)
       .getIcon()
       .setColorFilter(C.ThemedColors[C.colorTextNormal], PorterDuff.Mode.SRC_ATOP);
   mToolbar.setOnMenuItemClickListener(this);
   if (rootView.findViewById(R.id.frame_box) == null) {
     MainActivity ma = (MainActivity) getActivity();
     ma.setStatusBarColor(0, 0, true);
   }
   ImageButton close = (ImageButton) rootView.findViewById(R.id.close);
   close.setOnClickListener(this);
   mElevation = (int) (getResources().getDimension(R.dimen.toolbar_elevation) + 0.5f);
 }
Ejemplo n.º 16
0
 private void changeSaveStatus() {
   boolean enable = mSavable && mNameOk;
   mToolbar.getMenu().getItem(0).getIcon().setAlpha(enable ? 255 : 138);
   mToolbar.getMenu().getItem(0).setEnabled(enable);
 }
Ejemplo n.º 17
0
 public void onDestroy() {
   super.onDestroy();
   mToolbar.getMenu().clear();
 }
Ejemplo n.º 18
0
  @Override
  public void onCreate(Bundle savedInstanceState) {

    setTheme(MyApplication.theme_int);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_uswxoglv2);

    loc_x_current =
        MyApplication.preferences.getString("LOC" + MyApplication.current_loc_fragment + "_X", "");
    loc_y_current =
        MyApplication.preferences.getString("LOC" + MyApplication.current_loc_fragment + "_Y", "");

    turl = getIntent().getStringArrayExtra(RID);

    // for L2 archive called from storm reports
    if (turl.length > 5) {
      url_str = turl[3];
      loc_x_current = turl[4];
      loc_y_current = turl[5];
      archive_mode = true;
    }

    toolbar = (Toolbar) findViewById(R.id.toolbar_top);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    // toolbar.setNavigationIcon(getResources().getDrawable(R.drawable.ic_arrow_back_white_36px));
    // toolbar.setNavigationIcon(android.R.drawable.);

    toolbar_bottom = (Toolbar) findViewById(R.id.toolbar_bottom);

    if (MyApplication.icons_even_spaced)
      UtilityToolbar.setupEvenlyDistributedToolbar(this, toolbar_bottom, R.menu.uswxoglradar);
    else toolbar_bottom.inflateMenu(R.menu.uswxoglradar);

    toolbar_bottom.setOnMenuItemClickListener(this);

    if (archive_mode) toolbar_bottom.setVisibility(View.GONE);

    Menu menu = toolbar_bottom.getMenu();

    star_icon = R.drawable.star;
    star_outline_icon = R.drawable.star_outline;
    map_icon = R.drawable.map;
    star = menu.findItem(R.id.action_fav);
    map = menu.findItem(R.id.action_ridmap);
    map.setIcon(map_icon);

    tv0 = menu.findItem(R.id.action_tv0);
    tdwr = menu.findItem(R.id.action_tdwr);

    anim = menu.findItem(R.id.action_a6);
    tilt_menu = menu.findItem(R.id.action_tilt);

    // if ( ! MyApplication.loaded )
    //	MyApplication.Init(this);

    mImageMap = (ImageMap) findViewById(R.id.map);
    mImageMap.setVisibility(View.GONE);

    delay = UtilityImg.GetAnimInterval();

    img = (TouchImageView2) findViewById(R.id.iv);
    img.setMaxZoom(max_zoom);

    prod = "N0Q";

    glview = (WXGLSurfaceView) findViewById(R.id.glsurfaceview);
    InitGLVIEW();

    ogl_in_view = true;

    rid1 = turl[0];
    state = turl[1];
    if (turl.length > 2) {
      prod = turl[2];
      if (prod.equals("N0R")) {
        prod = "N0Q";
      }
    }

    if (MyApplication.wxogl_remember_location && !archive_mode) {

      OGLR.setZoom(MyApplication.wxogl_zoom);
      glview.mScaleFactor = (MyApplication.wxogl_zoom);
      if (!MyApplication.wxogl_rid.equals("")) rid1 = MyApplication.wxogl_rid;
      prod = MyApplication.wxogl_prod;
      OGLR.mPositionX = MyApplication.wxogl_x;
      OGLR.mPositionY = MyApplication.wxogl_y;
    }

    setTitle(prod);
    rid_arr_loc = UtilityFavorites.SetupFavMenu(MyApplication.rid_fav, rid1, pref_token_location);

    spinner1 = (Spinner) findViewById(R.id.spinner1);
    dataAdapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, rid_arr_loc);
    dataAdapter.setDropDownViewResource(MyApplication.spinner_layout);
    spinner1.setAdapter(dataAdapter);
    spinner1.setOnItemSelectedListener(this);

    if (MyApplication.wxogl_radar_autorefresh) {
      // 180000 is 3 min
      mInterval = 60000 * MyApplication.preferences.getInt("RADAR_REFRESH_INTERVAL", 3);

      getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
      mHandler = new Handler();
      startRepeatingTask();
    }
  }
Ejemplo n.º 19
0
  private void updateVisualsForContactPickingMode(final boolean animate) {
    // Don't update visuals if the visuals haven't been inflated yet.
    if (mRootView != null) {
      final Menu menu = mToolbar.getMenu();
      final MenuItem addMoreParticipantsItem = menu.findItem(R.id.action_add_more_participants);
      final MenuItem confirmParticipantsItem = menu.findItem(R.id.action_confirm_participants);
      switch (mContactPickingMode) {
        case MODE_PICK_INITIAL_CONTACT:
          addMoreParticipantsItem.setVisible(false);
          confirmParticipantsItem.setVisible(false);
          mCustomHeaderViewPager.setVisibility(View.VISIBLE);
          mComposeDivider.setVisibility(View.INVISIBLE);
          mRecipientTextView.setEnabled(true);
          showImeKeyboard();
          break;

        case MODE_CHIPS_ONLY:
          if (animate) {
            if (mPendingExplodeView == null) {
              // The user didn't click on any contact item, so use the toolbar as
              // the view to "explode."
              mPendingExplodeView = mToolbar;
            }
            startExplodeTransitionForContactLists(false /* show */);

            ViewGroupItemVerticalExplodeAnimation.startAnimationForView(
                mCustomHeaderViewPager,
                mPendingExplodeView,
                mRootView,
                true /* snapshotView */,
                UiUtils.COMPOSE_TRANSITION_DURATION);
            showHideContactPagerWithAnimation(false /* show */);
          } else {
            mCustomHeaderViewPager.setVisibility(View.GONE);
          }

          addMoreParticipantsItem.setVisible(true);
          confirmParticipantsItem.setVisible(false);
          mComposeDivider.setVisibility(View.VISIBLE);
          mRecipientTextView.setEnabled(true);
          break;

        case MODE_PICK_MORE_CONTACTS:
          if (animate) {
            // Correctly set the start visibility state for the view pager and
            // individual list items (hidden initially), so that the transition
            // manager can properly track the visibility change for the explode.
            mCustomHeaderViewPager.setVisibility(View.VISIBLE);
            toggleContactListItemsVisibilityForPendingTransition(false /* show */);
            startExplodeTransitionForContactLists(true /* show */);
          }
          addMoreParticipantsItem.setVisible(false);
          confirmParticipantsItem.setVisible(true);
          mCustomHeaderViewPager.setVisibility(View.VISIBLE);
          mComposeDivider.setVisibility(View.INVISIBLE);
          mRecipientTextView.setEnabled(true);
          showImeKeyboard();
          break;

        case MODE_PICK_MAX_PARTICIPANTS:
          addMoreParticipantsItem.setVisible(false);
          confirmParticipantsItem.setVisible(true);
          mCustomHeaderViewPager.setVisibility(View.VISIBLE);
          mComposeDivider.setVisibility(View.INVISIBLE);
          // TODO: Verify that this is okay for accessibility
          mRecipientTextView.setEnabled(false);
          break;

        default:
          Assert.fail("Unsupported contact picker mode!");
          break;
      }
      updateTextInputButtonsVisibility();
    }
  }
 @Override
 public Menu getMenu() {
   return mToolbar.getMenu();
 }