convert License activity to kotlin
This commit is contained in:
parent
59b0208422
commit
80bd5bbadf
|
@ -1,41 +0,0 @@
|
|||
package com.simplemobiletools.calendar.activities;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.simplemobiletools.calendar.R;
|
||||
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.OnClick;
|
||||
|
||||
public class LicenseActivity extends SimpleActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_license);
|
||||
ButterKnife.bind(this);
|
||||
}
|
||||
|
||||
@OnClick(R.id.license_butterknife_title)
|
||||
public void butterKnifeClicked() {
|
||||
openUrl(R.string.butterknife_url);
|
||||
}
|
||||
|
||||
@OnClick(R.id.license_ambilwarna_title)
|
||||
public void ambilwarnaClicked() {
|
||||
openUrl(R.string.ambilwarna_url);
|
||||
}
|
||||
|
||||
@OnClick(R.id.license_joda_title)
|
||||
public void jodaClicked() {
|
||||
openUrl(R.string.joda_url);
|
||||
}
|
||||
|
||||
private void openUrl(int id) {
|
||||
final String url = getResources().getString(id);
|
||||
final Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
||||
startActivity(browserIntent);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package com.simplemobiletools.calendar.activities
|
||||
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import com.simplemobiletools.calendar.R
|
||||
import kotlinx.android.synthetic.main.activity_license.*
|
||||
|
||||
class LicenseActivity : SimpleActivity() {
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_license)
|
||||
|
||||
license_butterknife_title.setOnClickListener { openUrl(R.string.butterknife_url) }
|
||||
license_ambilwarna_title.setOnClickListener { openUrl(R.string.ambilwarna_url) }
|
||||
license_joda_title.setOnClickListener { openUrl(R.string.joda_url) }
|
||||
}
|
||||
|
||||
private fun openUrl(id: Int) {
|
||||
val url = resources.getString(id)
|
||||
val browserIntent = Intent(Intent.ACTION_VIEW, Uri.parse(url))
|
||||
startActivity(browserIntent)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue