| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.chrome.browser.ntp; | 5 package org.chromium.chrome.browser.ntp; |
| 6 | 6 |
| 7 import android.content.Context; | 7 import android.content.Context; |
| 8 import android.graphics.Canvas; | 8 import android.graphics.Canvas; |
| 9 import android.util.AttributeSet; | 9 import android.util.AttributeSet; |
| 10 import android.view.View; | 10 import android.view.View; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 /** Default constructor needed to inflate via XML. */ | 43 /** Default constructor needed to inflate via XML. */ |
| 44 public IncognitoNewTabPageView(Context context, AttributeSet attrs) { | 44 public IncognitoNewTabPageView(Context context, AttributeSet attrs) { |
| 45 super(context, attrs); | 45 super(context, attrs); |
| 46 } | 46 } |
| 47 | 47 |
| 48 @Override | 48 @Override |
| 49 protected void onFinishInflate() { | 49 protected void onFinishInflate() { |
| 50 super.onFinishInflate(); | 50 super.onFinishInflate(); |
| 51 | 51 |
| 52 mScrollView = (NewTabPageScrollView) findViewById(R.id.ntp_scrollview); | 52 mScrollView = (NewTabPageScrollView) findViewById(R.id.ntp_scrollview); |
| 53 mScrollView.setBackgroundColor( |
| 54 NtpColorUtils.getBackgroundColorResource(getResources(), true)); |
| 53 | 55 |
| 54 // FOCUS_BEFORE_DESCENDANTS is needed to support keyboard shortcuts. Oth
erwise, pressing | 56 // FOCUS_BEFORE_DESCENDANTS is needed to support keyboard shortcuts. Oth
erwise, pressing |
| 55 // any shortcut causes the UrlBar to be focused. See ViewRootImpl.leaveT
ouchMode(). | 57 // any shortcut causes the UrlBar to be focused. See ViewRootImpl.leaveT
ouchMode(). |
| 56 mScrollView.setDescendantFocusability(FOCUS_BEFORE_DESCENDANTS); | 58 mScrollView.setDescendantFocusability(FOCUS_BEFORE_DESCENDANTS); |
| 57 | 59 |
| 58 View learnMore = findViewById(R.id.learn_more); | 60 View learnMore = findViewById(R.id.learn_more); |
| 59 learnMore.setOnClickListener(new OnClickListener() { | 61 learnMore.setOnClickListener(new OnClickListener() { |
| 60 @Override | 62 @Override |
| 61 public void onClick(View v) { | 63 public void onClick(View v) { |
| 62 mManager.loadIncognitoLearnMore(); | 64 mManager.loadIncognitoLearnMore(); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 @Override | 100 @Override |
| 99 public void onAttachedToWindow() { | 101 public void onAttachedToWindow() { |
| 100 super.onAttachedToWindow(); | 102 super.onAttachedToWindow(); |
| 101 assert mManager != null; | 103 assert mManager != null; |
| 102 if (mFirstShow) { | 104 if (mFirstShow) { |
| 103 mManager.onLoadingComplete(); | 105 mManager.onLoadingComplete(); |
| 104 mFirstShow = false; | 106 mFirstShow = false; |
| 105 } | 107 } |
| 106 } | 108 } |
| 107 } | 109 } |
| OLD | NEW |