protected void onCreate(Bundle paramBundle)
 {
   kkxxkk.b041E041EОО041EО(getApplicationContext());
   xkkkxk.b041E041EООО041E(getApplicationContext());
   super.onCreate(paramBundle);
   setContentView(2130968686);
   a = ((AbsListView)findViewById(2131362386));
   b = new mr(this);
   c = ((Button)findViewById(2131362385));
   c.setOnClickListener(new View.OnClickListener()
   {
     public final void onClick(View paramAnonymousView)
     {
       abp.a(HttpMetricsActivity.this);
     }
   });
   d = ((Button)findViewById(2131362381));
   d.setOnClickListener(this);
   e = ((Button)findViewById(2131362382));
   e.setOnClickListener(this);
   f = ((Button)findViewById(2131362384));
   f.setOnClickListener(this);
   g = ((Button)findViewById(2131362383));
   g.setOnClickListener(this);
   a.setAdapter(b);
   getSupportLoaderManager().initLoader$71be8de6(900, this);
 }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_item, container, false);

    // Set the adapter
    if (mAdapter != null) {
      if (isNewData()) {
        createNewAdapter();
      }
      mListView = (AbsListView) view.findViewById(android.R.id.list);
      mListView.setAdapter(mAdapter);
      // Set OnItemClickListener so we can be notified on item clicks
      mListView.setOnItemClickListener(this);
    } else {
      TextView noRestaurantView = (TextView) view.findViewById(R.id.noRestaurantView);
      noRestaurantView.setText("There aren't  any restaurants.");
    }

    FloatingActionButton addRestaurantButton =
        (FloatingActionButton) view.findViewById(R.id.addRestaurant);
    addRestaurantButton.setOnClickListener(this);
    mListener = (OnFragmentInteractionListener) getActivity();
    return view;
  }
  @Override
  public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    if (currentView == null) return;

    NodesAdapter nodesAdapter = new NodesAdapter(getActivity(), nodes, pickedFiles);

    if (viewType.equals(THUMBNAILS_VIEW)) nodesAdapter.setThumbnail(true);

    currentView.setAdapter(nodesAdapter);

    currentView.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

            // Clicked node object
            Node node = (Node) parent.getAdapter().getItem(position);

            // If node is dir then open it
            if (node.isDir) {
              getContract().showNextNode(node);
            }
          }
        });

    currentView.setVisibility(View.VISIBLE);

    // Form consists of input for name, text with extension and save button
    initForm();
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_usercontent, container, false);

    // Set the adapter
    mListView = (AbsListView) view.findViewById(android.R.id.list);
    mListView.setAdapter(mAdapter);

    // Set OnItemClickListener so we can be notified on item clicks
    mListView.setOnItemClickListener(this);

    return view;
  }
Example #5
0
  /**
   * 设置适配器,用于显示数据
   *
   * @param adapter
   */
  @TargetApi(Build.VERSION_CODES.HONEYCOMB)
  public void setAdapter(IDataAdapter<DATA> adapter) {
    if (contentView instanceof AbsListView) {
      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        ((AbsListView) contentView).setAdapter((ListAdapter) adapter);
      } else {
        try {
          Method method = contentView.getClass().getDeclaredMethod("setAdapter", ListAdapter.class);
          method.invoke(contentView, adapter);
        } catch (Exception e) {
          e.printStackTrace();
        }
      }
    } else if (contentView instanceof RecyclerView) {
      RecyclerView.Adapter<?> adapter2 = (Adapter<?>) adapter;
      final RecyclerView recyclerView = (RecyclerView) contentView;
      if (mLoadMoreView != null) {
        final HFRecyclerAdapter hfAdapter = new HFRecyclerAdapter(adapter2);
        adapter2 = hfAdapter;
        mLoadMoreView.init(
            new FootViewAdder() {

              @Override
              public View addFootView(int layoutId) {
                View view = LayoutInflater.from(context).inflate(layoutId, recyclerView, false);
                return addFootView(view);
              }

              @Override
              public View addFootView(View view) {
                hfAdapter.addFooter(view);
                return view;
              }
            },
            onClickLoadMoreListener);
      }
      recyclerView.setAdapter(adapter2);
    }
    this.dataAdapter = adapter;
  }
Example #6
0
 @Override
 public void receiveAbsListView(AbsListView listView) {
   listView.setAdapter(pcGridAdapter);
   listView.setOnItemClickListener(
       new OnItemClickListener() {
         @Override
         public void onItemClick(AdapterView<?> arg0, View arg1, int pos, long id) {
           ComputerObject computer = (ComputerObject) pcGridAdapter.getItem(pos);
           if (computer.details.reachability == ComputerDetails.Reachability.UNKNOWN
               || computer.details.reachability == ComputerDetails.Reachability.OFFLINE) {
             // Open the context menu if a PC is offline or refreshing
             openContextMenu(arg1);
           } else if (computer.details.pairState != PairState.PAIRED) {
             // Pair an unpaired machine by default
             doPair(computer.details);
           } else {
             doAppList(computer.details);
           }
         }
       });
   registerForContextMenu(listView);
 }
Example #7
0
  /** Show lines in a list dialog * */
  private void showLines() {
    LayoutInflater li = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View v = li.inflate(R.layout.list, null, false);

    TextView titleText = (TextView) v.findViewById(R.id.title);
    titleText.setVisibility(View.GONE);
    TextView helpText = (TextView) v.findViewById(R.id.help);
    helpText.setVisibility(View.GONE);

    final Dialog listDialog = new Dialog(this);
    listDialog.setTitle(getString(R.string.choose_line));
    listDialog.setContentView(v);
    listDialog.setCancelable(true);

    // Get all stations in the cursor
    final Cursor l = helper.getLinesByName("");
    startManagingCursor(l);

    // Set up a list adapter with two fields
    final CursorAdapter lAdapter =
        new SimpleCursorAdapter(
            this, R.layout.row_alt, l, fields, new int[] {R.id.itemId, R.id.itemName});

    AbsListView list = (AbsListView) listDialog.findViewById(android.R.id.list);
    list.setAdapter(lAdapter);
    list.setFastScrollEnabled(true);

    // Listen for clicks on items in the list
    list.setOnItemClickListener(
        new OnItemClickListener() {
          public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {

            // Get id of line clicked
            Cursor cursor = (Cursor) lAdapter.getItem(arg2);
            final String lineId = cursor.getString(cursor.getColumnIndex("_id"));
            final String lineName = cursor.getString(cursor.getColumnIndex("name"));
            final String lineDescA = cursor.getString(cursor.getColumnIndex("desc_a"));
            final String lineDescB = cursor.getString(cursor.getColumnIndex("desc_b"));

            // Build and show direction dialog
            AlertDialog.Builder builder = new AlertDialog.Builder(arg1.getContext());
            builder
                .setTitle(getString(R.string.choose_direction) + " " + lineName)
                .setMessage("(A) " + lineDescA + "\n\n" + "(B) " + lineDescB)
                .setPositiveButton(
                    "A",
                    new DialogInterface.OnClickListener() {
                      public void onClick(DialogInterface dialog, int which) {
                        dialog.dismiss();
                        listDialog.dismiss();
                        stopManagingCursor(l);
                        l.close();

                        lineSummary = lineDescA;

                        // Draw line markers in direction "A"
                        drawLineMarkers(lineId, "A");
                      }
                    })
                .setNegativeButton(
                    "B",
                    new DialogInterface.OnClickListener() {
                      public void onClick(DialogInterface dialog, int which) {
                        dialog.dismiss();
                        listDialog.dismiss();
                        stopManagingCursor(l);
                        l.close();

                        lineSummary = lineDescB;

                        // Draw line markers in direction "B"
                        drawLineMarkers(lineId, "B");
                      }
                    });
            AlertDialog alert = builder.create();
            alert.show();
          }
        });

    listDialog.show();
  }
Example #8
0
 /**
  * Assigns the created adapter to the given {@code AbsListView} inherited widget (ListView,
  * GridView).
  *
  * @param widget ListView, GridView, ie any widget inheriting from {@code AbsListView}
  * @return assigned adapter
  */
 public MultiAdapter into(@NonNull AbsListView widget) {
   MultiAdapter adapter = adapter();
   widget.setAdapter(adapter);
   return adapter;
 }