Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
a6995948
Commit
a6995948
authored
Sep 11, 2012
by
Alexander Smorkalov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue # 2344 OpenCV Manager doesn't tell which pack is used fixed.
parent
84087a85
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
115 additions
and
44 deletions
+115
-44
info.xml
android/service/engine/res/layout/info.xml
+2
-2
ManagerActivity.java
...engine/src/org/opencv/engine/manager/ManagerActivity.java
+79
-42
PackageListAdapter.java
...ine/src/org/opencv/engine/manager/PackageListAdapter.java
+34
-0
No files found.
android/service/engine/res/layout/info.xml
View file @
a6995948
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"
wrap_cont
ent"
android:layout_height=
"
wrap_cont
ent"
android:layout_width=
"
fill_par
ent"
android:layout_height=
"
fill_par
ent"
android:focusable=
"false"
android:orientation=
"vertical"
>
...
...
android/service/engine/src/org/opencv/engine/manager/ManagerActivity.java
View file @
a6995948
...
...
@@ -47,11 +47,11 @@ public class ManagerActivity extends Activity
mMarket
=
new
MarketConnector
(
this
);
mInstalledPacksAdapter
=
new
Simple
Adapter
(
mInstalledPacksAdapter
=
new
PackageList
Adapter
(
this
,
mListViewItems
,
R
.
layout
.
info
,
new
String
[]
{
"Name"
,
"Version"
,
"Hardware"
},
new
String
[]
{
"Name"
,
"Version"
,
"Hardware"
,
"Activity"
},
new
int
[]
{
R
.
id
.
InfoName
,
R
.
id
.
InfoVersion
,
R
.
id
.
InfoHardware
}
);
...
...
@@ -158,7 +158,7 @@ public class ManagerActivity extends Activity
public
void
onItemClick
(
AdapterView
<?>
arg0
,
View
arg1
,
int
arg2
,
long
id
)
{
mInstalledPackageView
.
setTag
(
new
Integer
((
int
)
id
));
mInstalledPackageView
.
setTag
(
Integer
.
valueOf
((
int
)
id
));
mActionDialog
.
show
();
}
});
...
...
@@ -188,6 +188,7 @@ public class ManagerActivity extends Activity
@Override
protected
void
onResume
()
{
super
.
onResume
();
Log
.
d
(
TAG
,
"Filling package list on resume"
);
FillPackageList
();
}
...
...
@@ -195,15 +196,18 @@ public class ManagerActivity extends Activity
protected
ListView
mInstalledPackageView
;
protected
Button
mUpdateEngineButton
;
protected
PackageInfo
[]
mInstalledPackageInfo
;
protected
static
final
ArrayList
<
HashMap
<
String
,
String
>>
mListViewItems
=
new
ArrayList
<
HashMap
<
String
,
String
>>();
protected
final
ArrayList
<
HashMap
<
String
,
String
>>
mListViewItems
=
new
ArrayList
<
HashMap
<
String
,
String
>>();
protected
static
final
String
TAG
=
"OpenCV_Manager/Activity"
;
protected
MarketConnector
mMarket
;
AlertDialog
mActionDialog
;
protected
AlertDialog
mActionDialog
;
protected
HashMap
<
String
,
String
>
mActivePackageMap
=
new
HashMap
<
String
,
String
>();
protected
BroadcastReceiver
mPackageChangeReciever
=
new
BroadcastReceiver
()
{
@Override
public
void
onReceive
(
Context
context
,
Intent
intent
)
{
Log
.
d
(
"OpenCV Manager/Reciever"
,
"Bradcast message "
+
intent
.
getAction
()
+
" reciever"
);
Log
.
d
(
"OpenCV Manager/Reciever"
,
"Filling package list on broadcast message"
);
FillPackageList
();
}
};
...
...
@@ -224,50 +228,83 @@ public class ManagerActivity extends Activity
EngineVersionView
.
setText
(
"not avaliable"
);
e
.
printStackTrace
();
}
try
{
String
path
=
EngineService
.
getLibPathByVersion
(
"2.4"
);
Log
.
d
(
TAG
,
"2.4 -> "
+
path
);
mActivePackageMap
.
put
(
"24"
,
path
);
path
=
EngineService
.
getLibPathByVersion
(
"2.5"
);
Log
.
d
(
TAG
,
"2.5 -> "
+
path
);
mActivePackageMap
.
put
(
"25"
,
path
);
}
catch
(
RemoteException
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
}
Log
.
d
(
TAG
,
"Filling package list on service connection"
);
FillPackageList
();
unbindService
(
mServiceConnection
);
}
};
protected
void
FillPackageList
()
{
mInstalledPackageInfo
=
mMarket
.
GetInstalledOpenCVPackages
();
mListViewItems
.
clear
();
for
(
int
i
=
0
;
i
<
mInstalledPackageInfo
.
length
;
i
++)
{
// Convert to Items for package list view
HashMap
<
String
,
String
>
temp
=
new
HashMap
<
String
,
String
>();
temp
.
put
(
"Name"
,
mMarket
.
GetApplicationName
(
mInstalledPackageInfo
[
i
].
applicationInfo
));
synchronized
(
mListViewItems
)
{
mInstalledPackageInfo
=
mMarket
.
GetInstalledOpenCVPackages
();
mListViewItems
.
clear
();
for
(
int
i
=
0
;
i
<
mInstalledPackageInfo
.
length
;
i
++)
{
// Convert to Items for package list view
HashMap
<
String
,
String
>
temp
=
new
HashMap
<
String
,
String
>();
String
PublicName
=
mMarket
.
GetApplicationName
(
mInstalledPackageInfo
[
i
].
applicationInfo
);
int
idx
=
0
;
String
OpenCVersion
=
"unknown"
;
String
HardwareName
=
""
;
StringTokenizer
tokenizer
=
new
StringTokenizer
(
mInstalledPackageInfo
[
i
].
packageName
,
"_"
);
while
(
tokenizer
.
hasMoreTokens
())
{
if
(
idx
==
1
)
{
// version of OpenCV
OpenCVersion
=
tokenizer
.
nextToken
().
substring
(
1
);
}
else
if
(
idx
>=
2
)
{
// hardware options
HardwareName
+=
tokenizer
.
nextToken
()
+
" "
;
}
else
{
tokenizer
.
nextToken
();
}
idx
++;
}
String
ActivePackagePath
;
ActivePackagePath
=
mActivePackageMap
.
get
(
OpenCVersion
);
Log
.
d
(
TAG
,
OpenCVersion
+
" -> "
+
ActivePackagePath
);
if
(
null
!=
ActivePackagePath
&&
ActivePackagePath
.
indexOf
(
mInstalledPackageInfo
[
i
].
packageName
)
>=
0
)
{
temp
.
put
(
"Activity"
,
"y"
);
PublicName
+=
" (Active)"
;
}
else
{
temp
.
put
(
"Activity"
,
"n"
);
}
int
idx
=
0
;
String
OpenCVersion
=
"unknown"
;
String
HardwareName
=
""
;
StringTokenizer
tokenizer
=
new
StringTokenizer
(
mInstalledPackageInfo
[
i
].
packageName
,
"_"
);
while
(
tokenizer
.
hasMoreTokens
())
{
if
(
idx
==
1
)
{
// version of OpenCV
OpenCVersion
=
tokenizer
.
nextToken
().
substring
(
1
);
}
else
if
(
idx
>=
2
)
{
// hardware options
HardwareName
+=
tokenizer
.
nextToken
()
+
" "
;
}
else
{
tokenizer
.
nextToken
();
}
idx
++;
}
temp
.
put
(
"Version"
,
NormalizeVersion
(
OpenCVersion
,
mInstalledPackageInfo
[
i
].
versionName
));
temp
.
put
(
"Hardware"
,
HardwareName
);
mListViewItems
.
add
(
temp
);
}
mInstalledPacksAdapter
.
notifyDataSetChanged
();
temp
.
put
(
"Name"
,
PublicName
);
temp
.
put
(
"Version"
,
NormalizeVersion
(
OpenCVersion
,
mInstalledPackageInfo
[
i
].
versionName
));
temp
.
put
(
"Hardware"
,
HardwareName
);
mListViewItems
.
add
(
temp
);
}
mInstalledPacksAdapter
.
notifyDataSetChanged
();
}
}
protected
String
NormalizeVersion
(
String
OpenCVersion
,
String
PackageVersion
)
...
...
android/service/engine/src/org/opencv/engine/manager/PackageListAdapter.java
0 → 100644
View file @
a6995948
package
org
.
opencv
.
engine
.
manager
;
import
java.util.List
;
import
java.util.Map
;
import
android.content.Context
;
import
android.util.Log
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.SimpleAdapter
;
public
class
PackageListAdapter
extends
SimpleAdapter
{
public
PackageListAdapter
(
Context
context
,
List
<?
extends
Map
<
String
,
?>>
data
,
int
resource
,
String
[]
from
,
int
[]
to
)
{
super
(
context
,
data
,
resource
,
from
,
to
);
// TODO Auto-generated constructor stub
}
@Override
public
View
getView
(
int
position
,
View
convertView
,
ViewGroup
parent
)
{
View
view
=
super
.
getView
(
position
,
convertView
,
parent
);
@SuppressWarnings
(
"unchecked"
)
Map
<
String
,
String
>
item
=
(
Map
<
String
,
String
>)
getItem
(
position
);
Log
.
d
(
"PackageListAdapter"
,
item
.
get
(
"Activity"
));
if
(
item
.
get
(
"Activity"
)
!=
"n"
)
{
view
.
setBackgroundColor
(
0x50ffffff
);
}
return
view
;
}
}
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