当前位置: 首页>>代码示例>>Java>>正文


Java DrawerArrowDrawable类代码示例

本文整理汇总了Java中android.support.v7.graphics.drawable.DrawerArrowDrawable的典型用法代码示例。如果您正苦于以下问题:Java DrawerArrowDrawable类的具体用法?Java DrawerArrowDrawable怎么用?Java DrawerArrowDrawable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DrawerArrowDrawable类属于android.support.v7.graphics.drawable包,在下文中一共展示了DrawerArrowDrawable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ActionBarDrawerToggle

import android.support.v7.graphics.drawable.DrawerArrowDrawable; //导入依赖的package包/类
public ActionBarDrawerToggle(Toolbar toolbar, LockableDrawerLayout drawerLayout,
                             int openTextId, int closeTextId) {
    mDrawable = new DrawerArrowDrawable(toolbar.getContext());
    mToolbar = toolbar;
    mOpenTextId = openTextId;
    mCloseTextId = closeTextId;
    drawerLayout.addDrawerListener(this);
    toolbar.setNavigationIcon(mDrawable);
    toolbar.setNavigationContentDescription(drawerLayout.isDrawerOpen(Gravity.START)
            ? closeTextId : openTextId);
    toolbar.setNavigationOnClickListener((View view) -> {
        if (drawerLayout.isDrawerOpen(Gravity.START))
            drawerLayout.closeDrawer(Gravity.START, !drawerLayout.isCurrentlyLocked());
        else
            drawerLayout.openDrawer(Gravity.START, !drawerLayout.isCurrentlyLocked());
        drawerLayout.requestLayout();
    });
    mOpenTextId = openTextId;
    mCloseTextId = closeTextId;
}
 
开发者ID:MCMrARM,项目名称:revolution-irc,代码行数:21,代码来源:LockableDrawerLayout.java

示例2: init

import android.support.v7.graphics.drawable.DrawerArrowDrawable; //导入依赖的package包/类
private void init(final Context context, DrawerLayout drawerLayout, Toolbar toolbar, int[] gravities) {
    mDrawerLayout = drawerLayout;
    mArrowDrawable = new DrawerArrowDrawable(context);


    mToolbar = toolbar;

    if (gravities == null) {
        mGravities = new int[]{Gravity.LEFT, Gravity.TOP, Gravity.RIGHT, Gravity.BOTTOM};
    } else {
        mGravities = gravities;
    }
    mToolbar.setNavigationIcon(mArrowDrawable);
    mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            toggleDrawers();
        }
    });
}
 
开发者ID:andryr,项目名称:Harmony-Music-Player,代码行数:21,代码来源:ToolbarDrawerToggle.java

示例3: getNavigationIcon

import android.support.v7.graphics.drawable.DrawerArrowDrawable; //导入依赖的package包/类
public static Drawable getNavigationIcon(@NonNull Context context, @NonNull CandyBarApplication.NavigationIcon navigationIcon) {
    switch (navigationIcon) {
        case DEFAULT:
            return new DrawerArrowDrawable(context);
        case STYLE_1:
            return get(context, R.drawable.ic_toolbar_navigation);
        case STYLE_2:
            return get(context, R.drawable.ic_toolbar_navigation_2);
        case STYLE_3:
            return get(context, R.drawable.ic_toolbar_navigation_3);
        case STYLE_4:
            return get(context, R.drawable.ic_toolbar_navigation_4);
        default:
            return get(context, R.drawable.ic_toolbar_navigation);
    }
}
 
开发者ID:danimahardhika,项目名称:candybar-library,代码行数:17,代码来源:ConfigurationHelper.java

示例4: onCreate

import android.support.v7.graphics.drawable.DrawerArrowDrawable; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    final DrawerArrowDrawable indicator = new DrawerArrowDrawable(this);
    indicator.setColor(Color.WHITE);
    getSupportActionBar().setHomeAsUpIndicator(indicator);

    setTransformer();
    // setListener();
    drawerLayout = (DrawerLayout) findViewById(R.id.drawerLayout);
    drawerLayout.setScrimColor(Color.TRANSPARENT);
    drawerLayout.addDrawerListener(new DrawerLayout.SimpleDrawerListener() {
        @Override
        public void onDrawerSlide(View drawerView, float slideOffset) {
            if (((ViewGroup) drawerView).getChildAt(1).getId() == R.id.leftSideBar) {
                indicator.setProgress(slideOffset);
            }
        }
    });
}
 
开发者ID:mzule,项目名称:FantasySlide,代码行数:23,代码来源:MainActivity.java

示例5: openMenuDrawable

import android.support.v7.graphics.drawable.DrawerArrowDrawable; //导入依赖的package包/类
private void openMenuDrawable(final DrawerArrowDrawable drawerArrowDrawable, boolean withAnim) {
    if (withAnim) {
        ValueAnimator anim = ValueAnimator.ofFloat(0.0f, 1.0f);
        anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator animation) {

                float value = (Float) animation.getAnimatedValue();
                drawerArrowDrawable.setProgress(value);
            }
        });
        anim.setDuration(MENU_ICON_ANIM_DURATION);
        anim.start();
    } else {
        drawerArrowDrawable.setProgress(1.0f);
    }
}
 
开发者ID:JasonChow1989,项目名称:Floatingsearchview-master,代码行数:18,代码来源:FloatingSearchView.java

示例6: closeMenuDrawable

import android.support.v7.graphics.drawable.DrawerArrowDrawable; //导入依赖的package包/类
private void closeMenuDrawable(final DrawerArrowDrawable drawerArrowDrawable, boolean withAnim) {
    if (withAnim) {
        ValueAnimator anim = ValueAnimator.ofFloat(1.0f, 0.0f);
        anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator animation) {

                float value = (Float) animation.getAnimatedValue();
                drawerArrowDrawable.setProgress(value);
            }
        });
        anim.setDuration(MENU_ICON_ANIM_DURATION);
        anim.start();
    } else {
        drawerArrowDrawable.setProgress(0.0f);
    }
}
 
开发者ID:JasonChow1989,项目名称:Floatingsearchview-master,代码行数:18,代码来源:FloatingSearchView.java

示例7: bindViews

import android.support.v7.graphics.drawable.DrawerArrowDrawable; //导入依赖的package包/类
private void bindViews() {
    // Bind toolbar
    toolbar = (BreadcrumbToolbar) findViewById(R.id.toolbar);
    // We can't use setSupportActionBar()
    toolbar.setBreadcrumbToolbarListener(this);
    toolbar.setTitle(R.string.app_name);
    // Set animated drawer icon to toolbar
    DrawerArrowDrawable drawerArrow = new DrawerArrowDrawable(this);
    drawerArrow.setColor(ContextCompat.getColor(this, android.R.color.white));
    toolbar.setNavigationIcon(drawerArrow);
    getSupportFragmentManager().addOnBackStackChangedListener(this);

    // Bind drawer and toggle button
    drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    bindDrawerToggle();
    NavigationView navigationView = (NavigationView) findViewById(R.id.navigation_view);
    navigationView.setNavigationItemSelectedListener(this);
    navigationView.setCheckedItem(R.id.nav_home);

    // Bind FAB
    fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(this::openBreadCrumbFragment);
}
 
开发者ID:rok5ek,项目名称:BreadcrumbToolbar,代码行数:24,代码来源:BreadcrumbActivity.java

示例8: initToolbar

import android.support.v7.graphics.drawable.DrawerArrowDrawable; //导入依赖的package包/类
public void initToolbar(BreadcrumbToolbarItem object) {
    LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    breadcrumbScrollView = (BreadcrumbScrollView) inflater.inflate(R.layout.breadcrumb_scroll_view, null);
    breadcrumbScrollView.setBreadcrumbItemCallback(this);
    addView(breadcrumbScrollView);

    // Breadcrumb scroll view is now initialized and needs its first root element
    addItem(object);

    // Animate toolbar toggle icon if exists, set navigation back icon otherwise.
    if (getNavigationIcon() instanceof DrawerArrowDrawable) {
        animateNavigationIcon(((DrawerArrowDrawable) getNavigationIcon()), true);
    } else {
        initNavigationListener(true);
    }

    // Primary title needs to be saved
    if (getTitle() != null) {
        toolbarTitle = getTitle().toString();
    }

    // Clear toolbar title on breadcrumb before adding breadcrumbs
    setTitle("");

}
 
开发者ID:rok5ek,项目名称:BreadcrumbToolbar,代码行数:26,代码来源:BreadcrumbToolbar.java

示例9: cleanToolbar

import android.support.v7.graphics.drawable.DrawerArrowDrawable; //导入依赖的package包/类
public void cleanToolbar() {
    if (breadcrumbScrollView != null) {
        toolbarItemStack.removeAllElements();

        if (getNavigationIcon() instanceof DrawerArrowDrawable) {
            // Animate navigation icon
            animateNavigationIcon(((DrawerArrowDrawable) getNavigationIcon()), false);
        } else {
            // Navigation icon must be removed if none existed
            setNavigationIcon(null);
        }

        // Remove scroll view
        removeView(breadcrumbScrollView);
        breadcrumbScrollView = null;

        // Reset the toolbar title
        setTitle(toolbarTitle);
    }
}
 
开发者ID:rok5ek,项目名称:BreadcrumbToolbar,代码行数:21,代码来源:BreadcrumbToolbar.java

示例10: onCreate

import android.support.v7.graphics.drawable.DrawerArrowDrawable; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    gimbal = new Gimbal(this);
    gimbal.lock();
    setContentView(R.layout.activity_about);
    ButterKnife.bind(this);
    toolbar.setTitle(R.string.app_name);
    DrawerArrowDrawable drawerArrowDrawable = new DrawerArrowDrawable(this);
    drawerArrowDrawable.setProgress(1.0f);
    toolbar.setNavigationIcon(drawerArrowDrawable);
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            onBackPressed();
        }
    });
    sensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
    gravitySensor = sensorManager.getDefaultSensor(Sensor.TYPE_GRAVITY);
    GithubClient.instance().contributors(REPO_USER, REPO_NAME, contributorResponseCallback);
}
 
开发者ID:Jawnnypoo,项目名称:PhysicsLayout,代码行数:22,代码来源:AboutActivity.java

示例11: onCreate

import android.support.v7.graphics.drawable.DrawerArrowDrawable; //导入依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    String name = getIntent().getStringExtra(EXTRA_FILE_NAME);
    mPath = getIntent().getStringExtra(EXTRA_FILE_PATH);

    setContentView(R.layout.activity_view_text_file);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    DrawerArrowDrawable drawerDrawable = new DrawerArrowDrawable(this);
    drawerDrawable.setColor(getResources().getColor(android.R.color.white));
    drawerDrawable.setProgress(1f);
    toolbar.setNavigationIcon(drawerDrawable);

    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setTitle(name);
    getSupportActionBar().setHomeButtonEnabled(true);

    mContentView = (TextView) findViewById(R.id.content);
    mStorage = new Storage(this);
    byte[] bytes = mStorage.readFile(mPath);
    mContentView.setText(new String(bytes));
}
 
开发者ID:snatik,项目名称:android-storage,代码行数:24,代码来源:ViewTextActivity.java

示例12: onCreate

import android.support.v7.graphics.drawable.DrawerArrowDrawable; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // set content view
    binding = DataBindingUtil.setContentView(this, R.layout.activity_main);

    // set support action bar
    binding.toolbar.setNavigationIcon(new DrawerArrowDrawable(this));
    setSupportActionBar(binding.toolbar);

    // set moving toolbar
    helper = new MovingToolbarHelper();
    helper.bind(
            binding.nestedScrollView,
            binding.imageView,
            binding.imageContainer,
            binding.toolbarContainer,
            binding.contentContainer);
}
 
开发者ID:nutbutterfly,项目名称:android-moving-toolbar,代码行数:21,代码来源:MainActivity.java

示例13: onSearchExpanded

import android.support.v7.graphics.drawable.DrawerArrowDrawable; //导入依赖的package包/类
@Override
public void onSearchExpanded(boolean expand) {
    Toolbar toolbar = findViewById(R.id.toolbar);
    mIsMenuVisible = !expand;

    if (expand) {
        int color = ColorHelper.getAttributeColor(this, R.attr.toolbar_icon);
        toolbar.setNavigationIcon(DrawableHelper.getTintedDrawable(
                this, R.drawable.ic_toolbar_back, color));
        toolbar.setNavigationOnClickListener(view -> onBackPressed());
    } else {
        SoftKeyboardHelper.closeKeyboard(this);
        ColorHelper.setStatusBarColor(this, Color.TRANSPARENT, true);
        if (CandyBarApplication.getConfiguration().getNavigationIcon() == CandyBarApplication.NavigationIcon.DEFAULT) {
            mDrawerToggle.setDrawerArrowDrawable(new DrawerArrowDrawable(this));
        } else {
            toolbar.setNavigationIcon(ConfigurationHelper.getNavigationIcon(this,
                    CandyBarApplication.getConfiguration().getNavigationIcon()));
        }

        toolbar.setNavigationOnClickListener(view ->
                mDrawerLayout.openDrawer(GravityCompat.START));
    }

    mDrawerLayout.setDrawerLockMode(expand ? DrawerLayout.LOCK_MODE_LOCKED_CLOSED :
            DrawerLayout.LOCK_MODE_UNLOCKED);
    supportInvalidateOptionsMenu();
}
 
开发者ID:danimahardhika,项目名称:candybar-library,代码行数:29,代码来源:CandyBarMainActivity.java

示例14: onCreate

import android.support.v7.graphics.drawable.DrawerArrowDrawable; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    getSupportActionBar().setHomeButtonEnabled(true);
    getSupportActionBar().setDisplayShowHomeEnabled(true);

    drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    snackContainer = (CoordinatorLayout) findViewById(R.id.snack_bar_container);

    DrawerArrowDrawable arrowDrawable = new DrawerArrowDrawable(MainActivity.this);
    toolbar.setNavigationIcon(arrowDrawable);

    toolbar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (drawerLayout.isDrawerOpen(Gravity.LEFT)) {
                drawerLayout.closeDrawers();
            } else {
                drawerLayout.openDrawer(Gravity.LEFT);
            }
        }
    });

    initView();
    initData();
}
 
开发者ID:AlarmZeng,项目名称:zhishi,代码行数:31,代码来源:MainActivity.java

示例15: getArrowAnimator

import android.support.v7.graphics.drawable.DrawerArrowDrawable; //导入依赖的package包/类
static ValueAnimator getArrowAnimator(final DrawerArrowDrawable btnReturnIcon) {
    float start = 0f;
    float end = 1f;
    ValueAnimator animator = ValueAnimator.ofFloat(start, end);
    animator.setDuration(300);
    animator.addUpdateListener(animation -> btnReturnIcon.setProgress((Float) animation.getAnimatedValue()));
    return animator;
}
 
开发者ID:PureDark,项目名称:H-Viewer,代码行数:9,代码来源:AnimationOnActivity.java


注:本文中的android.support.v7.graphics.drawable.DrawerArrowDrawable类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。