예제 #1
1
  /** Put a nice border on the bitmap. */
  private static View applyFrame(
      final PhotoTable table, final BitmapFactory.Options options, Bitmap decodedPhoto) {
    LayoutInflater inflater =
        (LayoutInflater) table.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View photo = inflater.inflate(R.layout.photo, null);
    ImageView image = (ImageView) photo;
    Drawable[] layers = new Drawable[2];
    int photoWidth = options.outWidth;
    int photoHeight = options.outHeight;
    if (decodedPhoto == null || options.outWidth <= 0 || options.outHeight <= 0) {
      photo = null;
    } else {
      decodedPhoto.setHasMipMap(true);
      layers[0] = new BitmapDrawable(table.mResources, decodedPhoto);
      layers[1] = table.mResources.getDrawable(R.drawable.frame);
      LayerDrawable layerList = new LayerDrawable(layers);
      layerList.setLayerInset(0, table.mInset, table.mInset, table.mInset, table.mInset);
      image.setImageDrawable(layerList);

      photo.setTag(R.id.photo_width, Integer.valueOf(photoWidth));
      photo.setTag(R.id.photo_height, Integer.valueOf(photoHeight));

      photo.setOnTouchListener(new PhotoTouchListener(table.getContext(), table));
    }
    return photo;
  }
예제 #2
0
  /**
   * Sets a private OnTouchListener to the SuperCardToast that will dismiss the SuperCardToast when
   * swiped. <br>
   *
   * @param swipeDismiss
   */
  public void setSwipeToDismiss(boolean swipeDismiss) {

    this.isSwipeDismissable = swipeDismiss;

    if (swipeDismiss) {

      if (Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.HONEYCOMB_MR1) {

        final SwipeDismissListener swipeDismissListener =
            new SwipeDismissListener(
                mToastView,
                new SwipeDismissListener.OnDismissCallback() {

                  @Override
                  public void onDismiss(View view) {

                    dismissImmediately();
                  }
                });

        mToastView.setOnTouchListener(swipeDismissListener);

      } else {

        Log.w(TAG, WARNING_PREHONEYCOMB);
      }

    } else {

      mToastView.setOnTouchListener(null);
    }
  }
  private void setupOnTouchListeners(View rootView) {
    mGestureDetector = new GestureDetector(this, new MyGestureListener());

    // If the user touches anywhere on the panel (including the
    // next/prev button). We show the on-screen controls. In addition
    // to that, if the touch is not on the prev/next button, we
    // pass the event to the gesture detector to detect double tap.
    final OnTouchListener buttonListener =
        new OnTouchListener() {
          public boolean onTouch(View v, MotionEvent event) {
            scheduleDismissOnScreenControls();
            return false;
          }
        };

    OnTouchListener rootListener =
        new OnTouchListener() {
          public boolean onTouch(View v, MotionEvent event) {
            buttonListener.onTouch(v, event);
            mGestureDetector.onTouchEvent(event);

            // We do not use the return value of
            // mGestureDetector.onTouchEvent because we will not receive
            // the "up" event if we return false for the "down" event.
            return true;
          }
        };

    mNextImageView.setOnTouchListener(buttonListener);
    mPrevImageView.setOnTouchListener(buttonListener);
    rootView.setOnTouchListener(rootListener);
  }
예제 #4
0
  public BasePickerView setCancelable(boolean isCancelable) {
    View view = rootView.findViewById(R.id.outmost_container);

    if (isCancelable) {
      view.setOnTouchListener(onCancelableTouchListener);
    } else {
      view.setOnTouchListener(null);
    }
    return this;
  }
 protected void toggleButtonListener(boolean enable) {
   View recentView = mCurrentView.findViewWithTag(NavbarEditor.NAVBAR_RECENT);
   if (recentView != null) {
     recentView.setOnClickListener(enable ? mRecentsClickListener : null);
     recentView.setOnTouchListener(enable ? mRecentsPreloadListener : null);
   }
   View homeView = mCurrentView.findViewWithTag(NavbarEditor.NAVBAR_HOME);
   if (homeView != null) {
     homeView.setOnTouchListener(enable ? mHomeSearchActionListener : null);
   }
 }
예제 #6
0
  /**
   * Sets a private OnTouchListener to the SuperCardToast View that will dismiss it when touched.
   * <br>
   *
   * @param touchDismiss If true will dismiss when touched
   */
  public void setTouchToDismiss(boolean touchDismiss) {

    this.isTouchDismissable = touchDismiss;

    if (touchDismiss) {

      mToastView.setOnTouchListener(mTouchDismissListener);

    } else {

      mToastView.setOnTouchListener(null);
    }
  }
예제 #7
0
  /**
   * Enables lateral swiping for {@link ActionBar} navigation tabs by detecting swipe gestures on
   * the given target {@link View}.
   *
   * @param targetViewId the compulsory target {@link View} which is to be swiped
   * @param moreTargetViewIds additional IDs of the {@link View}s which can be swiped
   * @since 1.1.0
   */
  protected void enableNavigationSwiping(int targetViewId, int... moreTargetViewIds) {

    NavigationSwipeDetector tabSwipeListener = new NavigationSwipeDetector(this);

    View main = findViewById(targetViewId);
    if (main != null) main.setOnTouchListener(tabSwipeListener);

    for (int id : moreTargetViewIds) {

      View view = findViewById(id);

      if (view != null) view.setOnTouchListener(tabSwipeListener);
    }
  }
예제 #8
0
  private void viewSetup() {
    setRoleAssignmentText(mClientGameStateController.getCurrentGameState().assignment);
    mShowDetailsView.setOnTouchListener(
        new View.OnTouchListener() {
          @Override
          public boolean onTouch(View view, MotionEvent motionEvent) {
            if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
              mShowDetailsView.setAlpha(0f);
            } else if (motionEvent.getAction() == MotionEvent.ACTION_UP) {
              mShowDetailsView.setAlpha(1f);
            }
            return true;
          }
        });

    mNoButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            mClientGameStateController.processClientResponse(false);
            mUiChangedListener.notifyDataChanged();
          }
        });

    mYesButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            mClientGameStateController.processClientResponse(true);
            mUiChangedListener.notifyDataChanged();
          }
        });
  }
예제 #9
0
파일: Panel.java 프로젝트: 357016138/dxt
  @SuppressWarnings("deprecation")
  @Override
  protected void onFinishInflate() {
    super.onFinishInflate();
    mHandle = findViewById(R.id.panelHandle);
    if (mHandle == null) {
      throw new RuntimeException(
          "Your Panel must have a View whose id attribute is 'R.id.panelHandle'");
    }
    mHandle.setOnTouchListener(touchListener);

    mContent = findViewById(R.id.panelContent);
    if (mContent == null) {
      throw new RuntimeException(
          "Your Panel must have a View whose id attribute is 'R.id.panelContent'");
    }

    // reposition children
    removeView(mHandle);
    removeView(mContent);
    if (mPosition == TOP || mPosition == LEFT) {
      addView(mContent);
      addView(mHandle);
    } else {
      addView(mHandle);
      addView(mContent);
    }

    if (mClosedHandle != null) {
      mHandle.setBackgroundDrawable(mClosedHandle);
    }
    mContent.setVisibility(GONE);
  }
예제 #10
0
  @Override
  public void call(final Subscriber<? super MotionEvent> subscriber) {
    checkUiThread();

    View.OnTouchListener listener =
        new View.OnTouchListener() {
          @Override
          public boolean onTouch(View v, @NonNull MotionEvent event) {
            if (handled.call(event)) {
              if (!subscriber.isUnsubscribed()) {
                subscriber.onNext(event);
              }
              return true;
            }
            return false;
          }
        };
    view.setOnTouchListener(listener);

    subscriber.add(
        new MainThreadSubscription() {
          @Override
          protected void onUnsubscribe() {
            view.setOnTouchListener(null);
          }
        });
  }
예제 #11
0
  public AndroidInput(
      Application activity, Context context, Object view, AndroidApplicationConfiguration config) {
    // we hook into View, for LWPs we call onTouch below directly from
    // within the AndroidLivewallpaperEngine#onTouchEvent() method.
    if (view instanceof View) {
      View v = (View) view;
      v.setOnKeyListener(this);
      v.setOnTouchListener(this);
      v.setFocusable(true);
      v.setFocusableInTouchMode(true);
      v.requestFocus();
    }
    this.config = config;
    this.onscreenKeyboard = new AndroidOnscreenKeyboard(context, new Handler(), this);

    for (int i = 0; i < realId.length; i++) realId[i] = -1;
    handle = new Handler();
    this.app = activity;
    this.context = context;
    this.sleepTime = config.touchSleepTime;
    touchHandler = new AndroidMultiTouchHandler();
    hasMultitouch = touchHandler.supportsMultitouch(context);

    vibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);

    int rotation = getRotation();
    DisplayMode mode = app.getGraphics().getDesktopDisplayMode();
    if (((rotation == 0 || rotation == 180) && (mode.width >= mode.height))
        || ((rotation == 90 || rotation == 270) && (mode.width <= mode.height))) {
      nativeOrientation = Orientation.Landscape;
    } else {
      nativeOrientation = Orientation.Portrait;
    }
  }
예제 #12
0
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        if (fragmentView == null) {
            fragmentView = inflater.inflate(R.layout.media_layout, container, false);

            emptyView = fragmentView.findViewById(R.id.searchEmptyView);
            listView = (GridView)fragmentView.findViewById(R.id.media_grid);
            progressView = fragmentView.findViewById(R.id.progressLayout);

            listView.setAdapter(listAdapter = new ListAdapter(parentActivity));
            listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
                @Override
                public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
                    NotificationCenter.Instance.addToMemCache(54, messages);
                    NotificationCenter.Instance.addToMemCache(55, i);
                    Intent intent = new Intent(parentActivity, GalleryImageViewer.class);
                    startActivity(intent);
                }
            });
            if (loading && messages.isEmpty()) {
                progressView.setVisibility(View.VISIBLE);
                listView.setEmptyView(null);
            } else {
                progressView.setVisibility(View.GONE);
                listView.setEmptyView(emptyView);
            }

            listView.setOnScrollListener(new AbsListView.OnScrollListener() {
                @Override
                public void onScrollStateChanged(AbsListView absListView, int i) {

                }

                @Override
                public void onScroll(AbsListView absListView, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
                    if (visibleItemCount != 0 && firstVisibleItem + visibleItemCount > totalItemCount - 2 && !loading && !endReached) {
                        loading = true;
                        MessagesController.Instance.loadMedia(dialog_id, 0, 50, max_id, !cacheEndReached, classGuid);
                    }
                }
            });

            listView.setOnTouchListener(new OnSwipeTouchListener() {
                public void onSwipeRight() {
                    finishFragment(true);
                }
            });
            emptyView.setOnTouchListener(new OnSwipeTouchListener() {
                public void onSwipeRight() {
                    finishFragment(true);
                }
            });
        } else {
            ViewGroup parent = (ViewGroup)fragmentView.getParent();
            if (parent != null) {
                parent.removeView(fragmentView);
            }
        }
        return fragmentView;
    }
예제 #13
0
  @OnClick({R.id.right_btn, R.id.rl_wechat})
  public void onClick(View view) {
    switch (view.getId()) {
      case R.id.right_btn:
        view1 = View.inflate(getContext(), R.layout.pop_fragment, null);
        if (pop == null) {
          pop = new PopupWindow(view1, 260, 340);
        }
        pop.setFocusable(true);
        pop.setTouchable(true);
        pop.setAnimationStyle(R.style.popwin_anim_style);
        pop.showAsDropDown(rightBtn, -180, 10);
        pop.setOutsideTouchable(true);
        pop.setBackgroundDrawable(new ColorDrawable(0x00000000));
        view1.setOnTouchListener(
            new View.OnTouchListener() {
              @Override
              public boolean onTouch(View v, MotionEvent event) {

                if (pop != null | pop.isShowing()) {
                  pop.dismiss();
                  pop = null;
                }
                return false;
              }
            });
        break;
      case R.id.rl_wechat:
        Intent intent = new Intent(getContext(), WeChatDatilActivity.class);
        startActivity(intent);
        break;
    }
  }
예제 #14
0
 /** Dispose of the photo gracefully, in case we can see some of it. */
 public void fadeAway(final View photo, final boolean replace) {
   // fade out of view
   mOnTable.remove(photo);
   exitStageLeft(photo);
   photo.setOnTouchListener(null);
   photo.animate().cancel();
   photo
       .animate()
       .withLayer()
       .alpha(0f)
       .setDuration(mPickUpDuration)
       .withEndAction(
           new Runnable() {
             @Override
             public void run() {
               if (photo == getFocus()) {
                 clearFocus();
               }
               mStageLeft.removeView(photo);
               recycle(photo);
               if (replace) {
                 scheduleNext(mNowDropDelay);
               }
             }
           });
 }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup viewGroup, Bundle savedInstanceState) {
    view = inflater.inflate(R.layout.socio_negocio_buscar_calle_fragment, viewGroup, false);

    if (!MainSocioNegocio.idDistrito.equals("")) {
      codDistrito = MainSocioNegocio.idDistrito;
    }

    sideIndex = (LinearLayout) view.findViewById(R.id.sideIndex);
    lvCalle = (ListView) view.findViewById(R.id.listView4);

    contexto = view.getContext();
    llenarDatos();

    /** ********************************* */
    /** ********* INDEXEEERRRR-> ************ */
    /** ********************************* */
    mGestureDetector = new GestureDetector(contexto, new SideIndexGestureListener());

    buildListCustomFormat();

    view.setOnTouchListener(
        new View.OnTouchListener() {
          @SuppressLint("ClickableViewAccessibility")
          @Override
          public boolean onTouch(View v, MotionEvent event) {
            if (mGestureDetector.onTouchEvent(event)) {
              return true;
            } else {
              return false;
            }
          }
        });

    // Obtener el refreshLayout
    refreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.swipeRefresh);

    // Seteamos los colores que se usarán a lo largo de la animación
    refreshLayout.setColorSchemeResources(R.color.s1, R.color.s2, R.color.s3, R.color.s4);

    // Iniciar la tarea al revelar el indicador
    refreshLayout.setOnRefreshListener(
        new SwipeRefreshLayout.OnRefreshListener() {
          @Override
          public void onRefresh() {
            alphabet.clear();
            sections.clear();
            llenarDatos();
            buildListCustomFormat();
            refreshLayout.setRefreshing(false);
          }
        });

    lvCalle.setOnScrollListener(this);
    lvCalle.setOnItemClickListener(this);

    setHasOptionsMenu(true);
    return view;
  }
예제 #16
0
  public void setupUI(View view, final Context context2) {

    // Set up touch listener for non-text box views to hide keyboard.
    if (!(view instanceof EditText)) {

      view.setOnTouchListener(
          new OnTouchListener() {

            public boolean onTouch(View v, MotionEvent event) {
              hideSoftKeyboard(context2);
              return false;
            }
          });
    }

    // If a layout container, iterate over children and seed recursion.
    if (view instanceof ViewGroup) {

      for (int i = 0; i < ((ViewGroup) view).getChildCount(); i++) {

        View innerView = ((ViewGroup) view).getChildAt(i);

        setupUI(innerView, context2);
      }
    }
  }
예제 #17
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    container = findViewById(R.id.container);

    mallarmeView = new MallarmeView(this);

    container.setOnTouchListener(
        new View.OnTouchListener() {
          @Override
          public boolean onTouch(View v, MotionEvent event) {

            switch (event.getAction()) {
              case MotionEvent.ACTION_DOWN:
                Utils.setFullScreen(MainActivity.this, true);
                mallarmeView.fadeIn();

                return true;
              case MotionEvent.ACTION_UP:
                Utils.setFullScreen(MainActivity.this, false);
                mallarmeView.fadeOut();

                return true;
              default:
                break;
            }

            return false;
          }
        });
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.game_fragment, container, false);
    box = v.findViewById(R.id.box);
    box.setOnTouchListener(
        new View.OnTouchListener() {
          @Override
          public boolean onTouch(View v, MotionEvent event) {
            if (event.getAction() == MotionEvent.ACTION_DOWN) {
              // Move to the next level.
              DbxRecord record = getRecord();
              record.set("level", record.getDouble("level") + 1);
              try {
                mDatastore.sync();
              } catch (DbxException e) {
                e.printStackTrace();
              }
              updateLevel();
              return true;
            } else {
              return false;
            }
          }
        });

    Button reset = (Button) v.findViewById(R.id.reset);
    reset.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            // Move back to level 0.
            getRecord().set("level", 0.0);
            try {
              mDatastore.sync();
            } catch (DbxException e) {
              e.printStackTrace();
            }
            updateLevel();
          }
        });

    Button logout = (Button) v.findViewById(R.id.logout);
    logout.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            // Stop listening for changes and close the datastore.
            if (mDatastore != null) {
              mDatastore.removeSyncStatusListener(mDatastoreListener);
              mDatastore.close();
              mDatastore = null;
            }
            // "Unlink" the account, which will cause the login screen to be displayed again.
            mAccountManager.unlink();
          }
        });

    return v;
  }
예제 #19
0
  private void initFloatingWindow() {
    mWindowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
    mWindow = PolicyManager.makeNewWindow(mContext);
    mWindow.setWindowManager(mWindowManager, null, null);
    mWindow.requestFeature(Window.FEATURE_NO_TITLE);
    mDecor = mWindow.getDecorView();

    /// M: Get measured height of window and update. @{
    ViewTreeObserver vto = mDecor.getViewTreeObserver();
    vto.addOnPreDrawListener(
        new ViewTreeObserver.OnPreDrawListener() {
          public boolean onPreDraw() {
            mHeight = mDecor.getMeasuredHeight();
            updateFloatingWindowLayout();
            mWindowManager.updateViewLayout(mDecor, mDecorLayoutParams);
            mDecor.getViewTreeObserver().removeOnPreDrawListener(this);
            return true;
          }
        });
    /// @}

    mDecor.setOnTouchListener(mTouchListener);
    mWindow.setContentView(this);
    mWindow.setBackgroundDrawableResource(android.R.color.transparent);

    // While the media controller is up, the volume control keys should
    // affect the media stream type
    mWindow.setVolumeControlStream(AudioManager.STREAM_MUSIC);

    setFocusable(true);
    setFocusableInTouchMode(true);
    setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS);
    requestFocus();
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    View containerView = inflater.inflate(R.layout.fragment_notification, container, false);

    Bundle args = getArguments();
    mTitle = args.getString(EXTRA_TITLE);
    mSubtitle = args.getString(EXTRA_SUBTITLE);

    // Get UI elements.
    titleView = (TextView) containerView.findViewById(R.id.title);
    subtitleView = (TextView) containerView.findViewById(R.id.subtitle);

    if (mTitle == null) {
      titleView.setVisibility(View.GONE);
    } else {
      titleView.setVisibility(View.VISIBLE);
      titleView.setText(mTitle);
    }

    if (mSubtitle == null) {
      subtitleView.setVisibility(View.GONE);
    } else {
      subtitleView.setVisibility(View.VISIBLE);
      subtitleView.setText(mSubtitle);
    }

    containerView.setOnTouchListener(
        new SwipeDismissViewTouchListener(containerView, mDismissCallback));

    containerView.setOnClickListener(mOnClickListener);

    return containerView;
  }
예제 #21
0
  /**
   * Called when the activity is first created.
   *
   * @param savedInstanceState the saved instance state
   */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    // Add swipe detectors to everything that needs it.
    int swipedImgIds[] = {
      R.id.TopClothesView,
      R.id.BottomClothesView,
      R.id.OvercoatClothesView,
      R.id.mainWeatherImageView,
      R.id.firstNextPeriodLayout,
      R.id.secondNextPeriodLayout,
      R.id.thirdNextPeriodLayout,
      R.id.fourthNextPeriodLayout
    };
    for (int id : swipedImgIds) {
      View view = findViewById(id);
      GestureDetector mGestureDetector = new GestureDetector(new MainPanelGestureDetector(view));
      MyTouchListener mGestureListener = new MyTouchListener(mGestureDetector);

      view.setOnTouchListener(mGestureListener);
    }

    // Initialize providers and indexes.
    weatherProvider = new DummyProvider();
    suggestionsEngine = new SuggestionsEngine(getApplicationContext());
    currentPeriod = 0;
    clothesSuggestion = new ClothesSuggestion[4];
  }
 private void showPop() {
   LayoutInflater layoutInflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
   popupWindowView = layoutInflater.inflate(R.layout.popup_addyf, null); // 外层
   popupWindowView.setOnKeyListener(
       new OnKeyListener() {
         @Override
         public boolean onKey(View v, int keyCode, KeyEvent event) {
           if ((keyCode == KeyEvent.KEYCODE_MENU) && (popupWindow.isShowing())) {
             popupWindow.dismiss();
             return true;
           }
           return false;
         }
       });
   popupWindowView.setOnTouchListener(
       new OnTouchListener() {
         @Override
         public boolean onTouch(View v, MotionEvent event) {
           if (popupWindow.isShowing()) {
             popupWindow.dismiss();
           }
           return false;
         }
       });
   popupWindow =
       new PopupWindow(popupWindowView, LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT, true);
   popupWindow.showAsDropDown(imgbtn_add, 0, 0);
   popupWindow.setOutsideTouchable(true);
   popupWindowView.findViewById(R.id.btn_qmc).setOnClickListener(this);
   popupWindowView.findViewById(R.id.btn_xmcbc).setOnClickListener(this);
 }
예제 #23
0
  @Override
  public void onViewCreated(View view, Bundle savedInstanceState) {
    // View-IDs fuer die Textfelder einer Bestellung des aktuellen Kunden
    final TextView kundeTxt = (TextView) view.findViewById(R.id.bestellungen_kunde_id);
    kundeTxt.setText(getString(R.string.k_bestellungen_kunde_id, kunde.id));
    Log.v(LOG_TAG, "!!! KundeTxt Text zugewiesen !!!");
    txtBestellungId = (TextView) view.findViewById(R.id.bestellung_id);
    txtBestellungDatum = (TextView) view.findViewById(R.id.datum);

    final Activity activity = getActivity();
    if (Main.class.equals(activity.getClass())) {
      Log.v(LOG_TAG, "!!! Main.class equals activity Class !!!");
      Main main = (Main) activity;
      kundeServiceBinder = main.getKundeServiceBinder();
      bestellungServiceBinder = main.getBestellungServiceBinder();
    } else if (KundenListe.class.equals(activity.getClass())) {
      KundenListe kundenListe = (KundenListe) activity;
      kundeServiceBinder = kundenListe.getKundeServiceBinder();
      bestellungServiceBinder = kundenListe.getBestellungServiceBinder();
    } else {
      Log.e(LOG_TAG, "Activity " + activity.getClass().getSimpleName() + " nicht beruecksichtigt.");
      return;
    }

    Log.v(LOG_TAG, "!!! 1 !!!");
    bestellungenIds = kundeServiceBinder.sucheBestellungenIdsByKundeId(kunde.id, view.getContext());
    if (bestellungenIds == null || bestellungenIds.isEmpty()) {
      kundeTxt.setText(getString(R.string.k_keine_bestellungen, kunde.id));
    } else {
      // ListView mit den IDs der Bestellungen aufbauen
      Log.v(LOG_TAG, "!!! List View: bestellungen-liste !!!");
      final ListView listView = (ListView) view.findViewById(R.id.bestellungen_liste);
      int anzahl = bestellungenIds.size();
      bestellungen = new ArrayList<Bestellung>(anzahl);
      final String[] values = new String[anzahl];
      for (int i = 0; i < anzahl; i++) {
        bestellungen.add(null);
        values[i] = getString(R.string.k_kunde_bestellung_id, bestellungenIds.get(anzahl - i - 1));
        Log.d(LOG_TAG, values[i]);
      }
      final ArrayAdapter<String> adapter =
          new ArrayAdapter<String>(
              view.getContext(), android.R.layout.simple_list_item_1, android.R.id.text1, values);
      // Items in der Liste duerfen angeklickt werden
      listView.setAdapter(adapter);
      listView.setOnItemClickListener(this);

      // Die neueste Bestellung visualisieren
      Log.v(LOG_TAG, " !!! Vor activateBestellung !!!");
      Log.v(LOG_TAG, "bestellungenIds: " + bestellungenIds.toString());
      activateBestellung(0, view);
    }

    final OnGestureListener onGestureListener = new WischenListener(activity);
    gestureDetector =
        new GestureDetector(
            activity, onGestureListener); // Context und OnGestureListener als Argumente
    view.setOnTouchListener(this);
  }
예제 #24
0
  public MaterialSection(Context ctx, boolean hasIcon, boolean hasRippleSupport, int target) {
    rippleSupport = hasRippleSupport;
    isCustom = false;
    if (rippleAnimationSupport()) {
      // section with ripple effect
      if (!isCustom) {
        if (!hasIcon) {
          view =
              LayoutInflater.from(ctx)
                  .inflate(R.layout.layout_material_section_ripple_custom, null);

          text = (TextView) view.findViewById(R.id.section_text);
          notifications = (TextView) view.findViewById(R.id.section_notification);
          ripple = (RevealColorView) view.findViewById(R.id.section_ripple);
        } else {
          view =
              LayoutInflater.from(ctx).inflate(R.layout.layout_material_section_icon_ripple, null);

          text = (TextView) view.findViewById(R.id.section_text);
          icon = (ImageView) view.findViewById(R.id.section_icon);
          notifications = (TextView) view.findViewById(R.id.section_notification);
          ripple = (RevealColorView) view.findViewById(R.id.section_ripple);
        }
      } else {
        view = LayoutInflater.from(ctx).inflate(R.layout.layout_material_section_ripple, null);

        text = (TextView) view.findViewById(R.id.section_text);
        notifications = (TextView) view.findViewById(R.id.section_notification);
        ripple = (RevealColorView) view.findViewById(R.id.section_ripple);
      }

    } else {
      if (!hasIcon) {
        view = LayoutInflater.from(ctx).inflate(R.layout.layout_material_section, null);

        text = (TextView) view.findViewById(R.id.section_text);
        notifications = (TextView) view.findViewById(R.id.section_notification);
      } else {
        view = LayoutInflater.from(ctx).inflate(R.layout.layout_material_section_icon, null);

        text = (TextView) view.findViewById(R.id.section_text);
        icon = (ImageView) view.findViewById(R.id.section_icon);
        notifications = (TextView) view.findViewById(R.id.section_notification);
      }
    }

    view.setOnTouchListener(this);

    colorPressed = Color.parseColor("#16000000");
    colorUnpressed = Color.parseColor("#00FFFFFF");
    colorSelected = Color.parseColor("#0A000000");
    iconColor = Color.BLACK;
    isSelected = false;
    sectionColor = false;
    hasColorDark = false;
    touchable = true;
    targetType = target;
    numberNotifications = 0;
  }
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   View rootView = getActivity().getWindow().getDecorView().findViewById(android.R.id.content);
   rootView.setOnTouchListener(
       new GestureHandler(getActivity(), VideoActivity.class, EmailActivity.class));
   index = 0;
 }
예제 #26
0
  @Override
  public View getView(final int position, View convertView, ViewGroup parent) {

    View view = createViewFromResource(position, convertView, parent, layoutid);
    view.setBackgroundDrawable(GameCzDialog.getScCzBg());
    view.setOnTouchListener(
        new OnTouchListener() {

          public boolean onTouch(View v, MotionEvent event) {

            if (currentView != null && currentView != v) {
              // currentView.setBackgroundDrawable(GameCzDialog.getScCzBg());
              ImageView iv = (ImageView) currentView.findViewById(R.id.cz_img);
              if (iv != null) {
                iv.setBackgroundResource(0);
              }
            }
            currentView = (ViewGroup) v;
            // currentView.setBackgroundDrawable(GameCzDialog.getScCzBg());
            if (event.getAction() == 0) {
              startx = event.getX();
              starty = event.getY();
              ImageView iv = (ImageView) currentView.findViewById(R.id.cz_img);
              if (iv != null) {
                iv.setBackgroundDrawable(GameCzDialog.getScCzSel());
              }

            } else if (event.getAction() == 1) {
              ImageView iv = (ImageView) currentView.findViewById(R.id.cz_img);
              if (iv != null) {
                iv.setBackgroundResource(0);
              }
              if (call != null) {
                call.CallBack(position);
              }
            } else {
              float temp = event.getX() - startx;
              if (temp > 15 || temp < -15) {

                ImageView iv = (ImageView) currentView.findViewById(R.id.cz_img);
                if (iv != null) {
                  iv.setBackgroundResource(0);
                }
              } else {
                temp = event.getY() - starty;
                if (temp > 15 || temp < -15) {
                  ImageView iv = (ImageView) currentView.findViewById(R.id.cz_img);
                  if (iv != null) {
                    iv.setBackgroundResource(0);
                  }
                }
              }
            }
            return true;
          }
        });
    return view;
  }
예제 #27
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.player_activity);
    View root = findViewById(R.id.root);
    root.setOnTouchListener(
        new OnTouchListener() {
          @Override
          public boolean onTouch(View view, MotionEvent motionEvent) {
            if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
              toggleControlsVisibility();
            } else if (motionEvent.getAction() == MotionEvent.ACTION_UP) {
              view.performClick();
            }
            return true;
          }
        });
    root.setOnKeyListener(
        new OnKeyListener() {
          @Override
          public boolean onKey(View v, int keyCode, KeyEvent event) {
            if (keyCode == KeyEvent.KEYCODE_BACK
                || keyCode == KeyEvent.KEYCODE_ESCAPE
                || keyCode == KeyEvent.KEYCODE_MENU) {
              return false;
            }
            return mediaController.dispatchKeyEvent(event);
          }
        });

    shutterView = findViewById(R.id.shutter);
    debugRootView = findViewById(R.id.controls_root);

    videoFrame = (AspectRatioFrameLayout) findViewById(R.id.video_frame);
    surfaceView = (SurfaceView) findViewById(R.id.surface_view);
    surfaceView.getHolder().addCallback(this);
    debugTextView = (TextView) findViewById(R.id.debug_text_view);

    playerStateTextView = (TextView) findViewById(R.id.player_state_view);
    subtitleLayout = (SubtitleLayout) findViewById(R.id.subtitles);

    mediaController = new MediaController(this);
    mediaController.setAnchorView(root);
    retryButton = (Button) findViewById(R.id.retry_button);
    retryButton.setOnClickListener(this);
    videoButton = (Button) findViewById(R.id.video_controls);
    audioButton = (Button) findViewById(R.id.audio_controls);
    textButton = (Button) findViewById(R.id.text_controls);

    CookieHandler currentHandler = CookieHandler.getDefault();
    if (currentHandler != defaultCookieManager) {
      CookieHandler.setDefault(defaultCookieManager);
    }

    audioCapabilitiesReceiver = new AudioCapabilitiesReceiver(this, this);
    audioCapabilitiesReceiver.register();
  }
예제 #28
0
    public View getView(final int position, View convertView, ViewGroup viewGroup) {
      ViewHolder holder = null;

      if (convertView == null) {
        holder = new ViewHolder();
        convertView = mInflater.inflate(R.layout.pay, null);
        holder.payMethodName = (TextView) convertView.findViewById(R.id.payMethodName);
        holder.fee = (TextView) convertView.findViewById(R.id.fee);
        holder.buttonDelete = (Button) convertView.findViewById(R.id.buttonDelete);
        holder.fee.setTextColor(holder.payMethodName.getTextColors().getDefaultColor());
        holder.fee.setGravity(Gravity.CENTER);
        convertView.setTag(holder);

      } else {
        holder = (ViewHolder) convertView.getTag();
      }

      final Integer[] paymentIDs = grandpa.mapPay.keySet().toArray(new Integer[] {});
      Object[] objs = grandpa.mapPaymentMaster.get(paymentIDs[position]);

      holder.payMethodName.setText(
          (String)
              objs[
                  DatabaseHelper.getColumnIndex(PaymentMaster.COLUMN_NAME, PaymentMaster.COLUMNS)]);
      holder.fee.setText(grandpa.mapPay.get(paymentIDs[position]).toString());

      holder.buttonDelete.setOnClickListener(
          new View.OnClickListener() {
            public void onClick(View v) {
              grandpa.mapPay.remove(paymentIDs[position]);
              v.setVisibility(View.GONE);
              parent.listViewNotifyDataSetChanged(R.id.listViewPay);
              parent.setTotal();
              parent.setButtonPay();
            }
          });

      convertView.setOnTouchListener(
          new OnTouchListener() {

            public boolean onTouch(View v, MotionEvent event) {
              switch (event.getAction()) {
                case MotionEvent.ACTION_UP:
                  positionCurrent = -1;
                  viewCurrent = null;
                  break;
                case MotionEvent.ACTION_DOWN:
                  positionCurrent = position;
                  viewCurrent = v;
                  break;
              }

              return false;
            }
          });

      return convertView;
    }
  /** Set the top view and add the fling listener */
  private void setTopView() {
    if (getChildCount() > 0) {

      mActiveCard = getChildAt(LAST_OBJECT_IN_STACK);
      if (mActiveCard != null) {

        flingCardListener =
            new FlingCardListener(
                this,
                mActiveCard,
                mAdapter.getItem(0),
                ROTATION_DEGREES,
                new FlingCardListener.FlingListener() {

                  @Override
                  public void onCardExited() {
                    mActiveCard = null;
                    System.out.println(" onCardExited ");
                    mFlingListener.removeFirstObjectInAdapter();
                  }

                  @Override
                  public void leftExit(Object dataObject) {
                    mFlingListener.onLeftCardExit(dataObject);
                  }

                  @Override
                  public void rightExit(Object dataObject) {
                    mFlingListener.onRightCardExit(dataObject);
                  }

                  @Override
                  public void onClick(Object dataObject) {
                    if (mOnItemClickListener != null)
                      mOnItemClickListener.onItemClicked(0, dataObject);
                  }

                  @Override
                  public void onScroll(float scrollProgressPercent) {
                    mFlingListener.onScroll(scrollProgressPercent);
                  }

                  @Override
                  public void onAbove(Object dataObject) {
                    mFlingListener.onAboveCard(dataObject);
                  }

                  @Override
                  public void onBelow(Object dataObject) {
                    mFlingListener.onBelowCard(dataObject);
                  }
                });

        mActiveCard.setOnTouchListener(flingCardListener);
      }
    }
  }
예제 #30
0
  public ShowShare(Activity context) {
    super(context);
    LayoutInflater inflater =
        (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    mMenuView = inflater.inflate(R.layout.share_alert, null);
    btn_qq = (ImageView) mMenuView.findViewById(R.id.btn_qq);
    btn_weibo = (ImageView) mMenuView.findViewById(R.id.btn_sinaweibo);
    btn_weixin = (ImageView) mMenuView.findViewById(R.id.btn_wechat);
    btn_friends = (ImageView) mMenuView.findViewById(R.id.btn_wechatmoments);

    //        btn_cancel.setOnClickListener(new View.OnClickListener() {
    //
    //            public void onClick(View v) {
    //
    //                dismiss();
    //            }
    //        });
    // 设置按钮监听
    //        btn_qq.setOnClickListener(itemsOnClick);
    //        btn_weibo.setOnClickListener(itemsOnClick);

    this.setContentView(mMenuView);

    this.setWidth(LayoutParams.FILL_PARENT);

    this.setHeight(LayoutParams.WRAP_CONTENT);

    this.setFocusable(true);

    this.setAnimationStyle(R.style.AnimBottom);

    ColorDrawable dw = new ColorDrawable(0xb0000000);
    // 设置SelectPicPopupWindow弹出窗体的背景
    this.setBackgroundDrawable(dw);
    // mMenuView添加OnTouchListener监听判断获取触屏位置如果在选择框外面则销毁弹出框
    mMenuView.setOnTouchListener(
        new OnTouchListener() {

          public boolean onTouch(View v, MotionEvent event) {

            int height = mMenuView.findViewById(R.id.pop_layout).getTop();
            int y = (int) event.getY();
            if (event.getAction() == MotionEvent.ACTION_UP) {
              if (y < height) {
                dismiss();
              }
            }
            return true;
          }
        });

    btn_weibo.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {}
        });
  }