本文整理汇总了Java中com.r0adkll.slidr.Slidr类的典型用法代码示例。如果您正苦于以下问题:Java Slidr类的具体用法?Java Slidr怎么用?Java Slidr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Slidr类属于com.r0adkll.slidr包,在下文中一共展示了Slidr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setBaseView
import com.r0adkll.slidr.Slidr; //导入依赖的package包/类
@Override
protected void setBaseView(@LayoutRes int layoutId) {
Slidr.attach(this);
contentView = LayoutInflater.from(this).inflate(R.layout.activity_back, null);
setContentView(contentView);
rootLayout = (CoordinatorLayout) findViewById(R.id.root_layout);
abl = (AppBarLayout) findViewById(R.id.abl);
mToolbar = (Toolbar) findViewById(R.id.toolbar);
flActivityContainer = (FrameLayout) findViewById(R.id.activity_container);
flActivityContainer.addView(LayoutInflater.from(this).inflate(layoutId, flActivityContainer, false));
setSupportActionBar(mToolbar);
getToolBar().setDisplayHomeAsUpEnabled(true);
BarUtils.setStatusBarColor(this, ContextCompat.getColor(UtilsApp.getInstance(), R.color.colorPrimary), 0);
BarUtils.addMarginTopEqualStatusBarHeight(rootLayout);
}
示例2: initView
import com.r0adkll.slidr.Slidr; //导入依赖的package包/类
@Override
public void initView(Bundle savedInstanceState, View view) {
Slidr.attach(this);
llContainer = (LinearLayout) findViewById(R.id.ll_container);
cbAlpha = (CheckBox) findViewById(R.id.cb_alpha);
btnRandomColor = (Button) findViewById(R.id.btn_random_color);
tvStatusAlpha = (TextView) findViewById(R.id.tv_status_alpha);
sbChangeAlpha = (SeekBar) findViewById(R.id.sb_change_alpha);
cbAlpha.setOnCheckedChangeListener(mCheckedChangeListener);
btnRandomColor.setOnClickListener(this);
findViewById(R.id.btn_set_transparent).setOnClickListener(this);
sbChangeAlpha.setOnSeekBarChangeListener(mColorListener);
tvStatusAlpha.setText(String.valueOf(mAlpha));
updateStatusBar();
}
示例3: setBaseView
import com.r0adkll.slidr.Slidr; //导入依赖的package包/类
@Override
protected void setBaseView(@LayoutRes int layoutId) {
Slidr.attach(this);
contentView = LayoutInflater.from(this).inflate(R.layout.activity_back, null);
setContentView(contentView);
rootLayout = findViewById(R.id.root_layout);
abl = findViewById(R.id.abl);
mToolbar = findViewById(R.id.toolbar);
flActivityContainer = findViewById(R.id.activity_container);
flActivityContainer.addView(LayoutInflater.from(this).inflate(layoutId, flActivityContainer, false));
setSupportActionBar(mToolbar);
getToolBar().setDisplayHomeAsUpEnabled(true);
BarUtils.setStatusBarColor(this, ContextCompat.getColor(UtilsApp.getInstance(), R.color.colorPrimary), 0);
BarUtils.addMarginTopEqualStatusBarHeight(rootLayout);
}
示例4: initView
import com.r0adkll.slidr.Slidr; //导入依赖的package包/类
@Override
public void initView(Bundle savedInstanceState, View view) {
Slidr.attach(this);
llContainer = findViewById(R.id.ll_container);
cbAlpha = findViewById(R.id.cb_alpha);
btnRandomColor = findViewById(R.id.btn_random_color);
tvStatusAlpha = findViewById(R.id.tv_status_alpha);
sbChangeAlpha = findViewById(R.id.sb_change_alpha);
cbAlpha.setOnCheckedChangeListener(mCheckedChangeListener);
btnRandomColor.setOnClickListener(this);
findViewById(R.id.btn_set_transparent).setOnClickListener(this);
sbChangeAlpha.setOnSeekBarChangeListener(mColorListener);
tvStatusAlpha.setText(String.valueOf(mAlpha));
updateStatusBar();
}
示例5: onCreate
import com.r0adkll.slidr.Slidr; //导入依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// 设置右滑动返回
Slidr.attach(this);
setContentView(R.layout.swipe_back_activity);
mToolbar = (Toolbar) findViewById(R.id.toolbar);
mBtnChangeColor = (Button) findViewById(R.id.btn_change_color);
setSupportActionBar(mToolbar);
if (getSupportActionBar() != null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
mToolbar.setBackgroundColor(mColor);
mBtnChangeColor.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Random random = new Random();
mColor = 0xff000000 | random.nextInt(0xffffff);
mToolbar.setBackgroundColor(mColor);
StatusBarUtil.setColorForSwipeBack(SwipeBackActivity.this, mColor, 38);
}
});
}
示例6: onCreate
import com.r0adkll.slidr.Slidr; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
switch(SettingsActivity.getTheme(this)) {
case SettingsActivity.THEME_VERT:
setTheme(R.style.AppTheme_SlidrActivity);
break;
case SettingsActivity.THEME_NOIR:
setTheme(R.style.AppThemeNoir_SlidrActivity);
break;
case SettingsActivity.THEME_BLEU:
setTheme(R.style.AppThemeBleu_SlidrActivity);
break;
case SettingsActivity.THEME_ROUGE:
setTheme(R.style.AppThemeRouge_SlidrActivity);
break;
case SettingsActivity.THEME_VIOLET:
setTheme(R.style.AppThemeViolet_SlidrActivity);
break;
}
slidrInterface = Slidr.attach(this, slidrConfig);
super.onCreate(savedInstanceState);
}
示例7: onCreate
import com.r0adkll.slidr.Slidr; //导入依赖的package包/类
/***********************************************************************************************
*
* Lifecycle Methods
*
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_settings);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
Slidr.attach(this);
Timber.i("Launching Settings Fragment: (%s)", getIntent());
if(savedInstanceState == null) {
getFragmentManager().beginTransaction()
.replace(R.id.container, SettingsFragment.createInstance())
.commit();
}
}
示例8: onContentChanged
import com.r0adkll.slidr.Slidr; //导入依赖的package包/类
@Override
public void onContentChanged() {
super.onContentChanged();
//设置沉淀式状态栏
mImmersionBar = ImmersionBar.with(this);
initImmersionBar(mImmersionBar);
if (isEnableSlideFinish()) {
Slidr.attach(this, new SlidrConfig
.Builder()
.edge(true)
.edgeSize(0.18f)// The % of the screen that counts as the edge, default 18%
.listener(new SlidrListenerAdapter() {
@Override
public void onSlideStateChanged(int state) {
BaseActivity.this.onSlideStateChanged(state);
}
@Override
public void onSlideOpened() {
BaseActivity.this.onSlideCancel();
}
@Override
public void onSlideClosed() {
BaseActivity.this.onSlideClosed();
}
})
.build());
}
}
示例9: onCreate
import com.r0adkll.slidr.Slidr; //导入依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
// Window window = getWindow();
// window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
// window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
// window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
// window.setStatusBarColor(Color.TRANSPARENT);
//}
//if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
// Window window = getWindow();
// //透明状态栏
// window.setFlags(
// WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,
// WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
// //透明导航栏
// window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
// window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
//}
//绑定向右滑动退出
SlidrInterface slidrInterface = Slidr.attach(this, SlidrUtils.getSlidrConfig());
}
示例10: initSlidr
import com.r0adkll.slidr.Slidr; //导入依赖的package包/类
protected void initSlidr() {
FrameLayout content = (FrameLayout)findViewById(android.R.id.content);
content.setBackgroundColor(getResources().getColor(R.color.activityBackground));
if (viewDelegate.isAttach()){
attach = Slidr.attach(this);
}
}
示例11: onCreate
import com.r0adkll.slidr.Slidr; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_preferences);
ButterKnife.bind(this);
getFragmentManager().beginTransaction()
.replace(R.id.frame, new PreferencesFragment())
.commit();
setSupportActionBar(toolbar);
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setTitle(getString(R.string.settings));
}
SlidrConfig config = new SlidrConfig.Builder()
.sensitivity(1f)
.scrimColor(Color.BLACK)
.scrimStartAlpha(0.8f)
.scrimEndAlpha(0f)
.velocityThreshold(2400)
.distanceThreshold(0.25f)
.edge(true)
.edgeSize(0.18f)
.build();
Slidr.attach(this, config);
}
示例12: initSlidable
import com.r0adkll.slidr.Slidr; //导入依赖的package包/类
/**
* 初始化滑动返回
*/
protected void initSlidable() {
int isSlidable = SettingUtil.getInstance().getSlidable();
if (isSlidable != Constant.SLIDABLE_DISABLE) {
SlidrConfig config = new SlidrConfig.Builder()
.edge(isSlidable == Constant.SLIDABLE_EDGE)
.build();
slidrInterface = Slidr.attach(this, config);
}
}
示例13: onCreate
import com.r0adkll.slidr.Slidr; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_viewer);
ButterKnife.inject(this);
// Get the status bar colors to interpolate between
int primary = getResources().getColor(R.color.primaryDark);
int secondary = getResources().getColor(R.color.accent);
// Build the slidr config
SlidrConfig config = new SlidrConfig.Builder()
.primaryColor(primary)
.secondaryColor(secondary)
.position(SlidrPosition.LEFT)
.touchSize(Utils.dpToPx(this, 32))
.build();
// Attach the Slidr Mechanism to this activity
Slidr.attach(this, config);
setSupportActionBar(mToolbar);
getSupportActionBar().setTitle("");
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
mOS = getIntent().getParcelableExtra(EXTRA_OS);
if(savedInstanceState != null) mOS = savedInstanceState.getParcelable(EXTRA_OS);
// Set layout contents
mTitle.setText(mOS.name);
mDescription.setText(mOS.description);
mDate.setText(String.valueOf(mOS.year));
mVersion.setText(mOS.version);
mSdk.setText(String.valueOf(mOS.sdk_int));
// Load header image
Picasso.with(this)
.load(mOS.image_url)
.into(mCover);
}
示例14: onCreate
import com.r0adkll.slidr.Slidr; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_post);
int primary = getResources().getColor(R.color.primary_dark);
int secondary = getResources().getColor(R.color.primary_text);
ButterKnife.bind(this);
SlidrConfig mConfig = new SlidrConfig.Builder()
.primaryColor(primary)
.secondaryColor(secondary)
.build();
Slidr.attach(this,mConfig);
getSupportActionBar().setTitle("Create Post");
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
示例15: onCreate
import com.r0adkll.slidr.Slidr; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_profile);
ButterKnife.bind(this);
databaseHelper = DatabaseOpenHelper.getInstance(this);
profileImg.setClipToOutline(true);
profileImg.setElevation(PROFILE_IMG_ELEVATION);
setSupportActionBar(toolbar);
actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setDisplayShowTitleEnabled(false);
}
appBar.addOnOffsetChangedListener(this);
startAlphaAnimation(title, 0, View.INVISIBLE);
SlidrConfig config = new SlidrConfig.Builder()
.sensitivity(1f)
.scrimColor(Color.BLACK)
.scrimStartAlpha(0.8f)
.scrimEndAlpha(0f)
.velocityThreshold(2400)
.distanceThreshold(0.25f)
.edge(true)
.edgeSize(0.18f)
.build();
Slidr.attach(this, config);
Bundle extras = getIntent().getExtras();
pokemonId = extras.getInt(POKEMON_ID_KEY);
pokemonName = extras.getString(POKEMON_NAME_KEY);
infoView.setButtonsVisible(true);
infoView.loadPokemonInfo(pokemonId);
loadNextPrevious();
Glide.with(PokemonProfileActivity.this)
.load(String.format(getString(R.string.sprite_url),
databaseHelper.queryPokemonNameById(pokemonId).toLowerCase()))
.into(profileImg);
String formattedName = String.format(getString(R.string.pokemon_name),
formatId(pokemonId), pokemonName);
title.setText(formattedName);
mainTitle.setText(formattedName);
}