Exemplo n.º 1
0
  private void populateRatesListView() {
    if (mRatesListView == null) {
      mRatesListView = (RecyclerView) getActivity().findViewById(R.id.stockRatesList);
      mRatesListView.setLayoutManager(new LinearLayoutManager(getActivity()));
    }

    final PreferencesManager prefs = PreferencesManager.getInstance();
    List<String> ratesList = prefs.getStocksList();
    if (ratesList.isEmpty()) return;

    JSONObject ratesJson;
    try {
      ratesJson = new JSONObject(prefs.getStockData());
    } catch (JSONException ignored) {
      return;
    }

    final ExRatesGroup exRatesGroup = new ExRatesGroup("", ratesList, ratesJson);

    if (mStockItemsAdapter == null) {
      mStockItemsAdapter =
          new StockItemsAdapter(getActivity(), fromExRates(exRatesGroup.exRates), this);
    } else {
      mStockItemsAdapter.setStockItems(fromExRates(exRatesGroup.exRates));
      mStockItemsAdapter.notifyDataSetChanged();
    }
    mRatesListView.setAdapter(mStockItemsAdapter);
  }
Exemplo n.º 2
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup viewGroup, Bundle savedInstanceState) {

    View root = inflater.inflate(R.layout.fragment_log, viewGroup, false);
    RecyclerView recycler = (RecyclerView) root.findViewById(R.id.cardList);
    recycler.setAdapter(mAdapter);
    recycler.setLayoutManager(new LinearLayoutManager(getActivity()));

    initFloatingActionButton();

    // Pull-to-refresh
    SwipeRefreshLayout swipeRefreshLayout =
        (SwipeRefreshLayout) root.findViewById(R.id.refresh_layout);
    swipeRefreshLayout.setColorSchemeColors(
        ContextCompat.getColor(getActivity(), R.color.colorPrimary),
        ContextCompat.getColor(getActivity(), R.color.colorAccent),
        ContextCompat.getColor(getActivity(), R.color.colorPrimaryDark));
    swipeRefreshLayout.setOnRefreshListener(
        new SwipeRefreshLayout.OnRefreshListener() {
          @Override
          public void onRefresh() {
            mPresenter.loadLog(true);
          }
        });

    return root;
  }
Exemplo n.º 3
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View layout = inflater.inflate(R.layout.fragment_navigation_drawer, container, false);
    recyclerView = (RecyclerView) layout.findViewById(R.id.drawerList);
    adapter = new NavigationDrawerAdapter(getActivity(), ((MainActivity) getActivity()).getData());
    recyclerView.setHasFixedSize(true);
    recyclerView.setAdapter(adapter);
    recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    recyclerView.addOnItemTouchListener(
        new RecyclerTouchListener(
            getActivity(),
            recyclerView,
            new ClickListener() {

              @Override
              public void onClick(View view, final int position) {
                if ((position + 1) > ManagerFragmentId.playlistFragment()
                    && (position + 1) < ManagerFragmentId.settingFragment()) return;
                if ((position + 1) != ManagerFragmentId.settingFragment()) {
                  adapter.selectPosition(position);
                }
                drawerListener.onDrawerItemSelected(view, position);
                mDrawerLayout.closeDrawer(containerView);
              }

              @Override
              public void onLongClick(View view, int position) {}
            }));
    return layout;
  }
Exemplo n.º 4
0
  @Override
  protected void setupLayout() {
    mLayoutManager = new GridLayoutManager(getActivity(), 2);
    mAdapter = new ProductListAdapter(getActivity(), null);

    mRecyclerView.setHasFixedSize(true);
    mRecyclerView.addItemDecoration(new MarginDecoration(getActivity()));
    mRecyclerView.setLayoutManager(mLayoutManager);
    mRecyclerView.setAdapter(mAdapter);
    mRecyclerView.addOnItemTouchListener(
        new RecyclerItemClickListener(
            getActivity(),
            new RecyclerItemClickListener.OnItemClickListener() {
              @Override
              public void onItemClick(View view, int position) {
                manager.currentProductDetailed = manager.productList.get(position);
                ((BaseActivity_NavDrawer) getActivity())
                    .navigator.openNewActivity(getActivity(), new ProductDetailActivity());
                Log.d("CLICK", "Clicked on item" + position);
              }
            }));

    mSwipeRefreshLayout.setColorSchemeResources(R.color.app_primary, R.color.signal_green);
    mSwipeRefreshLayout.setOnRefreshListener(
        new SwipeRefreshLayout.OnRefreshListener() {
          @Override
          public void onRefresh() {
            makeAPICall();
          }
        });

    makeAPICall();
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // 初始化
    initDatas();
    initViews();

    mAdapter = new StaggeredAdapter(this, mDatas);
    mRecyclerView.setAdapter(mAdapter);

    // 设置RecyclerView的布局管理
    mRecyclerView.setLayoutManager(
        new StaggeredGridLayoutManager(3, StaggeredGridLayoutManager.VERTICAL));
    mAdapter.setOnItemClickListener(
        new SimpleAdapter.OnItemClickListener() {
          @Override
          public void onItemClick(View view, int position) {
            //                mAdapter.deleteData(position);
          }

          @Override
          public void onItemLongClick(View view, int position) {
            mAdapter.deleteData(position);
          }
        });
  }
Exemplo n.º 6
0
 private void setupRvMovies() {
   preloadLayoutManager = new PreloadLayoutManager(getActivity());
   adapter = new TrendingShowsAdapter(this, getActivity());
   rvMovies.setLayoutManager(preloadLayoutManager);
   rvMovies.setAdapter(adapter);
   rvMovies.addOnScrollListener(recyclerViewOnScrollListener);
 }
Exemplo n.º 7
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_estadisticas, container, false);

    RecyclerView rvHerramientas = (RecyclerView) rootView.findViewById(R.id.recycler_estadisticas);
    List<ItemEstadistica> estadisticas = new ArrayList<ItemEstadistica>();
    estadisticas.add(
        new ItemEstadistica(
            "Estadistica marcas",
            "ic_estadisticas",
            new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                ((ActivityPrincipal) getActivity()).setFlujo(new FlujoTemporizador());
                ((ActivityPrincipal) getActivity()).finish();
                ((ActivityPrincipal) getActivity())
                    .startActivity(
                        new Intent(
                            ((ActivityPrincipal) getActivity()), ActivityEstadisticaMarcas.class));
              }
            }));

    // Set adapter.
    EstadisticaAdapter adapter =
        new EstadisticaAdapter(estadisticas, (ActivityPrincipal) getActivity(), getContext());
    rvHerramientas.setAdapter(adapter);
    rvHerramientas.setLayoutManager(new LinearLayoutManager(rootView.getContext()));

    return rootView;
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.layout_activity_example);

    recyclerView = (RecyclerView) findViewById(R.id.recyclerViewActivityExample);
    recyclerView.setLayoutManager(new LinearLayoutManager(getApplicationContext()));

    list = new ArrayList<>();
    list.add(new AnimalObject("Cat", "Mammals"));
    list.add(new AnimalObject("Lion", "Mammals"));
    list.add(new AnimalObject("Dog", "Mammals"));
    list.add(new AnimalObject("Monkey", "Mammals"));
    list.add(new AnimalObject("Puma", "Mammals"));

    list.add(new AnimalObject("Albatross", "Birds"));
    list.add(new AnimalObject("Pigeon", "Birds"));

    list.add(new AnimalObject("Crabs", "Aquatic Animals"));
    list.add(new AnimalObject("Sharks", "Aquatic Animals"));

    MyAdapter myAdapter = new MyAdapter();

    sectionedRecyclerViewAdapter =
        new SectionedRecyclerViewAdapter(
            getApplicationContext(),
            R.layout.layout_list_section,
            R.id.textViewItemSection,
            myAdapter,
            this);
    sectionedRecyclerViewAdapter.setSections(list);

    recyclerView.setAdapter(sectionedRecyclerViewAdapter);
  }
 private void initData() {
   adapter = new RelativeMvRecycleAdapter(getActivity(), mvDetailBean.getRelatedVideos());
   recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
   recyclerView.setAdapter(adapter);
   recyclerView.addItemDecoration(
       new RecycleViewDivider(getActivity(), LinearLayoutManager.HORIZONTAL));
 }
 private void initView() {
   view = LayoutInflater.from(context).inflate(R.layout.floating_layout_list, null);
   RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.recycler);
   recyclerView.setLayoutManager(
       new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false));
   recyclerView.setItemAnimator(new DefaultItemAnimator());
   setupBackground();
   hideRecycler();
   recyclerView.setAdapter(adapter);
   windowManager.addView(view, rParams);
   if (floatingImage == null) floatingImage = new ImageView(context);
   setupFloatingImage(false);
   floatingImage.setOnTouchListener(
       new View.OnTouchListener() {
         @Override
         public boolean onTouch(View v, MotionEvent event) {
           gestureDetector.onTouchEvent(event);
           return FloatingHorizontalLayout.this.onTouch(v, event);
         }
       });
   windowManager.addView(floatingImage, mParams);
   onMyAppsLoader = new MyPopupAppsLoader(context, this);
   onMyAppsLoader.registerListener(3, onLoadCompleteListener);
   onMyAppsLoader.startLoading();
   animateHidden();
 }
Exemplo n.º 11
0
 private void setUpRecyclerView(Context context) {
   recyclerView = (RecyclerView) findViewById(R.id.recycler_view);
   layoutManager = new LinearLayoutManager(context);
   recyclerView.setLayoutManager(layoutManager);
   recyclerViewAdapter = new RecyclerViewAdapter(model.getContacts());
   recyclerView.setAdapter(recyclerViewAdapter);
 }
Exemplo n.º 12
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, final Bundle savedInstanceState) {
    Bus bus = ((ApplicationModified) getActivity().getApplication()).getBus();
    bus.register(this);

    View myFragment = inflater.inflate(R.layout.fragment_main, container, false);
    recList = (RecyclerView) myFragment.findViewById(R.id.card_list);
    recList.setHasFixedSize(true);
    LinearLayoutManager llm = new LinearLayoutManager(this.getActivity());
    llm.setOrientation(LinearLayoutManager.VERTICAL);
    recList.setLayoutManager(llm);
    View.OnClickListener listener =
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            String title = ((TextView) v.findViewById(R.id.title)).getText().toString();
            ((BaseActivity) getActivity()).openArticle(title);
          }
        };
    ArticlesAdapter articlesAdapter;
    if (articlesList == null) {
      articlesAdapter = new ArticlesAdapter(listener);
      new ServiceHelper().getSavedArticles(this.getActivity());
    } else {
      articlesAdapter = new ArticlesAdapter(listener, articlesList);
    }
    recList.setAdapter(articlesAdapter);
    if (noResults) {
      TextView no_Results = (TextView) myFragment.findViewById(R.id.NoResultMessage);
      no_Results.setVisibility(View.VISIBLE);
    }

    return myFragment;
  }
Exemplo n.º 13
0
  /**
   * Register a callback to be invoked when an item in the RecyclerView has been clicked and held.
   *
   * @param listener The callback that will be invoked.
   */
  public void setOnItemLongClickListener(OnItemLongClickListener listener) {
    if (!mRecyclerView.isLongClickable()) {
      mRecyclerView.setLongClickable(true);
    }

    mItemLongClickListener = listener;
  }
Exemplo n.º 14
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflating view layout
    View layout = inflater.inflate(R.layout.fragment_navigation_drawer, container, false);
    recyclerView = (RecyclerView) layout.findViewById(R.id.drawerList);

    adapter = new NavigationDrawerAdapter(getActivity(), getData());
    recyclerView.setAdapter(adapter);
    recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    recyclerView.addOnItemTouchListener(
        new RecyclerTouchListener(
            getActivity(),
            recyclerView,
            new ClickListener() {
              @Override
              public void onClick(View view, int position) {
                drawerListener.onDrawerItemSelected(view, position);
                mDrawerLayout.closeDrawer(containerView);
              }

              @Override
              public void onLongClick(View view, int position) {}
            }));

    return layout;
  }
Exemplo n.º 15
0
  private void initRecyclerViewCard() {

    mRecyclerView = (RecyclerView) v.findViewById(R.id.my_recycler_view_cardView);
    mLayoutManager = new LinearLayoutManager(getActivity().getApplicationContext());
    mRecyclerView.setHasFixedSize(true);
    mRecyclerView.setLayoutManager(mLayoutManager);
    mAdapter = new MyRecyclerViewAdapterCardView(myDataset);
    mRecyclerView.setAdapter(mAdapter);

    // Code to Add an item with default animation
    // ((MyRecyclerViewAdapter) mAdapter).addItem(obj, index);

    // Code to remove an item with default animation
    // ((MyRecyclerViewAdapter) mAdapter).deleteItem(index);
    ((MyRecyclerViewAdapterCardView) mAdapter)
        .setOnItemClickListener(
            new MyRecyclerViewAdapterCardView.MyClickListener() {
              @Override
              public void onItemClick(int position, View v) {
                ArrayList<String> temp = mLstOrders.get(position);
                intent.putStringArrayListExtra("dish", temp);
                intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                startActivity(intent);
              }
            });
  }
 private void initViews() {
   nextPageToken = "";
   if (recyclerView == null) {
     recyclerView = (RecyclerView) rootView.findViewById(R.id.recyclerview);
     progressWheel = rootView.findViewById(R.id.progress_bar);
     footerProgressWheel = rootView.findViewById(R.id.footer_progress_bar);
     LinearLayoutManager linearLayoutManager = new LinearLayoutManager(recyclerView.getContext());
     recyclerView.setLayoutManager(linearLayoutManager);
     recyclerView.addOnScrollListener(
         new EndlessScrollVideosListener(linearLayoutManager) {
           @Override
           public void onLoadMore(int currentPage) {
             MyLog.e("Current Page: (DailyMotion) " + currentPage);
             if (nextPageToken == null) {
               MyLog.e("End of loading more daily motion video");
             } else {
               loadVideoContent();
             }
           }
         });
   }
   loadVideoContent();
   navIndex = TTApplication.navIndex;
   Utils.sendTracker(Constants.SCREEN_DAILYMOTION_SEARCH_LIST);
 }
Exemplo n.º 17
0
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   AppController.getController().getBus().register(this);
   manager = new GridLayoutManager(this, getResources().getInteger(R.integer.num_row));
   recycler.setItemAnimator(new DefaultItemAnimator());
   recycler.setHasFixedSize(true);
   recycler.setLayoutManager(manager);
   mDrawerLayout.setStatusBarBackgroundColor(
       AppHelper.getPrimaryDarkColor(AppHelper.getPrimaryColor(this)));
   navigationView.setItemIconTintList(ColorStateList.valueOf(AppHelper.getAccentColor(this)));
   if (AppHelper.isDarkTheme(this)) {
     navigationView.setItemTextColor(ColorStateList.valueOf(AppHelper.getAccentColor(this)));
   }
   adapter = new AppsAdapter(this, new ArrayList<AppsModel>());
   recycler.setAdapter(adapter);
   mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
   if (navigationView != null) {
     setupDrawerContent(navigationView);
   }
   getLoaderManager().restartLoader(0, null, this);
   productsList.addAll(Arrays.asList(getResources().getStringArray(R.array.in_app_billing)));
   mHelper = new IabHelper(this, getString(R.string.base64));
   mHelper.startSetup(mPurchaseFinishedListener);
   showWhatsNew();
   countBackup();
 }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View view = inflater.inflate(R.layout.fragment_programme_list, container, false);
    FragmentActivity context = getActivity();

    rv = (RecyclerView) view.findViewById(R.id.rec_view_prog);
    LinearLayoutManager llm = new LinearLayoutManager(context);
    rv.setLayoutManager(llm);

    // Init programme list adapter
    programmes = Programme.listAll(Programme.class);
    programmeAdapter = new ProgrammeAdapter(programmes);

    // Set adapter to page view
    rv.setAdapter(programmeAdapter);

    programmeAdapter.SetOnItemClickListener(
        new ProgrammeAdapter.OnItemClickListener() {
          public void onItemClick(View v, int position) {

            // Load programme detail fragment on item click

            Programme selectedProgramme = programmes.get(position);
            mListener.onProgrammeSelected(selectedProgramme.getId());
          }
        });

    return view;
  }
Exemplo n.º 19
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_expenses_details);

    db = DatabaseHandler.getInstance(this);

    datestr = getIntent().getStringExtra("date");

    TextView heading = (TextView) findViewById(R.id.dateheading);
    heading.setText(datestr);

    mRecyclerView = (RecyclerView) findViewById(R.id.expenselist);

    mLayoutManager = new LinearLayoutManager(this);
    mRecyclerView.setLayoutManager(mLayoutManager);

    List<Expense> explist = fetchExpenses();
    List<String> expstr = new ArrayList<String>();

    for (int i = 0; i < explist.size(); i++) {
      expstr.add(explist.get(i)._place + ": " + explist.get(i)._cost);
    }

    mAdapter = new ExpenseAdapter(expstr, this);
    mRecyclerView.setAdapter(mAdapter);
  }
  private void initRecyclerView() {

    Toolbar mActionBarToolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(mActionBarToolbar);
    getSupportActionBar().setTitle("Grid view");

    recyclerView = (RecyclerView) findViewById(R.id.recycler);
    recyclerView.setLayoutManager(new GridLayoutManager(this, 2));
    adapter = new RecyclerViewAdapter(items);
    adapter.setOnItemClickListener(this);
    recyclerView.setAdapter(adapter);

    btn_grid = (Button) findViewById(R.id.btn_grid);
    btn_grid.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            if (!isSingleGrid) {
              recyclerView.setLayoutManager(new GridLayoutManager(GridViewActivity.this, 1));
              adapter.notifyDataSetChanged();
              isSingleGrid = true;
              btn_grid.setText("MULTI GRID");
            } else {
              recyclerView.setLayoutManager(new GridLayoutManager(GridViewActivity.this, 2));
              adapter.notifyDataSetChanged();
              isSingleGrid = false;
              btn_grid.setText("SINGLE GRID");
            }
          }
        });
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_tarot_feedback);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    final ActionBar ab = getSupportActionBar();
    ab.setDisplayHomeAsUpEnabled(false);

    FloatingActionButton fablogin = (FloatingActionButton) findViewById(R.id.fab_login);
    fablogin.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            if (TextUtils.isEmpty(getUsername())) {
              facebookLogin();
            } else {
              addFeedback(getUsername());
            }
          }
        });
    RecyclerView rv = (RecyclerView) findViewById(R.id.recyclerview);
    rv.setHasFixedSize(true);
    LinearLayoutManager llm = new LinearLayoutManager(this);
    llm.setOrientation(LinearLayoutManager.VERTICAL);
    rv.setLayoutManager(llm);
    updateList();
  }
Exemplo n.º 22
0
  private static View findRangeLastItem(
      RecyclerView rv,
      ItemDraggableRange range,
      int firstVisiblePosition,
      int lastVisiblePosition) {
    if (firstVisiblePosition == RecyclerView.NO_POSITION
        || lastVisiblePosition == RecyclerView.NO_POSITION) {
      return null;
    }

    View v = null;

    final int childCount = rv.getChildCount();
    for (int i = childCount - 1; i >= 0; i--) {
      final View v2 = rv.getChildAt(i);
      final RecyclerView.ViewHolder vh = rv.getChildViewHolder(v2);

      if (vh != null) {
        final int position = vh.getLayoutPosition();

        if ((position >= firstVisiblePosition)
            && (position <= lastVisiblePosition)
            && range.checkInRange(position)) {
          v = v2;
          break;
        }
      }
    }

    return v;
  }
Exemplo n.º 23
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    activateToolbar();

    mRecyclerView = (RecyclerView) findViewById(R.id.recycler_view);
    mRecyclerView.setLayoutManager(new LinearLayoutManager(this));

    flickrRecyclerViewAdapter =
        new FlickrRecyclerViewAdapter(MainActivity.this, new ArrayList<Photo>());
    mRecyclerView.setAdapter(flickrRecyclerViewAdapter);
    mRecyclerView.addOnItemTouchListener(
        new RecyclerItemClickListener(
            this,
            mRecyclerView,
            new RecyclerItemClickListener.OnItemClickListener() {
              @Override
              public void onItemClick(View view, int position) {
                Toast.makeText(MainActivity.this, "Normal tap", Toast.LENGTH_SHORT).show();
              }

              @Override
              public void onItemLongClick(View view, int position) {
                //                Toast.makeText(MainActivity.this, "Long tap",
                // Toast.LENGTH_SHORT).show();
                Intent intent = new Intent(MainActivity.this, ViewPhotoDetailsActivity.class);

                // additional data to be sent to and accessed by next activity
                intent.putExtra(PHOTO_TRANSFER, flickrRecyclerViewAdapter.getPhoto(position));
                startActivity(intent);
              }
            }));
  }
Exemplo n.º 24
0
  private void initiateView() {
    LayoutInflater.from(mContext).inflate((R.layout.search_view), this, true);

    mSearchLayout = findViewById(R.id.search_layout);
    mCardView = (CardView) mSearchLayout.findViewById(R.id.cardView);

    LinearLayoutManager layoutManager =
        new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false);
    mSuggestionsRecyclerView = (RecyclerView) mSearchLayout.findViewById(R.id.recyclerView);
    mSuggestionsRecyclerView.setLayoutManager(layoutManager);
    mSuggestionsRecyclerView.setItemAnimator(new DefaultItemAnimator());
    mSuggestionsRecyclerView.setVisibility(GONE);

    mSearchEditText = (EditText) mSearchLayout.findViewById(R.id.editText_input);
    mBackImageView = (ImageView) mSearchLayout.findViewById(R.id.imageView_arrow_back);
    mVoiceImageView = (ImageView) mSearchLayout.findViewById(R.id.imageView_mic);
    mEmptyImageView = (ImageView) mSearchLayout.findViewById(R.id.imageView_clear); // CLEAR
    mTintView = mSearchLayout.findViewById(R.id.view_transparent);
    mSeparatorView = mSearchLayout.findViewById(R.id.view_separator);

    mSearchEditText.setOnClickListener(mOnClickListener);
    mBackImageView.setOnClickListener(mOnClickListener);
    mVoiceImageView.setOnClickListener(mOnClickListener);
    mEmptyImageView.setOnClickListener(mOnClickListener);
    mTintView.setOnClickListener(mOnClickListener);
    mSeparatorView.setVisibility(GONE);

    showVoice(true);
    initSearchView();
  }
Exemplo n.º 25
0
  private void initRecyclerView() {
    bookAvailable = (ListView) findViewById(R.id.books_available_msg);
    bookAuthor = (RecyclerView) findViewById(R.id.books_author_msg);
    bookPublisher = (RecyclerView) findViewById(R.id.books_publisher_msg);

    getAvailableMsg();

    BookInfo authorMsg = new BookInfo();
    if (!BOOK_AUTHOR.equals("")) {
      authorMsg.title = BOOK_AUTHOR;
    } else {
      authorMsg.title = "没有找到";
    }
    authorMsg.subTitle = "作者";
    List<BookInfo> authorList = new ArrayList<>();
    authorList.add(authorMsg);

    BookInfo publisherMsg = new BookInfo();
    publisherMsg.title = BOOK_PUBLISHER;
    publisherMsg.subTitle = "出版社";
    List<BookInfo> publisherList = new ArrayList<>();
    publisherList.add(publisherMsg);

    BookInfoAdapter authorAdapter = new BookInfoAdapter(getApplicationContext(), authorList);
    BookInfoAdapter publisherAdapter = new BookInfoAdapter(getApplicationContext(), publisherList);

    bookAuthor.setAdapter(authorAdapter);
    bookAuthor.setLayoutManager(new LinearLayoutManager(getApplicationContext()));

    bookPublisher.setAdapter(publisherAdapter);
    bookPublisher.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
  }
  @Override
  public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    recyclerView = (RecyclerView) view.findViewById(R.id.list_recyclerViewFragment_content);
    GridLayoutManager gridLayoutManager = new GridLayoutManager(getActivity(), 4);
    gridLayoutManager.setSpanSizeLookup(
        new GridLayoutManager.SpanSizeLookup() {
          @Override
          public int getSpanSize(int position) {
            RecyclerView.Adapter adapter = recyclerView.getAdapter();
            if (adapter == null || !(adapter instanceof AssemblyRecyclerAdapter)) {
              return 1;
            }
            return ((AssemblyRecyclerAdapter) adapter).getSpanSize(position);
          }
        });
    recyclerView.setLayoutManager(gridLayoutManager);

    if (adapter != null) {
      recyclerView.setAdapter(adapter);
    } else {
      loadAppList();
    }
  }
Exemplo n.º 27
0
        @Override
        public void onClick(View v) {
          if (refreshing) return;
          Animation operatingAnim =
              AnimationUtils.loadAnimation(getActivity(), R.anim.refresh_route);
          LinearInterpolator lin = new LinearInterpolator();
          operatingAnim.setInterpolator(lin);
          if (operatingAnim != null) {
            v.startAnimation(operatingAnim);
          }

          swipeRefreshLayout.setRefreshing(true);

          mListView.post(
              new Runnable() {
                @Override
                public void run() {
                  mListView.smoothScrollToPosition(0);
                }
              });

          mListView.postDelayed(
              new Runnable() {
                @Override
                public void run() {
                  onRefresh();
                }
              },
              800);
        }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // init async handler
    asyncQuery = new MyAsyncQueryHandler(getContentResolver());

    setContentView(R.layout.activity_data_viewer);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            DialogFragment newFragment = new DataEntryFragment();
            newFragment.show(getFragmentManager(), "dataentry");
          }
        });

    RecyclerView dataViewer = (RecyclerView) findViewById(R.id.viewer);
    LinearLayoutManager llm = new LinearLayoutManager(this);
    dataViewer.setLayoutManager(llm);
    mAdapter = new DataViewerAdapter();
    dataViewer.setAdapter(mAdapter);

    // Setup the loader
    getLoaderManager().initLoader(DATA_LOADER_ID, null, this);

    setUpTempDataDisplay();
    setUpTempDataUpdate_Del();
  }
Exemplo n.º 29
0
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    View view = inflater.inflate(R.layout.fragment_restaurant, container, false);

    RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.restaurant_fragment_recycler);
    recyclerView.setHasFixedSize(true);

    recyclerView.setLayoutManager(mStaggeredGridLayoutManager);

    final RuAdapter ruAdapter = new RuAdapter(getActivity());
    recyclerView.setAdapter(ruAdapter);

    final SwipeRefreshLayout swipeRefreshLayout =
        (SwipeRefreshLayout) view.findViewById(R.id.restaurant_fragment_swipe_layout);
    swipeRefreshLayout.setOnRefreshListener(
        new SwipeRefreshLayout.OnRefreshListener() {
          @Override
          public void onRefresh() {
            Log.d(AppTags.UFRGS_MOBILE, "RU Refresh");
            ruAdapter.updateAdapter();
            swipeRefreshLayout.setRefreshing(false);
          }
        });

    return view;
  }
Exemplo n.º 30
0
 @Override
 public View onCreateView(
     LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
   View v = inflater.inflate(R.layout.fragment_history, container, false);
   swipeRefreshLayout = (SwipeRefreshLayout) v.findViewById(R.id.swipeRefesh);
   recyclerView = (RecyclerView) v.findViewById(R.id.historylist);
   swipeRefreshLayout.setColorSchemeColors(Color.RED, Color.GREEN, Color.BLUE);
   swipeRefreshLayout.setOnRefreshListener(
       new SwipeRefreshLayout.OnRefreshListener() {
         @Override
         public void onRefresh() {
           swipeRefreshLayout.postDelayed(
               new Runnable() {
                 @Override
                 public void run() {
                   getContext().startService(new Intent(getContext(), CloudSyncService.class));
                   recyclerView.setAdapter(new HistoryListAdapter(checkUpDAO.getAll()));
                   swipeRefreshLayout.setRefreshing(false);
                 }
               },
               300);
         }
       });
   LinearLayoutManager l = new LinearLayoutManager(getActivity());
   l.setOrientation(LinearLayoutManager.VERTICAL);
   recyclerView.setLayoutManager(l);
   recyclerView.setAdapter(new HistoryListAdapter(checkUpDAO.getAll()));
   return v;
 }