Search in sources :

Example 6 with CardScrollView

use of com.google.android.glass.widget.CardScrollView in project gdk-apidemo-sample by googleglass.

the class EmbeddedCardLayoutActivity method onCreate.

@Override
protected void onCreate(Bundle bundle) {
    super.onCreate(bundle);
    mCardScroller = new CardScrollView(this);
    mCardScroller.setAdapter(new EmbeddedCardLayoutAdapter(this, createItems()));
    setContentView(mCardScroller);
}
Also used : CardScrollView(com.google.android.glass.widget.CardScrollView)

Example 7 with CardScrollView

use of com.google.android.glass.widget.CardScrollView in project gdk-apidemo-sample by googleglass.

the class SelectGestureDemoActivity method onCreate.

@Override
protected void onCreate(Bundle bundle) {
    super.onCreate(bundle);
    mCardScroller = new CardScrollView(this);
    mCardScroller.setAdapter(new CardAdapter(createCards(this)));
    setContentView(mCardScroller);
    setCardScrollerListener();
}
Also used : CardScrollView(com.google.android.glass.widget.CardScrollView) CardAdapter(com.google.android.glass.sample.apidemo.card.CardAdapter)

Example 8 with CardScrollView

use of com.google.android.glass.widget.CardScrollView in project gdk-apidemo-sample by googleglass.

the class VoiceMenuActivity method onCreate.

@Override
protected void onCreate(Bundle bundle) {
    super.onCreate(bundle);
    // Requests a voice menu on this activity. As for any other window feature,
    // be sure to request this before setContentView() is called
    getWindow().requestFeature(WindowUtils.FEATURE_VOICE_COMMANDS);
    // Ensure screen stays on during demo.
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    // Sets up a singleton card scroller as content of this activity. Clicking
    // on the card toggles the voice menu on and off.
    mCardScroller = new CardScrollView(this);
    mCardScroller.setAdapter(new CardAdapter(createCards(this)));
    mCardScroller.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            // Plays sound.
            AudioManager am = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
            am.playSoundEffect(Sounds.TAP);
            // Toggles voice menu. Invalidates menu to flag change.
            mVoiceMenuEnabled = !mVoiceMenuEnabled;
            getWindow().invalidatePanelMenu(WindowUtils.FEATURE_VOICE_COMMANDS);
        }
    });
    setContentView(mCardScroller);
}
Also used : AudioManager(android.media.AudioManager) CardScrollView(com.google.android.glass.widget.CardScrollView) AdapterView(android.widget.AdapterView) CardAdapter(com.google.android.glass.sample.apidemo.card.CardAdapter) CardScrollView(com.google.android.glass.widget.CardScrollView) View(android.view.View) AdapterView(android.widget.AdapterView)

Example 9 with CardScrollView

use of com.google.android.glass.widget.CardScrollView in project BarcodeEye by BarcodeEye.

the class ResultsActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Intent intent = getIntent();
    if (savedInstanceState != null) {
        readExtras(intent.getExtras());
    } else if (intent != null && intent.getExtras() != null) {
        readExtras(intent.getExtras());
    } else {
        Log.e(TAG, "No extras were present");
        finish();
        return;
    }
    if (mCardPresenters.size() == 0) {
        Log.w(TAG, "There were no cards to display");
        finish();
        return;
    }
    mCardScrollView = new CardScrollView(this);
    mCardScrollView.setAdapter(new CardScrollViewAdapter(this, mCardPresenters));
    mCardScrollView.activate();
    mCardScrollView.setOnItemClickListener(mOnItemClickListener);
    setContentView(mCardScrollView);
}
Also used : Intent(android.content.Intent) PendingIntent(android.app.PendingIntent) CardScrollView(com.google.android.glass.widget.CardScrollView)

Aggregations

CardScrollView (com.google.android.glass.widget.CardScrollView)9 CardAdapter (com.google.android.glass.sample.apidemo.card.CardAdapter)4 AudioManager (android.media.AudioManager)2 View (android.view.View)2 AdapterView (android.widget.AdapterView)2 PendingIntent (android.app.PendingIntent)1 Intent (android.content.Intent)1