This file contains 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
<!-- target activity --> | |
<activity android:name="..."> | |
<meta-data | |
android:name="com.android.systemui.action_assist_icon" | |
android:resource="@drawable/ic_assist"/> | |
<intent-filter> | |
<action android:name="android.intent.action.ASSIST"/> | |
<category android:name="android.intent.category.DEFAULT"/> | |
</intent-filter> |
This file contains 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 class ListViewUtils { | |
public static final int SCROLL_DURATION = 150; | |
private ListViewUtils() {} | |
@TargetApi(Build.VERSION_CODES.HONEYCOMB) | |
public static void scrollListView(final ListView listView, final int position) { | |
if (CommonUtils.hasHoneycomb()) { | |
listView.smoothScrollToPositionFromTop(position, 0); | |
listView.postDelayed(new Runnable() { |
This file contains 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
/** | |
* Remove all entries from the backStack of this fragmentManager. | |
* | |
* @param fragmentManager the fragmentManager to clear. | |
*/ | |
private void clearBackStack(FragmentManager fragmentManager) { | |
if (fragmentManager.getBackStackEntryCount() > 0) { | |
FragmentManager.BackStackEntry entry = fragmentManager.getBackStackEntryAt(0); | |
mFragmentManager.popBackStack(entry.getId(), FragmentManager.POP_BACK_STACK_INCLUSIVE); | |
} |
This file contains 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 void throwIfNotOnMainThread(){ | |
if (Looper.myLooper() != Looper.getMainLooper()) { | |
throw new IllegalStateException("Must be invoked from the main thread."); | |
} | |
} |
This file contains 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.support.v4.app.Fragment; | |
import android.support.v4.app.FragmentManager; | |
import android.support.v4.app.FragmentStatePagerAdapter; | |
import android.support.v4.view.ViewPager; | |
/** | |
* Created by Chaojun Wang on 5/6/14. | |
*/ | |
public class ViewPagerUtils { | |
private ViewPagerUtils() {} |
This file contains 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
/** | |
* Get actionbar height | |
*/ | |
public static int getActionBarHeight(Context context) { | |
TypedValue typedValue = new TypedValue(); | |
if (context.getTheme().resolveAttribute(android.R.attr.actionBarSize, typedValue, true)) { | |
return typedValue.complexToDimensionPixelSize(typedValue.data, context.getResources() | |
.getDisplayMetrics()); | |
} | |
return 0; |
This file contains 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
<!-- activity --> | |
<activity | |
android:name=".ui.WelcomeActivity" | |
android:label="@string/app_name" | |
android:windowSoftInputMode="adjustResize|stateHidden" > | |
<intent-filter> | |
<action android:name="android.intent.action.MAIN" /> | |
</intent-filter> | |
</activity> |
This file contains 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 me.imid.fuubo.utils; | |
import android.annotation.SuppressLint; | |
import android.app.ActionBar; | |
import android.support.v4.app.FragmentActivity; | |
import java.lang.reflect.InvocationTargetException; | |
import java.lang.reflect.Method; | |
@SuppressLint("NewApi") |
This file contains 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
/** | |
* 使用{@link AsyncTask.THREAD_POOL_EXECUTOR} 执行AsyncTask 这样可以避免android | |
* 4.0以上系统 每次只执行一个 asyncTask | |
* | |
* @param task | |
* @param params | |
*/ | |
public static <Params, Progress, Result> void executeAsyncTask( | |
AsyncTask<Params, Progress, Result> task, Params... params) { | |
if (VERSION.SDK_INT >= 11) { |