Вверх ↑
Ответов: 163
Рейтинг: 33
#1: 2018-01-10 13:24:17 ЛС | профиль | цитата
Konst, вообще-то я не спец по камере, но как-то на форуме кто-то задавал вопрос в связи с "падением" приложения, использующего камеру. Я тогда элемент камера немного доработал, обернув все опасные вызовы в try/catch. Взять можно здесь. Ну и для проверки набросал схему для тестов.

Add(MainActivity,2953706,56,203)
{
Left=0
Top=0
Width=500
Height=400
BorderStyle=3
AppName="test_camera"
Package="hiasm.test_camera"
VersionCode=1
Version="1.0"
Compatibility=0
Caption="test_camera"
AppIcon=[]
SysName=""
DefaultLayout="(empty)"
IntentFilter=#
Theme=0
CustomTheme=""
BackgroundImage="(empty)"
ProcName=""
Point(onPause)
Point(onResume)
link(onPause,16681065:In,[])
}
Add(Camera,14857860,651,210)
{
Index=0
Orientation=0
Point(doSetPreviewDisplay)
Point(doStopPreview)
Point(doRelease)
link(onTakePhoto,6950238:doDecodeFile,[(695,216)(695,286)(639,286)(639,356)])
link(onError,14828735:doShow,[])
link(SurfaceView,495367:SurfaceView,[])
}
Add(SurfaceView,495367,651,133)
{
Left=25
Top=15
Width=140
Height=172
Align=0
Color=-16777201
LayoutManager="(empty)"
Weight=1
OffsetX=0
OffsetY=0
UnitsX=0
UnitsY=0
gVertical=0
gHorizontal=0
gFill=0
HeightMode=0
WidthMode=1
FixedHeight="40px"
FixedWidth="100px"
MinHeight=""
MinWidth=""
mLeft=""
mTop=""
mRight=""
mBottom=""
pLeft=""
pTop=""
pRight=""
pBottom=""
Alpha=1
Visibility=0
Clickable=1
Focusable=1
Enabled=1
ContextMenu="(empty)"
BackgroundImage="(empty)"
Background=""
Animation="(empty)"
Point(doVisibility)
}
Add(Button,11105323,427,224)
{
Left=30
Top=290
Width=120
Height=22
Align=0
Color=-16777201
LayoutManager="(empty)"
Weight=0
OffsetX=0
OffsetY=0
UnitsX=0
UnitsY=0
gVertical=0
gHorizontal=0
gFill=0
HeightMode=0
WidthMode=1
FixedHeight="40px"
FixedWidth="100px"
MinHeight=""
MinWidth=""
mLeft=""
mTop=""
mRight=""
mBottom=""
pLeft=""
pTop=""
pRight=""
pBottom=""
Alpha=1
Visibility=2
Clickable=1
Focusable=1
Enabled=1
ContextMenu="(empty)"
BackgroundImage="(empty)"
Background=""
Animation="(empty)"
TypeFace=0
TextColor=536870912
TextStyle=0
TextSize=""
TextScaleX=1
Caption="2. снимок"
StrResName=""
Point(onClick)
Point(doVisibility)
link(onClick,14857860:doTakePhoto,[])
AddHint(-17,40,65,13,Caption)
}
Add(Hub,6408835,546,210)
{
InCount=1
OutCount=2
link(onEvent1,14857860:doOpen,[])
link(onEvent2,14857860:doStartPreview,[])
}
Add(BitmapFactory,6950238,651,343)
{
Path=""
Format=0
Quality=100
Point(doDecodeFile)
Point(ByteArray)
link(onDecode,2290773:doEvent1,[(695,349)(695,387)(394,387)(394,426)])
link(ByteArray,14857860:Picture,[])
}
Add(ImageView,2010164,651,420)
{
Left=35
Top=205
Width=120
Height=22
Align=0
Color=-16777201
LayoutManager="(empty)"
Weight=1
OffsetX=0
OffsetY=0
UnitsX=0
UnitsY=0
gVertical=0
gHorizontal=0
gFill=0
HeightMode=0
WidthMode=1
FixedHeight="40px"
FixedWidth="100px"
MinHeight=""
MinWidth=""
mLeft=""
mTop=""
mRight=""
mBottom=""
pLeft=""
pTop=""
pRight=""
pBottom=""
Alpha=1
Visibility=2
Clickable=1
Focusable=1
Enabled=1
ContextMenu="(empty)"
BackgroundImage="(empty)"
Background=""
Animation="(empty)"
DefaultPicture="(empty)"
ScaleType=0
MaxWidth=0
MaxHeight=0
Point(doVisibility)
link(Bitmap,6950238:Bitmap,[])
}
Add(Hub,2290773,406,420)
{
InCount=1
OutCount=6
link(onEvent1,2010164:doBitmap,[])
link(onEvent2,15026089:In,[(441,433)(441,447)])
link(onEvent3,7476065:In,[(438,440)(438,461)])
link(onEvent4,2960512:In,[(434,447)(434,475)])
link(onEvent5,8467543:In,[(430,454)(430,489)])
link(onEvent6,5301396:In,[(427,461)(427,503)])
}
Add(ChanelToIndex,16519872,602,140)
{
Count=3
link(onIndex,495367:doVisibility,[])
}
Add(LineBreak,13983063,546,154)
{
Caption="hide"
Type=0
Color=-16777201
link(Out,16519872:doWork3,[])
Primary=[15026089,-84,287]
}
Add(LineBreak,5873952,546,441)
{
Caption="show"
Type=0
Color=-16777201
link(Out,8253367:doWork1,[])
Primary=[2960512,-98,28]
}
Add(ChanelToIndex,8253367,602,441)
{
Count=3
link(onIndex,2010164:doVisibility,[(642,447)(642,433)])
}
Add(LineBreak,9565760,546,455)
{
Caption="hide"
Type=0
Color=-16777201
link(Out,8253367:doWork3,[])
Primary=[8285730,-91,-329]
}
Add(LineBreak,10320615,546,140)
{
Caption="show"
Type=0
Color=-16777201
link(Out,16519872:doWork1,[])
Primary=[7723285,-98,0]
}
Add(Hub,11451664,399,126)
{
InCount=1
OutCount=5
link(onEvent1,8285730:In,[])
link(onEvent2,7723285:In,[(431,139)(431,146)])
link(onEvent3,1583150:In,[(427,146)(427,160)])
link(onEvent4,11697313:In,[(423,153)(423,174)])
link(onEvent5,11658968:In,[(420,160)(420,188)])
}
Add(LineBreak,10381631,490,210)
{
Caption="start"
Type=0
Color=65280
link(Out,6408835:doEvent1,[])
Primary=[11658968,-63,-28]
}
Add(LineBreak,922714,490,238)
{
Caption="stop"
Type=0
Color=255
link(Out,15225362:doWork2,[])
Primary=[16681065,-322,-7]
}
Add(Hub,3662804,560,238)
{
InCount=1
OutCount=2
link(onEvent1,14857860:doStopPreview,[])
link(onEvent2,14857860:doRelease,[])
}
Add(ToastNotification,14828735,728,217)
{
Text=""
Duration=1
}
Add(LineBreak,3345619,322,238)
{
Caption="hide"
Type=0
Color=-16777201
link(Out,13716067:doWork3,[])
Primary=[7476065,133,217]
}
Add(ChanelToIndex,13716067,378,224)
{
Count=3
link(onIndex,11105323:doVisibility,[])
}
Add(LineBreak,5954548,322,224)
{
Caption="show"
Type=0
Color=-16777201
link(Out,13716067:doWork1,[])
Primary=[1583150,119,-70]
}
Add(Button,7124984,336,126)
{
Left=25
Top=240
Width=120
Height=22
Align=0
Color=-16777201
LayoutManager="(empty)"
Weight=0
OffsetX=0
OffsetY=0
UnitsX=0
UnitsY=0
gVertical=0
gHorizontal=0
gFill=0
HeightMode=0
WidthMode=1
FixedHeight="40px"
FixedWidth="100px"
MinHeight=""
MinWidth=""
mLeft=""
mTop=""
mRight=""
mBottom=""
pLeft=""
pTop=""
pRight=""
pBottom=""
Alpha=1
Visibility=0
Clickable=1
Focusable=1
Enabled=1
ContextMenu="(empty)"
BackgroundImage="(empty)"
Background=""
Animation="(empty)"
TypeFace=0
TextColor=536870912
TextStyle=0
TextSize=""
TextScaleX=1
Caption="1. открыть камеру"
StrResName=""
Point(onClick)
Point(doVisibility)
link(onClick,11451664:doEvent1,[])
AddHint(-33,-28,109,13,Caption)
}
Add(ChanelToIndex,3982939,273,126)
{
Count=3
link(onIndex,7124984:doVisibility,[])
}
Add(LineBreak,1413522,203,126)
{
Caption="show"
Type=0
Color=-16777201
link(Out,3982939:doWork1,[])
Primary=[8467543,238,357]
}
Add(LineBreak,12999272,490,252)
{
Caption="stop"
Type=0
Color=255
link(Out,15225362:doWork3,[(536,258)])
Primary=[5301396,-56,245]
}
Add(HubEx,15225362,532,238)
{
Angle=0
link(onEvent,3662804:doEvent1,[])
}
Add(LineBreak,6701064,203,140)
{
Caption="hide"
Type=0
Color=-16777201
link(Out,3982939:doWork3,[])
Primary=[11697313,231,28]
}

карма: 3

0