Android Open Source - StockTicker Suggestions Adapter






From Project

Back to project page StockTicker.

License

The source code is released under:

MIT License

If you think the Android project StockTicker listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.github.premnirmal.ticker.ui;
//from  ww  w. j  av a 2s.c  o m
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.github.premnirmal.tickerwidget.R;
import com.github.premnirmal.ticker.network.Suggestion;

import java.util.List;

/**
* Created by premnirmal on 12/21/14.
*/
class SuggestionsAdapter extends BaseAdapter {

    final List<Suggestion> suggestions;

    SuggestionsAdapter(List<Suggestion> suggestions) {
        this.suggestions = suggestions;
    }

    @Override
    public int getCount() {
        return suggestions.size();
    }

    @Override
    public Suggestion getItem(int position) {
        return suggestions.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        final Context context = parent.getContext();
        if(convertView == null) {
            convertView = new TextView(context);
        }

        final Suggestion item = getItem(position);
        ((TextView)convertView).setText(item.symbol + " (" + item.name + ")");
        final int padding = (int) context.getResources().getDimension(R.dimen.text_padding);
        convertView.setPadding(padding,padding,padding,padding);

        return convertView;
    }
}




Java Source Code List

com.github.premnirmal.ticker.AppModule.java
com.github.premnirmal.ticker.ApplicationTest.java
com.github.premnirmal.ticker.BaseActivity.java
com.github.premnirmal.ticker.StocksApp.java
com.github.premnirmal.ticker.Tools.java
com.github.premnirmal.ticker.UpdateReceiver.java
com.github.premnirmal.ticker.events.NoNetworkEvent.java
com.github.premnirmal.ticker.events.StockUpdatedEvent.java
com.github.premnirmal.ticker.model.HistoryProvider.java
com.github.premnirmal.ticker.model.IHistoryProvider.java
com.github.premnirmal.ticker.model.IStocksProvider.java
com.github.premnirmal.ticker.model.StocksProvider.java
com.github.premnirmal.ticker.model.StocksStorage.java
com.github.premnirmal.ticker.network.ApiModule.java
com.github.premnirmal.ticker.network.QueryCreator.java
com.github.premnirmal.ticker.network.QueryResults.java
com.github.premnirmal.ticker.network.Query.java
com.github.premnirmal.ticker.network.Results.java
com.github.premnirmal.ticker.network.StockQuery.java
com.github.premnirmal.ticker.network.Stock.java
com.github.premnirmal.ticker.network.StocksApi.java
com.github.premnirmal.ticker.network.StupidYahooWrapConverter.java
com.github.premnirmal.ticker.network.SuggestionApi.java
com.github.premnirmal.ticker.network.Suggestion.java
com.github.premnirmal.ticker.network.Suggestions.java
com.github.premnirmal.ticker.network.historicaldata.HistoricalData.java
com.github.premnirmal.ticker.network.historicaldata.History.java
com.github.premnirmal.ticker.network.historicaldata.Query.java
com.github.premnirmal.ticker.network.historicaldata.Quote.java
com.github.premnirmal.ticker.settings.FileExportTask.java
com.github.premnirmal.ticker.settings.FileImportTask.java
com.github.premnirmal.ticker.settings.SettingsActivity.java
com.github.premnirmal.ticker.ui.GraphActivity.java
com.github.premnirmal.ticker.ui.ParanormalActivity.java
com.github.premnirmal.ticker.ui.StocksAdapter.java
com.github.premnirmal.ticker.ui.SuggestionsAdapter.java
com.github.premnirmal.ticker.ui.TickerSelectorActivity.java
com.github.premnirmal.ticker.widget.RemoteStockProviderService.java
com.github.premnirmal.ticker.widget.RemoteStockViewAdapter.java
com.github.premnirmal.ticker.widget.StockWidget.java
com.terlici.dragndroplist.DragNDropAdapter.java
com.terlici.dragndroplist.DragNDropCursorAdapter.java
com.terlici.dragndroplist.DragNDropListView.java
com.terlici.dragndroplist.DragNDropSimpleAdapter.java