Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Mathias Stanger
yasc
Commits
cb477cc2
Commit
cb477cc2
authored
Aug 01, 2018
by
Mathias Stanger
Browse files
Release V3: ssh-Key-Auswahl kommt nun mit mehrer FileChoosern klar + Tasten skalieren nun mit
parent
36fa2f0c
Changes
9
Hide whitespace changes
Inline
Side-by-side
.idea/gradle.xml
View file @
cb477cc2
...
...
@@ -3,20 +3,16 @@
<component
name=
"GradleSettings"
>
<option
name=
"linkedExternalProjectsSettings"
>
<GradleProjectSettings>
<option
name=
"distributionType"
value=
"
DEFAULT_WRAPPED
"
/>
<option
name=
"distributionType"
value=
"
LOCAL
"
/>
<option
name=
"externalProjectPath"
value=
"$PROJECT_DIR$"
/>
<option
name=
"gradleHome"
value=
"C:\Program Files\Android\Android Studio\gradle\gradle-2.14.1"
/>
<option
name=
"modules"
>
<set>
<option
value=
"$PROJECT_DIR$"
/>
<option
value=
"$PROJECT_DIR$/app"
/>
</set>
</option>
<option
name=
"myModules"
>
<set>
<option
value=
"$PROJECT_DIR$"
/>
<option
value=
"$PROJECT_DIR$/app"
/>
</set>
</option>
<option
name=
"resolveModulePerSourceSet"
value=
"false"
/>
</GradleProjectSettings>
</option>
</component>
...
...
.idea/misc.xml
View file @
cb477cc2
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<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"
/>
...
...
@@ -27,17 +24,7 @@
</value>
</option>
</component>
<component
name=
"ProjectLevelVcsManager"
settingsEditedManually=
"false"
>
<OptionsSetting
value=
"true"
id=
"Add"
/>
<OptionsSetting
value=
"true"
id=
"Remove"
/>
<OptionsSetting
value=
"true"
id=
"Checkout"
/>
<OptionsSetting
value=
"true"
id=
"Update"
/>
<OptionsSetting
value=
"true"
id=
"Status"
/>
<OptionsSetting
value=
"true"
id=
"Edit"
/>
<ConfirmationsSetting
value=
"0"
id=
"Add"
/>
<ConfirmationsSetting
value=
"0"
id=
"Remove"
/>
</component>
<component
name=
"ProjectRootManager"
version=
"2"
languageLevel=
"JDK_1_7"
default=
"true"
assert-keyword=
"true"
jdk-15=
"true"
project-jdk-name=
"1.7"
project-jdk-type=
"JavaSDK"
>
<component
name=
"ProjectRootManager"
version=
"2"
languageLevel=
"JDK_1_7"
default=
"true"
project-jdk-name=
"1.8"
project-jdk-type=
"JavaSDK"
>
<output
url=
"file://$PROJECT_DIR$/build/classes"
/>
</component>
<component
name=
"ProjectType"
>
...
...
app/build.gradle
View file @
cb477cc2
apply
plugin:
'com.android.application'
android
{
compileSdkVersion
23
buildToolsVersion
"23.0.2"
defaultConfig
{
applicationId
"de.matsta.sshclient"
minSdkVersion
17
targetSdkVersion
23
versionCode
1
versionName
"
1
.0"
}
buildTypes
{
release
{
minifyEnabled
false
proguardFiles
getDefaultProguardFile
(
'proguard-android.txt'
),
'proguard-rules.pro'
}
}
}
repositories
{
jcenter
()
maven
{
url
"https://jitpack.io"
}
}
dependencies
{
compile
fileTree
(
dir:
'libs'
,
include:
[
'*.jar'
])
testCompile
'junit:junit:4.12'
compile
'com.android.support:appcompat-v7:23.3.0'
compile
'com.jcraft:jsch:0.1.53'
compile
'com.jakewharton:butterknife:7.0.1'
compile
'com.redmadrobot:chronos:1.0.5'
compile
'com.github.dmytrodanylyk:android-morphing-button:98a4986e56'
}
apply
plugin:
'com.android.application'
android
{
compileSdkVersion
23
buildToolsVersion
"23.0.2"
defaultConfig
{
applicationId
"de.matsta.sshclient"
minSdkVersion
17
targetSdkVersion
23
versionCode
3
versionName
"
3
.0"
}
buildTypes
{
release
{
minifyEnabled
false
proguardFiles
getDefaultProguardFile
(
'proguard-android.txt'
),
'proguard-rules.pro'
}
}
}
repositories
{
jcenter
()
maven
{
url
"https://jitpack.io"
}
}
dependencies
{
compile
fileTree
(
dir:
'libs'
,
include:
[
'*.jar'
])
testCompile
'junit:junit:4.12'
compile
'com.android.support:appcompat-v7:23.3.0'
compile
'com.jcraft:jsch:0.1.53'
compile
'com.jakewharton:butterknife:7.0.1'
compile
'com.redmadrobot:chronos:1.0.5'
compile
'com.github.dmytrodanylyk:android-morphing-button:98a4986e56'
}
app/src/main/java/de/matsta/yasc/Utils.java
View file @
cb477cc2
package
de.matsta.yasc
;
import
android.content.Context
;
import
android.database.Cursor
;
import
android.graphics.Color
;
import
android.net.Uri
;
import
com.dd.morphingbutton.MorphingButton
;
import
java.net.URISyntaxException
;
public
class
Utils
{
public
static
String
getPath
(
Context
context
,
Uri
uri
)
throws
URISyntaxException
{
if
(
"content"
.
equalsIgnoreCase
(
uri
.
getScheme
()))
{
String
[]
projection
=
{
"_data"
};
Cursor
cursor
=
null
;
try
{
cursor
=
context
.
getContentResolver
().
query
(
uri
,
projection
,
null
,
null
,
null
);
int
column_index
=
cursor
.
getColumnIndexOrThrow
(
"_data"
);
if
(
cursor
.
moveToFirst
())
{
return
cursor
.
getString
(
column_index
);
}
}
catch
(
Exception
e
)
{
// Eat it
}
}
else
if
(
"file"
.
equalsIgnoreCase
(
uri
.
getScheme
()))
{
return
uri
.
getPath
();
}
return
null
;
}
public
static
void
morphToSuccess
(
final
MorphingButton
btnMorph
)
{
MorphingButton
.
Params
circle
=
MorphingButton
.
Params
.
create
()
.
duration
(
500
)
.
cornerRadius
(
80
)
.
width
(
80
)
.
height
(
80
)
.
color
(
Color
.
GREEN
)
.
colorPressed
(
Color
.
YELLOW
)
.
icon
(
R
.
drawable
.
ic_check
);
btnMorph
.
morph
(
circle
);
}
public
static
void
morphToButton
(
final
MorphingButton
btnMorph
,
final
String
caption
)
{
MorphingButton
.
Params
square
=
MorphingButton
.
Params
.
create
()
.
duration
(
500
)
.
cornerRadius
(
2
)
.
width
(
400
)
.
height
(
70
)
.
color
(
Color
.
GRAY
)
.
colorPressed
(
Color
.
DKGRAY
)
.
text
(
caption
);
btnMorph
.
morph
(
square
);
}
public
static
void
morphToFailure
(
final
MorphingButton
btnMorph
,
int
duration
)
{
MorphingButton
.
Params
circle
=
MorphingButton
.
Params
.
create
()
.
duration
(
duration
)
.
cornerRadius
(
80
)
.
width
(
80
)
.
height
(
80
)
.
color
(
Color
.
RED
)
.
colorPressed
(
Color
.
DKGRAY
)
.
icon
(
R
.
drawable
.
ic_fail
);
btnMorph
.
morph
(
circle
);
}
public
static
void
morphToSquare
(
final
MorphingButton
btnMorph
,
int
duration
)
{
MorphingButton
.
Params
square
=
MorphingButton
.
Params
.
create
()
.
duration
(
duration
)
.
cornerRadius
(
2
)
.
width
(
200
)
.
height
(
70
)
.
color
(
Color
.
DKGRAY
)
.
colorPressed
(
Color
.
DKGRAY
)
.
text
(
"..."
);
btnMorph
.
morph
(
square
);
}
}
package
de.matsta.yasc
;
import
android.annotation.SuppressLint
;
import
android.content.ContentUris
;
import
android.content.Context
;
import
android.content.res.Resources
;
import
android.database.Cursor
;
import
android.graphics.Color
;
import
android.net.Uri
;
import
android.os.Build
;
import
android.os.Environment
;
import
android.provider.DocumentsContract
;
import
android.provider.MediaStore
;
import
com.dd.morphingbutton.MorphingButton
;
import
java.net.URISyntaxException
;
public
class
Utils
{
@SuppressLint
(
"NewApi"
)
public
static
String
getPath
(
Context
context
,
Uri
uri
)
{
final
boolean
isKitKat
=
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
;
// DocumentProvider
if
(
isKitKat
&&
DocumentsContract
.
isDocumentUri
(
context
,
uri
))
{
// ExternalStorageProvider
if
(
isExternalStorageDocument
(
uri
))
{
final
String
docId
=
DocumentsContract
.
getDocumentId
(
uri
);
final
String
[]
split
=
docId
.
split
(
":"
);
final
String
type
=
split
[
0
];
if
(
"primary"
.
equalsIgnoreCase
(
type
))
{
return
Environment
.
getExternalStorageDirectory
()
+
"/"
+
split
[
1
];
}
// TODO handle non-primary volumes
}
// DownloadsProvider
else
if
(
isDownloadsDocument
(
uri
))
{
final
String
id
=
DocumentsContract
.
getDocumentId
(
uri
);
final
Uri
contentUri
=
ContentUris
.
withAppendedId
(
Uri
.
parse
(
"content://downloads/public_downloads"
),
Long
.
valueOf
(
id
));
return
getDataColumn
(
context
,
contentUri
,
null
,
null
);
}
// MediaProvider
else
if
(
isMediaDocument
(
uri
))
{
final
String
docId
=
DocumentsContract
.
getDocumentId
(
uri
);
final
String
[]
split
=
docId
.
split
(
":"
);
final
String
type
=
split
[
0
];
Uri
contentUri
=
null
;
if
(
"image"
.
equals
(
type
))
{
contentUri
=
MediaStore
.
Images
.
Media
.
EXTERNAL_CONTENT_URI
;
}
else
if
(
"video"
.
equals
(
type
))
{
contentUri
=
MediaStore
.
Video
.
Media
.
EXTERNAL_CONTENT_URI
;
}
else
if
(
"audio"
.
equals
(
type
))
{
contentUri
=
MediaStore
.
Audio
.
Media
.
EXTERNAL_CONTENT_URI
;
}
final
String
selection
=
"_id=?"
;
final
String
[]
selectionArgs
=
new
String
[]
{
split
[
1
]};
return
getDataColumn
(
context
,
contentUri
,
selection
,
selectionArgs
);
}
}
// MediaStore (and general)
else
if
(
"content"
.
equalsIgnoreCase
(
uri
.
getScheme
()))
{
// Return the remote address
if
(
isGooglePhotosUri
(
uri
))
return
uri
.
getLastPathSegment
();
return
getDataColumn
(
context
,
uri
,
null
,
null
);
}
// File
else
if
(
"file"
.
equalsIgnoreCase
(
uri
.
getScheme
()))
{
return
uri
.
getPath
();
}
return
null
;
}
public
static
String
getDataColumn
(
Context
context
,
Uri
uri
,
String
selection
,
String
[]
selectionArgs
)
{
Cursor
cursor
=
null
;
final
String
column
=
"_data"
;
final
String
[]
projection
=
{
column
};
try
{
cursor
=
context
.
getContentResolver
().
query
(
uri
,
projection
,
selection
,
selectionArgs
,
null
);
if
(
cursor
!=
null
&&
cursor
.
moveToFirst
())
{
final
int
index
=
cursor
.
getColumnIndexOrThrow
(
column
);
return
cursor
.
getString
(
index
);
}
}
finally
{
if
(
cursor
!=
null
)
cursor
.
close
();
}
return
null
;
}
public
static
boolean
isExternalStorageDocument
(
Uri
uri
)
{
return
"com.android.externalstorage.documents"
.
equals
(
uri
.
getAuthority
());
}
/**
* @param uri The Uri to check.
* @return Whether the Uri authority is DownloadsProvider.
*/
public
static
boolean
isDownloadsDocument
(
Uri
uri
)
{
return
"com.android.providers.downloads.documents"
.
equals
(
uri
.
getAuthority
());
}
/**
* @param uri The Uri to check.
* @return Whether the Uri authority is MediaProvider.
*/
public
static
boolean
isMediaDocument
(
Uri
uri
)
{
return
"com.android.providers.media.documents"
.
equals
(
uri
.
getAuthority
());
}
/**
* @param uri The Uri to check.
* @return Whether the Uri authority is Google Photos.
*/
public
static
boolean
isGooglePhotosUri
(
Uri
uri
)
{
return
"com.google.android.apps.photos.content"
.
equals
(
uri
.
getAuthority
());
}
public
static
String
OLD_getPath
(
Context
context
,
Uri
uri
)
throws
URISyntaxException
{
if
(
"content"
.
equalsIgnoreCase
(
uri
.
getScheme
()))
{
String
[]
projection
=
{
"_data"
};
Cursor
cursor
=
null
;
Uri
cleanUri
=
Uri
.
parse
(
uri
.
toString
().
replace
(
"%3A"
,
":"
));
try
{
cursor
=
context
.
getContentResolver
().
query
(
cleanUri
,
projection
,
null
,
null
,
null
);
int
column_index
=
cursor
.
getColumnIndexOrThrow
(
"_data"
);
if
(
cursor
.
moveToFirst
())
{
return
cursor
.
getString
(
column_index
);
}
}
catch
(
Exception
e
)
{
// Eat it
}
}
else
if
(
"file"
.
equalsIgnoreCase
(
uri
.
getScheme
()))
{
return
uri
.
getPath
();
}
return
null
;
}
public
static
void
morphToSuccess
(
final
MorphingButton
btnMorph
,
final
Resources
res
)
{
MorphingButton
.
Params
circle
=
MorphingButton
.
Params
.
create
()
.
duration
(
500
)
.
cornerRadius
(
getDimen
(
res
,
R
.
dimen
.
buttonSuccessCornerRadius
))
.
width
(
getDimen
(
res
,
R
.
dimen
.
buttonSuccessWidth
))
.
height
(
getDimen
(
res
,
R
.
dimen
.
buttonSuccessHight
))
.
color
(
Color
.
GREEN
)
.
colorPressed
(
Color
.
YELLOW
)
.
icon
(
R
.
drawable
.
ic_check
);
btnMorph
.
morph
(
circle
);
}
public
static
int
getDimen
(
final
Resources
res
,
final
int
id
)
{
return
(
int
)
res
.
getDimension
(
id
);
}
public
static
void
morphToButton
(
final
MorphingButton
btnMorph
,
final
String
caption
,
final
Resources
res
)
{
MorphingButton
.
Params
square
=
MorphingButton
.
Params
.
create
()
.
duration
(
500
)
.
cornerRadius
(
getDimen
(
res
,
R
.
dimen
.
buttonCornerRadius
))
.
width
(
getDimen
(
res
,
R
.
dimen
.
buttonWidth
))
.
height
(
getDimen
(
res
,
R
.
dimen
.
buttonHight
))
.
color
(
Color
.
GRAY
)
.
colorPressed
(
Color
.
DKGRAY
)
.
text
(
caption
);
btnMorph
.
morph
(
square
);
}
public
static
void
morphToFailure
(
final
MorphingButton
btnMorph
,
int
duration
,
final
Resources
res
)
{
MorphingButton
.
Params
circle
=
MorphingButton
.
Params
.
create
()
.
duration
(
duration
)
.
cornerRadius
(
getDimen
(
res
,
R
.
dimen
.
buttonFailureCornerRadius
))
.
width
(
getDimen
(
res
,
R
.
dimen
.
buttonFailureWidth
))
.
height
(
getDimen
(
res
,
R
.
dimen
.
buttonFailureHight
))
.
color
(
Color
.
RED
)
.
colorPressed
(
Color
.
DKGRAY
)
.
icon
(
R
.
drawable
.
ic_fail
);
btnMorph
.
morph
(
circle
);
}
public
static
void
morphToSquare
(
final
MorphingButton
btnMorph
,
int
duration
,
final
Resources
res
)
{
MorphingButton
.
Params
square
=
MorphingButton
.
Params
.
create
()
.
duration
(
duration
)
.
cornerRadius
(
getDimen
(
res
,
R
.
dimen
.
buttonSquareCornerRadius
))
.
width
(
getDimen
(
res
,
R
.
dimen
.
buttonSquareWidth
))
.
height
(
getDimen
(
res
,
R
.
dimen
.
buttonSquareHight
))
.
color
(
Color
.
DKGRAY
)
.
colorPressed
(
Color
.
DKGRAY
)
.
text
(
"..."
);
btnMorph
.
morph
(
square
);
}
}
app/src/main/java/de/matsta/yasc/fragments/ControlFragment.java
View file @
cb477cc2
package
de.matsta.yasc.fragments
;
import
android.Manifest
;
import
android.content.pm.PackageManager
;
import
android.os.Bundle
;
import
android.support.annotation.Nullable
;
import
android.support.v4.content.ContextCompat
;
import
android.util.Log
;
import
android.view.LayoutInflater
;
import
android.view.Menu
;
import
android.view.MenuInflater
;
import
android.view.MenuItem
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.Button
;
import
android.widget.EditText
;
import
android.widget.Toast
;
import
com.dd.morphingbutton.MorphingButton
;
import
com.redmadrobot.chronos.gui.fragment.ChronosFragment
;
import
com.redmadrobot.chronos.gui.fragment.ChronosSupportFragment
;
import
butterknife.Bind
;
import
butterknife.ButterKnife
;
import
de.matsta.yasc.R
;
import
de.matsta.yasc.SharedPrefsTools
;
import
de.matsta.yasc.SshOperation
;
import
de.matsta.yasc.Utils
;
public
class
ControlFragment
extends
ChronosFragment
{
@Bind
(
R
.
id
.
btnBuzz
)
MorphingButton
mBtnBuzz
;
@Bind
(
R
.
id
.
btnUnlock
)
MorphingButton
mBtnUnlock
;
@Nullable
@Override
public
View
onCreateView
(
LayoutInflater
inflater
,
@Nullable
ViewGroup
container
,
@Nullable
Bundle
savedInstanceState
)
{
View
view
=
inflater
.
inflate
(
R
.
layout
.
control_fragment
,
container
,
false
);
ButterKnife
.
bind
(
this
,
view
);
setHasOptionsMenu
(
true
);
mBtnBuzz
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
Utils
.
morphToSquare
(
mBtnBuzz
,
100
);
executeRemote
(
"buzz"
);
}
}
);
mBtnUnlock
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
Utils
.
morphToSquare
(
mBtnUnlock
,
100
);
executeRemote
(
"unlock"
);
}
});
Utils
.
morphToButton
(
mBtnBuzz
,
"Buzz"
);
Utils
.
morphToButton
(
mBtnUnlock
,
"Unlock"
);
return
view
;
}
private
void
executeRemote
(
String
command
)
{
SharedPrefsTools
sharedPrefsTools
=
new
SharedPrefsTools
(
getActivity
().
getApplicationContext
());
runOperation
(
new
SshOperation
(
sharedPrefsTools
.
getHost
(),
sharedPrefsTools
.
getUsername
(),
sharedPrefsTools
.
getKey
(),
sharedPrefsTools
.
getKeyPwd
(),
sharedPrefsTools
.
getPort
(),
command
));
}
@Override
public
void
onCreateOptionsMenu
(
Menu
menu
,
MenuInflater
inflater
)
{
inflater
.
inflate
(
R
.
menu
.
control_fragment_menu
,
menu
);
super
.
onCreateOptionsMenu
(
menu
,
inflater
);
}
public
void
onOperationFinished
(
final
SshOperation
.
Result
result
)
{
// TODO Rückgabe besser parsen
if
(
result
.
isSuccessful
())
{
if
(
result
.
getOutput
().
contains
(
"buzz executed"
))
{
// Buzz hat funktioniert.
Toast
.
makeText
(
getActivity
(),
"Buzz wurde ausgelöst"
,
Toast
.
LENGTH_SHORT
).
show
();
}
else
if
(
result
.
getOutput
().
contains
(
""
))
{
// Unlock hat funktioniert.
Toast
.
makeText
(
getActivity
(),
"Tür wurde entsperrt"
,
Toast
.
LENGTH_SHORT
).
show
();
}
else
{
// Fallback
Toast
.
makeText
(
getActivity
(),
result
.
getOutput
(),
Toast
.
LENGTH_LONG
).
show
();
}
// Buttons wieder zurücksetzen
Utils
.
morphToButton
(
mBtnBuzz
,
"Buzz"
);
Utils
.
morphToButton
(
mBtnUnlock
,
"Unlock"
);
}
else
{
Toast
.
makeText
(
getActivity
(),
result
.
getErrorMessage
(),
Toast
.
LENGTH_LONG
).
show
();
Log
.
d
(
this
.
getClass
().
getSimpleName
(),
result
.
getErrorMessage
());
}
}
@Override
public
boolean
onOptionsItemSelected
(
MenuItem
item
)
{
switch
(
item
.
getItemId
())
{
case
R
.
id
.
action_config
:
// Einstellungen anzeigen
SettingsFragment
fragment
=
new
SettingsFragment
();
getActivity
().
getFragmentManager
().
beginTransaction
().
replace
(
R
.
id
.
fragment_container
,
fragment
,
getString
(
R
.
string
.
config
)).
addToBackStack
(
null
).
commit
();
return
true
;
default
:
return
super
.
onOptionsItemSelected
(
item
);
}
}
}
package
de.matsta.yasc.fragments
;
import
android.Manifest
;
import
android.content.pm.PackageManager
;
import
android.os.Bundle
;
import
android.support.annotation.Nullable
;
import
android.support.v4.content.ContextCompat
;
import
android.util.Log
;
import
android.view.LayoutInflater
;
import
android.view.Menu
;
import
android.view.MenuInflater
;
import
android.view.MenuItem
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.Button
;
import
android.widget.EditText
;
import
android.widget.Toast
;
import
com.dd.morphingbutton.MorphingButton
;
import
com.redmadrobot.chronos.gui.fragment.ChronosFragment
;
import
com.redmadrobot.chronos.gui.fragment.ChronosSupportFragment
;
import
butterknife.Bind
;
import
butterknife.ButterKnife
;
import
de.matsta.yasc.R
;
import
de.matsta.yasc.SharedPrefsTools
;
import
de.matsta.yasc.SshOperation
;
import
de.matsta.yasc.Utils
;
public
class
ControlFragment
extends
ChronosFragment
{
@Bind
(
R
.
id
.
btnBuzz
)
MorphingButton
mBtnBuzz
;
@Bind
(
R
.
id
.
btnUnlock
)
MorphingButton
mBtnUnlock
;
@Nullable
@Override
public
View
onCreateView
(
LayoutInflater
inflater
,
@Nullable
ViewGroup
container
,
@Nullable
Bundle
savedInstanceState
)
{
View
view
=
inflater
.
inflate
(
R
.
layout
.
control_fragment
,
container
,
false
);
ButterKnife
.
bind
(
this
,
view
);
setHasOptionsMenu
(
true
);
mBtnBuzz
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
Utils
.
morphToSquare
(
mBtnBuzz
,
100
,
getResources
()
);
executeRemote
(
"buzz"
);
}
}
);
mBtnUnlock
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
Utils
.
morphToSquare
(
mBtnUnlock
,
100
,
getResources
()
);
executeRemote
(
"unlock"
);
}
});
Utils
.
morphToButton
(
mBtnBuzz
,
"Buzz"
,
getResources
()
);
Utils
.
morphToButton
(
mBtnUnlock
,
"Unlock"
,
getResources
()
);
return
view
;
}
private
void
executeRemote
(
String
command
)
{
SharedPrefsTools
sharedPrefsTools
=
new
SharedPrefsTools
(
getActivity
().
getApplicationContext
());
runOperation
(
new
SshOperation
(
sharedPrefsTools
.
getHost
(),
sharedPrefsTools
.
getUsername
(),
sharedPrefsTools
.
getKey
(),
sharedPrefsTools
.
getKeyPwd
(),
sharedPrefsTools
.
getPort
(),
command
));
}
@Override
public
void
onCreateOptionsMenu
(
Menu
menu
,
MenuInflater
inflater
)
{
inflater
.
inflate
(
R
.
menu
.
control_fragment_menu
,
menu
);
super
.
onCreateOptionsMenu
(
menu
,
inflater
);