Return-Path: X-Original-To: apmail-cordova-issues-archive@minotaur.apache.org Delivered-To: apmail-cordova-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 546A417864 for ; Tue, 31 Mar 2015 00:38:53 +0000 (UTC) Received: (qmail 99849 invoked by uid 500); 31 Mar 2015 00:38:53 -0000 Delivered-To: apmail-cordova-issues-archive@cordova.apache.org Received: (qmail 99824 invoked by uid 500); 31 Mar 2015 00:38:53 -0000 Mailing-List: contact issues-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list issues@cordova.apache.org Received: (qmail 99813 invoked by uid 99); 31 Mar 2015 00:38:53 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 31 Mar 2015 00:38:53 +0000 Date: Tue, 31 Mar 2015 00:38:53 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: issues@cordova.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CB-8753) Maintain splash screen aspect ratio MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CB-8753?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14387714#comment-14387714 ] ASF GitHub Bot commented on CB-8753: ------------------------------------ Github user AlexTalis commented on a diff in the pull request: https://github.com/apache/cordova-plugin-splashscreen/pull/43#discussion_r27445114 --- Diff: src/android/SplashScreen.java --- @@ -194,9 +263,25 @@ public void run() { // TODO: Use the background color of the webView's parent instead of using the // preference. root.setBackgroundColor(preferences.getInteger("backgroundColor", Color.BLACK)); + root.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, 0.0F)); - root.setBackgroundResource(drawableId); + + // Use an ImageView to render the image because of its flexible scaling options. + splashImageView = new ImageView(context); + splashImageView.setImageResource(drawableId); --- End diff -- Setting ImageView background color does work. It just does not show with any of the current scaling options. Without "maintain aspect ratio" the image is stretched to fit screen, so you never see the background. With "maintain aspect ratio" the image covers the screen fully, so again you don't see the background. If I hard-code a scaling option like FIT_CENTER, then ImageView background color does fill areas that are not covered by the drawable. So if the purpose of BG color is to simply fill areas not covered by the drawable, then we can take out LinearLayout. I thought that the purpose was to somehow cover up the WebView in background if the device is rotated, which probably wouldn't work anyway. Here's the test app without LinearLayout, with scale mode temporarily set to FIT_CENTER and BG color set to RED: ![image](https://cloud.githubusercontent.com/assets/1012600/6910105/4eb48854-d703-11e4-8d08-f5ecce5bea91.png) > Maintain splash screen aspect ratio > ----------------------------------- > > Key: CB-8753 > URL: https://issues.apache.org/jira/browse/CB-8753 > Project: Apache Cordova > Issue Type: Improvement > Components: Android > Affects Versions: 3.7.1 > Environment: Android > Reporter: Alex Talis > Fix For: 3.8.0, 4.0.0, 3.7.1 > > Attachments: cur-land.png, cur-port.png, new-land.png, new-port.png > > > I will be submitting a pull request for this enhancement shortly. > Current splash screen scales images non-uniformly to fit into splash dialog. This approach does not work well for many typical splash screen images that contain scenery or text and look bad when aspect ratio is not preserved. 9-patch images may work, but they have to be carefully designed so that the inside can be stretched without distorting important information. > The purpose of this enhancement is to allow use of non-9-patch images without stretching, similar to CSS "background-size:cover" capability. For this to work, splash images have to have large safe area all around that can be safely cropped off. > With this type of splash screen, it is usually necessary to use different images for portrait and landscape orientations, so a second part of this enhancement is to add an option to reload the drawable when orientation changes. > Examples of the two preferences are shown below. Both are optional and default to False to maintain current splash screen behavior. > > -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org For additional commands, e-mail: issues-help@cordova.apache.org