Search in sources :

Example 1 with AfFragment

use of com.andframe.fragment.AfFragment in project AndFrameWorks by scwang90.

the class AfActivity method onKeyMultiple.

/**
 * 转发 onKeyMultiple 事件给 AfFragment
 */
@Override
public boolean onKeyMultiple(int keyCode, int repeatCount, KeyEvent event) {
    boolean isHandled = false;
    List<Fragment> fragments = getSupportFragmentManager().getFragments();
    fragments = fragments == null ? new ArrayList<>() : fragments;
    for (Fragment fragment : fragments) {
        if (fragment != null && fragment.getUserVisibleHint() && fragment instanceof AfFragment) {
            AfFragment afment = (AfFragment) fragment;
            isHandled = afment.onKeyMultiple(keyCode, repeatCount, event) || isHandled;
        }
    }
    return isHandled || super.onKeyMultiple(keyCode, repeatCount, event);
}
Also used : AfFragment(com.andframe.fragment.AfFragment) ArrayList(java.util.ArrayList) Fragment(android.support.v4.app.Fragment) AfFragment(com.andframe.fragment.AfFragment)

Example 2 with AfFragment

use of com.andframe.fragment.AfFragment in project AndFrameWorks by scwang90.

the class AfActivity method onKeyDown.

/**
 * 转发 onKeyDown 事件给 AfFragment
 */
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    boolean isHandled = false;
    List<Fragment> fragments = getSupportFragmentManager().getFragments();
    fragments = fragments == null ? new ArrayList<>() : fragments;
    for (Fragment fragment : fragments) {
        if (fragment != null && fragment.getUserVisibleHint() && fragment instanceof AfFragment) {
            AfFragment afment = (AfFragment) fragment;
            isHandled = afment.onKeyDown(keyCode, event) || isHandled;
        }
    }
    return isHandled || super.onKeyDown(keyCode, event);
}
Also used : AfFragment(com.andframe.fragment.AfFragment) ArrayList(java.util.ArrayList) Fragment(android.support.v4.app.Fragment) AfFragment(com.andframe.fragment.AfFragment)

Example 3 with AfFragment

use of com.andframe.fragment.AfFragment in project AndFrameWorks by scwang90.

the class AfActivity method onNewIntent.

@Override
protected void onNewIntent(Intent intent) {
    super.onNewIntent(intent);
    setIntent(intent);
    Injecter.doInjectExtra(this);
    LifeCycleInjecter.injectonNewIntent(this, intent);
    List<Fragment> fragments = getSupportFragmentManager().getFragments();
    fragments = fragments == null ? new ArrayList<>() : fragments;
    for (Fragment fragment : fragments) {
        if (fragment != null && fragment instanceof AfFragment) {
            AfFragment afment = (AfFragment) fragment;
            afment.onNewIntent(intent);
        }
    }
}
Also used : AfFragment(com.andframe.fragment.AfFragment) ArrayList(java.util.ArrayList) Fragment(android.support.v4.app.Fragment) AfFragment(com.andframe.fragment.AfFragment)

Example 4 with AfFragment

use of com.andframe.fragment.AfFragment in project AndFrameWorks by scwang90.

the class AfActivity method onBackKeyPressed.

/**
 * 转发 onBackPressed 事件给 AfFragment
 */
protected boolean onBackKeyPressed() {
    boolean isHandled = false;
    List<Fragment> fragments = getSupportFragmentManager().getFragments();
    fragments = fragments == null ? new ArrayList<>() : fragments;
    for (Fragment fragment : fragments) {
        if (fragment != null && fragment.getUserVisibleHint() && fragment instanceof AfFragment) {
            AfFragment afment = (AfFragment) fragment;
            isHandled = afment.onBackPressed() || isHandled;
        }
    }
    return isHandled;
}
Also used : AfFragment(com.andframe.fragment.AfFragment) ArrayList(java.util.ArrayList) Fragment(android.support.v4.app.Fragment) AfFragment(com.andframe.fragment.AfFragment)

Example 5 with AfFragment

use of com.andframe.fragment.AfFragment in project AndFrameWorks by scwang90.

the class AfActivity method onKeyLongPress.

/**
 * 转发 onKeyLongPress 事件给 AfFragment
 */
@Override
public boolean onKeyLongPress(int keyCode, KeyEvent event) {
    boolean isHandled = false;
    List<Fragment> fragments = getSupportFragmentManager().getFragments();
    fragments = fragments == null ? new ArrayList<>() : fragments;
    for (Fragment fragment : fragments) {
        if (fragment != null && fragment.getUserVisibleHint() && fragment instanceof AfFragment) {
            AfFragment afment = (AfFragment) fragment;
            isHandled = afment.onKeyLongPress(keyCode, event) || isHandled;
        }
    }
    return isHandled || super.onKeyLongPress(keyCode, event);
}
Also used : AfFragment(com.andframe.fragment.AfFragment) ArrayList(java.util.ArrayList) Fragment(android.support.v4.app.Fragment) AfFragment(com.andframe.fragment.AfFragment)

Aggregations

Fragment (android.support.v4.app.Fragment)7 AfFragment (com.andframe.fragment.AfFragment)7 ArrayList (java.util.ArrayList)7 SuppressLint (android.annotation.SuppressLint)2