File tree Expand file tree Collapse file tree 3 files changed +11
-2
lines changed
java/com/example/chatfull Expand file tree Collapse file tree 3 files changed +11
-2
lines changed Original file line number Diff line number Diff line change 1
1
package com .example .chatfull ;
2
2
3
3
import android .content .Intent ;
4
+ import android .graphics .Bitmap ;
4
5
import android .os .Bundle ;
5
6
import android .util .Log ;
7
+ import android .widget .ImageView ;
6
8
import android .widget .TextView ;
7
9
8
10
import androidx .appcompat .app .AppCompatActivity ;
9
11
12
+ import net .glxn .qrgen .android .QRCode ;
13
+
10
14
import java .net .InetAddress ;
11
15
import java .net .NetworkInterface ;
12
16
import java .net .SocketException ;
@@ -35,6 +39,10 @@ protected void onCreate(Bundle savedInstanceState) {
35
39
String ip_address = getSelfIpAddress ();
36
40
ipView .setText (ip_address );
37
41
portView .setText (Integer .toString (selfPort ));
42
+
43
+ Bitmap myBitmap = QRCode .from (ip_address +":" +selfPort ).bitmap ();
44
+ ImageView myImage = (ImageView ) findViewById (R .id .qr_view );
45
+ myImage .setImageBitmap (myBitmap );
38
46
}
39
47
40
48
@ Override
Original file line number Diff line number Diff line change 80
80
app : layout_constraintBottom_toBottomOf =" parent"
81
81
app : layout_constraintEnd_toEndOf =" parent"
82
82
app : layout_constraintStart_toStartOf =" parent"
83
- app : layout_constraintTop_toBottomOf =" @+id/linearLayout3" />
83
+ app : layout_constraintTop_toBottomOf =" @+id/linearLayout3"
84
+ android : id =" @+id/qr_view" />
84
85
85
86
86
87
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ android {
18
18
buildTypes {
19
19
release {
20
20
minifyEnabled false
21
- proguardFiles getDefaultProguardFile(' proguard-android.txt' ), ' proguard-rules.pro'
21
+ proguardFiles getDefaultProguardFile(' proguard-android-optimize .txt' ), ' proguard-rules.pro'
22
22
}
23
23
}
24
24
You can’t perform that action at this time.
0 commit comments