@Override
  protected void collectViews(final View view) {
    formLayout = (LinearLayout) view.findViewById(R.id.activity_send_form);
    formLayout.setVisibility(formVisibilityForSave);
    thanksLayout = (RelativeLayout) view.findViewById(R.id.activity_send_thanks);
    thanksLayout.setVisibility(thanksVisibilityForSave);

    final TextView thx = (TextView) view.findViewById(R.id.activity_send_admission_thanks);
    if (thx != null) {
      FontUtil.setOswaldRegularFont(thx);
    }

    labelTextView = (TextView) view.findViewById(R.id.activity_send_admission_label);

    uniSpinner = (Spinner) view.findViewById(R.id.activity_send_admission_spinner_uni);
    if (uniSpinner != null) {
      final List<University> universityList = new ArrayList<University>();
      universityList.add(
          0,
          new University(
              0, getString(R.string.activity_send_admission_university_spinner_uni_prompt), ""));
      universityList.addAll(DataAccessObjectImpl.INSTACE.getAllUniversities());
      final UniversitySpinnerAdapter adater =
          new UniversitySpinnerAdapter(getActivity(), 0, universityList);
      uniSpinner.setAdapter(adater);
    }

    admissionEditText = (EditText) view.findViewById(R.id.activity_send_admission_text);
    sendButton = (Button) view.findViewById(R.id.activity_send_admission_button_send);
  }
Ejemplo n.º 2
0
 @Override
 protected void onCreate(final Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   final TextView v = (TextView) findViewById(R.id.title);
   FontUtil.setOswaldRegularFont(v);
   setContentView(R.layout.p_progress_dialog);
   image = findViewById(R.id.p_progress_dialog_image);
   rotate = AnimationUtils.loadAnimation(mContext, R.anim.p_progress_dialog_rotate);
 }
 @Override
 public View onCreateView(
     final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) {
   final View view =
       inflater.inflate(R.layout.activity_send_university_admission, container, false);
   collectViews(view);
   addListeners();
   restoreFromBundle(savedInstanceState);
   FontUtil.setOswaldRegularFont(labelTextView, admissionEditText, sendButton);
   return view;
 }
Ejemplo n.º 4
0
  /**
   * Constructs a new swipe-to-dismiss touch listener for the given list view.
   *
   * @param listView The list view whose items should be dismissable.
   * @param dismissCallback The callback to trigger when the user has indicated that she would like
   *     to dismiss one or more list items.
   * @param mode The mode this list handles multiple undos.
   * @param onScrollListener litnerr s kt blokujem touch a nacitavam na bottom dalsie admissions,
   *     skopceny z SwipeDismissList a doplneni o nacitanie
   */
  public SwipeDismissList(
      final AbsListView listView,
      final OnDismissCallback dismissCallback,
      final OnDiscardCallback discardCallback,
      final AbsListView.OnScrollListener onScrollListener) {

    if (listView == null) {
      throw new IllegalArgumentException("listview must not be null.");
    }

    mHandler = new HideUndoPopupHandler();
    mListView = listView;
    mDismissCallback = dismissCallback;
    mDiscardCallback = discardCallback;
    mMode = UndoMode.COLLAPSED_UNDO;

    final ViewConfiguration vc = ViewConfiguration.get(listView.getContext());
    mSlop = vc.getScaledTouchSlop();
    mMinFlingVelocity = vc.getScaledMinimumFlingVelocity();
    mMaxFlingVelocity = vc.getScaledMaximumFlingVelocity();
    mAnimationTime =
        listView.getContext().getResources().getInteger(android.R.integer.config_shortAnimTime);

    mDensity = mListView.getResources().getDisplayMetrics().density;

    // -- Load undo popup --
    final LayoutInflater inflater =
        (LayoutInflater) mListView.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    final View v = inflater.inflate(R.layout.activity_favorite_undo_popup, null);
    mUndoButton = (ImageButton) v.findViewById(R.id.activity_favorite_popup_button_undo);
    mUndoButton.setOnClickListener(new UndoHandler());
    mUndoButton.setOnTouchListener(
        new View.OnTouchListener() {
          @Override
          public boolean onTouch(final View v, final MotionEvent event) {
            // If user tabs "undo" button, reset delay time to remove popup
            mDelayedMsgId++;
            return false;
          }
        });
    mUndoText = (TextView) v.findViewById(R.id.activity_favorite_popup_text);
    FontUtil.setOswaldRegularFont(mUndoText);

    mUndoPopup = new PopupWindow(v);
    mUndoPopup.setAnimationStyle(R.style.activity_favorite_fade_animation);
    // Get scren width in dp and set width respectively
    final int xdensity =
        (int) (mListView.getContext().getResources().getDisplayMetrics().widthPixels / mDensity);
    if (xdensity < 300) {
      mUndoPopup.setWidth((int) (mDensity * 280));
    } else if (xdensity < 350) {
      mUndoPopup.setWidth((int) (mDensity * 300));
    } else if (xdensity < 500) {
      mUndoPopup.setWidth((int) (mDensity * 330));
    } else {
      mUndoPopup.setWidth((int) (mDensity * 450));
    }
    mUndoPopup.setHeight((int) (mDensity * 56));
    // -- END Load undo popu --

    listView.setOnTouchListener(this);
    listView.setOnScrollListener(onScrollListener);

    switch (mMode) {
      case SINGLE_UNDO:
        mUndoActions = new ArrayList<Undoable>(1);
        break;
      default:
        mUndoActions = new ArrayList<Undoable>(10);
        break;
    }
  }