Search in sources :

Example 1 with VideosCursorAdapter

use of com.zype.android.ui.main.fragments.videos.VideosCursorAdapter in project zype-android by zype.

the class SearchActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_search);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    if (getIntent() != null) {
        searchString = getIntent().getStringExtra(BundleConstants.SEARCH_STRING);
    } else {
        throw new IllegalStateException("VideoId can not be empty");
    }
    searchProgress = (ProgressBar) findViewById(R.id.search_progress);
    tvSearchField = (TextView) findViewById(R.id.search_field);
    tvSearchField.setText(searchString);
    viewSearch = (SearchView) findViewById(R.id.viewSearch);
    viewSearch.setOnQueryTextListener(new SearchView.OnQueryTextListener() {

        @Override
        public boolean onQueryTextSubmit(String query) {
            startSearch();
            return false;
        }

        @Override
        public boolean onQueryTextChange(String newText) {
            return false;
        }
    });
    viewSearch.setOnCloseListener(new SearchView.OnCloseListener() {

        @Override
        public boolean onClose() {
            return false;
        }
    });
    viewSearch.setQuery(searchString, false);
    viewSearch.setIconified(false);
    viewSearch.setFocusable(false);
    viewSearch.clearFocus();
    // tvSearchField.setOnKeyListener(new View.OnKeyListener() {
    // 
    // @Override
    // public boolean onKey(View v, int keyCode, KeyEvent event) {
    // if (event.getAction() == KeyEvent.ACTION_DOWN
    // && event.getKeyCode() == KeyEvent.KEYCODE_ENTER) {
    // startSearch();
    // return true;
    // }
    // 
    // return false;
    // }
    // });
    // tvSearchField.setOnEditorActionListener(new TextView.OnEditorActionListener() {
    // @Override
    // public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
    // if (actionId == EditorInfo.IME_ACTION_SEARCH) {
    // startSearch();
    // return true;
    // }
    // return false;
    // }
    // });
    mAdapter = new VideosCursorAdapter(this, CursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER, this, this);
    ListView mListView = (ListView) findViewById(R.id.list_search);
    mListView.setEmptyView(findViewById(R.id.empty));
    mListView.setAdapter(mAdapter);
    mListView.setOnItemClickListener(this);
    tabHost = (TabHost) findViewById(android.R.id.tabhost);
    tabHost.setup();
    TabHost.TabSpec tabSpec = tabHost.newTabSpec("tagAll");
    tabSpec.setIndicator(getString(R.string.title_tab_search_all));
    tabSpec.setContent(R.id.list_search);
    tabHost.addTab(tabSpec);
    tabSpec = tabHost.newTabSpec("tagGuests");
    tabSpec.setIndicator(getString(R.string.title_tab_search_guests));
    tabSpec.setContent(R.id.list_search);
    tabHost.addTab(tabSpec);
    tabSpec = tabHost.newTabSpec("tagTags");
    tabSpec.setIndicator(getString(R.string.title_tab_search_tags));
    tabSpec.setContent(R.id.list_search);
    tabHost.addTab(tabSpec);
    tabHost.setCurrentTabByTag("tagAll");
    setTabColors(tabHost);
    tabHost.setOnTabChangedListener(new TabHost.OnTabChangeListener() {

        @Override
        public void onTabChanged(String arg0) {
            setTabColors(tabHost);
        }
    });
    TabWidget tabs = (TabWidget) findViewById(android.R.id.tabs);
    tabs.setVisibility(GONE);
    requestSearchResult(1, searchString);
    if (ZypeConfiguration.isNativeSubscriptionEnabled(this)) {
        new BillingManager(this, this);
    }
}
Also used : TabHost(android.widget.TabHost) VideosCursorAdapter(com.zype.android.ui.main.fragments.videos.VideosCursorAdapter) BillingManager(com.zype.android.Billing.BillingManager) TabWidget(android.widget.TabWidget) ListView(android.widget.ListView) SearchView(android.support.v7.widget.SearchView) Toolbar(android.support.v7.widget.Toolbar)

Example 2 with VideosCursorAdapter

use of com.zype.android.ui.main.fragments.videos.VideosCursorAdapter in project zype-android by zype.

the class MyLibraryFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);
    adapter = new VideosCursorAdapter(getActivity(), CursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER, onVideoItemActionListener, onLoginListener);
    View view = inflater.inflate(R.layout.fragment_my_library, null);
    listMyLibrary = (ListView) view.findViewById(R.id.listMyLibrary);
    listMyLibrary.setEmptyView(textEmpty);
    listMyLibrary.setOnItemClickListener(this);
    listMyLibrary.setAdapter(adapter);
    progressBar = (ProgressBar) view.findViewById(R.id.progressBar);
    layoutSignIn = (RelativeLayout) view.findViewById(R.id.layoutSignIn);
    Button buttonSignIn = (Button) view.findViewById(R.id.buttonSighIn);
    buttonSignIn.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            onLoginListener.onRequestLogin();
        }
    });
    textEmpty = (TextView) view.findViewById(R.id.empty);
    prefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
    prefListener = new SharedPreferences.OnSharedPreferenceChangeListener() {

        public void onSharedPreferenceChanged(SharedPreferences prefs, String key) {
            updateViews();
            updateTextEmpty();
        }
    };
    prefs.registerOnSharedPreferenceChangeListener(prefListener);
    updateViews();
    return view;
}
Also used : Button(android.widget.Button) SharedPreferences(android.content.SharedPreferences) VideosCursorAdapter(com.zype.android.ui.main.fragments.videos.VideosCursorAdapter) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) ListView(android.widget.ListView)

Example 3 with VideosCursorAdapter

use of com.zype.android.ui.main.fragments.videos.VideosCursorAdapter in project zype-android by zype.

the class AbstractTabFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);
    mAdapter = new VideosCursorAdapter(getActivity(), CursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER, mOnVideoItemActionListener, mOnLoginListener);
    View view = inflater.inflate(R.layout.fragment_base_tab_list, null);
    mListView = (ListView) view.findViewById(R.id.list_tab);
    mEmpty = (TextView) view.findViewById(R.id.empty);
    mListView.setEmptyView(mEmpty);
    mListView.setOnItemClickListener(this);
    mListView.setAdapter(mAdapter);
    tabHost = (TabHost) view.findViewById(android.R.id.tabhost);
    tabHost.setup();
    TabHost.TabSpec tabSpec = tabHost.newTabSpec("tag1");
    tabSpec.setIndicator(getString(R.string.title_tab_search_all));
    tabSpec.setContent(R.id.list_tab);
    tabHost.addTab(tabSpec);
    tabSpec = tabHost.newTabSpec("tag2");
    tabSpec.setIndicator(getString(R.string.title_tab_search_audio));
    tabSpec.setContent(R.id.list_tab);
    tabHost.addTab(tabSpec);
    tabSpec = tabHost.newTabSpec("tag3");
    tabSpec.setIndicator(getString(R.string.title_tab_search_video));
    tabSpec.setContent(R.id.list_tab);
    tabHost.addTab(tabSpec);
    tabHost.setCurrentTabByTag("tag1");
    setTabColors(tabHost);
    tabHost.setOnTabChangedListener(new TabHost.OnTabChangeListener() {

        @Override
        public void onTabChanged(String arg0) {
            setTabColors(tabHost);
            startLoadCursors(selectedTab);
        }
    });
    return view;
}
Also used : TabHost(android.widget.TabHost) VideosCursorAdapter(com.zype.android.ui.main.fragments.videos.VideosCursorAdapter) TextView(android.widget.TextView) View(android.view.View) ListView(android.widget.ListView)

Example 4 with VideosCursorAdapter

use of com.zype.android.ui.main.fragments.videos.VideosCursorAdapter in project zype-android by zype.

the class FavoritesFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);
    adapter = new VideosCursorAdapter(getActivity(), CursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER, onVideoItemActionListener, onLoginListener);
    View view = inflater.inflate(R.layout.fragment_favorites, null);
    listFavorites = (ListView) view.findViewById(R.id.listFavorites);
    textEmpty = (TextView) view.findViewById(R.id.empty);
    listFavorites.setEmptyView(textEmpty);
    listFavorites.setOnItemClickListener(this);
    listFavorites.setAdapter(adapter);
    prefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
    prefListener = new SharedPreferences.OnSharedPreferenceChangeListener() {

        public void onSharedPreferenceChanged(SharedPreferences prefs, String key) {
            updateTextEmpty();
        }
    };
    prefs.registerOnSharedPreferenceChangeListener(prefListener);
    return view;
}
Also used : SharedPreferences(android.content.SharedPreferences) VideosCursorAdapter(com.zype.android.ui.main.fragments.videos.VideosCursorAdapter) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) ListView(android.widget.ListView)

Aggregations

ListView (android.widget.ListView)4 VideosCursorAdapter (com.zype.android.ui.main.fragments.videos.VideosCursorAdapter)4 View (android.view.View)3 TextView (android.widget.TextView)3 SharedPreferences (android.content.SharedPreferences)2 AdapterView (android.widget.AdapterView)2 TabHost (android.widget.TabHost)2 SearchView (android.support.v7.widget.SearchView)1 Toolbar (android.support.v7.widget.Toolbar)1 Button (android.widget.Button)1 TabWidget (android.widget.TabWidget)1 BillingManager (com.zype.android.Billing.BillingManager)1