-
-
Notifications
You must be signed in to change notification settings - Fork 106
Expand file tree
/
Copy pathAboutActivity.java
More file actions
83 lines (67 loc) · 2.86 KB
/
AboutActivity.java
File metadata and controls
83 lines (67 loc) · 2.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
package com.parishod.watomatic.activity.about;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import com.parishod.watomatic.R;
import com.parishod.watomatic.model.githubUesrsResponse.GithubUsersResponse;
import com.parishod.watomatic.network.GetGitUserInterface;
import com.parishod.watomatic.network.RetrofitInstance;
import java.util.List;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import retrofit2.Retrofit;
public class AboutActivity extends AppCompatActivity implements View.OnClickListener {
private TextView text_view;
private String all_contributers = "";
private TextView privacy_policy;
private TextView developer_link;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_about);
text_view = findViewById(R.id.contributers);
privacy_policy = findViewById(R.id.privacyPolicyLabel);
developer_link = findViewById(R.id.developerLink);
privacy_policy.setOnClickListener(this);
developer_link.setOnClickListener(this);
Retrofit retrofit = RetrofitInstance.getRetrofitInstance();
GetGitUserInterface getGitUserInterface = retrofit.create(GetGitUserInterface.class);
Call<List<GithubUsersResponse>> call = getGitUserInterface.getContriUsers();
call.enqueue(new Callback<List<GithubUsersResponse>>() {
@Override
public void onResponse(Call<List<GithubUsersResponse>> call, Response<List<GithubUsersResponse>> response) {
if (response.isSuccessful()) {
List<GithubUsersResponse> list = response.body();
for (GithubUsersResponse i : list) {
all_contributers += i.getLogin() + ", ";
}
text_view.setText(all_contributers);
}
}
@Override
public void onFailure(Call<List<GithubUsersResponse>> call, Throwable t) {
Toast.makeText(getApplicationContext(), t.getMessage(), Toast.LENGTH_SHORT).show();
}
});
}
@Override
public void onClick(View view) {
if (view.getId() == R.id.privacyPolicyLabel) {
String url = "https://adeekshith.github.io/watomatic/#/privacy-policy.md";
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);
}
if (view.getId() == R.id.developerLink) {
String url = "https://twitter.com/adeekshith";
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);
}
}
}