This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// THIS IS A BETA! I DON'T RECOMMEND USING IT IN PRODUCTION CODE JUST YET | |
/* | |
* Copyright 2012 Roman Nurik | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.goodev; | |
import android.util.Log; | |
import org.goodev.BuildConfig; | |
/** | |
* https://github.com/ANDLABS-Git/AndlabsAndroidUtils/blob/master/library/src/com/andlabs/androidutils/logging/L.java | |
* | |
* <pre> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.content.Context; | |
import android.content.pm.PackageManager.NameNotFoundException; | |
import android.content.res.Resources.NotFoundException; | |
import android.graphics.drawable.Drawable; | |
import android.os.SystemClock; | |
import android.text.format.DateUtils; | |
import android.util.AttributeSet; | |
import android.widget.ImageView; | |
import android.widget.RelativeLayout; | |
import android.widget.TextView; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<resources> | |
<style name="TransparentTheme" parent="@android:style/Theme.Holo.Light"> | |
<item name="android:windowBackground">@null</item> | |
<item name="android:actionBarStyle">@style/ActionBarStyle.Transparent</item> | |
<item name="android:windowActionBarOverlay">true</item> | |
</style> | |
<style name="ActionBarStyle.Transparent" parent="@android:Widget.ActionBar"> | |
<item name="android:background">@null</item> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
tools:context=".NoBoringActionBarActivity"> | |
<ListView | |
android:id="@+id/listview" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:layout_width="match_parent" | |
android:layout_height="@dimen/header_height" | |
android:orientation="vertical"> | |
</LinearLayout> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mFakeHeader = getLayoutInflater().inflate(R.layout.fake_header, mListView, false); | |
mListView.addHeaderView(mFakeHeader); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public int getScrollY() { | |
View c = mListView.getChildAt(0); | |
if (c == null) { | |
return 0; | |
} | |
int firstVisiblePosition = mListView.getFirstVisiblePosition(); | |
int top = c.getTop(); | |
int headerHeight = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mListView.setOnScrollListener(new AbsListView.OnScrollListener() { | |
@Override | |
public void onScrollStateChanged(AbsListView view, int scrollState) { | |
} | |
@Override | |
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { | |
int scrollY = getScrollY(); | |
//sticky actionbar | |
mHeader.setTranslationY(Math.max(-scrollY, mMinHeaderTranslation)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private TextView getActionBarTitleView() { | |
int id = Resources.getSystem().getIdentifier("action_bar_title", "id", "android"); | |
return (TextView) findViewById(id); | |
} | |
getActionBarTitleView().setAlpha(0f); |
OlderNewer