android.app.TabActivity Java Examples

The following examples show how to use android.app.TabActivity. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TrackerManager.java    From android_viewtracker with Apache License 2.0 6 votes vote down vote up
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());
    }

}
 
Example #2
Source File: e.java    From letv with Apache License 2.0 6 votes vote down vote up
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) {
        }
    }
}
 
Example #3
Source File: l.java    From letv with Apache License 2.0 6 votes vote down vote up
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;
        }
    }
}
 
Example #4
Source File: StatusBarUtil.java    From LLApp with Apache License 2.0 6 votes vote down vote up
/**
 * 为头部是 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);
        }
    }
}
 
Example #5
Source File: StatusBarUtil.java    From ByWebView with Apache License 2.0 6 votes vote down vote up
/**
 * 为头部是 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);
        }
    }
}
 
Example #6
Source File: StatusBarUtil.java    From HHComicViewer with Apache License 2.0 6 votes vote down vote up
/**
 * 为头部是 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);
        }
    }
}
 
Example #7
Source File: StatusBarUtil.java    From CloudReader with Apache License 2.0 6 votes vote down vote up
/**
 * 为头部是 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);
        }
    }
}
 
Example #8
Source File: StatusBarUtil.java    From NetEasyNews with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 为头部是 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);
        }
    }
}
 
Example #9
Source File: TrackerManager.java    From android_viewtracker with Apache License 2.0 5 votes vote down vote up
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());
    }

}
 
Example #10
Source File: e.java    From letv with Apache License 2.0 5 votes vote down vote up
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]);
    }
}
 
Example #11
Source File: l.java    From letv with Apache License 2.0 5 votes vote down vote up
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;
        }
    }
}