1
1
package io .spaceapi .community .myhackerspace ;
2
2
3
- import static android .view .ViewGroup .LayoutParams .MATCH_PARENT ;
4
- import static android .view .ViewGroup .LayoutParams .WRAP_CONTENT ;
5
-
6
- import android .Manifest ;
7
3
import android .content .Context ;
8
- import android .content .Intent ;
9
- import android .net .Uri ;
10
4
import android .util .AttributeSet ;
11
5
import android .view .LayoutInflater ;
12
- import android .view .View ;
13
- import android .view .ViewGroup ;
14
- import android .widget .Button ;
15
6
import android .widget .LinearLayout ;
16
7
import android .widget .TextView ;
17
8
@@ -36,38 +27,14 @@ public AboutLayout(Context context, AttributeSet attrs, int defStyleAttr, int de
36
27
}
37
28
38
29
public void init () {
39
- Button openRepoButton = findViewById (R .id .about_open_repo_button );
40
- openRepoButton .setOnClickListener (new OnClickListener () {
41
- @ Override
42
- public void onClick (View v ) {
43
- TextView repository = (TextView )findViewById (R .id .about_repository );
44
- String url = (String ) repository .getText ();
45
- openWebPage (url );
46
- }
47
- });
48
30
TextView version = findViewById (R .id .about_version_text );
49
31
version .setText (BuildConfig .VERSION_NAME + " (" + Integer .toString (BuildConfig .VERSION_CODE ) + ")" );
50
32
}
51
33
52
34
public static AboutLayout create (Context context ) {
53
- // use xml layout, see https://stackoverflow.com/a/13889257
54
35
LayoutInflater layoutInflater = LayoutInflater .from (context );
55
36
AboutLayout about = (AboutLayout ) layoutInflater .inflate (R .layout .about , null , false );
56
37
about .init ();
57
38
return about ;
58
39
}
59
-
60
- public void openWebPage (String url ) {
61
- // from https://stackoverflow.com/a/43981160
62
- Uri webpage = Uri .parse (url );
63
-
64
- Intent intent = new Intent (Intent .ACTION_VIEW , webpage );
65
-
66
- if (intent .resolveActivity (getContext ().getPackageManager ()) != null ) {
67
- getContext ().startActivity (intent );
68
- }else {
69
- //Page not found
70
- }
71
- }
72
-
73
40
}
0 commit comments