Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
SwapIt
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Rafal
SwapIt
Commits
086b4224
Commit
086b4224
authored
Oct 24, 2015
by
Antek Grzanka
Browse files
Options
Browse Files
Download
Plain Diff
merge
parents
53a0ae14
9988b3e4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
942 additions
and
203 deletions
+942
-203
misc.xml
peepers/.idea/misc.xml
+24
-0
vcs.xml
peepers/.idea/vcs.xml
+1
-1
workspace.xml
peepers/.idea/workspace.xml
+836
-116
app.iml
peepers/app/app.iml
+1
-2
AndroidManifest.xml
peepers/app/src/main/AndroidManifest.xml
+4
-4
MainActivity.java
...src/main/java/com/foxdogstudios/peepers/MainActivity.java
+16
-17
StreamCameraActivity.java
.../java/com/foxdogstudios/peepers/StreamCameraActivity.java
+34
-48
activity_main.xml
peepers/app/src/main/res/layout/activity_main.xml
+2
-2
main.xml
peepers/app/src/main/res/layout/main.xml
+23
-12
peepers.iml
peepers/peepers.iml
+1
-1
No files found.
peepers/.idea/misc.xml
View file @
086b4224
...
...
@@ -3,6 +3,30 @@
<component
name=
"EntryPointsManager"
>
<entry_points
version=
"2.0"
/>
</component>
<component
name=
"NullableNotNullManager"
>
<option
name=
"myDefaultNullable"
value=
"android.support.annotation.Nullable"
/>
<option
name=
"myDefaultNotNull"
value=
"android.support.annotation.NonNull"
/>
<option
name=
"myNullables"
>
<value>
<list
size=
"4"
>
<item
index=
"0"
class=
"java.lang.String"
itemvalue=
"org.jetbrains.annotations.Nullable"
/>
<item
index=
"1"
class=
"java.lang.String"
itemvalue=
"javax.annotation.Nullable"
/>
<item
index=
"2"
class=
"java.lang.String"
itemvalue=
"edu.umd.cs.findbugs.annotations.Nullable"
/>
<item
index=
"3"
class=
"java.lang.String"
itemvalue=
"android.support.annotation.Nullable"
/>
</list>
</value>
</option>
<option
name=
"myNotNulls"
>
<value>
<list
size=
"4"
>
<item
index=
"0"
class=
"java.lang.String"
itemvalue=
"org.jetbrains.annotations.NotNull"
/>
<item
index=
"1"
class=
"java.lang.String"
itemvalue=
"javax.annotation.Nonnull"
/>
<item
index=
"2"
class=
"java.lang.String"
itemvalue=
"edu.umd.cs.findbugs.annotations.NonNull"
/>
<item
index=
"3"
class=
"java.lang.String"
itemvalue=
"android.support.annotation.NonNull"
/>
</list>
</value>
</option>
</component>
<component
name=
"ProjectLevelVcsManager"
settingsEditedManually=
"false"
>
<OptionsSetting
value=
"true"
id=
"Add"
/>
<OptionsSetting
value=
"true"
id=
"Remove"
/>
...
...
peepers/.idea/vcs.xml
View file @
086b4224
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"VcsDirectoryMappings"
>
<mapping
directory=
"
"
vcs=
"
"
/>
<mapping
directory=
"
$PROJECT_DIR$/.."
vcs=
"Git
"
/>
</component>
</project>
\ No newline at end of file
peepers/.idea/workspace.xml
View file @
086b4224
This diff is collapsed.
Click to expand it.
peepers/app/app.iml
View file @
086b4224
...
...
@@ -24,7 +24,7 @@
</configuration>
</facet>
</component>
<component
name=
"NewModuleRootManager"
inherit-compiler-output=
"false"
>
<component
name=
"NewModuleRootManager"
LANGUAGE_LEVEL=
"JDK_1_6"
inherit-compiler-output=
"false"
>
<output
url=
"file://$MODULE_DIR$/build/intermediates/classes/debug"
/>
<output-test
url=
"file://$MODULE_DIR$/build/intermediates/classes/androidTest/debug"
/>
<exclude-output
/>
...
...
@@ -82,7 +82,6 @@
<excludeFolder
url=
"file://$MODULE_DIR$/build/intermediates/rs"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/build/intermediates/symbols"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/build/outputs"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/build/tmp"
/>
</content>
<orderEntry
type=
"jdk"
jdkName=
"Android API 19 Platform"
jdkType=
"Android SDK"
/>
<orderEntry
type=
"sourceFolder"
forTests=
"false"
/>
...
...
peepers/app/src/main/AndroidManifest.xml
View file @
086b4224
...
...
@@ -30,17 +30,17 @@
android:name=
".PeepersApplication"
android:allowBackup=
"true"
android:icon=
"@drawable/ic_launcher_peepers"
android:label=
"@string/app_name"
android:theme=
"@android:style/Theme.NoTitleBar"
>
android:label=
"@string/app_name"
>
<activity
android:name=
".StreamCameraActivity"
android:label=
"@string/app_name"
android:screenOrientation=
"landscape"
>
android:screenOrientation=
"landscape"
android:theme=
"@android:style/Theme.NoTitleBar.Fullscreen"
>
</activity>
<activity
android:name=
".PeepersPreferenceActivity"
/>
<activity
android:name=
".MainActivity"
android:label=
"@string/title_activity_main"
>
android:label=
"@string/title_activity_main"
>
<intent-filter>
<action
android:name=
"android.intent.action.MAIN"
/>
...
...
peepers/app/src/main/java/com/foxdogstudios/peepers/MainActivity.java
View file @
086b4224
...
...
@@ -20,6 +20,7 @@ public class MainActivity extends Activity {
EditText
mEdit
;
String
myIp
;
TextView
myIpView
;
private
MenuItem
mSettingsMenuItem
=
null
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
...
...
@@ -32,26 +33,24 @@ public class MainActivity extends Activity {
}
@Override
public
boolean
onCreateOptionsMenu
(
Menu
menu
)
{
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater
().
inflate
(
R
.
menu
.
menu_main
,
menu
);
public
boolean
onCreateOptionsMenu
(
final
Menu
menu
)
{
super
.
onCreateOptionsMenu
(
menu
);
mSettingsMenuItem
=
menu
.
add
(
R
.
string
.
settings
);
mSettingsMenuItem
.
setIcon
(
android
.
R
.
drawable
.
ic_menu_manage
);
return
true
;
}
}
// onCreateOptionsMenu(Menu)
@Override
public
boolean
onOptionsItemSelected
(
MenuItem
item
)
{
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int
id
=
item
.
getItemId
();
//noinspection SimplifiableIfStatement
if
(
id
==
R
.
id
.
action_settings
)
{
return
true
;
}
return
super
.
onOptionsItemSelected
(
item
);
}
public
boolean
onOptionsItemSelected
(
final
MenuItem
item
)
{
if
(
item
!=
mSettingsMenuItem
)
{
return
super
.
onOptionsItemSelected
(
item
);
}
// if
startActivity
(
new
Intent
(
this
,
PeepersPreferenceActivity
.
class
));
return
true
;
}
// onOptionsItemSelected(MenuItem)
public
void
startView
(
View
myView
){
Intent
intent
=
new
Intent
(
MainActivity
.
this
,
StreamCameraActivity
.
class
);
...
...
peepers/app/src/main/java/com/foxdogstudios/peepers/StreamCameraActivity.java
View file @
086b4224
...
...
@@ -37,17 +37,16 @@ import android.view.Menu;
import
android.view.MenuItem
;
import
android.view.SurfaceHolder
;
import
android.view.SurfaceView
;
import
android.view.View
;
import
android.webkit.WebSettings
;
import
android.webkit.WebView
;
import
android.widget.Button
;
import
android.widget.TextView
;
import
org.apache.http.conn.util.InetAddressUtils
;
public
final
class
StreamCameraActivity
extends
Activity
implements
SurfaceHolder
.
Callback
{
private
static
final
String
TAG
=
StreamCameraActivity
.
class
.
getSimpleName
();
private
static
final
String
WAKE_LOCK_TAG
=
"peepers"
;
private
static
final
String
PREF_CAMERA
=
"camera"
;
...
...
@@ -73,11 +72,12 @@ public final class StreamCameraActivity extends Activity
private
int
mPort
=
PREF_PORT_DEF
;
private
int
mJpegQuality
=
PREF_JPEG_QUALITY_DEF
;
private
int
mPrevieSizeIndex
=
PREF_PREVIEW_SIZE_INDEX_DEF
;
private
TextView
mIpAddressView
=
null
;
private
LoadPreferencesTask
mLoadPreferencesTask
=
null
;
private
SharedPreferences
mPrefs
=
null
;
private
MenuItem
mSettingsMenuItem
=
null
;
private
WakeLock
mWakeLock
=
null
;
private
WebView
myWebView
=
null
;
private
String
clientAddressIp
=
""
;
private
Button
webViewButton
=
null
;
public
StreamCameraActivity
()
{
...
...
@@ -92,7 +92,7 @@ public final class StreamCameraActivity extends Activity
Intent
iin
=
getIntent
();
Bundle
b
=
iin
.
getExtras
();
String
address
=
(
String
)
b
.
get
(
"ip"
);
clientAddressIp
=
b
.
get
(
"ip"
)
+
":8080"
;
// client ip
new
LoadPreferencesTask
().
execute
();
...
...
@@ -101,36 +101,16 @@ public final class StreamCameraActivity extends Activity
mPreviewDisplay
.
addCallback
(
this
);
mIpAddress
=
(
String
)
b
.
get
(
"myIp"
);
mIpAddressView
=
(
TextView
)
findViewById
(
R
.
id
.
ip_address
);
updatePrefCacheAndUi
();
final
PowerManager
powerManager
=
(
PowerManager
)
getSystemService
(
POWER_SERVICE
);
mWakeLock
=
powerManager
.
newWakeLock
(
PowerManager
.
SCREEN_DIM_WAKE_LOCK
,
WAKE_LOCK_TAG
);
myWebView
=
(
WebView
)
findViewById
(
R
.
id
.
webview
);
webViewButton
=
(
Button
)
findViewById
(
R
.
id
.
client_mode
);
WebView
myWebView
=
(
WebView
)
findViewById
(
R
.
id
.
webview
);
String
mDescText
=
"<head>\n"
+
"\n"
+
"</head>\n"
+
"<body>\n"
+
"\t<div style='width:50%;display:inline-block;height:auto'>\n"
+
"\t\t<img style='width:100%' src='"
+
"http://"
+
address
+
"'/>\n"
+
"\t</div>\n"
+
"\t<div style='float:right;width:50%;display:inline-block;height:auto'> \n"
+
"\t\t<img style='width:100%' src='"
+
"http://"
+
address
+
"'/>\n"
+
"\t</div>\n"
+
"\n"
+
"</body>"
;
WebSettings
settings
=
myWebView
.
getSettings
();
settings
.
setDefaultTextEncodingName
(
"utf-8"
);
settings
.
setJavaScriptEnabled
(
true
);
myWebView
.
loadData
(
mDescText
,
"text/html; charset=utf-8"
,
null
);
}
// onCreate(Bundle)
@Override
...
...
@@ -202,25 +182,7 @@ public final class StreamCameraActivity extends Activity
}
// if
}
// stopCameraStreamer()
@Override
public
boolean
onCreateOptionsMenu
(
final
Menu
menu
)
{
super
.
onCreateOptionsMenu
(
menu
);
mSettingsMenuItem
=
menu
.
add
(
R
.
string
.
settings
);
mSettingsMenuItem
.
setIcon
(
android
.
R
.
drawable
.
ic_menu_manage
);
return
true
;
}
// onCreateOptionsMenu(Menu)
@Override
public
boolean
onOptionsItemSelected
(
final
MenuItem
item
)
{
if
(
item
!=
mSettingsMenuItem
)
{
return
super
.
onOptionsItemSelected
(
item
);
}
// if
startActivity
(
new
Intent
(
this
,
PeepersPreferenceActivity
.
class
));
return
true
;
}
// onOptionsItemSelected(MenuItem)
private
final
class
LoadPreferencesTask
extends
AsyncTask
<
Void
,
Void
,
SharedPreferences
>
...
...
@@ -324,7 +286,6 @@ public final class StreamCameraActivity extends Activity
{
mJpegQuality
=
100
;
}
// else if
mIpAddressView
.
setText
(
"http://"
+
mIpAddress
+
":"
+
mPort
+
"/"
);
}
// updatePrefCacheAndUi()
private
boolean
hasFlashLight
()
...
...
@@ -333,6 +294,31 @@ public final class StreamCameraActivity extends Activity
PackageManager
.
FEATURE_CAMERA_FLASH
);
}
// hasFlashLight()
public
void
showWebView
(
View
myView
){
webViewButton
.
setVisibility
(
View
.
INVISIBLE
);
String
mDescText
=
"<head>\n"
+
"\n"
+
"</head>\n"
+
"<body>\n"
+
"<style>\n"
+
"* { margin: 0; padding: 0 }"
+
"</style>\n"
+
"\t<div style='width:50%;display:inline-block;height:auto'>\n"
+
"\t\t<img style='width:100%' src='"
+
"http://"
+
clientAddressIp
+
"'/>\n"
+
"\t</div>\n"
+
"\t<div style='float:right;width:50%;display:inline-block;height:auto'> \n"
+
"\t\t<img style='width:100%' src='"
+
"http://"
+
clientAddressIp
+
"'/>\n"
+
"\t</div>\n"
+
"\n"
+
"</body>"
;
WebSettings
settings
=
myWebView
.
getSettings
();
settings
.
setDefaultTextEncodingName
(
"utf-8"
);
settings
.
setJavaScriptEnabled
(
true
);
myWebView
.
loadData
(
mDescText
,
"text/html; charset=utf-8"
,
null
);
}
}
// class StreamCameraActivity
...
...
peepers/app/src/main/res/layout/activity_main.xml
View file @
086b4224
...
...
@@ -10,7 +10,7 @@
android:layout_width=
"fill_parent"
android:layout_height=
"wrap_content"
android:id=
"@+id/input_address"
android:text=
"192.168.43.116
:8080
"
android:text=
"192.168.43.116"
android:layout_alignEnd=
"@+id/go_to_view"
/>
<TextView
...
...
@@ -27,6 +27,6 @@
android:onClick=
"startView"
android:text=
"Dupa"
android:layout_alignParentBottom=
"true"
android:layout_alignParentEnd=
"true"
></Button
>
android:layout_alignParentEnd=
"true"
/
>
</RelativeLayout>
peepers/app/src/main/res/layout/main.xml
View file @
086b4224
...
...
@@ -15,25 +15,36 @@
limitations under the License.
-->
<merge
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"#000000"
>
<SurfaceView
android:id=
"@+id/camera"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
/>
android:layout_height=
"match_parent"
android:background=
"#000000"
/>
<WebView
android:id=
"@+id/webview"
android:layout_width=
"fill_parent"
android:layout_height=
"fill_parent"
android:layout_centerInParent=
"true"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:background=
"#000000"
android:layout_centerVertical=
"true"
/>
<Button
android:layout_width=
"100dp"
android:layout_height=
"wrap_content"
android:text=
"Go!"
android:id=
"@+id/client_mode"
android:onClick=
"showWebView"
android:layout_centerInParent=
"true"
android:layout_alignParentBottom=
"true"
/>
<TextView
android:id=
"@+id/ip_address"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"bottom|top"
android:background=
"@android:color/black"
/>
</merge>
</RelativeLayout>
peepers/peepers.iml
View file @
086b4224
...
...
@@ -8,7 +8,7 @@
</configuration>
</facet>
</component>
<component
name=
"NewModuleRootManager"
inherit-compiler-output=
"true"
>
<component
name=
"NewModuleRootManager"
LANGUAGE_LEVEL=
"JDK_1_6"
inherit-compiler-output=
"true"
>
<exclude-output
/>
<content
url=
"file://$MODULE_DIR$"
>
<excludeFolder
url=
"file://$MODULE_DIR$/.gradle"
/>
...
...
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