コード例 #1
0
  private void setupViews() {

    mSearchEditText.addTextChangedListener(mTextWatcher);
    mSearchEditText.setImeActionLabel(getString(R.string.launch), EditorInfo.IME_ACTION_GO);
    mSearchEditText.setOnEditorActionListener(
        new TextView.OnEditorActionListener() {
          @Override
          public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {

            if (actionId == EditorInfo.IME_ACTION_GO) {
              Log.d("KEYBOARD", "ACTION_GO");
              return openFirstActivity();
            }
            return false;
          }
        });
    mSearchEditText.setOnKeyListener(
        new View.OnKeyListener() {
          public boolean onKey(View v, int keyCode, KeyEvent event) {
            if ((event.getAction() == KeyEvent.ACTION_DOWN)
                && (keyCode == KeyEvent.KEYCODE_ENTER)) {
              Log.d("KEYBOARD", "ENTER_KEY");
              return openFirstActivity();
            }
            return false;
          }
        });
    registerForContextMenu(mAppListView);

    ((GridView) mAppListView)
        .setOnScrollListener(
            new AbsListView.OnScrollListener() {
              @Override
              public void onScrollStateChanged(AbsListView view, int scrollState) {
                if (scrollState != SCROLL_STATE_IDLE) {
                  hideKeyboard();
                }
              }

              @Override
              public void onScroll(
                  AbsListView view,
                  int firstVisibleItem,
                  int visibleItemCount,
                  int totalItemCount) {}
            });
    //noinspection unchecked
    mAppListView.setAdapter(mArrayAdapter);

    mAppListView.setOnItemClickListener(
        new OnItemClickListener() {

          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            if (position >= mColumnCount) {
              launchActivity(mActivityInfos.get(position - mColumnCount));
            }
          }
        });
  }
コード例 #2
0
ファイル: MQuery.java プロジェクト: georgeyang1024/mquery
 public MQuery itemClicked(OnItemClickListener listener) {
   if (view instanceof AdapterView) {
     AdapterView<?> alv = (AdapterView<?>) view;
     alv.setOnItemClickListener(listener);
   }
   return this;
 }
コード例 #3
0
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setLayoutView();
   listView.setOnItemClickListener(
       new OnItemClickListener() {
         @Override
         public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
           AdapterActivity.this.onItemClick(adapterView, view, position, id);
         }
       });
 }
コード例 #4
0
    @SuppressWarnings("unchecked")
    private View generateView(LayoutInflater inflater, ViewGroup container) {
      View layout = inflater.inflate(R.layout.live_wallpaper_list, container, false);

      mAdapter = new LiveWallpaperListAdapter(getActivity());
      AdapterView<BaseAdapter> adapterView =
          (AdapterView<BaseAdapter>) layout.findViewById(android.R.id.list);
      adapterView.setAdapter(mAdapter);
      adapterView.setOnItemClickListener(this);
      adapterView.setEmptyView(layout.findViewById(android.R.id.empty));
      return layout;
    }
コード例 #5
0
  /**
   * Binds this adapter to the given {@link AdapterView}, setting it as its adapter. This should be
   * done by construction or immediately after, before this adapter is used. This mechanism sets
   * this class as the view's adapter and permits certain functionality such as click events.
   * Without it, this class will still function as a normal {@link BaseAdapter}, but additional
   * functionality may not work. Ignore this step at your own risk.
   *
   * @param adapterView The {@link AdapterView} to bind to.
   */
  public void bindToAdapterView(AdapterView<? super BaseAdapter> adapterView) {
    if (adapterView != null) {
      adapterView.setAdapter(this);

      // Spinners don't like on item click listeners.
      // We will still delegate calls to it since you're clicking on an item to select it...
      if (!(adapterView instanceof Spinner)) {
        adapterView.setOnItemClickListener(internalItemClickListener);
      } else {
        adapterView.setOnItemSelectedListener(internalItemSelectedListener);
      }

      adapterView.setOnItemLongClickListener(internalLongClickListener);
    }
  }
コード例 #6
0
  private void afterSetContentView_() {
    {
      AdapterView<?> view = ((AdapterView<?>) findViewById(studio.lc.dotaanalysis.R.id.matches));
      if (view != null) {
        view.setOnItemClickListener(
            new OnItemClickListener() {

              @Override
              public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                matchesItemClicked(((Match) parent.getAdapter().getItem(position)));
              }
            });
      }
    }
    ((NewMatchAdapter_) matchAdapter).afterSetContentView_();
    setview();
  }
コード例 #7
0
ファイル: NewsFragment_.java プロジェクト: jimanyu/QuickNews
  @Override
  public void onViewChanged(HasViews hasViews) {
    swipeLayout =
        ((SwipeRefreshLayout) hasViews.findViewById(com.tiger.quicknews.R.id.swipe_container));
    mProgressBar = ((ProgressBar) hasViews.findViewById(com.tiger.quicknews.R.id.progressBar));
    mListView = ((SwipeListView) hasViews.findViewById(com.tiger.quicknews.R.id.listview));
    {
      AdapterView<?> view =
          ((AdapterView<?>) hasViews.findViewById(com.tiger.quicknews.R.id.listview));
      if (view != null) {
        view.setOnItemClickListener(
            new OnItemClickListener() {

              @Override
              public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                NewsFragment_.this.onItemClick(position);
              }
            });
      }
    }
    initView();
  }
コード例 #8
0
 public QmlAdapterViewListener(AdapterView view, long instance) {
   m_instance = instance;
   if (!(view instanceof Spinner)) {
     view.setOnItemClickListener(this);
   }
 }
コード例 #9
0
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_shimmer_devices_menu);
    Log.d(logName, "OnCreate");

    Intent intent = getIntent(); // gets the intent sent to the activity
    Intent intentShim =
        new Intent(
            ShimmerDevicesMenu.this, ShimmerService.class); // intent that will be used to start the
    // Shimmer service

    // binds the shimmer service to this activity
    bindService(intentShim, shimmerServiceConnection, Context.BIND_AUTO_CREATE);

    // register the shimmer receiver
    registerReceiver(shimmerReceiver, new IntentFilter("com.jpl_347E.bio_sigapp.ShimmerService"));

    // below we get all of the 'extra' information passed to us via the intent
    deviceid = intent.getIntExtra("DeviceType", -1);

    // this next part sets the title of the window to include the name of the shimmer device being
    // worked on
    if (intent.getStringExtra("LocalDeviceID") != null) {
      // set the name of the device based on the int ID we receive from the parent
      switch (deviceid) {
        case (ECG_DEVICE):
          devicename = "ECG Device";
          break;
        case (EMG_DEVICE):
          devicename = "EMG Device";
          break;
        case (GSR_DEVICE):
          devicename = "GSR Device";
          break;
        case (EEG_DEVICE):
          devicename = "EEG Device";
          break;
        default:
          devicename = "";
      } // end switch statement
      Log.d(logName, "ShimmerDevicesMenu: LocalDeviceID registered fine");

      // set the activity title based on the shimmer device being setup
      titledisplay = (TextView) findViewById(R.id.shimmerdialogtitle);
      titledisplay.setText("\t" + devicename + " Setup");

    } else Log.d(logName, "ShimmerDevicesMenu: LocalDeviceID extra entered as NULL");

    // fill the list item menu
    shimmermenu1 = (ListView) findViewById(R.id.shimmerDialogOptions);
    ArrayList<String> menuOpts = new ArrayList<String>();
    menuOpts.addAll(Arrays.asList(shimmermenuoptions));
    ArrayAdapter<String> mO = new ArrayAdapter<String>(this, R.layout.menu_options, menuOpts);
    shimmermenu1.setAdapter(mO);
    shimmermenu1.setOnItemClickListener(shimmerMenu1Listener);

    // this next section handles the settings of the two radio  buttons on the bottom of the window
    // it checks if the device is connected, if it is then the radio button will light up
    // it checks if the device is currently streaming information, if so the other radio button will
    // light up
    isdeviceconnected = (RadioButton) findViewById(R.id.rbIsConnected);
    isdevicestreaming = (RadioButton) findViewById(R.id.rbIsStreaming);
    isdevicelogging = (RadioButton) findViewById(R.id.rbIsLogging);
    // these next 7 lines initialize the radio buttons
    if (!isDeviceConnected()) {
      isdeviceconnected.setText("  " + devicename + " is not Connected");
      isdeviceconnected.setChecked(false);

      isdevicestreaming.setText("  " + devicename + " is not Streaming");
      isdevicestreaming.setChecked(false);

      isdevicelogging.setText("  " + devicename + " is not Logging");
      isdevicelogging.setChecked(false);
    } else updateInterface();
  } // end onCreate