Skip to content

Commit

Permalink
Merge pull request #605 from ooni/issues/1709/info-activity
Browse files Browse the repository at this point in the history
Chore: Update `InfoActivity` to `ViewBinding`
  • Loading branch information
aanorbel authored Sep 11, 2023
2 parents e2e127e + bd25e4f commit fe7c897
Showing 1 changed file with 14 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,44 +3,40 @@
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.widget.TextView;

import androidx.annotation.Nullable;
import androidx.appcompat.widget.Toolbar;

import org.openobservatory.ooniprobe.BuildConfig;
import org.openobservatory.ooniprobe.R;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import org.openobservatory.ooniprobe.databinding.ActivityInfoBinding;

public class InfoActivity extends AbstractActivity {
@BindView(R.id.toolbar) Toolbar toolbar;
@BindView(R.id.version) TextView version;

@Override protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_info);
ButterKnife.bind(this);
setSupportActionBar(toolbar);
ActivityInfoBinding binding = ActivityInfoBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());
setSupportActionBar(binding.toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
version.setText(getString(R.string.version, BuildConfig.SOFTWARE_NAME, BuildConfig.VERSION_NAME));
binding.version.setText(getString(R.string.version, BuildConfig.SOFTWARE_NAME, BuildConfig.VERSION_NAME));

binding.blog.setOnClickListener(v -> onBlogClick());
binding.reports.setOnClickListener(v -> onReportsClick());
binding.learnMore.setOnClickListener(v -> onLearnMoreClick());
binding.dataPolicy.setOnClickListener(v -> onDataPolicyClick());
}

@OnClick(R.id.blog) void onBlogClick() {
void onBlogClick() {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://ooni.org/blog/")));
}

@OnClick(R.id.reports) void onReportsClick() {
void onReportsClick() {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://ooni.org/reports/")));
}

@OnClick(R.id.learnMore) void onLearnMoreClick() {
void onLearnMoreClick() {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://ooni.org/")));
}

@OnClick(R.id.dataPolicy) void onDataPolicyClick() {
void onDataPolicyClick() {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://ooni.org/about/data-policy/")));
}
}

0 comments on commit fe7c897

Please sign in to comment.