Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
halo
packages_apps_Camera2
Commits
148552a0
Commit
148552a0
authored
11 years ago
by
The Android Open Source Project
Browse files
Options
Download
Plain Diff
Merge commit '
da6d9776
' into HEAD
parents
c4cffe22
da6d9776
Changes
40
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
266 additions
and
45 deletions
+266
-45
AndroidManifest.xml
AndroidManifest.xml
+2
-0
res/drawable-hdpi/ic_notification.png
res/drawable-hdpi/ic_notification.png
+0
-0
res/drawable-mdpi/ic_notification.png
res/drawable-mdpi/ic_notification.png
+0
-0
res/drawable-xhdpi/ic_notification.png
res/drawable-xhdpi/ic_notification.png
+0
-0
res/drawable-xxhdpi/ic_notification.png
res/drawable-xxhdpi/ic_notification.png
+0
-0
res/layout-port/keyguard_widget.xml
res/layout-port/keyguard_widget.xml
+3
-3
res/layout/filmstrip_bottom_controls.xml
res/layout/filmstrip_bottom_controls.xml
+2
-0
res/layout/panorama_module.xml
res/layout/panorama_module.xml
+6
-0
res/layout/photo_module.xml
res/layout/photo_module.xml
+6
-0
res/layout/placeholder_progressbar.xml
res/layout/placeholder_progressbar.xml
+29
-0
res/layout/video_module.xml
res/layout/video_module.xml
+6
-0
res/values/arrays.xml
res/values/arrays.xml
+14
-4
res/values/dimens.xml
res/values/dimens.xml
+2
-0
res/values/strings.xml
res/values/strings.xml
+9
-4
src/com/android/camera/AndroidCameraManagerImpl.java
src/com/android/camera/AndroidCameraManagerImpl.java
+12
-3
src/com/android/camera/CameraActivity.java
src/com/android/camera/CameraActivity.java
+142
-16
src/com/android/camera/ComboPreferences.java
src/com/android/camera/ComboPreferences.java
+0
-1
src/com/android/camera/FocusOverlayManager.java
src/com/android/camera/FocusOverlayManager.java
+29
-13
src/com/android/camera/ListPreference.java
src/com/android/camera/ListPreference.java
+2
-0
src/com/android/camera/PhotoController.java
src/com/android/camera/PhotoController.java
+2
-1
No files found.
AndroidManifest.xml
View file @
148552a0
...
...
@@ -47,6 +47,7 @@
android:largeHeap=
"true"
android:logo=
"@mipmap/ic_launcher_camera"
android:restoreAnyVersion=
"true"
android:supportsRtl=
"true"
android:theme=
"@style/Theme.Camera"
>
<activity
android:name=
"com.android.camera.CameraActivity"
...
...
@@ -112,6 +113,7 @@
android:excludeFromRecents=
"true"
android:icon=
"@mipmap/ic_launcher_camera"
android:label=
"@string/app_name"
android:logo=
"@mipmap/ic_launcher_gallery"
android:taskAffinity=
"com.android.camera.SecureCameraActivity"
android:theme=
"@style/Theme.Camera"
android:windowSoftInputMode=
"stateAlwaysHidden|adjustPan"
>
...
...
This diff is collapsed.
Click to expand it.
res/drawable-hdpi/ic_notification.png
0 → 100644
View file @
148552a0
1.08 KB
This diff is collapsed.
Click to expand it.
res/drawable-mdpi/ic_notification.png
0 → 100644
View file @
148552a0
841 Bytes
This diff is collapsed.
Click to expand it.
res/drawable-xhdpi/ic_notification.png
0 → 100644
View file @
148552a0
1.43 KB
This diff is collapsed.
Click to expand it.
res/drawable-xxhdpi/ic_notification.png
0 → 100644
View file @
148552a0
1.91 KB
This diff is collapsed.
Click to expand it.
res/layout-port/keyguard_widget.xml
View file @
148552a0
...
...
@@ -34,7 +34,7 @@
android:layout_height=
"64dip"
android:layout_toRightOf=
"@id/shutter"
android:layout_alignParentBottom=
"true"
android:layout_marginBottom=
"
6
dip"
android:layout_marginBottom=
"
9
dip"
android:layout_marginRight=
"-5dip"
/>
<ImageView
...
...
@@ -42,7 +42,7 @@
style=
"@style/SwitcherButton"
android:layout_toLeftOf=
"@id/shutter"
android:layout_alignParentBottom=
"true"
android:layout_marginBottom=
"
2
dip"
android:layout_marginBottom=
"
3
dip"
android:scaleType=
"center"
android:contentDescription=
"@string/accessibility_mode_picker"
android:src=
"@drawable/ic_switch_camera"
/>
...
...
@@ -52,7 +52,7 @@
style=
"@style/SwitcherButton"
android:layout_toLeftOf=
"@id/shutter"
android:layout_alignParentBottom=
"true"
android:layout_marginBottom=
"
2
dip"
android:layout_marginBottom=
"
3
dip"
android:scaleType=
"center"
android:contentDescription=
"@string/accessibility_mode_picker"
android:src=
"@drawable/ic_switcher_menu_indicator"
/>
...
...
This diff is collapsed.
Click to expand it.
res/layout/filmstrip_bottom_controls.xml
View file @
148552a0
...
...
@@ -30,6 +30,7 @@
android:layout_height=
"wrap_content"
android:layout_alignParentBottom=
"true"
android:layout_alignParentLeft=
"true"
android:layout_alignParentStart=
"true"
android:background=
"@drawable/photopage_bottom_button_background"
android:paddingBottom=
"5dp"
android:paddingLeft=
"15dp"
...
...
@@ -55,6 +56,7 @@
android:layout_height=
"wrap_content"
android:layout_alignParentBottom=
"true"
android:layout_alignParentRight=
"true"
android:layout_alignParentEnd=
"true"
android:background=
"@drawable/photopage_bottom_button_background"
android:paddingBottom=
"5dp"
android:paddingLeft=
"15dp"
...
...
This diff is collapsed.
Click to expand it.
res/layout/panorama_module.xml
View file @
148552a0
...
...
@@ -19,6 +19,12 @@
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<include
layout=
"@layout/pano_module_capture"
/>
<View
android:id=
"@+id/preview_cover"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@android:color/black"
android:visibility=
"gone"
/>
<include
layout=
"@layout/pano_module_review"
/>
<include
layout=
"@layout/camera_controls"
android:layout_gravity=
"center"
...
...
This diff is collapsed.
Click to expand it.
res/layout/photo_module.xml
View file @
148552a0
...
...
@@ -33,6 +33,12 @@
android:id=
"@+id/preview_content"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
/>
<View
android:id=
"@+id/preview_cover"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@android:color/black"
android:visibility=
"gone"
/>
</FrameLayout>
<ImageView
android:id=
"@+id/review_image"
...
...
This diff is collapsed.
Click to expand it.
res/layout/placeholder_progressbar.xml
0 → 100644
View file @
148552a0
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2013 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<ProgressBar
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:id=
"@+id/placeholder_progress"
style=
"@android:style/Widget.Holo.ProgressBar.Large"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"bottom|center_horizontal"
android:paddingBottom=
"58dp"
android:visibility=
"visible"
android:indeterminate=
"true"
android:indeterminateOnly=
"true"
android:background=
"@null"
/>
This diff is collapsed.
Click to expand it.
res/layout/video_module.xml
View file @
148552a0
...
...
@@ -26,6 +26,12 @@
android:id=
"@+id/preview_content"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
/>
<View
android:id=
"@+id/preview_cover"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@android:color/black"
android:visibility=
"gone"
/>
</FrameLayout>
<View
android:id=
"@+id/flash_overlay"
...
...
This diff is collapsed.
Click to expand it.
res/values/arrays.xml
View file @
148552a0
...
...
@@ -163,8 +163,13 @@
<item>
@string/pref_camera_picturesize_entry_3mp
</item>
<item>
@string/pref_camera_picturesize_entry_2mp
</item>
<item>
@string/pref_camera_picturesize_entry_2mp_wide
</item>
<item>
@string/pref_camera_picturesize_entry_2mp_wide
</item>
<item>
@string/pref_camera_picturesize_entry_1_5mp
</item>
<item>
@string/pref_camera_picturesize_entry_1_3mp
</item>
<item>
@string/pref_camera_picturesize_entry_1mp
</item>
<item>
@string/pref_camera_picturesize_entry_1mp
</item>
<item>
960 x 720
</item>
<item>
720 x 480
</item>
<item>
@string/pref_camera_picturesize_entry_vga
</item>
<item>
@string/pref_camera_picturesize_entry_qvga
</item>
</string-array>
...
...
@@ -182,8 +187,13 @@
<item>
2048x1536
</item>
<item>
1600x1200
</item>
<item>
1920x1088
</item>
<item>
1920x1080
</item>
<item>
1440x1080
</item>
<item>
1280x960
</item>
<item>
1280x720
</item>
<item>
1024x768
</item>
<item>
960x720
</item>
<item>
720x480
</item>
<item>
640x480
</item>
<item>
320x240
</item>
</string-array>
...
...
@@ -436,8 +446,8 @@
</string-array>
<string-array
name=
"pref_camera_hdr_plus_labels"
translatable=
"false"
>
<item>
@string/pref_camera_scenemode_entry_hdr_plus
</item>
<item>
@string/pref_camera_scenemode_entry_hdr_plus
</item>
<item>
@string/pref_camera_scenemode_entry_
turn_
hdr_plus
_on
</item>
<item>
@string/pref_camera_scenemode_entry_
turn_
hdr_plus
_off
</item>
</string-array>
<string-array
name=
"pref_camera_hdr_plus_icons"
translatable=
"false"
>
...
...
@@ -457,8 +467,8 @@
</string-array>
<string-array
name=
"pref_camera_hdr_labels"
translatable=
"false"
>
<item>
@string/pref_camera_
hdr_label
</item>
<item>
@string/pref_camera_
hdr_label
</item>
<item>
@string/pref_camera_
scenemode_entry_turn_hdr_on
</item>
<item>
@string/pref_camera_
scenemode_entry_turn_hdr_off
</item>
</string-array>
<string-array
name=
"pref_camera_hdr_icons"
translatable=
"false"
>
...
...
This diff is collapsed.
Click to expand it.
res/values/dimens.xml
View file @
148552a0
...
...
@@ -74,6 +74,8 @@
<dimen
name=
"effect_setting_type_text_left_padding_xlarge"
>
26dp
</dimen>
<dimen
name=
"onscreen_indicators_height_xlarge"
>
36dp
</dimen>
<dimen
name=
"onscreen_exposure_indicator_text_size_xlarge"
>
18dp
</dimen>
<dimen
name=
"pie_progress_radius"
>
25dp
</dimen>
<dimen
name=
"pie_progress_width"
>
3dp
</dimen>
<dimen
name=
"pie_radius_start"
>
80dp
</dimen>
<dimen
name=
"pie_radius_increment"
>
48dp
</dimen>
<dimen
name=
"pie_touch_slop"
>
12dp
</dimen>
...
...
This diff is collapsed.
Click to expand it.
res/values/strings.xml
View file @
148552a0
...
...
@@ -185,6 +185,9 @@
<!-- A label that overlays on top of the preview frame to indicate the camcorder is in time lapse mode [CHAR LIMIT=35] -->
<string
name=
"time_lapse_title"
>
Time lapse recording
</string>
<!-- Screen display message during image capture to indicate that the capture is in progress, like during HDR+. [CHAR LIMIT=20] -->
<string
name=
"capturing"
>
Capturing
</string>
<!-- Settings screen, camera selection dialog title. Users can select a camera from the phone (front-facing or back-facing). [CHAR LIMIT=20] -->
<string
name=
"pref_camera_id_title"
>
Choose camera
</string>
...
...
@@ -269,6 +272,8 @@
<string
name=
"pref_camera_picturesize_entry_2mp"
>
2M pixels
</string>
<!-- Settings screen, dialog choice for 2 megapixels picture size [CHAR LIMIT=20] -->
<string
name=
"pref_camera_picturesize_entry_2mp_wide"
>
2M pixels (16:9)
</string>
<!-- Settings screen, dialog choice for 1.5 megapixels picture size [CHAR LIMIT=20] -->
<string
name=
"pref_camera_picturesize_entry_1_5mp"
>
1.5M pixels
</string>
<!-- Settings screen, dialog choice for 1.3 megapixels picture size [CHAR LIMIT=20] -->
<string
name=
"pref_camera_picturesize_entry_1_3mp"
>
1.3M pixels
</string>
<!-- Settings screen, dialog choice for 1 megapixels picture size [CHAR LIMIT=20] -->
...
...
@@ -355,13 +360,13 @@
<!-- Scene mode that uses HDR (high dynamic range) [CHAR LIMIT=16] -->
<string
name=
"pref_camera_scenemode_entry_hdr"
>
HDR
</string>
<!-- Scene mode to turn on HDR (better high dynamic range) [CHAR LIMIT=50] -->
<string
name=
"pref_camera_scenemode_entry_turn_hdr_plus_on"
>
Turn
HDR+ O
n
</string>
<string
name=
"pref_camera_scenemode_entry_turn_hdr_plus_on"
>
HDR+ O
N
</string>
<!-- Scene mode to turn off HDR (better high dynamic range) [CHAR LIMIT=50] -->
<string
name=
"pref_camera_scenemode_entry_turn_hdr_plus_off"
>
Turn
HDR+ O
ff
</string>
<string
name=
"pref_camera_scenemode_entry_turn_hdr_plus_off"
>
HDR+ O
FF
</string>
<!-- Scene mode to turn on HDR (high dynamic range) [CHAR LIMIT=50] -->
<string
name=
"pref_camera_scenemode_entry_turn_hdr_on"
>
Turn
HDR O
n
</string>
<string
name=
"pref_camera_scenemode_entry_turn_hdr_on"
>
HDR O
N
</string>
<!-- Scene mode to turn off HDR (high dynamic range) [CHAR LIMIT=50] -->
<string
name=
"pref_camera_scenemode_entry_turn_hdr_off"
>
Turn
HDR O
ff
</string>
<string
name=
"pref_camera_scenemode_entry_turn_hdr_off"
>
HDR O
FF
</string>
<!-- Scene mode that takes an image quickly with little motion blur. [CHAR LIMIT=16] -->
<string
name=
"pref_camera_scenemode_entry_action"
>
Action
</string>
<!-- Scene mode that takes long exposures to capture night scenes without flash. [CHAR LIMIT=16] -->
...
...
This diff is collapsed.
Click to expand it.
src/com/android/camera/AndroidCameraManagerImpl.java
View file @
148552a0
...
...
@@ -329,8 +329,14 @@ class AndroidCameraManagerImpl implements CameraManager {
}
mCamera
=
null
;
}
else
if
(
mCamera
==
null
)
{
Log
.
w
(
TAG
,
"Cannot handle message, mCamera is null."
);
return
;
if
(
msg
.
what
==
OPEN_CAMERA
)
{
if
(
msg
.
obj
!=
null
)
{
((
CameraOpenErrorCallback
)
msg
.
obj
).
onDeviceOpenFailure
(
msg
.
arg1
);
}
}
else
{
Log
.
w
(
TAG
,
"Cannot handle message, mCamera is null."
);
}
return
;
}
throw
e
;
}
...
...
@@ -814,7 +820,10 @@ class AndroidCameraManagerImpl implements CameraManager {
private
CameraOpenErrorCallbackForward
(
Handler
h
,
CameraOpenErrorCallback
cb
)
{
mHandler
=
h
;
// Given that we are using the main thread handler, we can create it
// here instead of holding onto the PhotoModule objects. In this
// way, we can avoid memory leak.
mHandler
=
new
Handler
(
Looper
.
getMainLooper
());
mCallback
=
cb
;
}
...
...
This diff is collapsed.
Click to expand it.
src/com/android/camera/CameraActivity.java
View file @
148552a0
...
...
@@ -64,6 +64,7 @@ import android.widget.ProgressBar;
import
android.widget.ShareActionProvider
;
import
com.android.camera.app.AppManagerFactory
;
import
com.android.camera.app.PlaceholderManager
;
import
com.android.camera.app.PanoramaStitchingManager
;
import
com.android.camera.crop.CropActivity
;
import
com.android.camera.data.CameraDataAdapter
;
...
...
@@ -83,15 +84,20 @@ import com.android.camera.ui.FilmStripView;
import
com.android.camera.util.ApiHelper
;
import
com.android.camera.util.CameraUtil
;
import
com.android.camera.util.GcamHelper
;
import
com.android.camera.util.IntentHelper
;
import
com.android.camera.util.PhotoSphereHelper
;
import
com.android.camera.util.PhotoSphereHelper.PanoramaViewHelper
;
import
com.android.camera.util.UsageStatistics
;
import
com.android.camera2.R
;
import
java.io.File
;
import
static
com
.
android
.
camera
.
CameraManager
.
CameraOpenErrorCallback
;
public
class
CameraActivity
extends
Activity
implements
ModuleSwitcher
.
ModuleSwitchListener
,
ActionBar
.
OnMenuVisibilityListener
{
ActionBar
.
OnMenuVisibilityListener
,
ShareActionProvider
.
OnShareTargetSelectedListener
{
private
static
final
String
TAG
=
"CAM_Activity"
;
...
...
@@ -143,6 +149,7 @@ public class CameraActivity extends Activity
private
LocalDataAdapter
mWrappedDataAdapter
;
private
PanoramaStitchingManager
mPanoramaManager
;
private
PlaceholderManager
mPlaceholderManager
;
private
int
mCurrentModuleIndex
;
private
CameraModule
mCurrentModule
;
private
FrameLayout
mAboveFilmstripControlLayout
;
...
...
@@ -225,18 +232,27 @@ public class CameraActivity extends Activity
new
CameraOpenErrorCallback
()
{
@Override
public
void
onCameraDisabled
(
int
cameraId
)
{
UsageStatistics
.
onEvent
(
UsageStatistics
.
COMPONENT_CAMERA
,
UsageStatistics
.
ACTION_OPEN_FAIL
,
"security"
);
CameraUtil
.
showErrorAndFinish
(
CameraActivity
.
this
,
R
.
string
.
camera_disabled
);
}
@Override
public
void
onDeviceOpenFailure
(
int
cameraId
)
{
UsageStatistics
.
onEvent
(
UsageStatistics
.
COMPONENT_CAMERA
,
UsageStatistics
.
ACTION_OPEN_FAIL
,
"open"
);
CameraUtil
.
showErrorAndFinish
(
CameraActivity
.
this
,
R
.
string
.
cannot_connect_camera
);
}
@Override
public
void
onReconnectionFailure
(
CameraManager
mgr
)
{
UsageStatistics
.
onEvent
(
UsageStatistics
.
COMPONENT_CAMERA
,
UsageStatistics
.
ACTION_OPEN_FAIL
,
"reconnect"
);
CameraUtil
.
showErrorAndFinish
(
CameraActivity
.
this
,
R
.
string
.
cannot_connect_camera
);
}
...
...
@@ -289,15 +305,30 @@ public class CameraActivity extends Activity
sFirstStartAfterScreenOn
=
false
;
}
private
String
fileNameFromDataID
(
int
dataID
)
{
final
LocalData
localData
=
mDataAdapter
.
getLocalData
(
dataID
);
File
localFile
=
new
File
(
localData
.
getPath
());
return
localFile
.
getName
();
}
private
FilmStripView
.
Listener
mFilmStripListener
=
new
FilmStripView
.
Listener
()
{
@Override
public
void
onDataPromoted
(
int
dataID
)
{
UsageStatistics
.
onEvent
(
UsageStatistics
.
COMPONENT_CAMERA
,
UsageStatistics
.
ACTION_DELETE
,
"promoted"
,
0
,
UsageStatistics
.
hashFileName
(
fileNameFromDataID
(
dataID
)));
removeData
(
dataID
);
}
@Override
public
void
onDataDemoted
(
int
dataID
)
{
UsageStatistics
.
onEvent
(
UsageStatistics
.
COMPONENT_CAMERA
,
UsageStatistics
.
ACTION_DELETE
,
"demoted"
,
0
,
UsageStatistics
.
hashFileName
(
fileNameFromDataID
(
dataID
)));
removeData
(
dataID
);
}
...
...
@@ -336,6 +367,7 @@ public class CameraActivity extends Activity
@Override
public
void
onReload
()
{
setPreviewControlsVisibility
(
true
);
CameraActivity
.
this
.
setSystemBarsVisibility
(
false
);
}
@Override
...
...
@@ -347,6 +379,7 @@ public class CameraActivity extends Activity
if
(!
arePreviewControlsVisible
())
{
setPreviewControlsVisibility
(
true
);
CameraActivity
.
this
.
setSystemBarsVisibility
(
false
);
}
}
...
...
@@ -443,6 +476,9 @@ public class CameraActivity extends Activity
};
public
void
gotoGallery
()
{
UsageStatistics
.
onEvent
(
UsageStatistics
.
COMPONENT_CAMERA
,
UsageStatistics
.
ACTION_FILMSTRIP
,
"thumbnailTap"
);
mFilmStripView
.
getController
().
goToNextItem
();
}
...
...
@@ -462,13 +498,17 @@ public class CameraActivity extends Activity
*/
private
void
setSystemBarsVisibility
(
boolean
visible
,
boolean
hideLater
)
{
mMainHandler
.
removeMessages
(
HIDE_ACTION_BAR
);
boolean
currentlyVisible
=
mActionBar
.
isShowing
();
if
(
visible
!=
currentlyVisible
)
{
int
visibility
=
DEFAULT_SYSTEM_UI_VISIBILITY
|
(
visible
?
View
.
SYSTEM_UI_FLAG_VISIBLE
:
View
.
SYSTEM_UI_FLAG_LOW_PROFILE
|
View
.
SYSTEM_UI_FLAG_FULLSCREEN
);
mAboveFilmstripControlLayout
.
setSystemUiVisibility
(
visibility
);
int
currentSystemUIVisibility
=
mAboveFilmstripControlLayout
.
getSystemUiVisibility
();
int
newSystemUIVisibility
=
DEFAULT_SYSTEM_UI_VISIBILITY
|
(
visible
?
View
.
SYSTEM_UI_FLAG_VISIBLE
:
View
.
SYSTEM_UI_FLAG_LOW_PROFILE
|
View
.
SYSTEM_UI_FLAG_FULLSCREEN
);
if
(
newSystemUIVisibility
!=
currentSystemUIVisibility
)
{
mAboveFilmstripControlLayout
.
setSystemUiVisibility
(
newSystemUIVisibility
);
}
boolean
currentActionBarVisibility
=
mActionBar
.
isShowing
();
if
(
visible
!=
currentActionBarVisibility
)
{
if
(
visible
)
{
mActionBar
.
show
();
}
else
{
...
...
@@ -579,6 +619,18 @@ public class CameraActivity extends Activity
}
}
@Override
public
boolean
onShareTargetSelected
(
ShareActionProvider
shareActionProvider
,
Intent
intent
)
{
int
currentDataId
=
mFilmStripView
.
getCurrentId
();
if
(
currentDataId
<
0
)
{
return
false
;
}
UsageStatistics
.
onEvent
(
UsageStatistics
.
COMPONENT_CAMERA
,
UsageStatistics
.
ACTION_SHARE
,
intent
.
getComponent
().
getPackageName
(),
0
,
UsageStatistics
.
hashFileName
(
fileNameFromDataID
(
currentDataId
)));
return
true
;
}
/**
* According to the data type, make the menu items for supported operations
* visible.
...
...
@@ -687,6 +739,41 @@ public class CameraActivity extends Activity
item
.
setVisible
(
visible
);
}
private
ImageTaskManager
.
TaskListener
mPlaceholderListener
=
new
ImageTaskManager
.
TaskListener
()
{
@Override
public
void
onTaskQueued
(
String
filePath
,
final
Uri
imageUri
)
{
mMainHandler
.
post
(
new
Runnable
()
{
@Override
public
void
run
()
{
notifyNewMedia
(
imageUri
);
int
dataID
=
mDataAdapter
.
findDataByContentUri
(
imageUri
);
if
(
dataID
!=
-
1
)
{
LocalData
d
=
mDataAdapter
.
getLocalData
(
dataID
);
InProgressDataWrapper
newData
=
new
InProgressDataWrapper
(
d
,
true
);
mDataAdapter
.
updateData
(
dataID
,
newData
);
}
}
});
}
@Override
public
void
onTaskDone
(
String
filePath
,
final
Uri
imageUri
)
{
mMainHandler
.
post
(
new
Runnable
()
{
@Override
public
void
run
()
{
mDataAdapter
.
refresh
(
getContentResolver
(),
imageUri
);
}
});
}
@Override
public
void
onTaskProgress
(
String
filePath
,
Uri
imageUri
,
int
progress
)
{
// Do nothing
}
};
private
ImageTaskManager
.
TaskListener
mStitchingListener
=
new
ImageTaskManager
.
TaskListener
()
{
@Override
...
...
@@ -760,6 +847,8 @@ public class CameraActivity extends Activity
mDataAdapter
.
addNewPhoto
(
cr
,
uri
);
}
else
if
(
mimeType
.
startsWith
(
"application/stitching-preview"
))
{
mDataAdapter
.
addNewPhoto
(
cr
,
uri
);
}
else
if
(
mimeType
.
startsWith
(
PlaceholderManager
.
PLACEHOLDER_MIME_TYPE
))
{
mDataAdapter
.
addNewPhoto
(
cr
,
uri
);
}
else
{
android
.
util
.
Log
.
w
(
TAG
,
"Unknown new media with MIME type:"
+
mimeType
+
", uri:"
+
uri
);
...
...
@@ -812,6 +901,9 @@ public class CameraActivity extends Activity
mPanoramaShareActionProvider
.
setShareIntent
(
mPanoramaShareIntent
);
}
mStandardShareActionProvider
.
setOnShareTargetSelectedListener
(
this
);
mPanoramaShareActionProvider
.
setOnShareTargetSelectedListener
(
this
);
return
super
.
onCreateOptionsMenu
(
menu
);
}
...
...
@@ -828,18 +920,22 @@ public class CameraActivity extends Activity
case
android
.
R
.
id
.
home
:
// ActionBar's Up/Home button was clicked
try
{
if
(!
CameraUtil
.
launchGallery
(
CameraActivity
.
this
))
{
mFilmStripView
.
getController
().
goToFirstItem
();
}
startActivity
(
IntentHelper
.
getGalleryIntent
(
this
));
return
true
;
}
catch
(
ActivityNotFoundException
e
)
{
Log
.
w
(
TAG
,
"
No activity found to handle APP_GALLERY category!
"
);
Log
.
w
(
TAG
,
"
Failed to launch gallery activity, closing
"
);
finish
();
}
case
R
.
id
.
action_delete
:
UsageStatistics
.
onEvent
(
UsageStatistics
.
COMPONENT_CAMERA
,
UsageStatistics
.
ACTION_DELETE
,
null
,
0
,
UsageStatistics
.
hashFileName
(
fileNameFromDataID
(
currentDataId
)));
removeData
(
currentDataId
);
return
true
;
case
R
.
id
.
action_edit
:
UsageStatistics
.
onEvent
(
UsageStatistics
.
COMPONENT_CAMERA
,
UsageStatistics
.
ACTION_EDIT
,
null
,
0
,
UsageStatistics
.
hashFileName
(
fileNameFromDataID
(
currentDataId
)));
launchEditor
(
localData
);
return
true
;
case
R
.
id
.
action_trim
:
{
...
...
@@ -860,6 +956,9 @@ public class CameraActivity extends Activity
localData
.
rotate90Degrees
(
this
,
mDataAdapter
,
currentDataId
,
true
);
return
true
;
case
R
.
id
.
action_crop
:
{
UsageStatistics
.
onEvent
(
UsageStatistics
.
COMPONENT_CAMERA
,
UsageStatistics
.
ACTION_CROP
,
null
,
0
,
UsageStatistics
.
hashFileName
(
fileNameFromDataID
(
currentDataId
)));
Intent
intent
=
new
Intent
(
CropActivity
.
CROP_ACTION
);
intent
.
setClass
(
this
,
CropActivity
.
class
);
intent
.
setDataAndType
(
localData
.
getContentUri
(),
localData
.
getMimeType
())
...
...
@@ -965,7 +1064,10 @@ public class CameraActivity extends Activity
this
.
setSystemBarsVisibility
(
false
);
mPanoramaManager
=
AppManagerFactory
.
getInstance
(
this
)
.
getPanoramaStitchingManager
();
mPlaceholderManager
=
AppManagerFactory
.
getInstance
(
this
)
.
getGcamProcessingManager
();
mPanoramaManager
.
addTaskListener
(
mStitchingListener
);
mPlaceholderManager
.
addTaskListener
(
mPlaceholderListener
);
LayoutInflater
inflater
=
getLayoutInflater
();
View
rootLayout
=
inflater
.
inflate
(
R
.
layout
.
camera
,
null
,
false
);
mCameraModuleRootView
=
rootLayout
.
findViewById
(
R
.
id
.
camera_app_root
);
...
...
@@ -994,8 +1096,14 @@ public class CameraActivity extends Activity
moduleIndex
=
ModuleSwitcher
.
VIDEO_MODULE_INDEX
;
}
else
if
(
MediaStore
.
INTENT_ACTION_STILL_IMAGE_CAMERA
.
equals
(
getIntent
().
getAction
())
||
MediaStore
.
INTENT_ACTION_STILL_IMAGE_CAMERA_SECURE
.
equals
(
getIntent
()
.
getAction
())
||
MediaStore
.
ACTION_IMAGE_CAPTURE
.
equals
(
getIntent
().
getAction
())
.
getAction
()))
{
moduleIndex
=
ModuleSwitcher
.
PHOTO_MODULE_INDEX
;
SharedPreferences
prefs
=
PreferenceManager
.
getDefaultSharedPreferences
(
this
);
if
(
prefs
.
getInt
(
CameraSettings
.
KEY_STARTUP_MODULE_INDEX
,
-
1
)
==
ModuleSwitcher
.
GCAM_MODULE_INDEX
&&
GcamHelper
.
hasGcamCapture
())
{
moduleIndex
=
ModuleSwitcher
.
GCAM_MODULE_INDEX
;
}
}
else
if
(
MediaStore
.
ACTION_IMAGE_CAPTURE
.
equals
(
getIntent
().
getAction
())
||
MediaStore
.
ACTION_IMAGE_CAPTURE_SECURE
.
equals
(
getIntent
().
getAction
()))
{
moduleIndex
=
ModuleSwitcher
.
PHOTO_MODULE_INDEX
;
}
else
{
...
...
@@ -1027,7 +1135,13 @@ public class CameraActivity extends Activity
v
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
CameraUtil
.
launchGallery
(
CameraActivity
.
this
);
try
{
UsageStatistics
.
onEvent
(
UsageStatistics
.
COMPONENT_CAMERA
,
UsageStatistics
.
ACTION_GALLERY
,
null
);
startActivity
(
IntentHelper
.
getGalleryIntent
(
CameraActivity
.
this
));
}
catch
(
ActivityNotFoundException
e
)
{
Log
.
w
(
TAG
,
"Failed to launch gallery activity, closing"
);
}
finish
();
}
});
...
...
@@ -1120,6 +1234,10 @@ public class CameraActivity extends Activity
setRequestedOrientation
(
ActivityInfo
.
SCREEN_ORIENTATION_FULL_SENSOR
);
mAutoRotateScreen
=
true
;
}
UsageStatistics
.
onEvent
(
UsageStatistics
.
COMPONENT_CAMERA
,
UsageStatistics
.
ACTION_FOREGROUNDED
,
this
.
getClass
().
getSimpleName
());
mOrientationListener
.
enable
();
mCurrentModule
.
onResumeBeforeSuper
();
super
.
onResume
();
...
...
@@ -1343,8 +1461,12 @@ public class CameraActivity extends Activity
Intent
intent
=
new
Intent
(
Intent
.
ACTION_EDIT
)
.
setDataAndType
(
data
.
getContentUri
(),
data
.
getMimeType
())
.
setFlags
(
Intent
.
FLAG_GRANT_READ_URI_PERMISSION
);
startActivityForResult
(
Intent
.
createChooser
(
intent
,
null
),
REQ_CODE_DONT_SWITCH_TO_PREVIEW
);
try
{
startActivityForResult
(
intent
,
REQ_CODE_DONT_SWITCH_TO_PREVIEW
);
}
catch
(
ActivityNotFoundException
e
)
{
startActivityForResult
(
Intent
.
createChooser
(
intent
,
null
),
REQ_CODE_DONT_SWITCH_TO_PREVIEW
);
}
}
/**
...
...
@@ -1381,7 +1503,10 @@ public class CameraActivity extends Activity
}
hideUndoDeletionBar
(
false
);
mDataAdapter
.
executeDeletion
(
CameraActivity
.
this
);
updateActionBarMenu
(
mFilmStripView
.
getCurrentId
());
int
currentId
=
mFilmStripView
.
getCurrentId
();
updateActionBarMenu
(
currentId
);
mFilmStripListener
.
onCurrentDataCentered
(
currentId
);
}
public
void
showUndoDeletionBar
()
{
...
...
@@ -1462,6 +1587,7 @@ public class CameraActivity extends Activity
@Override
public
void
onShowSwitcherPopup
()
{
mCurrentModule
.
onShowSwitcherPopup
();
}
/**
...
...
This diff is collapsed.
Click to expand it.
src/com/android/camera/ComboPreferences.java
View file @
148552a0
...
...
@@ -330,6 +330,5 @@ public class ComboPreferences implements
listener
.
onSharedPreferenceChanged
(
this
,
key
);
}
BackupManager
.
dataChanged
(
mPackageName
);
UsageStatistics
.
onEvent
(
"CameraSettingsChange"
,
null
,
key
);
}
}
This diff is collapsed.
Click to expand it.
src/com/android/camera/FocusOverlayManager.java
View file @
148552a0
...
...
@@ -29,6 +29,7 @@ import android.os.Message;
import
android.util.Log
;
import
com.android.camera.util.CameraUtil
;
import
com.android.camera.util.UsageStatistics
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -76,8 +77,6 @@ public class FocusOverlayManager {
private
boolean
mAeAwbLock
;
private
Matrix
mMatrix
;
private
int
mPreviewWidth
;
// The width of the preview frame layout.
private
int
mPreviewHeight
;
// The height of the preview frame layout.
private
boolean
mMirror
;
// true if the camera is front-facing.
private
int
mDisplayOrientation
;
private
List
<
Object
>
mFocusArea
;
// focus area in driver format
...
...
@@ -93,6 +92,7 @@ public class FocusOverlayManager {
private
boolean
mFocusDefault
;
private
FocusUI
mUI
;
private
final
Rect
mPreviewRect
=
new
Rect
(
0
,
0
,
0
,
0
);
public
interface
FocusUI
{
public
boolean
hasFaces
();
...
...
@@ -159,13 +159,25 @@ public class FocusOverlayManager {
}
public
void
setPreviewSize
(
int
previewWidth
,
int
previewHeight
)
{
if
(
mPreviewWidth
!=
previewWidth
||
mPreviewHeight
!=
previewHeight
)
{
mPreviewWidth
=
previewWidth
;
mPreviewHeight
=
previewHeight
;
if
(
mPreviewRect
.
width
()
!=
previewWidth
||
mPreviewRect
.
height
()
!=
previewHeight
)
{
setPreviewRect
(
new
Rect
(
0
,
0
,
previewWidth
,
previewHeight
));
}
}
/** This setter should be the only way to mutate mPreviewRect. */
public
void
setPreviewRect
(
Rect
previewRect
)
{
if
(!
mPreviewRect
.
equals
(
previewRect
))
{
mPreviewRect
.
set
(
previewRect
);
setMatrix
();
}
}
/** Returns a copy of mPreviewRect so that outside class cannot modify preview
* rect except deliberately doing so through the setter. */
public
Rect
getPreviewRect
()
{
return
new
Rect
(
mPreviewRect
);
}
public
void
setMirror
(
boolean
mirror
)
{
mMirror
=
mirror
;
setMatrix
();
...
...
@@ -177,10 +189,9 @@ public class FocusOverlayManager {
}
private
void
setMatrix
()
{
if
(
mPreview
W
idth
!=
0
&&
mPreview
H
eight
!=
0
)
{
if
(
mPreview
Rect
.
w
idth
()
!=
0
&&
mPreview
Rect
.
h
eight
()
!=
0
)
{
Matrix
matrix
=
new
Matrix
();
CameraUtil
.
prepareMatrix
(
matrix
,
mMirror
,
mDisplayOrientation
,
mPreviewWidth
,
mPreviewHeight
);
CameraUtil
.
prepareMatrix
(
matrix
,
mMirror
,
mDisplayOrientation
,
getPreviewRect
());
// In face detection, the matrix converts the driver coordinates to UI
// coordinates. In tap focus, the inverted matrix converts the UI
// coordinates to driver coordinates.
...
...
@@ -347,12 +358,15 @@ public class FocusOverlayManager {
public
void
onSingleTapUp
(
int
x
,
int
y
)
{
if
(!
mInitialized
||
mState
==
STATE_FOCUSING_SNAP_ON_FINISH
)
return
;
UsageStatistics
.
onEvent
(
UsageStatistics
.
COMPONENT_CAMERA
,
UsageStatistics
.
ACTION_TOUCH_FOCUS
,
x
+
","
+
y
);
// Let users be able to cancel previous touch focus.
if
((!
mFocusDefault
)
&&
(
mState
==
STATE_FOCUSING
||
mState
==
STATE_SUCCESS
||
mState
==
STATE_FAIL
))
{
cancelAutoFocus
();
}
if
(
mPreview
W
idth
==
0
||
mPreview
H
eight
==
0
)
return
;
if
(
mPreview
Rect
.
w
idth
()
==
0
||
mPreview
Rect
.
h
eight
()
==
0
)
return
;
mFocusDefault
=
false
;
// Initialize mFocusArea.
if
(
mFocusAreaSupported
)
{
...
...
@@ -507,7 +521,7 @@ public class FocusOverlayManager {
mUI
.
clearFocus
();
// Initialize mFocusArea.
if
(
mFocusAreaSupported
)
{
initializeFocusAreas
(
mPreview
Width
/
2
,
mPreviewHeight
/
2
);
initializeFocusAreas
(
mPreview
Rect
.
centerX
(),
mPreviewRect
.
centerY
()
);
}
// Reset metering area when no specific region is selected.
if
(
mMeteringAreaSupported
)
{
...
...
@@ -518,8 +532,10 @@ public class FocusOverlayManager {
private
void
calculateTapArea
(
int
x
,
int
y
,
float
areaMultiple
,
Rect
rect
)
{
int
areaSize
=
(
int
)
(
getAreaSize
()
*
areaMultiple
);
int
left
=
CameraUtil
.
clamp
(
x
-
areaSize
/
2
,
0
,
mPreviewWidth
-
areaSize
);
int
top
=
CameraUtil
.
clamp
(
y
-
areaSize
/
2
,
0
,
mPreviewHeight
-
areaSize
);
int
left
=
CameraUtil
.
clamp
(
x
-
areaSize
/
2
,
mPreviewRect
.
left
,
mPreviewRect
.
right
-
areaSize
);
int
top
=
CameraUtil
.
clamp
(
y
-
areaSize
/
2
,
mPreviewRect
.
top
,
mPreviewRect
.
bottom
-
areaSize
);
RectF
rectF
=
new
RectF
(
left
,
top
,
left
+
areaSize
,
top
+
areaSize
);
mMatrix
.
mapRect
(
rectF
);
...
...
@@ -529,7 +545,7 @@ public class FocusOverlayManager {
private
int
getAreaSize
()
{
// Recommended focus area size from the manufacture is 1/8 of the image
// width (i.e. longer edge of the image)
return
Math
.
max
(
mPreview
W
idth
,
mPreview
H
eight
)
/
8
;
return
Math
.
max
(
mPreview
Rect
.
w
idth
()
,
mPreview
Rect
.
h
eight
()
)
/
8
;
}
/* package */
int
getFocusState
()
{
...
...
This diff is collapsed.
Click to expand it.
src/com/android/camera/ListPreference.java
View file @
148552a0
...
...
@@ -27,6 +27,7 @@ import android.util.Log;
import
android.util.TypedValue
;
import
com.android.camera.util.CameraUtil
;
import
com.android.camera.util.UsageStatistics
;
import
com.android.camera2.R
;
/**
...
...
@@ -159,6 +160,7 @@ public class ListPreference extends CameraPreference {
SharedPreferences
.
Editor
editor
=
getSharedPreferences
().
edit
();
editor
.
putString
(
mKey
,
value
);
editor
.
apply
();
UsageStatistics
.
onEvent
(
"CameraSettingsChange"
,
value
,
mKey
);
}
@Override
...
...
This diff is collapsed.
Click to expand it.
src/com/android/camera/PhotoController.java
View file @
148552a0
...
...
@@ -16,6 +16,7 @@
package
com.android.camera
;
import
android.graphics.Rect
;
import
android.view.View
;
import
com.android.camera.ShutterButton.OnShutterButtonListener
;
...
...
@@ -54,7 +55,7 @@ public interface PhotoController extends OnShutterButtonListener {
public
void
onCountDownFinished
();
public
void
on
ScreenSizeChanged
(
int
width
,
int
heigh
t
);
public
void
on
PreviewRectChanged
(
Rect
previewRec
t
);
public
void
updateCameraOrientation
();
...
...
This diff is collapsed.
Click to expand it.
Prev
1
2
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment