Java 类android.app.TabActivity 实例源码
项目:ClouldReader
文件:StatusBarUtil.java
/**
* 为头部是 ImageView 的界面设置状态栏透明
*
* @param activity 需要设置的activity
* @param statusBarAlpha 状态栏透明度
* @param needOffsetView 需要向下偏移的 View
*/
public static void setTranslucentForImageView(Activity activity, int statusBarAlpha, View needOffsetView) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
return;
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
activity.getWindow().setStatusBarColor(Color.TRANSPARENT);
activity.getWindow()
.getDecorView()
.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
if (activity instanceof TabActivity){
activity.getWindow()//兼容TabActivity
.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
} else {
activity.getWindow()
.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
addTranslucentView(activity, statusBarAlpha);
if (needOffsetView != null) {
ViewGroup.MarginLayoutParams layoutParams = (ViewGroup.MarginLayoutParams) needOffsetView.getLayoutParams();
if (layoutParams != null) {
layoutParams.setMargins(0, getStatusBarHeight(activity), 0, 0);
}
}
}
项目:GitHub
文件:StatusBarUtil.java
/**
* 为头部是 ImageView 的界面设置状态栏透明
*
* @param activity 需要设置的activity
* @param statusBarAlpha 状态栏透明度
* @param needOffsetView 需要向下偏移的 View
*/
public static void setTranslucentForImageView(Activity activity, int statusBarAlpha, View needOffsetView) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
return;
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
activity.getWindow().setStatusBarColor(Color.TRANSPARENT);
activity.getWindow()
.getDecorView()
.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
if (activity instanceof TabActivity){
activity.getWindow()//兼容TabActivity
.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
} else {
activity.getWindow()
.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
addTranslucentView(activity, statusBarAlpha);
if (needOffsetView != null) {
ViewGroup.MarginLayoutParams layoutParams = (ViewGroup.MarginLayoutParams) needOffsetView.getLayoutParams();
if (layoutParams != null) {
layoutParams.setMargins(0, getStatusBarHeight(activity), 0, 0);
}
}
}
项目:ScrollShapeUI
文件:StatusBarUtil.java
/**
* 为头部是 ImageView 的界面设置状态栏透明
*
* @param activity 需要设置的activity
* @param statusBarAlpha 状态栏透明度
* @param needOffsetView 需要向下偏移的 View
*/
public static void setTranslucentForImageView(Activity activity, int statusBarAlpha, View needOffsetView) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
return;
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
activity.getWindow().setStatusBarColor(Color.TRANSPARENT);
activity.getWindow()
.getDecorView()
.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
if (activity instanceof TabActivity){
activity.getWindow()//兼容TabActivity
.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
} else {
activity.getWindow()
.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
addTranslucentView(activity, statusBarAlpha);
if (needOffsetView != null) {
ViewGroup.MarginLayoutParams layoutParams = (ViewGroup.MarginLayoutParams) needOffsetView.getLayoutParams();
if (layoutParams != null) {
layoutParams.setMargins(0, getStatusBarHeight(activity), 0, 0);
}
}
}
项目:android_viewtracker
文件:TrackerManager.java
private void detachTrackerFrameLayout(Activity activity) {
if (activity == null || activity instanceof TabActivity) {
return;
}
try {
ViewGroup container = (ViewGroup) activity.findViewById(android.R.id.content);
if (container == null) {
return;
}
if (container.getChildAt(0) instanceof TrackerFrameLayout) {
container.removeViewAt(0);
}
} catch (Exception e) {
TrackerLog.e(e.toString());
}
}
项目:letv
文件:e.java
public final void a(Context context) {
if (c(context, z[3])) {
a = true;
try {
if (Class.forName(context.getClass().getName()).newInstance() instanceof TabActivity) {
this.n = false;
}
} catch (Exception e) {
e.printStackTrace();
}
if (this.n) {
z.e(z[2], z[4]);
return;
}
this.n = true;
this.i = System.currentTimeMillis();
this.e = context.getClass().getName();
try {
this.d.execute(new h(this, context));
} catch (Exception e2) {
}
}
}
项目:letv
文件:l.java
public final void onActivityPaused(Activity activity) {
k.f = activity.getClass().getName();
if (ai.a(k.e)) {
k.e = activity.getClass().getName();
}
if (VERSION.SDK_INT >= 14 && k.a) {
if (!e.a && e.b().a()) {
k.d.put(k.e, Integer.valueOf(0));
if (!ai.a(k.g) && k.g.equals(k.e)) {
a.b(activity, k.c, k.e, 0);
}
}
if (activity instanceof TabActivity) {
z.d();
} else {
e.a = false;
}
}
}
项目:EasyReader
文件:StatusBarUtil.java
/**
* 为头部是 ImageView 的界面设置状态栏透明
*
* @param activity 需要设置的activity
* @param statusBarAlpha 状态栏透明度
* @param needOffsetView 需要向下偏移的 View
*/
public static void setTranslucentForImageView(Activity activity, int statusBarAlpha, View needOffsetView) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
return;
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
activity.getWindow().setStatusBarColor(Color.TRANSPARENT);
activity.getWindow()
.getDecorView()
.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
if (activity instanceof TabActivity){
activity.getWindow()//兼容TabActivity
.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
} else {
activity.getWindow()
.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
addTranslucentView(activity, statusBarAlpha);
if (needOffsetView != null) {
ViewGroup.MarginLayoutParams layoutParams = (ViewGroup.MarginLayoutParams) needOffsetView.getLayoutParams();
if (layoutParams != null) {
layoutParams.setMargins(0, getStatusBarHeight(activity), 0, 0);
}
}
}
项目:LLApp
文件:StatusBarUtil.java
/**
* 为头部是 ImageView 的界面设置状态栏透明
*
* @param activity 需要设置的activity
* @param statusBarAlpha 状态栏透明度
* @param needOffsetView 需要向下偏移的 View
*/
public static void setTranslucentForImageView(Activity activity, int statusBarAlpha, View needOffsetView) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
return;
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
activity.getWindow().setStatusBarColor(Color.TRANSPARENT);
activity.getWindow()
.getDecorView()
.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
if (activity instanceof TabActivity){
activity.getWindow()//兼容TabActivity
.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
} else {
activity.getWindow()
.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
addTranslucentView(activity, statusBarAlpha);
if (needOffsetView != null) {
ViewGroup.MarginLayoutParams layoutParams = (ViewGroup.MarginLayoutParams) needOffsetView.getLayoutParams();
if (layoutParams != null) {
layoutParams.setMargins(0, getStatusBarHeight(activity), 0, 0);
}
}
}
项目:HHComicViewer
文件:StatusBarUtil.java
/**
* 为头部是 ImageView 的界面设置状态栏透明
*
* @param activity 需要设置的activity
* @param statusBarAlpha 状态栏透明度
* @param needOffsetView 需要向下偏移的 View
*/
public static void setTranslucentForImageView(Activity activity, int statusBarAlpha, View needOffsetView) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
return;
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
activity.getWindow().setStatusBarColor(Color.TRANSPARENT);
activity.getWindow()
.getDecorView()
.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
if (activity instanceof TabActivity) {
activity.getWindow()//兼容TabActivity
.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
} else {
activity.getWindow()
.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
addTranslucentView(activity, statusBarAlpha);
if (needOffsetView != null) {
ViewGroup.MarginLayoutParams layoutParams = (ViewGroup.MarginLayoutParams) needOffsetView.getLayoutParams();
if (layoutParams != null) {
layoutParams.setMargins(0, getStatusBarHeight(activity), 0, 0);
}
}
}
项目:CloudReader
文件:StatusBarUtil.java
/**
* 为头部是 ImageView 的界面设置状态栏透明
*
* @param activity 需要设置的activity
* @param statusBarAlpha 状态栏透明度
* @param needOffsetView 需要向下偏移的 View
*/
public static void setTranslucentForImageView(Activity activity, int statusBarAlpha, View needOffsetView) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
return;
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
activity.getWindow().setStatusBarColor(Color.TRANSPARENT);
activity.getWindow()
.getDecorView()
.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
if (activity instanceof TabActivity){
activity.getWindow()//兼容TabActivity
.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
} else {
activity.getWindow()
.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
addTranslucentView(activity, statusBarAlpha);
if (needOffsetView != null) {
ViewGroup.MarginLayoutParams layoutParams = (ViewGroup.MarginLayoutParams) needOffsetView.getLayoutParams();
if (layoutParams != null) {
layoutParams.setMargins(0, getStatusBarHeight(activity), 0, 0);
}
}
}
项目:NetEasyNews
文件:StatusBarUtil.java
/**
* 为头部是 ImageView 的界面设置状态栏透明
*
* @param activity 需要设置的activity
* @param statusBarAlpha 状态栏透明度
* @param needOffsetView 需要向下偏移的 View
*/
public static void setTranslucentForImageView(Activity activity, int statusBarAlpha, View needOffsetView) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
return;
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
activity.getWindow().setStatusBarColor(Color.TRANSPARENT);
activity.getWindow()
.getDecorView()
.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
if (activity instanceof TabActivity){
activity.getWindow()//兼容TabActivity
.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
} else {
activity.getWindow()
.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
addTranslucentView(activity, statusBarAlpha);
if (needOffsetView != null) {
ViewGroup.MarginLayoutParams layoutParams = (ViewGroup.MarginLayoutParams) needOffsetView.getLayoutParams();
if (layoutParams != null) {
layoutParams.setMargins(0, getStatusBarHeight(activity), 0, 0);
}
}
}
项目:PowerDoctor
文件:InterfaceList.java
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY)
{
try {
if (Math.abs(e1.getY() - e2.getY()) > CompareFunc.SWIPE_MAX_OFF_PATH)
return false;
else if (e1.getX() - e2.getX() > CompareFunc.SWIPE_MIN_DISTANCE &&
Math.abs(velocityX) > CompareFunc.SWIPE_THRESHOLD_VELOCITY)
((TabActivity) this.getParent()).getTabHost().setCurrentTab(2);
else if (e2.getX() - e1.getX() > CompareFunc.SWIPE_MIN_DISTANCE &&
Math.abs(velocityX) > CompareFunc.SWIPE_THRESHOLD_VELOCITY)
((TabActivity) this.getParent()).getTabHost().setCurrentTab(0);
else
return false;
} catch (Exception e) {
// nothing
}
return true;
}
项目:PowerDoctor
文件:DebugBox.java
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY)
{
if(targetPID != 0)
return false;
try {
if (Math.abs(e1.getY() - e2.getY()) > CompareFunc.SWIPE_MAX_OFF_PATH)
return false;
else if (e1.getX() - e2.getX() > CompareFunc.SWIPE_MIN_DISTANCE &&
Math.abs(velocityX) > CompareFunc.SWIPE_THRESHOLD_VELOCITY)
((TabActivity) this.getParent()).getTabHost().setCurrentTab(0);
else if (e2.getX() - e1.getX() > CompareFunc.SWIPE_MIN_DISTANCE &&
Math.abs(velocityX) > CompareFunc.SWIPE_THRESHOLD_VELOCITY)
((TabActivity) this.getParent()).getTabHost().setCurrentTab(3);
else
return false;
} catch (Exception e) {
// nothing
}
return true;
}
项目:PowerDoctor
文件:MiscBox.java
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY)
{
try {
if (Math.abs(e1.getY() - e2.getY()) > CompareFunc.SWIPE_MAX_OFF_PATH)
return false;
else if (e1.getX() - e2.getX() > CompareFunc.SWIPE_MIN_DISTANCE &&
Math.abs(velocityX) > CompareFunc.SWIPE_THRESHOLD_VELOCITY)
((TabActivity) this.getParent()).getTabHost().setCurrentTab(4);
else if (e2.getX() - e1.getX() > CompareFunc.SWIPE_MIN_DISTANCE &&
Math.abs(velocityX) > CompareFunc.SWIPE_THRESHOLD_VELOCITY)
((TabActivity) this.getParent()).getTabHost().setCurrentTab(2);
else
return false;
} catch (Exception e) {
// nothing
}
return true;
}
项目:OSMonitor.Legacy
文件:InterfaceList.java
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY)
{
try {
if (Math.abs(e1.getY() - e2.getY()) > CommonUtil.SWIPE_MAX_OFF_PATH)
return false;
else if (e1.getX() - e2.getX() > CommonUtil.SWIPE_MIN_DISTANCE &&
Math.abs(velocityX) > CommonUtil.SWIPE_THRESHOLD_VELOCITY)
((TabActivity) this.getParent()).getTabHost().setCurrentTab(2);
else if (e2.getX() - e1.getX() > CommonUtil.SWIPE_MIN_DISTANCE &&
Math.abs(velocityX) > CommonUtil.SWIPE_THRESHOLD_VELOCITY)
((TabActivity) this.getParent()).getTabHost().setCurrentTab(0);
else
return false;
} catch (Exception e) {
// nothing
}
return true;
}
项目:OSMonitor.Legacy
文件:DebugBox.java
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY)
{
if(targetPID != 0)
return false;
try {
if (Math.abs(e1.getY() - e2.getY()) > CommonUtil.SWIPE_MAX_OFF_PATH)
return false;
else if (e1.getX() - e2.getX() > CommonUtil.SWIPE_MIN_DISTANCE &&
Math.abs(velocityX) > CommonUtil.SWIPE_THRESHOLD_VELOCITY)
((TabActivity) this.getParent()).getTabHost().setCurrentTab(0);
else if (e2.getX() - e1.getX() > CommonUtil.SWIPE_MIN_DISTANCE &&
Math.abs(velocityX) > CommonUtil.SWIPE_THRESHOLD_VELOCITY)
((TabActivity) this.getParent()).getTabHost().setCurrentTab(3);
else
return false;
} catch (Exception e) {
// nothing
}
return true;
}
项目:OSMonitor.Legacy
文件:NetworkList.java
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY)
{
try {
if (Math.abs(e1.getY() - e2.getY()) > CommonUtil.SWIPE_MAX_OFF_PATH)
return false;
else if (e1.getX() - e2.getX() > CommonUtil.SWIPE_MIN_DISTANCE &&
Math.abs(velocityX) > CommonUtil.SWIPE_THRESHOLD_VELOCITY)
((TabActivity) this.getParent()).getTabHost().setCurrentTab(3);
else if (e2.getX() - e1.getX() > CommonUtil.SWIPE_MIN_DISTANCE &&
Math.abs(velocityX) > CommonUtil.SWIPE_THRESHOLD_VELOCITY)
((TabActivity) this.getParent()).getTabHost().setCurrentTab(1);
else
return false;
} catch (Exception e) {
// nothing
}
return true;
}
项目:OSMonitor.Legacy
文件:MiscBox.java
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY)
{
try {
if (Math.abs(e1.getY() - e2.getY()) > CommonUtil.SWIPE_MAX_OFF_PATH)
return false;
else if (e1.getX() - e2.getX() > CommonUtil.SWIPE_MIN_DISTANCE &&
Math.abs(velocityX) > CommonUtil.SWIPE_THRESHOLD_VELOCITY)
((TabActivity) this.getParent()).getTabHost().setCurrentTab(4);
else if (e2.getX() - e1.getX() > CommonUtil.SWIPE_MIN_DISTANCE &&
Math.abs(velocityX) > CommonUtil.SWIPE_THRESHOLD_VELOCITY)
((TabActivity) this.getParent()).getTabHost().setCurrentTab(2);
else
return false;
} catch (Exception e) {
// nothing
}
return true;
}
项目:OSMonitor.Legacy
文件:ProcessList.java
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY)
{
try {
if (Math.abs(e1.getY() - e2.getY()) > CommonUtil.SWIPE_MAX_OFF_PATH)
return false;
else if (e1.getX() - e2.getX() > CommonUtil.SWIPE_MIN_DISTANCE &&
Math.abs(velocityX) > CommonUtil.SWIPE_THRESHOLD_VELOCITY)
((TabActivity) this.getParent()).getTabHost().setCurrentTab(1);
else if (e2.getX() - e1.getX() > CommonUtil.SWIPE_MIN_DISTANCE &&
Math.abs(velocityX) > CommonUtil.SWIPE_THRESHOLD_VELOCITY)
((TabActivity) this.getParent()).getTabHost().setCurrentTab(4);
else
return false;
} catch (Exception e) {
// nothing
}
GestureLong = false;
return true;
}
项目:OSMonitor.Classical
文件:InterfaceList.java
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY)
{
try {
if (Math.abs(e1.getY() - e2.getY()) > CompareFunc.SWIPE_MAX_OFF_PATH)
return false;
else if (e1.getX() - e2.getX() > CompareFunc.SWIPE_MIN_DISTANCE &&
Math.abs(velocityX) > CompareFunc.SWIPE_THRESHOLD_VELOCITY)
((TabActivity) this.getParent()).getTabHost().setCurrentTab(2);
else if (e2.getX() - e1.getX() > CompareFunc.SWIPE_MIN_DISTANCE &&
Math.abs(velocityX) > CompareFunc.SWIPE_THRESHOLD_VELOCITY)
((TabActivity) this.getParent()).getTabHost().setCurrentTab(0);
else
return false;
} catch (Exception e) {
// nothing
}
return true;
}
项目:OSMonitor.Classical
文件:DebugBox.java
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY)
{
if(targetPID != 0)
return false;
try {
if (Math.abs(e1.getY() - e2.getY()) > CompareFunc.SWIPE_MAX_OFF_PATH)
return false;
else if (e1.getX() - e2.getX() > CompareFunc.SWIPE_MIN_DISTANCE &&
Math.abs(velocityX) > CompareFunc.SWIPE_THRESHOLD_VELOCITY)
((TabActivity) this.getParent()).getTabHost().setCurrentTab(0);
else if (e2.getX() - e1.getX() > CompareFunc.SWIPE_MIN_DISTANCE &&
Math.abs(velocityX) > CompareFunc.SWIPE_THRESHOLD_VELOCITY)
((TabActivity) this.getParent()).getTabHost().setCurrentTab(3);
else
return false;
} catch (Exception e) {
// nothing
}
return true;
}
项目:OSMonitor.Classical
文件:NetworkList.java
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY)
{
try {
if (Math.abs(e1.getY() - e2.getY()) > CompareFunc.SWIPE_MAX_OFF_PATH)
return false;
else if (e1.getX() - e2.getX() > CompareFunc.SWIPE_MIN_DISTANCE &&
Math.abs(velocityX) > CompareFunc.SWIPE_THRESHOLD_VELOCITY)
((TabActivity) this.getParent()).getTabHost().setCurrentTab(3);
else if (e2.getX() - e1.getX() > CompareFunc.SWIPE_MIN_DISTANCE &&
Math.abs(velocityX) > CompareFunc.SWIPE_THRESHOLD_VELOCITY)
((TabActivity) this.getParent()).getTabHost().setCurrentTab(1);
else
return false;
} catch (Exception e) {
// nothing
}
return true;
}
项目:OSMonitor.Classical
文件:MiscBox.java
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY)
{
try {
if (Math.abs(e1.getY() - e2.getY()) > CompareFunc.SWIPE_MAX_OFF_PATH)
return false;
else if (e1.getX() - e2.getX() > CompareFunc.SWIPE_MIN_DISTANCE &&
Math.abs(velocityX) > CompareFunc.SWIPE_THRESHOLD_VELOCITY)
((TabActivity) this.getParent()).getTabHost().setCurrentTab(4);
else if (e2.getX() - e1.getX() > CompareFunc.SWIPE_MIN_DISTANCE &&
Math.abs(velocityX) > CompareFunc.SWIPE_THRESHOLD_VELOCITY)
((TabActivity) this.getParent()).getTabHost().setCurrentTab(2);
else
return false;
} catch (Exception e) {
// nothing
}
return true;
}
项目:OSMonitor.Classical
文件:ProcessList.java
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY)
{
try {
if (Math.abs(e1.getY() - e2.getY()) > CompareFunc.SWIPE_MAX_OFF_PATH)
return false;
else if (e1.getX() - e2.getX() > CompareFunc.SWIPE_MIN_DISTANCE &&
Math.abs(velocityX) > CompareFunc.SWIPE_THRESHOLD_VELOCITY)
((TabActivity) this.getParent()).getTabHost().setCurrentTab(1);
else if (e2.getX() - e1.getX() > CompareFunc.SWIPE_MIN_DISTANCE &&
Math.abs(velocityX) > CompareFunc.SWIPE_THRESHOLD_VELOCITY)
((TabActivity) this.getParent()).getTabHost().setCurrentTab(4);
else
return false;
} catch (Exception e) {
// nothing
}
GestureLong = false;
return true;
}
项目:android_viewtracker
文件:TrackerManager.java
public void attachTrackerFrameLayout(Activity activity) {
// this is a problem: several activity exist in the TabActivity
if (activity == null || activity instanceof TabActivity) {
return;
}
// exist android.R.id.content not found crash
try {
ViewGroup container = (ViewGroup) activity.findViewById(android.R.id.content);
if (container == null) {
return;
}
if (container.getChildCount() > 0) {
View root = container.getChildAt(0);
if (root instanceof TrackerFrameLayout) {
TrackerLog.d("no attachTrackerFrameLayout " + activity.toString());
} else {
TrackerFrameLayout trackerFrameLayout = new TrackerFrameLayout(activity);
while (container.getChildCount() > 0) {
View view = container.getChildAt(0);
container.removeViewAt(0);
trackerFrameLayout.addView(view, view.getLayoutParams());
}
container.addView(trackerFrameLayout, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
}
}
} catch (Exception e) {
TrackerLog.e(e.toString());
}
}
项目:letv
文件:e.java
public final void b(Context context) {
if (c(context, z[6])) {
b = true;
try {
if (Class.forName(context.getClass().getName()).newInstance() instanceof TabActivity) {
this.n = true;
}
} catch (Exception e) {
e.printStackTrace();
}
if (this.n) {
this.n = false;
if (this.e == null || !this.e.equals(context.getClass().getName())) {
z.c();
return;
}
this.j = System.currentTimeMillis();
this.g.add(new a(this.e, (this.j - this.i) / 1000));
this.p = this.i;
try {
this.d.execute(new i(this, context));
return;
} catch (Exception e2) {
return;
}
}
z.e(z[2], z[7]);
}
}
项目:letv
文件:l.java
public final void onActivityResumed(Activity activity) {
k.e = activity.getClass().getName();
if (VERSION.SDK_INT >= 14 && k.a) {
if (k.b) {
Intent intent = new Intent(z[0]);
intent.setPackage(activity.getPackageName());
intent.addCategory(z[2]);
ResolveInfo resolveActivity = activity.getPackageManager().resolveActivity(intent, 0);
if (resolveActivity == null) {
z.d(z[3], z[1]);
return;
}
k.g = resolveActivity.activityInfo.name;
k.b = false;
return;
}
if (!(e.b || !e.b().a() || k.f == null)) {
if (k.d.containsKey(k.f)) {
k.d.put(k.f, Integer.valueOf(2));
if (!ai.a(k.g) && k.g.equals(k.f)) {
a.b(activity, k.c, k.f, 2);
}
} else {
k.d.put(k.f, Integer.valueOf(1));
if (!ai.a(k.g) && k.g.equals(k.f)) {
a.b(activity, k.c, k.f, 1);
}
}
}
if (activity instanceof TabActivity) {
z.d();
} else {
e.b = false;
}
}
}
项目:FullRobolectricTestSample
文件:TabActivityTest.java
@Test
public void tabActivityShouldNotMakeNewTabHostEveryGet() throws Exception {
TabActivity activity = Robolectric.buildActivity(TabActivity.class).create().get();
TabHost tabHost1 = activity.getTabHost();
TabHost tabHost2 = activity.getTabHost();
assertThat(tabHost1).isEqualTo(tabHost2);
}
项目:FullRobolectricTestSample
文件:TabHostTest.java
@Test
public void shouldGetTabWidget() throws Exception {
TabActivity activity = Robolectric.buildActivity(TabActivity.class).create().get();
activity.setContentView(R.layout.tab_activity);
TabHost host = new TabHost(activity);
assertThat(host.getTabWidget()).isInstanceOf(TabWidget.class);
}
项目:bites-android
文件:RecipeList.java
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
selectItem(id);
//Get the parent tabactivity and set the curren tab to the ingredients tab
((TabActivity)getParent()).getTabHost().setCurrentTab(1);
}
项目:android-mvc-framework
文件:TabHostBuilder.java
/**
* 初期化。
*/
public TabHostBuilder(Activity context)
{
this.activity = (TabActivity)context;
this.tabhost = activity.getTabHost();
}
项目:FullRobolectricTestSample
文件:TabActivityTest.java
@Test
public void shouldGetTabWidget() throws Exception {
TabActivity activity = Robolectric.buildActivity(TabActivity.class).create().get();
activity.setContentView(R.layout.tab_activity);
assertThat(activity.getTabWidget()).isInstanceOf(TabWidget.class);
}
项目:Nakisousou
文件:TabHostBuilder.java
/**
* 初期化。
*/
public TabHostBuilder(Activity context)
{
this.activity = (TabActivity)context;
this.tabhost = activity.getTabHost();
}