Merge "Add a check to adjust thumbnail scaling for full screen shots on TV" into nyc-dev am: 0513125c92

am: 809bb0f195

* commit '809bb0f1957d92e9fc3a84c56573dddd6ce50162':
  Add a check to adjust thumbnail scaling for full screen shots on TV

Change-Id: Icd9595a35f31b4e669bf6e66afd2073fc170e274
This commit is contained in:
Sid Soundararajan
2016-05-23 20:07:01 +00:00
committed by android-build-merger
6 changed files with 36 additions and 8 deletions

View File

@@ -24,6 +24,8 @@
<dimen name="thumbnail_height">192dp</dimen>
<!-- The amount to scale a fullscreen screenshot thumbnail. -->
<item name="thumbnail_fullscreen_scale" type="fraction">60%</item>
<!-- The width used to calculate scale for full screen thumbnail on TV -->
<integer name="thumbnail_width_tv">240</integer>
<!-- The standard size (both width and height) of an application icon that
will be displayed in the app launcher and elsewhere. -->
<dimen name="app_icon_size">48dip</dimen>

View File

@@ -1497,6 +1497,7 @@
<java-symbol type="integer" name="config_dockedStackDividerSnapMode" />
<java-symbol type="fraction" name="docked_stack_divider_fixed_ratio" />
<java-symbol type="fraction" name="thumbnail_fullscreen_scale" />
<java-symbol type="integer" name="thumbnail_width_tv" />
<java-symbol type="dimen" name="resize_shadow_size" />
<java-symbol type="color" name="resize_shadow_start_color" />
<java-symbol type="color" name="resize_shadow_end_color" />

View File

@@ -54,9 +54,9 @@ import com.android.systemui.recents.model.Task;
import com.android.systemui.recents.model.TaskStack;
import com.android.systemui.recents.tv.animations.HomeRecentsEnterExitAnimationHolder;
import com.android.systemui.recents.tv.views.RecentsTvView;
import com.android.systemui.recents.tv.views.TaskCardView;
import com.android.systemui.recents.tv.views.TaskStackHorizontalGridView;
import com.android.systemui.recents.tv.views.TaskStackHorizontalViewAdapter;
import com.android.systemui.recents.views.AnimationProps;
import com.android.systemui.statusbar.BaseStatusBar;
import com.android.systemui.tv.pip.PipManager;
import com.android.systemui.tv.pip.PipRecentsOverlayManager;
@@ -184,12 +184,14 @@ public class RecentsTvActivity extends Activity implements OnPreDrawListener {
if (!plan.hasTasks()) {
loader.preloadTasks(plan, -1, !launchState.launchedFromHome);
}
int numVisibleTasks = TaskCardView.getNumberOfVisibleTasks(getApplicationContext());
mLaunchedFromHome = launchState.launchedFromHome;
TaskStack stack = plan.getTaskStack();
RecentsTaskLoadPlan.Options loadOpts = new RecentsTaskLoadPlan.Options();
loadOpts.runningTaskId = launchState.launchedToTaskId;
loadOpts.numVisibleTasks = stack.getStackTaskCount();
loadOpts.numVisibleTaskThumbnails = stack.getStackTaskCount();
loadOpts.numVisibleTasks = numVisibleTasks;
loadOpts.numVisibleTaskThumbnails = numVisibleTasks;
loader.loadTasks(this, plan, loadOpts);

View File

@@ -288,7 +288,6 @@ public class TaskCardView extends LinearLayout {
lp.height = LayoutParams.MATCH_PARENT;
screenshotView.setLayoutParams(lp);
screenshotView.setImageBitmap(screenshot);
screenshotView.setClipToOutline(true);
screenshotView.setOutlineProvider(new ViewOutlineProvider() {
@Override
@@ -296,6 +295,7 @@ public class TaskCardView extends LinearLayout {
outline.setRoundRect(0, 0, view.getWidth(), view.getHeight(), mCornerRadius);
}
});
screenshotView.setImageBitmap(screenshot);
}
private void setAsBannerView(Drawable banner, ImageView bannerView) {
@@ -304,7 +304,6 @@ public class TaskCardView extends LinearLayout {
.getDimensionPixelSize(R.dimen.recents_tv_banner_width);
lp.height = getResources()
.getDimensionPixelSize(R.dimen.recents_tv_banner_height);
bannerView.setLayoutParams(lp);
bannerView.setImageDrawable(banner);
}
@@ -327,4 +326,16 @@ public class TaskCardView extends LinearLayout {
public View getDismissIconView() {
return mDismissIconView;
}
public static int getNumberOfVisibleTasks(Context context) {
Resources res = context.getResources();
WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
Display display = wm.getDefaultDisplay();
Point size = new Point();
display.getSize(size);
int screenWidth = size.x;
int cardWidth = res.getDimensionPixelSize(R.dimen.recents_tv_card_width);
int spacing = res.getDimensionPixelSize(R.dimen.recents_tv_gird_card_spacing);
return (int) (1.0 + Math.ceil(screenWidth / (cardWidth + spacing * 2.0)));
}
}

View File

@@ -23,9 +23,11 @@ import android.view.View;
import android.view.ViewGroup;
import com.android.systemui.R;
import com.android.systemui.recents.Recents;
import com.android.systemui.recents.events.EventBus;
import com.android.systemui.recents.events.activity.LaunchTvTaskEvent;
import com.android.systemui.recents.events.ui.DeleteTaskDataEvent;
import com.android.systemui.recents.model.RecentsTaskLoader;
import com.android.systemui.recents.model.Task;
import com.android.systemui.recents.views.AnimationProps;
@@ -122,7 +124,10 @@ public class TaskStackHorizontalViewAdapter extends
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
holder.init(mTaskList.get(position));
Task task = mTaskList.get(position);
// Retrives from caches, loading only if necessary
Recents.getTaskLoader().loadTaskData(task);
holder.init(task);
}
@Override

View File

@@ -272,6 +272,7 @@ import static android.content.pm.PackageManager.MATCH_DIRECT_BOOT_UNAWARE;
import static android.content.pm.PackageManager.MATCH_SYSTEM_ONLY;
import static android.content.pm.PackageManager.MATCH_UNINSTALLED_PACKAGES;
import static android.content.pm.PackageManager.PERMISSION_GRANTED;
import static android.content.res.Configuration.UI_MODE_TYPE_TELEVISION;
import static android.provider.Settings.Global.ALWAYS_FINISH_ACTIVITIES;
import static android.provider.Settings.Global.DEBUG_APP;
import static android.provider.Settings.Global.DEVELOPMENT_ENABLE_FREEFORM_WINDOWS_SUPPORT;
@@ -12822,12 +12823,18 @@ public final class ActivityManagerService extends ActivityManagerNative
com.android.internal.R.dimen.thumbnail_width);
mThumbnailHeight = res.getDimensionPixelSize(
com.android.internal.R.dimen.thumbnail_height);
mFullscreenThumbnailScale = res.getFraction(
com.android.internal.R.fraction.thumbnail_fullscreen_scale, 1, 1);
mDefaultPinnedStackBounds = Rect.unflattenFromString(res.getString(
com.android.internal.R.string.config_defaultPictureInPictureBounds));
mAppErrors.loadAppsNotReportingCrashesFromConfigLocked(res.getString(
com.android.internal.R.string.config_appsNotReportingCrashes));
if ((mConfiguration.uiMode & UI_MODE_TYPE_TELEVISION) == UI_MODE_TYPE_TELEVISION) {
mFullscreenThumbnailScale = (float) res
.getInteger(com.android.internal.R.integer.thumbnail_width_tv) /
(float) mConfiguration.screenWidthDp;
} else {
mFullscreenThumbnailScale = res.getFraction(
com.android.internal.R.fraction.thumbnail_fullscreen_scale, 1, 1);
}
}
}