Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tic
Overview
Overview
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
wenyuanbo
tic
Commits
56a6ef31
Commit
56a6ef31
authored
Apr 13, 2018
by
Pariksheet Pinjari
Committed by
Tianqi Chen
Apr 12, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
RPC session connection request information persist app locally (#1098)
parent
01e1699d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
0 deletions
+23
-0
apps/android_rpc/app/src/main/java/ml/dmlc/tvm/tvmrpc/MainActivity.java
+23
-0
No files found.
apps/android_rpc/app/src/main/java/ml/dmlc/tvm/tvmrpc/MainActivity.java
View file @
56a6ef31
...
...
@@ -19,7 +19,9 @@ package ml.dmlc.tvm.tvmrpc;
import
android.annotation.SuppressLint
;
import
android.app.AlertDialog
;
import
android.content.Context
;
import
android.content.DialogInterface
;
import
android.content.SharedPreferences
;
import
android.os.Bundle
;
import
android.os.Handler
;
import
android.os.Message
;
...
...
@@ -86,6 +88,7 @@ public class MainActivity extends AppCompatActivity {
}
}
});
enableInputView
(
true
);
}
@Override
...
...
@@ -104,6 +107,13 @@ public class MainActivity extends AppCompatActivity {
final
String
key
=
edAppKey
.
getText
().
toString
();
tvmServerWorker
.
connect
(
proxyHost
,
proxyPort
,
key
);
SharedPreferences
pref
=
getApplicationContext
().
getSharedPreferences
(
"RPCProxyPreference"
,
Context
.
MODE_PRIVATE
);
SharedPreferences
.
Editor
editor
=
pref
.
edit
();
editor
.
putString
(
"input_address"
,
proxyHost
);
editor
.
putString
(
"input_port"
,
edProxyPort
.
getText
().
toString
());
editor
.
putString
(
"input_key"
,
key
);
editor
.
commit
();
}
private
void
disconnect
()
{
...
...
@@ -118,5 +128,18 @@ public class MainActivity extends AppCompatActivity {
edProxyAddress
.
setEnabled
(
enable
);
edProxyPort
.
setEnabled
(
enable
);
edAppKey
.
setEnabled
(
enable
);
if
(
enable
)
{
SharedPreferences
pref
=
getApplicationContext
().
getSharedPreferences
(
"RPCProxyPreference"
,
Context
.
MODE_PRIVATE
);
String
inputAddress
=
pref
.
getString
(
"input_address"
,
null
);
if
(
null
!=
inputAddress
)
edProxyAddress
.
setText
(
inputAddress
);
String
inputPort
=
pref
.
getString
(
"input_port"
,
null
);
if
(
null
!=
inputPort
)
edProxyPort
.
setText
(
inputPort
);
String
inputKey
=
pref
.
getString
(
"input_key"
,
null
);
if
(
null
!=
inputKey
)
edAppKey
.
setText
(
inputKey
);
}
}
}
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