List of usage examples for android.app Activity getWindow
public Window getWindow()
From source file:im.ene.ribbon.MiscUtils.java
/** * Returns if the current theme has the translucent status bar enabled * * @param activity context/*from ww w .j a v a 2 s . c o m*/ * @return true if the current theme has the translucent status bar */ static boolean hasTranslucentStatusBar(@Nullable final Activity activity) { return activity != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && // ((activity.getWindow().getAttributes().flags & LayoutParams.FLAG_TRANSLUCENT_STATUS) == LayoutParams.FLAG_TRANSLUCENT_STATUS); }
From source file:com.jaspersoft.android.jaspermobile.test.utils.espresso.JasperMatcher.java
public static ViewInteraction onViewDialogId(Activity activity, int id) { return onView(withId(id)).inRoot(withDecorView(is(not(activity.getWindow().getDecorView())))); }
From source file:com.jaspersoft.android.jaspermobile.test.utils.espresso.JasperMatcher.java
public static ViewInteraction onViewDialogText(Activity activity, int resId) { return onView(withText(resId)).inRoot(withDecorView(is(not(activity.getWindow().getDecorView())))); }
From source file:Main.java
/** * Create the transition participants required during a activity transition while * avoiding glitches with the system UI. * * @param activity The activity used as start for the transition. * @param includeStatusBar If false, the status bar will not be added as the transition * participant.//from w w w.j ava2 s .c o m * @return All transition participants. */ @TargetApi(Build.VERSION_CODES.LOLLIPOP) public static Pair<View, String>[] createSafeTransitionParticipants(@NonNull Activity activity, boolean includeStatusBar, @Nullable Pair... otherParticipants) { // Avoid system UI glitches as described here: // https://plus.google.com/+AlexLockwood/posts/RPtwZ5nNebb View decor = activity.getWindow().getDecorView(); View statusBar = null; if (includeStatusBar) { statusBar = decor.findViewById(android.R.id.statusBarBackground); } View navBar = decor.findViewById(android.R.id.navigationBarBackground); // Create pair of transition participants. List<Pair> participants = new ArrayList<>(3); addNonNullViewToTransitionParticipants(statusBar, participants); addNonNullViewToTransitionParticipants(navBar, participants); // only add transition participants if there's at least one none-null element if (otherParticipants != null && !(otherParticipants.length == 1 && otherParticipants[0] == null)) { participants.addAll(Arrays.asList(otherParticipants)); } return participants.toArray(new Pair[participants.size()]); }
From source file:de.vanita5.twittnuker.util.SwipebackActivityUtils.java
/** * /*w w w . j av a2 s . c o m*/ * May cause OutOfMemoryError * * @param activity * @param cacheQuality * @return Activity screenshot */ private static Bitmap getActivityScreenshotInternal(final Activity activity, final int cacheQuality) { if (activity == null) return null; final Window w = activity.getWindow(); final View view = w.getDecorView(); final int width = view.getWidth(), height = view.getHeight(); if (width <= 0 || height <= 0) return null; final Bitmap b = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_4444); final Rect frame = new Rect(); view.getWindowVisibleDisplayFrame(frame); // Remove window background behind status bar. final Canvas c = new Canvas(b); view.draw(c); final Paint paint = new Paint(); paint.setColor(Color.TRANSPARENT); paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN)); c.drawRect(frame.left, 0, frame.right, frame.top, paint); return b; }
From source file:nl.endran.scrumpoker.util.TransitionHelper.java
/** * Create the transition participants required during a activity transition while * avoiding glitches with the system UI. * * @param activity The activity used as start for the transition. * @param includeStatusBar If false, the status bar will not be added as the transition * participant.// www . jav a 2s.co m * @return All transition participants. */ @TargetApi(Build.VERSION_CODES.LOLLIPOP) public static Pair[] createSafeTransitionParticipants(@NonNull Activity activity, boolean includeStatusBar, @Nullable Pair... otherParticipants) { // Avoid system UI glitches as described here: // https://plus.google.com/+AlexLockwood/posts/RPtwZ5nNebb View decor = activity.getWindow().getDecorView(); View statusBar = null; if (includeStatusBar) { statusBar = decor.findViewById(android.R.id.statusBarBackground); } View navBar = decor.findViewById(android.R.id.navigationBarBackground); // Create pair of transition participants. List<Pair> participants = new ArrayList<>(3); addNonNullViewToTransitionParticipants(statusBar, participants); addNonNullViewToTransitionParticipants(navBar, participants); // only add transition participants if there's at least one none-null element if (otherParticipants != null && !(otherParticipants.length == 1 && otherParticipants[0] == null)) { participants.addAll(Arrays.asList(otherParticipants)); } return participants.toArray(new Pair[participants.size()]); }
From source file:andoridhost.imczy.com.activitymaterial.TransitionHelper.java
/** * Create the transition participants required during a activity transition while * avoiding glitches with the system UI. * * @param activity The activity used as start for the transition. * @param includeStatusBar If false, the status bar will not be added as the transition * participant./* ww w. j a v a 2 s . c om*/ * @return All transition participants. */ public static Pair<View, String>[] createSafeTransitionParticipants(@NonNull Activity activity, boolean includeStatusBar, @Nullable Pair... otherParticipants) { // Avoid system UI glitches as described here: // https://plus.google.com/+AlexLockwood/posts/RPtwZ5nNebb View decor = activity.getWindow().getDecorView(); View statusBar = null; if (includeStatusBar) { statusBar = decor.findViewById(android.R.id.statusBarBackground); } View navBar = decor.findViewById(android.R.id.navigationBarBackground); // Create pair of transition participants. List<Pair> participants = new ArrayList<>(3); addNonNullViewToTransitionParticipants(statusBar, participants); addNonNullViewToTransitionParticipants(navBar, participants); // only add transition participants if there's at least one none-null element if (otherParticipants != null && !(otherParticipants.length == 1 && otherParticipants[0] == null)) { participants.addAll(Arrays.asList(otherParticipants)); } return participants.toArray(new Pair[participants.size()]); }
From source file:com.arbo.gaogao.util.TransitionHelper.java
/** * Create the transition participants required during a activity transition while * avoiding glitches with the system UI. * * @param activity The activity used as start for the transition. * @param includeStatusBar If false, the status bar will not be added as the transition * participant.//from w ww . j a v a 2s . co m * @return All transition participants. */ public static Pair<View, String>[] createSafeTransitionParticipants(@NonNull Activity activity, boolean includeStatusBar, @Nullable Pair... otherParticipants) { // Avoid system UI glitches as described here: // https://plus.google.com/+AlexLockwood/posts/RPtwZ5nNebb View decor = activity.getWindow().getDecorView(); View statusBar = null; if (includeStatusBar) { statusBar = decor.findViewById(android.R.id.statusBarBackground); } View navBar = decor.findViewById(android.R.id.navigationBarBackground); // Create pair of transition participants. List<Pair> participants = new ArrayList<>(3); addNonNullViewToTransitionParticipants(statusBar, participants); addNonNullViewToTransitionParticipants(navBar, participants); // only add transition participants if there's at least One none-null element if (otherParticipants != null && !(otherParticipants.length == 1 && otherParticipants[0] == null)) { participants.addAll(Arrays.asList(otherParticipants)); } return participants.toArray(new Pair[participants.size()]); }
From source file:com.cmbb.smartkids.utils.TransitionHelper.java
/** * Create the transition participants required during a activity transition while * avoiding glitches with the system UI. * * @param activity The activity used as start for the transition. * @param includeStatusBar If false, the status bar will not be added as the transition * participant.//ww w .j a v a2 s.c o m * @return All transition participants. */ public static Pair[] createSafeTransitionParticipants(@NonNull Activity activity, boolean includeStatusBar, @Nullable Pair... otherParticipants) { // Avoid system UI glitches as described here: // https://plus.google.com/+AlexLockwood/posts/RPtwZ5nNebb View decor = activity.getWindow().getDecorView(); View statusBar = null; if (includeStatusBar) { statusBar = decor.findViewById(android.R.id.statusBarBackground); } View navBar = decor.findViewById(android.R.id.navigationBarBackground); // Create pair of transition participants. List<Pair> participants = new ArrayList<>(3); //addNonNullViewToTransitionParticipants(statusBar, participants); //addNonNullViewToTransitionParticipants(navBar, participants); // only add transition participants if there's at least one none-null element if (otherParticipants != null && !(otherParticipants.length == 1 && otherParticipants[0] == null)) { participants.addAll(Arrays.asList(otherParticipants)); } return participants.toArray(new Pair[participants.size()]); }
From source file:com.jaspersoft.android.jaspermobile.test.utils.espresso.JasperMatcher.java
public static ViewInteraction onOverflowView(Activity activity, final Matcher<View> viewMatcher) { return onView(viewMatcher).inRoot(withDecorView(is(not(activity.getWindow().getDecorView())))); }