From 04d1250527f2adfdfb2a51c308998b7c346e0f76 Mon Sep 17 00:00:00 2001 From: =Aniket Dalal <=aniketdalal126@gmail.com> Date: Fri, 5 Nov 2021 14:53:23 +0530 Subject: [PATCH 1/3] contributors name added to about page --- README.md | 1 - app/build.gradle | 3 + .../activity/about/AboutActivity.java | 83 ++++++ .../watomatic/activity/about/AboutActivity.kt | 36 --- .../GithubUsersResponse.java | 279 ++++++++++++++++++ .../network/GetGitUserInterface.java | 14 + app/src/main/res/layout/activity_about.xml | 187 +++++++----- app/src/main/res/values/strings.xml | 1 + 8 files changed, 487 insertions(+), 117 deletions(-) create mode 100644 app/src/main/java/com/parishod/watomatic/activity/about/AboutActivity.java delete mode 100644 app/src/main/java/com/parishod/watomatic/activity/about/AboutActivity.kt create mode 100644 app/src/main/java/com/parishod/watomatic/model/githubUesrsResponse/GithubUsersResponse.java create mode 100644 app/src/main/java/com/parishod/watomatic/network/GetGitUserInterface.java diff --git a/README.md b/README.md index 9cff8a567..b89fadc48 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,4 @@ # Watomatic - Auto reply for WhatsApp so you can stop using it - Watomatic sends an automated reply to everyone contacting you on WhatsApp. This is especially useful if you are planning to migrate away from WhatsApp but can also be used as a vacation responder. Get it on Google Play diff --git a/app/build.gradle b/app/build.gradle index d018d27c9..ff6cb0576 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -88,6 +88,9 @@ dependencies { implementation "com.squareup.okhttp3:logging-interceptor:4.7.2" implementation 'com.github.transferwise:sequence-layout:1.1.1' implementation "androidx.browser:browser:1.3.0" + + // https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind + implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.0.1' } repositories { mavenCentral() diff --git a/app/src/main/java/com/parishod/watomatic/activity/about/AboutActivity.java b/app/src/main/java/com/parishod/watomatic/activity/about/AboutActivity.java new file mode 100644 index 000000000..b55a588f9 --- /dev/null +++ b/app/src/main/java/com/parishod/watomatic/activity/about/AboutActivity.java @@ -0,0 +1,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> call = getGitUserInterface.getContriUsers(); + call.enqueue(new Callback>() { + @Override + public void onResponse(Call> call, Response> response) { + if (response.isSuccessful()) { + List list = response.body(); + for (GithubUsersResponse i : list) { + all_contributers += i.getLogin() + ", "; + } + text_view.setText(all_contributers); + } + } + + @Override + public void onFailure(Call> 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); + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/parishod/watomatic/activity/about/AboutActivity.kt b/app/src/main/java/com/parishod/watomatic/activity/about/AboutActivity.kt deleted file mode 100644 index f69da9a77..000000000 --- a/app/src/main/java/com/parishod/watomatic/activity/about/AboutActivity.kt +++ /dev/null @@ -1,36 +0,0 @@ -package com.parishod.watomatic.activity.about - -import android.content.Intent -import android.net.Uri -import android.os.Bundle -import androidx.lifecycle.ViewModelProvider -import com.parishod.watomatic.BuildConfig -import com.parishod.watomatic.R -import com.parishod.watomatic.activity.BaseActivity -import com.parishod.watomatic.databinding.ActivityAboutBinding -import com.parishod.watomatic.viewmodel.SwipeToKillAppDetectViewModel - -class AboutActivity : BaseActivity() { - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - val binding = ActivityAboutBinding.inflate(layoutInflater) - setContentView(binding.root) - - title = getString(R.string.about) - - ViewModelProvider(this).get(SwipeToKillAppDetectViewModel::class.java) - - binding.appVersion.text = String.format(resources.getString(R.string.app_version), BuildConfig.VERSION_NAME) - binding.privacyPolicyCardView.setOnClickListener { - val url = getString(R.string.url_privacy_policy) - val i = Intent(Intent.ACTION_VIEW).setData(Uri.parse(url)) - startActivity(i) - } - binding.developerLink.setOnClickListener { - val url = getString(R.string.url_adeekshith_twitter) - val i = Intent(Intent.ACTION_VIEW) - i.data = Uri.parse(url) - startActivity(i) - } - } -} \ No newline at end of file diff --git a/app/src/main/java/com/parishod/watomatic/model/githubUesrsResponse/GithubUsersResponse.java b/app/src/main/java/com/parishod/watomatic/model/githubUesrsResponse/GithubUsersResponse.java new file mode 100644 index 000000000..7362ca3e1 --- /dev/null +++ b/app/src/main/java/com/parishod/watomatic/model/githubUesrsResponse/GithubUsersResponse.java @@ -0,0 +1,279 @@ +package com.parishod.watomatic.model.githubUesrsResponse; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ + "login", + "id", + "node_id", + "avatar_url", + "gravatar_id", + "url", + "html_url", + "followers_url", + "following_url", + "gists_url", + "starred_url", + "subscriptions_url", + "organizations_url", + "repos_url", + "events_url", + "received_events_url", + "type", + "site_admin", + "contributions" +}) + +public class GithubUsersResponse { + + @JsonProperty("login") + private String login; + @JsonProperty("id") + private Integer id; + @JsonProperty("node_id") + private String nodeId; + @JsonProperty("avatar_url") + private String avatarUrl; + @JsonProperty("gravatar_id") + private String gravatarId; + @JsonProperty("url") + private String url; + @JsonProperty("html_url") + private String htmlUrl; + @JsonProperty("followers_url") + private String followersUrl; + @JsonProperty("following_url") + private String followingUrl; + @JsonProperty("gists_url") + private String gistsUrl; + @JsonProperty("starred_url") + private String starredUrl; + @JsonProperty("subscriptions_url") + private String subscriptionsUrl; + @JsonProperty("organizations_url") + private String organizationsUrl; + @JsonProperty("repos_url") + private String reposUrl; + @JsonProperty("events_url") + private String eventsUrl; + @JsonProperty("received_events_url") + private String receivedEventsUrl; + @JsonProperty("type") + private String type; + @JsonProperty("site_admin") + private Boolean siteAdmin; + @JsonProperty("contributions") + private Integer contributions; + @JsonIgnore + private Map additionalProperties = new HashMap(); + + @JsonProperty("login") + public String getLogin() { + return login; + } + + @JsonProperty("login") + public void setLogin(String login) { + this.login = login; + } + + @JsonProperty("id") + public Integer getId() { + return id; + } + + @JsonProperty("id") + public void setId(Integer id) { + this.id = id; + } + + @JsonProperty("node_id") + public String getNodeId() { + return nodeId; + } + + @JsonProperty("node_id") + public void setNodeId(String nodeId) { + this.nodeId = nodeId; + } + + @JsonProperty("avatar_url") + public String getAvatarUrl() { + return avatarUrl; + } + + @JsonProperty("avatar_url") + public void setAvatarUrl(String avatarUrl) { + this.avatarUrl = avatarUrl; + } + + @JsonProperty("gravatar_id") + public String getGravatarId() { + return gravatarId; + } + + @JsonProperty("gravatar_id") + public void setGravatarId(String gravatarId) { + this.gravatarId = gravatarId; + } + + @JsonProperty("url") + public String getUrl() { + return url; + } + + @JsonProperty("url") + public void setUrl(String url) { + this.url = url; + } + + @JsonProperty("html_url") + public String getHtmlUrl() { + return htmlUrl; + } + + @JsonProperty("html_url") + public void setHtmlUrl(String htmlUrl) { + this.htmlUrl = htmlUrl; + } + + @JsonProperty("followers_url") + public String getFollowersUrl() { + return followersUrl; + } + + @JsonProperty("followers_url") + public void setFollowersUrl(String followersUrl) { + this.followersUrl = followersUrl; + } + + @JsonProperty("following_url") + public String getFollowingUrl() { + return followingUrl; + } + + @JsonProperty("following_url") + public void setFollowingUrl(String followingUrl) { + this.followingUrl = followingUrl; + } + + @JsonProperty("gists_url") + public String getGistsUrl() { + return gistsUrl; + } + + @JsonProperty("gists_url") + public void setGistsUrl(String gistsUrl) { + this.gistsUrl = gistsUrl; + } + + @JsonProperty("starred_url") + public String getStarredUrl() { + return starredUrl; + } + + @JsonProperty("starred_url") + public void setStarredUrl(String starredUrl) { + this.starredUrl = starredUrl; + } + + @JsonProperty("subscriptions_url") + public String getSubscriptionsUrl() { + return subscriptionsUrl; + } + + @JsonProperty("subscriptions_url") + public void setSubscriptionsUrl(String subscriptionsUrl) { + this.subscriptionsUrl = subscriptionsUrl; + } + + @JsonProperty("organizations_url") + public String getOrganizationsUrl() { + return organizationsUrl; + } + + @JsonProperty("organizations_url") + public void setOrganizationsUrl(String organizationsUrl) { + this.organizationsUrl = organizationsUrl; + } + + @JsonProperty("repos_url") + public String getReposUrl() { + return reposUrl; + } + + @JsonProperty("repos_url") + public void setReposUrl(String reposUrl) { + this.reposUrl = reposUrl; + } + + @JsonProperty("events_url") + public String getEventsUrl() { + return eventsUrl; + } + + @JsonProperty("events_url") + public void setEventsUrl(String eventsUrl) { + this.eventsUrl = eventsUrl; + } + + @JsonProperty("received_events_url") + public String getReceivedEventsUrl() { + return receivedEventsUrl; + } + + @JsonProperty("received_events_url") + public void setReceivedEventsUrl(String receivedEventsUrl) { + this.receivedEventsUrl = receivedEventsUrl; + } + + @JsonProperty("type") + public String getType() { + return type; + } + + @JsonProperty("type") + public void setType(String type) { + this.type = type; + } + + @JsonProperty("site_admin") + public Boolean getSiteAdmin() { + return siteAdmin; + } + + @JsonProperty("site_admin") + public void setSiteAdmin(Boolean siteAdmin) { + this.siteAdmin = siteAdmin; + } + + @JsonProperty("contributions") + public Integer getContributions() { + return contributions; + } + + @JsonProperty("contributions") + public void setContributions(Integer contributions) { + this.contributions = contributions; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/parishod/watomatic/network/GetGitUserInterface.java b/app/src/main/java/com/parishod/watomatic/network/GetGitUserInterface.java new file mode 100644 index 000000000..68341f782 --- /dev/null +++ b/app/src/main/java/com/parishod/watomatic/network/GetGitUserInterface.java @@ -0,0 +1,14 @@ +package com.parishod.watomatic.network; + +import com.parishod.watomatic.model.githubUesrsResponse.GithubUsersResponse; + +import java.util.List; + +import retrofit2.Call; +import retrofit2.http.GET; + +public interface GetGitUserInterface { + @GET("/repos/adeekshith/watomatic/contributors") + Call> getContriUsers(); + +} diff --git a/app/src/main/res/layout/activity_about.xml b/app/src/main/res/layout/activity_about.xml index b276484c7..fd932b7b8 100644 --- a/app/src/main/res/layout/activity_about.xml +++ b/app/src/main/res/layout/activity_about.xml @@ -5,103 +5,130 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:fillViewport="true"> - - - + tools:context=".activity.about.AboutActivity"> - + + - + android:layout_height="match_parent"> - + + + + + + + + + + - - - - - + android:text="@string/privacy_policy_label" + android:textSize="18sp" + app:drawableStartCompat="@drawable/ic_baseline_privacy_tip_24" /> + - + android:layout_marginLeft="20dp" + android:gravity="left" + android:text="Contributors" + android:textColor="@color/black" + android:textSize="20dp" + app:layout_constraintBottom_toTopOf="@+id/contributers" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/privacyPolicyCardView" /> - + + + - + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 97f246f0e..b3803acd8 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -3,6 +3,7 @@ https://adeekshith.github.io/watomatic/#/privacy-policy.md \@adeekshith https://twitter.com/adeekshith + contributers will appear here About Settings From e26adedd50c2e9abaaa59235443dca4b731ba36b Mon Sep 17 00:00:00 2001 From: =Aniket Dalal <=aniketdalal126@gmail.com> Date: Fri, 12 Nov 2021 12:46:08 +0530 Subject: [PATCH 2/3] removed jackson --- app/build.gradle | 2 - .../GithubUsersResponse.java | 98 ++----------------- 2 files changed, 10 insertions(+), 90 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index ff6cb0576..a327269ba 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -89,8 +89,6 @@ dependencies { implementation 'com.github.transferwise:sequence-layout:1.1.1' implementation "androidx.browser:browser:1.3.0" - // https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind - implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.0.1' } repositories { mavenCentral() diff --git a/app/src/main/java/com/parishod/watomatic/model/githubUesrsResponse/GithubUsersResponse.java b/app/src/main/java/com/parishod/watomatic/model/githubUesrsResponse/GithubUsersResponse.java index 7362ca3e1..20930fb01 100644 --- a/app/src/main/java/com/parishod/watomatic/model/githubUesrsResponse/GithubUsersResponse.java +++ b/app/src/main/java/com/parishod/watomatic/model/githubUesrsResponse/GithubUsersResponse.java @@ -1,277 +1,199 @@ package com.parishod.watomatic.model.githubUesrsResponse; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; + import java.util.HashMap; import java.util.Map; -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ - "login", - "id", - "node_id", - "avatar_url", - "gravatar_id", - "url", - "html_url", - "followers_url", - "following_url", - "gists_url", - "starred_url", - "subscriptions_url", - "organizations_url", - "repos_url", - "events_url", - "received_events_url", - "type", - "site_admin", - "contributions" -}) public class GithubUsersResponse { - @JsonProperty("login") private String login; - @JsonProperty("id") private Integer id; - @JsonProperty("node_id") private String nodeId; - @JsonProperty("avatar_url") private String avatarUrl; - @JsonProperty("gravatar_id") private String gravatarId; - @JsonProperty("url") private String url; - @JsonProperty("html_url") private String htmlUrl; - @JsonProperty("followers_url") private String followersUrl; - @JsonProperty("following_url") private String followingUrl; - @JsonProperty("gists_url") private String gistsUrl; - @JsonProperty("starred_url") private String starredUrl; - @JsonProperty("subscriptions_url") + private String subscriptionsUrl; - @JsonProperty("organizations_url") + private String organizationsUrl; - @JsonProperty("repos_url") + private String reposUrl; - @JsonProperty("events_url") + private String eventsUrl; - @JsonProperty("received_events_url") + private String receivedEventsUrl; - @JsonProperty("type") + private String type; - @JsonProperty("site_admin") + private Boolean siteAdmin; - @JsonProperty("contributions") + private Integer contributions; - @JsonIgnore + private Map additionalProperties = new HashMap(); - @JsonProperty("login") public String getLogin() { return login; } - @JsonProperty("login") public void setLogin(String login) { this.login = login; } - @JsonProperty("id") public Integer getId() { return id; } - @JsonProperty("id") public void setId(Integer id) { this.id = id; } - @JsonProperty("node_id") public String getNodeId() { return nodeId; } - @JsonProperty("node_id") public void setNodeId(String nodeId) { this.nodeId = nodeId; } - @JsonProperty("avatar_url") public String getAvatarUrl() { return avatarUrl; } - @JsonProperty("avatar_url") public void setAvatarUrl(String avatarUrl) { this.avatarUrl = avatarUrl; } - @JsonProperty("gravatar_id") public String getGravatarId() { return gravatarId; } - @JsonProperty("gravatar_id") public void setGravatarId(String gravatarId) { this.gravatarId = gravatarId; } - @JsonProperty("url") public String getUrl() { return url; } - @JsonProperty("url") public void setUrl(String url) { this.url = url; } - @JsonProperty("html_url") public String getHtmlUrl() { return htmlUrl; } - @JsonProperty("html_url") public void setHtmlUrl(String htmlUrl) { this.htmlUrl = htmlUrl; } - @JsonProperty("followers_url") public String getFollowersUrl() { return followersUrl; } - @JsonProperty("followers_url") public void setFollowersUrl(String followersUrl) { this.followersUrl = followersUrl; } - @JsonProperty("following_url") public String getFollowingUrl() { return followingUrl; } - @JsonProperty("following_url") public void setFollowingUrl(String followingUrl) { this.followingUrl = followingUrl; } - @JsonProperty("gists_url") public String getGistsUrl() { return gistsUrl; } - @JsonProperty("gists_url") public void setGistsUrl(String gistsUrl) { this.gistsUrl = gistsUrl; } - @JsonProperty("starred_url") public String getStarredUrl() { return starredUrl; } - @JsonProperty("starred_url") public void setStarredUrl(String starredUrl) { this.starredUrl = starredUrl; } - @JsonProperty("subscriptions_url") public String getSubscriptionsUrl() { return subscriptionsUrl; } - @JsonProperty("subscriptions_url") public void setSubscriptionsUrl(String subscriptionsUrl) { this.subscriptionsUrl = subscriptionsUrl; } - @JsonProperty("organizations_url") public String getOrganizationsUrl() { return organizationsUrl; } - @JsonProperty("organizations_url") public void setOrganizationsUrl(String organizationsUrl) { this.organizationsUrl = organizationsUrl; } - @JsonProperty("repos_url") public String getReposUrl() { return reposUrl; } - @JsonProperty("repos_url") public void setReposUrl(String reposUrl) { this.reposUrl = reposUrl; } - @JsonProperty("events_url") public String getEventsUrl() { return eventsUrl; } - @JsonProperty("events_url") public void setEventsUrl(String eventsUrl) { this.eventsUrl = eventsUrl; } - @JsonProperty("received_events_url") public String getReceivedEventsUrl() { return receivedEventsUrl; } - @JsonProperty("received_events_url") public void setReceivedEventsUrl(String receivedEventsUrl) { this.receivedEventsUrl = receivedEventsUrl; } - @JsonProperty("type") public String getType() { return type; } - @JsonProperty("type") public void setType(String type) { this.type = type; } - @JsonProperty("site_admin") public Boolean getSiteAdmin() { return siteAdmin; } - @JsonProperty("site_admin") public void setSiteAdmin(Boolean siteAdmin) { this.siteAdmin = siteAdmin; } - @JsonProperty("contributions") public Integer getContributions() { return contributions; } - @JsonProperty("contributions") public void setContributions(Integer contributions) { this.contributions = contributions; } - @JsonAnyGetter public Map getAdditionalProperties() { return this.additionalProperties; } - @JsonAnySetter public void setAdditionalProperty(String name, Object value) { this.additionalProperties.put(name, value); } From bef3c328c93e05873ad0fd13737377cb7f5b562a Mon Sep 17 00:00:00 2001 From: =Aniket Dalal <=aniketdalal126@gmail.com> Date: Tue, 23 Nov 2021 17:02:07 +0530 Subject: [PATCH 3/3] place_holder removed --- app/src/main/res/layout/activity_about.xml | 1 - app/src/main/res/values/strings.xml | 2 -- 2 files changed, 3 deletions(-) diff --git a/app/src/main/res/layout/activity_about.xml b/app/src/main/res/layout/activity_about.xml index fd932b7b8..ea7219ce6 100644 --- a/app/src/main/res/layout/activity_about.xml +++ b/app/src/main/res/layout/activity_about.xml @@ -111,7 +111,6 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="50dp" - android:text="@string/contributers_will_appear_here" android:textColor="@color/black" android:textSize="20dp" app:layout_constraintBottom_toTopOf="@+id/developerLink" diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index b3803acd8..362a9918f 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -3,8 +3,6 @@ https://adeekshith.github.io/watomatic/#/privacy-policy.md \@adeekshith https://twitter.com/adeekshith - contributers will appear here - About Settings Privacy Policy