Skip to content

Commit

Permalink
Update InfoActivity to ViewBinding
Browse files Browse the repository at this point in the history
  • Loading branch information
aanorbel committed Aug 26, 2023
1 parent 9f033e7 commit bd25e4f
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 bd25e4f

Please sign in to comment.