pushes search/list and new UI change
This commit is contained in:
4
.idea/misc.xml
generated
4
.idea/misc.xml
generated
@@ -6,8 +6,10 @@
|
||||
<entry key="app/src/main/res/drawable-v24/ic_launcher_foreground.xml" value="0.37864583333333335" />
|
||||
<entry key="app/src/main/res/drawable/ic_launcher_background.xml" value="0.37864583333333335" />
|
||||
<entry key="app/src/main/res/drawable/peernet_logo_black.xml" value="0.37864583333333335" />
|
||||
<entry key="app/src/main/res/layout/activity_main.xml" value="0.296195652173913" />
|
||||
<entry key="app/src/main/res/layout/activity_main.xml" value="0.33" />
|
||||
<entry key="app/src/main/res/layout/activity_search.xml" value="0.3625" />
|
||||
<entry key="app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml" value="0.37864583333333335" />
|
||||
<entry key="app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml" value="0.37864583333333335" />
|
||||
</map>
|
||||
</option>
|
||||
</component>
|
||||
|
||||
Binary file not shown.
@@ -4,9 +4,7 @@
|
||||
package="com.peernet.test">
|
||||
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission
|
||||
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
|
||||
/>
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
@@ -18,7 +16,8 @@
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.Test"
|
||||
android:usesCleartextTraffic="true">
|
||||
android:usesCleartextTraffic="true"
|
||||
android:requestLegacyExternalStorage="true" >
|
||||
|
||||
<activity
|
||||
android:name=".Search"
|
||||
|
||||
@@ -4,6 +4,8 @@ import android.Manifest
|
||||
import android.content.ContentValues.TAG
|
||||
import android.content.Intent
|
||||
import android.content.pm.PackageManager
|
||||
import android.database.Cursor
|
||||
import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.widget.TextView
|
||||
@@ -31,6 +33,14 @@ import kotlinx.coroutines.launch
|
||||
import java.io.IOException
|
||||
import java.util.*
|
||||
import kotlin.concurrent.schedule
|
||||
import android.provider.MediaStore
|
||||
import java.io.File
|
||||
import android.os.Environment
|
||||
import com.android.volley.toolbox.JsonObjectRequest
|
||||
import com.android.volley.toolbox.JsonRequest
|
||||
import org.json.JSONArray
|
||||
import org.json.JSONObject
|
||||
import org.json.JSONTokener
|
||||
|
||||
|
||||
class MainActivity : AppCompatActivity() {
|
||||
@@ -47,10 +57,10 @@ class MainActivity : AppCompatActivity() {
|
||||
|
||||
val queue = Volley.newRequestQueue(this)
|
||||
|
||||
Timer().schedule(4000){
|
||||
Timer().schedule(500){
|
||||
// do something after 1 second
|
||||
GlobalScope.launch {
|
||||
val url = "http://127.0.0.1:8881/account/info"
|
||||
val url = "http://127.0.0.1:5125/account/info"
|
||||
|
||||
|
||||
|
||||
@@ -62,20 +72,23 @@ class MainActivity : AppCompatActivity() {
|
||||
// Display the first 500 characters of the response string.
|
||||
// textView.text = "Response is: ${response.substring(0, 500)}"
|
||||
//connectionLabel.text= "Response is: ${response.substring(0, 500)}"
|
||||
val connectionLabel1 = findViewById<View>(R.id.PeernetInfo1) as TextView
|
||||
connectionLabel1.text = response.toString()
|
||||
val ResponseObject = JSONTokener(response.toString()).nextValue() as JSONObject
|
||||
val peerID = findViewById<View>(R.id.PeerIDFIeld) as TextView
|
||||
val nodeID = findViewById<View>(R.id.NodeIDFIeld) as TextView
|
||||
peerID.text = ResponseObject.get("peerid").toString()
|
||||
nodeID.text = ResponseObject.get("nodeid").toString()
|
||||
// Log.d("myTag", "Response is: ${response.substring(0, 500)}");
|
||||
},
|
||||
Response.ErrorListener { errorresponse ->
|
||||
val connectionLabel1 = findViewById<View>(R.id.PeernetInfo1) as TextView
|
||||
connectionLabel1.text = errorresponse.toString()
|
||||
// val connectionLabel1 = findViewById<View>(R.id.PeernetInfo1) as TextView
|
||||
// connectionLabel1.text = errorresponse.toString()
|
||||
Log.d("myTag", errorresponse.toString());
|
||||
})
|
||||
|
||||
// Add the request to the RequestQueue.
|
||||
queue.add(stringRequest)
|
||||
|
||||
val url1 = "http://127.0.0.1:8881/status"
|
||||
val url1 = "http://127.0.0.1:5125/status"
|
||||
|
||||
val stringRequest1 = StringRequest(
|
||||
Request.Method.GET, url1,
|
||||
@@ -84,19 +97,27 @@ class MainActivity : AppCompatActivity() {
|
||||
// Display the first 500 characters of the response string.
|
||||
// textView.text = "Response is: ${response.substring(0, 500)}"
|
||||
//connectionLabel.text= "Response is: ${response.substring(0, 500)}"
|
||||
val connectionLabel = findViewById<View>(R.id.PeernetInfo) as TextView
|
||||
connectionLabel.text = response.toString()
|
||||
// Parse response as JSON
|
||||
val ResponseObject = JSONTokener(response.toString()).nextValue() as JSONObject
|
||||
|
||||
val isConnected = findViewById<View>(R.id.isConnectedField) as TextView
|
||||
val numPeers = findViewById<View>(R.id.PeerListField) as TextView
|
||||
|
||||
isConnected.text = ResponseObject.get("isconnected").toString()
|
||||
numPeers.text = ResponseObject.get("countpeerlist").toString()
|
||||
|
||||
// connectionLabel.text = response.toString()
|
||||
// Log.d("myTag", "Response is: ${response.substring(0, 500)}");
|
||||
},
|
||||
Response.ErrorListener { errorresponse ->
|
||||
val connectionLabel = findViewById<View>(R.id.PeernetInfo) as TextView
|
||||
connectionLabel.text = errorresponse.toString()
|
||||
//val connectionLabel = findViewById<View>(R.id.PeernetInfo) as TextView
|
||||
// connectionLabel.text = errorresponse.toString()
|
||||
Log.d("myTag", errorresponse.toString());
|
||||
})
|
||||
|
||||
queue.add(stringRequest1)
|
||||
|
||||
val url2 = "http://127.0.0.1:8881/blockchain/file/list"
|
||||
val url2 = "http://127.0.0.1:5125/blockchain/file/list"
|
||||
|
||||
val stringRequest2 = StringRequest(
|
||||
Request.Method.GET, url2,
|
||||
@@ -105,13 +126,13 @@ class MainActivity : AppCompatActivity() {
|
||||
// Display the first 500 characters of the response string.
|
||||
// textView.text = "Response is: ${response.substring(0, 500)}"
|
||||
//connectionLabel.text= "Response is: ${response.substring(0, 500)}"
|
||||
val connectionLabel = findViewById<View>(R.id.PeernetInfo2) as TextView
|
||||
connectionLabel.text = response.toString()
|
||||
// Log.d("myTag", "Response is: ${response.substring(0, 500)}");
|
||||
// val connectionLabel = findViewById<View>(R.id.PeernetInfo2) as TextView
|
||||
// connectionLabel.text = response.toString()
|
||||
// Log.d("myTag", "Response is: ${response.substring(0, 500)}");
|
||||
},
|
||||
Response.ErrorListener { errorresponse ->
|
||||
val connectionLabel = findViewById<View>(R.id.PeernetInfo2) as TextView
|
||||
connectionLabel.text = errorresponse.toString()
|
||||
// val connectionLabel = findViewById<View>(R.id.PeernetInfo2) as TextView
|
||||
// connectionLabel.text = errorresponse.toString()
|
||||
Log.d("myTag", errorresponse.toString());
|
||||
})
|
||||
|
||||
@@ -127,6 +148,8 @@ class MainActivity : AppCompatActivity() {
|
||||
.setAction(Intent.ACTION_GET_CONTENT)
|
||||
|
||||
startActivityForResult(Intent.createChooser(intent, "Select a file"), 777)
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Go to the search page
|
||||
@@ -188,11 +211,153 @@ class MainActivity : AppCompatActivity() {
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
super.onActivityResult(requestCode, resultCode, data)
|
||||
|
||||
val queue = Volley.newRequestQueue(this)
|
||||
|
||||
if (requestCode == 777) {
|
||||
val filePath = data?.data?.path
|
||||
var filePath = data?.data?.path
|
||||
|
||||
// data?.data
|
||||
|
||||
// imageFile = new File(getRealPathFromURI(selectedImageURI));
|
||||
|
||||
// filePath = File((data?.data?.let { getRealPathFromURI(it) })).toString()
|
||||
|
||||
// var file = File(
|
||||
// Environment.getExternalStorageDirectory().absolutePath,
|
||||
// filePath
|
||||
// )
|
||||
|
||||
// file.path
|
||||
//
|
||||
// Log.d("myTag", file.absolutePath)
|
||||
//
|
||||
//// val ResponseObjectSearch = JSONObject("{\"keyword\":" + file.readBytes());
|
||||
//
|
||||
// Log.d("myTag", java.net.URLEncoder.encode(filePath.toString(), "utf-8"));
|
||||
//
|
||||
// val UploadFilePOST = "http://127.0.0.1:8881/warehouse/create"
|
||||
//
|
||||
// val GetRequestWithFilePath = "http://127.0.0.1:8881/warehouse/create"
|
||||
|
||||
// val stringRequest2 = JsonObjectRequest(
|
||||
// Request.Method.POST, UploadFile,ResponseObjectSearch,
|
||||
// Response.Listener<JSONObject> { response ->
|
||||
// //val connectionLabel = findViewById<View>(R.id.PeernetInfo) as TextView
|
||||
// // Display the first 500 characters of the response string.
|
||||
// // textView.text = "Response is: ${response.substring(0, 500)}"
|
||||
// //connectionLabel.text= "Response is: ${response.substring(0, 500)}"
|
||||
// // val connectionLabel = findViewById<View>(R.id.PeernetInfo2) as TextView
|
||||
// //connectionLabel.text = response.toString()
|
||||
// Log.d("myTag", "Response is: ${response.toString()}");
|
||||
// },
|
||||
// Response.ErrorListener { errorresponse ->
|
||||
// // val connectionLabel = findViewById<View>(R.id.PeernetInfo2) as TextView
|
||||
// // connectionLabel.text = errorresponse.toString()
|
||||
// Log.d("myTag", errorresponse.toString());
|
||||
// })
|
||||
|
||||
val url2 = "http://127.0.0.1:5125/warehouse/create/path?path=" + java.net.URLEncoder.encode("/sdcard/Download/readingSmalltalk.pdf", "utf-8")
|
||||
|
||||
val stringRequest2 = StringRequest(
|
||||
Request.Method.GET, url2,
|
||||
Response.Listener<String> { response ->
|
||||
//val connectionLabel = findViewById<View>(R.id.PeernetInfo) as TextView
|
||||
// Display the first 500 characters of the response string.
|
||||
// textView.text = "Response is: ${response.substring(0, 500)}"
|
||||
//connectionLabel.text= "Response is: ${response.substring(0, 500)}"
|
||||
// val connectionLabel = findViewById<View>(R.id.PeernetInfo2) as TextView
|
||||
// connectionLabel.text = response.toString()
|
||||
Log.d("myTag", "Response is: ${response.toString()}");
|
||||
|
||||
// read hash from the json object and add to the blockchain
|
||||
val ResponseObject = JSONTokener(response.toString()).nextValue() as JSONObject
|
||||
|
||||
if (ResponseObject.get("status") == 0) {
|
||||
val urlAddBlockChain = "http://127.0.0.1:5125/blockchain/file/add"
|
||||
|
||||
val jsonobj = JSONObject()
|
||||
// Generate UUID
|
||||
jsonobj.put("id", UUID.randomUUID().toString())
|
||||
jsonobj.put("hash", ResponseObject.get("hash"))
|
||||
jsonobj.put("type", 5)
|
||||
jsonobj.put("format", 1)
|
||||
jsonobj.put("size", 2500)
|
||||
jsonobj.put("name", "readingSmalltalk.pdf")
|
||||
jsonobj.put("folder", "/sdcard/Download/")
|
||||
jsonobj.put("description", "I can C++ and Java But I can't read smalltalk")
|
||||
|
||||
val jsonArrayObj = JSONArray()
|
||||
|
||||
val JSONPostRequest = JSONObject()
|
||||
|
||||
jsonArrayObj.put(0,jsonobj)
|
||||
|
||||
JSONPostRequest.put("files",jsonArrayObj)
|
||||
|
||||
|
||||
|
||||
Log.d("myTag", JSONPostRequest.toString())
|
||||
|
||||
|
||||
|
||||
val stringRequest = JsonObjectRequest(
|
||||
Request.Method.POST,urlAddBlockChain,JSONPostRequest,
|
||||
Response.Listener { response ->
|
||||
//val connectionLabel = findViewById<View>(R.id.PeernetInfo) as TextView
|
||||
// Display the first 500 characters of the response string.
|
||||
// textView.text = "Response is: ${response.substring(0, 500)}"
|
||||
//connectionLabel.text= "Response is: ${response.substring(0, 500)}"
|
||||
// val connectionLabel1 = findViewById<View>(R.id.PeernetInfo1) as TextView
|
||||
// connectionLabel1.text = response.toString()
|
||||
Log.d("myTag1", "Response is: ${response}");
|
||||
|
||||
// val ResponseObject = JSONTokener(response.toString()).nextValue() as JSONObject
|
||||
|
||||
|
||||
|
||||
},
|
||||
Response.ErrorListener { errorresponse ->
|
||||
// val connectionLabel1 = findViewById<View>(R.id.PeernetInfo1) as TextView
|
||||
// connectionLabel1.text = errorresponse.toString()
|
||||
Log.d("myTag", errorresponse.toString());
|
||||
})
|
||||
|
||||
queue.add(stringRequest)
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
},
|
||||
Response.ErrorListener { errorresponse ->
|
||||
// val connectionLabel = findViewById<View>(R.id.PeernetInfo2) as TextView
|
||||
// connectionLabel.text = errorresponse.toString()
|
||||
Log.d("myTag", errorresponse.toString());
|
||||
})
|
||||
|
||||
queue.add(stringRequest2)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private fun getRealPathFromURI(contentURI: Uri): String? {
|
||||
val result: String
|
||||
val cursor: Cursor? = contentResolver.query(contentURI, null, null, null, null)
|
||||
if (cursor == null) { // Source is Dropbox or other similar local file path
|
||||
result = contentURI.getPath().toString()
|
||||
} else {
|
||||
cursor.moveToFirst()
|
||||
val idx: Int = cursor.getColumnIndex(MediaStore.Images.ImageColumns.DATA)
|
||||
result = cursor.getString(idx)
|
||||
cursor.close()
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
private fun requestAppPermissions() {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
|
||||
return
|
||||
|
||||
@@ -3,6 +3,9 @@ package com.peernet.test
|
||||
import android.content.Intent
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import android.os.Bundle
|
||||
import android.os.Environment
|
||||
import android.provider.MediaStore
|
||||
import android.telephony.mbms.DownloadRequest
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
import android.widget.*
|
||||
@@ -10,9 +13,7 @@ import com.android.volley.Request
|
||||
import com.android.volley.Response
|
||||
import com.android.volley.toolbox.StringRequest
|
||||
import com.android.volley.toolbox.Volley
|
||||
import com.android.volley.DefaultRetryPolicy
|
||||
import com.android.volley.toolbox.JsonObjectRequest
|
||||
import mobile.Mobile
|
||||
import org.json.JSONObject
|
||||
import org.json.JSONTokener
|
||||
|
||||
@@ -24,6 +25,9 @@ class Search : AppCompatActivity() {
|
||||
|
||||
// Go to the home page
|
||||
val Back = findViewById<Button>(R.id.Back)
|
||||
// Explore / search result varaibles
|
||||
var ResponseObjectSearch: JSONObject
|
||||
ResponseObjectSearch = JSONObject("{\"keyword\": null}");
|
||||
|
||||
// redirect back to the home page
|
||||
Back.setOnClickListener {
|
||||
@@ -33,11 +37,12 @@ class Search : AppCompatActivity() {
|
||||
|
||||
val queue = Volley.newRequestQueue(this)
|
||||
|
||||
|
||||
// Explore from golang
|
||||
// Mobile.searchResults()
|
||||
|
||||
// Default display explore
|
||||
val url = "http://127.0.0.1:8881/explore"
|
||||
val url = "http://127.0.0.1:5125/explore"
|
||||
|
||||
|
||||
|
||||
@@ -53,16 +58,16 @@ class Search : AppCompatActivity() {
|
||||
// connectionLabel1.text = response.toString()
|
||||
Log.d("myTag1", "Response is: ${response}");
|
||||
|
||||
val ResponseObject = JSONTokener(response.toString()).nextValue() as JSONObject
|
||||
ResponseObjectSearch = JSONTokener(response.toString()).nextValue() as JSONObject
|
||||
|
||||
val searchResult = findViewById<ListView>(R.id.SearchResult)
|
||||
|
||||
val listItems = arrayOfNulls<String>(ResponseObject.getJSONArray("files").length())
|
||||
val listItems = arrayOfNulls<String>(ResponseObjectSearch.getJSONArray("files").length())
|
||||
|
||||
for (i in 0 until ResponseObject.getJSONArray("files").length()) {
|
||||
val searchResultElement = ResponseObject.getJSONArray("files")[i]
|
||||
for (i in 0 until ResponseObjectSearch.getJSONArray("files").length()) {
|
||||
val searchResultElement = ResponseObjectSearch.getJSONArray("files")[i]
|
||||
|
||||
val ResponseObjectInLoop = JSONTokener(ResponseObject.getJSONArray("files")[i].toString()).nextValue() as JSONObject
|
||||
val ResponseObjectInLoop = JSONTokener(ResponseObjectSearch.getJSONArray("files")[i].toString()).nextValue() as JSONObject
|
||||
|
||||
listItems[i] = ResponseObjectInLoop.get("name").toString()
|
||||
}
|
||||
@@ -93,7 +98,7 @@ class Search : AppCompatActivity() {
|
||||
|
||||
|
||||
// Get search job UUID
|
||||
val url = "http://127.0.0.1:8881/search"
|
||||
val url = "http://127.0.0.1:5125/search"
|
||||
|
||||
// val params = HashMap<String,String>()
|
||||
// params["term"] = search
|
||||
@@ -133,7 +138,7 @@ class Search : AppCompatActivity() {
|
||||
val ResponseObject = JSONTokener(response.toString()).nextValue() as JSONObject
|
||||
|
||||
// request to get Job response
|
||||
val url1 = "http://127.0.0.1:8881/search/result?id=" + ResponseObject.get("id")
|
||||
val url1 = "http://127.0.0.1:5125/search/result?id=" + ResponseObject.get("id")
|
||||
|
||||
Log.d("myTag", url1);
|
||||
|
||||
@@ -148,16 +153,16 @@ class Search : AppCompatActivity() {
|
||||
// connectionLabel1.text = response.toString()
|
||||
Log.d("myTag1", "Response is: ${response}");
|
||||
|
||||
val ResponseObject = JSONTokener(response.toString()).nextValue() as JSONObject
|
||||
ResponseObjectSearch = JSONTokener(response.toString()).nextValue() as JSONObject
|
||||
|
||||
val searchResult = findViewById<ListView>(R.id.SearchResult)
|
||||
|
||||
val listItems = arrayOfNulls<String>(ResponseObject.getJSONArray("files").length())
|
||||
val listItems = arrayOfNulls<String>(ResponseObjectSearch.getJSONArray("files").length())
|
||||
|
||||
for (i in 0 until ResponseObject.getJSONArray("files").length()) {
|
||||
val searchResultElement = ResponseObject.getJSONArray("files")[i]
|
||||
for (i in 0 until ResponseObjectSearch.getJSONArray("files").length()) {
|
||||
val searchResultElement = ResponseObjectSearch.getJSONArray("files")[i]
|
||||
|
||||
val ResponseObjectInLoop = JSONTokener(ResponseObject.getJSONArray("files")[i].toString()).nextValue() as JSONObject
|
||||
val ResponseObjectInLoop = JSONTokener(ResponseObjectSearch.getJSONArray("files")[i].toString()).nextValue() as JSONObject
|
||||
|
||||
listItems[i] = ResponseObjectInLoop.get("name").toString()
|
||||
}
|
||||
@@ -184,9 +189,65 @@ class Search : AppCompatActivity() {
|
||||
|
||||
queue.add(stringRequest)
|
||||
|
||||
val searchResult = findViewById<ListView>(R.id.SearchResult)
|
||||
|
||||
// when a file is selected, Then start the download
|
||||
searchResult.onItemClickListener = AdapterView.OnItemClickListener {parent,view, position, id ->
|
||||
// Get the selected item text from ListView
|
||||
val selectedItem = parent.getItemAtPosition(position) as String
|
||||
Log.d("myTag", selectedItem);
|
||||
|
||||
// appropriate information to do a download of the file
|
||||
for (i in 0 until ResponseObjectSearch.getJSONArray("files").length()) {
|
||||
val searchResultElement = ResponseObjectSearch.getJSONArray("files")[i]
|
||||
|
||||
val FileName = JSONTokener(ResponseObjectSearch.getJSONArray("files")[i].toString()).nextValue() as JSONObject
|
||||
// If there is match. Get the appropriate information such as Node ID.
|
||||
if (FileName.get("name").toString() == selectedItem) {
|
||||
// File hash
|
||||
val FileHash = FileName.get("hash").toString()
|
||||
Log.d("myTag", FileHash)
|
||||
val NodeID = FileName.get("nodeid").toString()
|
||||
Log.d("myTag", NodeID)
|
||||
|
||||
// Get download path for the android phone
|
||||
val DownloadPath = "/data/local/tmp"
|
||||
|
||||
Log.d("myTag", DownloadPath.toString());
|
||||
|
||||
// Get request URL to download the file
|
||||
val DownloadURL = "http://127.0.0.1:5125/download/start?path=test.txt" + "&hash=" + FileHash + "&node=" + NodeID
|
||||
|
||||
val DownloadRequest = StringRequest(
|
||||
Request.Method.GET, DownloadURL,
|
||||
Response.Listener<String> { response ->
|
||||
//val connectionLabel = findViewById<View>(R.id.PeernetInfo) as TextView
|
||||
// Display the first 500 characters of the response string.
|
||||
// textView.text = "Response is: ${response.substring(0, 500)}"
|
||||
//connectionLabel.text= "Response is: ${response.substring(0, 500)}"
|
||||
// val connectionLabel = findViewById<View>(R.id.PeernetInfo) as TextView
|
||||
// connectionLabel.text = response.toString()
|
||||
Log.d("myTag", "Response is: ${response.substring(0, 500)}");
|
||||
},
|
||||
Response.ErrorListener { errorresponse ->
|
||||
// val connectionLabel = findViewById<View>(R.id.PeernetInfo) as TextView
|
||||
// connectionLabel.text = errorresponse.toString()
|
||||
Log.d("myTag", errorresponse.toString());
|
||||
})
|
||||
|
||||
queue.add(DownloadRequest)
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -7,50 +7,40 @@
|
||||
tools:context=".MainActivity">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/PeernetInfo"
|
||||
android:layout_width="192dp"
|
||||
android:layout_height="244dp"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:text="Hello World!"
|
||||
android:id="@+id/PeerID"
|
||||
android:layout_width="184dp"
|
||||
android:layout_height="35dp"
|
||||
android:text="Peer ID"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/PeernetInfo1"
|
||||
app:layout_constraintHorizontal_bias="0.082"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.026"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.324" />
|
||||
app:layout_constraintVertical_bias="0.415" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/PeernetInfo1"
|
||||
android:layout_width="217dp"
|
||||
android:layout_height="245dp"
|
||||
android:text="Hello World!"
|
||||
android:id="@+id/NodeID"
|
||||
android:layout_width="184dp"
|
||||
android:layout_height="35dp"
|
||||
android:text="Node ID"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintHorizontal_bias="1.0"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.026"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.325" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/PeernetInfo2"
|
||||
android:layout_width="217dp"
|
||||
android:layout_height="245dp"
|
||||
android:text="Hello World!"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.845" />
|
||||
app:layout_constraintVertical_bias="0.659" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/AddFIle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_width="129dp"
|
||||
android:layout_height="66dp"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:text="Add file "
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.606"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<ImageView
|
||||
@@ -65,14 +55,104 @@
|
||||
|
||||
<Button
|
||||
android:id="@+id/SearchHomeButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="136dp"
|
||||
android:layout_height="63dp"
|
||||
android:text="Search"
|
||||
android:textColorHighlight="#272727"
|
||||
android:textColorLink="#1E1D1D"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.11"
|
||||
app:layout_constraintHorizontal_bias="0.061"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.976" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/Description"
|
||||
android:layout_width="186dp"
|
||||
android:layout_height="32dp"
|
||||
android:text="Beat that IPFS !"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.568"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.193" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/IsConnected"
|
||||
android:layout_width="184dp"
|
||||
android:layout_height="35dp"
|
||||
android:text="Is Connected"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.026"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.27" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/NoPeers"
|
||||
android:layout_width="184dp"
|
||||
android:layout_height="35dp"
|
||||
android:text="Number of peers "
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.026"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.341" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/isConnectedField"
|
||||
android:layout_width="184dp"
|
||||
android:layout_height="35dp"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.876"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.27" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/PeerListField"
|
||||
android:layout_width="184dp"
|
||||
android:layout_height="35dp"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.876"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.34" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/PeerIDFIeld"
|
||||
android:layout_width="184dp"
|
||||
android:layout_height="147dp"
|
||||
android:textColorLink="#131313"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.876"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.494" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/NodeIDFIeld"
|
||||
android:layout_width="184dp"
|
||||
android:layout_height="178dp"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.876"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.83" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -11,23 +11,24 @@
|
||||
android:id="@+id/SearchField"
|
||||
android:layout_width="333dp"
|
||||
android:layout_height="49dp"
|
||||
android:layout_marginTop="84dp"
|
||||
android:ems="10"
|
||||
android:inputType="textPersonName"
|
||||
android:text="Search"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.095" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/Search"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="Search"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/SearchResult"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/SearchField" />
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.174" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/Back"
|
||||
@@ -42,8 +43,8 @@
|
||||
|
||||
<ListView
|
||||
android:id="@+id/SearchResult"
|
||||
android:layout_width="409dp"
|
||||
android:layout_height="527dp"
|
||||
android:layout_width="412dp"
|
||||
android:layout_height="564dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
|
||||
@@ -7,4 +7,5 @@
|
||||
<color name="teal_700">#FF018786</color>
|
||||
<color name="black">#FF000000</color>
|
||||
<color name="white">#FFFFFFFF</color>
|
||||
<color name="peernet">#3ac4e2</color>
|
||||
</resources>
|
||||
@@ -2,12 +2,12 @@
|
||||
<!-- Base application theme. -->
|
||||
<style name="Theme.Test" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
||||
<!-- Primary brand color. -->
|
||||
<item name="colorPrimary">@color/purple_500</item>
|
||||
<item name="colorPrimaryVariant">@color/purple_700</item>
|
||||
<item name="colorPrimary">@color/peernet</item>
|
||||
<item name="colorPrimaryVariant">@color/peernet</item>
|
||||
<item name="colorOnPrimary">@color/white</item>
|
||||
<!-- Secondary brand color. -->
|
||||
<item name="colorSecondary">@color/teal_200</item>
|
||||
<item name="colorSecondaryVariant">@color/teal_700</item>
|
||||
<item name="colorSecondary">@color/peernet</item>
|
||||
<item name="colorSecondaryVariant">@color/peernet</item>
|
||||
<item name="colorOnSecondary">@color/black</item>
|
||||
<!-- Status bar color. -->
|
||||
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
|
||||
|
||||
Reference in New Issue
Block a user