Java Code Examples for android.support.v4.view.KeyEventCompat#getKeyDispatcherState()

The following examples show how to use android.support.v4.view.KeyEventCompat#getKeyDispatcherState() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TransportMediator.java    From MiBandDecompiled with Apache License 2.0 5 votes vote down vote up
private TransportMediator(Activity activity, View view, TransportPerformer transportperformer)
{
    g = new ArrayList();
    h = new a(this);
    i = new b(this);
    Object obj;
    if (activity != null)
    {
        obj = activity;
    } else
    {
        obj = view.getContext();
    }
    a = ((Context) (obj));
    b = transportperformer;
    c = (AudioManager)a.getSystemService("audio");
    if (activity != null)
    {
        view = activity.getWindow().getDecorView();
    }
    d = view;
    e = KeyEventCompat.getKeyDispatcherState(d);
    if (android.os.Build.VERSION.SDK_INT >= 18)
    {
        f = new d(a, c, d, h);
        return;
    } else
    {
        f = null;
        return;
    }
}
 
Example 2
Source File: TransportMediator.java    From CodenameOne with GNU General Public License v2.0 5 votes vote down vote up
private TransportMediator(Activity activity, View view, TransportPerformer callbacks) {
    mContext = activity != null ? activity : view.getContext();
    mCallbacks = callbacks;
    mAudioManager = (AudioManager)mContext.getSystemService(Context.AUDIO_SERVICE);
    mView = activity != null ? activity.getWindow().getDecorView() : view;
    mDispatcherState = KeyEventCompat.getKeyDispatcherState(mView);
    if (Build.VERSION.SDK_INT >= 18) { // JellyBean MR2
        mController = new TransportMediatorJellybeanMR2(mContext, mAudioManager,
                mView, mTransportKeyCallback);
    } else {
        mController = null;
    }
}
 
Example 3
Source File: TransportMediator.java    From adt-leanback-support with Apache License 2.0 5 votes vote down vote up
private TransportMediator(Activity activity, View view, TransportPerformer callbacks) {
    mContext = activity != null ? activity : view.getContext();
    mCallbacks = callbacks;
    mAudioManager = (AudioManager)mContext.getSystemService(Context.AUDIO_SERVICE);
    mView = activity != null ? activity.getWindow().getDecorView() : view;
    mDispatcherState = KeyEventCompat.getKeyDispatcherState(mView);
    if (Build.VERSION.SDK_INT >= 18) { // JellyBean MR2
        mController = new TransportMediatorJellybeanMR2(mContext, mAudioManager,
                mView, mTransportKeyCallback);
    } else {
        mController = null;
    }
}
 
Example 4
Source File: TransportMediator.java    From android-recipes-app with Apache License 2.0 5 votes vote down vote up
private TransportMediator(Activity activity, View view, TransportPerformer callbacks) {
    mContext = activity != null ? activity : view.getContext();
    mCallbacks = callbacks;
    mAudioManager = (AudioManager)mContext.getSystemService(Context.AUDIO_SERVICE);
    mView = activity != null ? activity.getWindow().getDecorView() : view;
    mDispatcherState = KeyEventCompat.getKeyDispatcherState(mView);
    if (Build.VERSION.SDK_INT >= 18) { // JellyBean MR2
        mController = new TransportMediatorJellybeanMR2(mContext, mAudioManager,
                mView, mTransportKeyCallback);
    } else {
        mController = null;
    }
}
 
Example 5
Source File: TransportMediator.java    From V.FlyoutTest with MIT License 5 votes vote down vote up
private TransportMediator(Activity activity, View view, TransportPerformer callbacks) {
    mContext = activity != null ? activity : view.getContext();
    mCallbacks = callbacks;
    mAudioManager = (AudioManager)mContext.getSystemService(Context.AUDIO_SERVICE);
    mView = activity != null ? activity.getWindow().getDecorView() : view;
    mDispatcherState = KeyEventCompat.getKeyDispatcherState(mView);
    if (Build.VERSION.SDK_INT >= 18) { // JellyBean MR2
        mController = new TransportMediatorJellybeanMR2(mContext, mAudioManager,
                mView, mTransportKeyCallback);
    } else {
        mController = null;
    }
}
 
Example 6
Source File: TransportMediator.java    From guideshow with MIT License 5 votes vote down vote up
private TransportMediator(Activity activity, View view, TransportPerformer callbacks) {
    mContext = activity != null ? activity : view.getContext();
    mCallbacks = callbacks;
    mAudioManager = (AudioManager)mContext.getSystemService(Context.AUDIO_SERVICE);
    mView = activity != null ? activity.getWindow().getDecorView() : view;
    mDispatcherState = KeyEventCompat.getKeyDispatcherState(mView);
    if (Build.VERSION.SDK_INT >= 18) { // JellyBean MR2
        mController = new TransportMediatorJellybeanMR2(mContext, mAudioManager,
                mView, mTransportKeyCallback);
    } else {
        mController = null;
    }
}
 
Example 7
Source File: TransportMediator.java    From letv with Apache License 2.0 4 votes vote down vote up
private TransportMediator(Activity activity, View view, TransportPerformer callbacks) {
    this.mListeners = new ArrayList();
    this.mTransportKeyCallback = new TransportMediatorCallback() {
        public void handleKey(KeyEvent key) {
            key.dispatch(TransportMediator.this.mKeyEventCallback);
        }

        public void handleAudioFocusChange(int focusChange) {
            TransportMediator.this.mCallbacks.onAudioFocusChange(focusChange);
        }

        public long getPlaybackPosition() {
            return TransportMediator.this.mCallbacks.onGetCurrentPosition();
        }

        public void playbackPositionUpdate(long newPositionMs) {
            TransportMediator.this.mCallbacks.onSeekTo(newPositionMs);
        }
    };
    this.mKeyEventCallback = new Callback() {
        public boolean onKeyDown(int keyCode, KeyEvent event) {
            return TransportMediator.isMediaKey(keyCode) ? TransportMediator.this.mCallbacks.onMediaButtonDown(keyCode, event) : false;
        }

        public boolean onKeyLongPress(int keyCode, KeyEvent event) {
            return false;
        }

        public boolean onKeyUp(int keyCode, KeyEvent event) {
            return TransportMediator.isMediaKey(keyCode) ? TransportMediator.this.mCallbacks.onMediaButtonUp(keyCode, event) : false;
        }

        public boolean onKeyMultiple(int keyCode, int count, KeyEvent event) {
            return false;
        }
    };
    this.mContext = activity != null ? activity : view.getContext();
    this.mCallbacks = callbacks;
    this.mAudioManager = (AudioManager) this.mContext.getSystemService("audio");
    if (activity != null) {
        view = activity.getWindow().getDecorView();
    }
    this.mView = view;
    this.mDispatcherState = KeyEventCompat.getKeyDispatcherState(this.mView);
    if (VERSION.SDK_INT >= 18) {
        this.mController = new TransportMediatorJellybeanMR2(this.mContext, this.mAudioManager, this.mView, this.mTransportKeyCallback);
    } else {
        this.mController = null;
    }
}