convert LicenseActivity to kotlin
This commit is contained in:
parent
e9fca9e7dd
commit
3f90e2e325
|
@ -1,31 +0,0 @@
|
||||||
package com.simplemobiletools.camera.activities;
|
|
||||||
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.net.Uri;
|
|
||||||
import android.os.Bundle;
|
|
||||||
|
|
||||||
import com.simplemobiletools.camera.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);
|
|
||||||
}
|
|
||||||
|
|
||||||
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,22 @@
|
||||||
|
package com.simplemobiletools.camera.activities
|
||||||
|
|
||||||
|
import android.content.Intent
|
||||||
|
import android.net.Uri
|
||||||
|
import android.os.Bundle
|
||||||
|
import com.simplemobiletools.camera.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) }
|
||||||
|
}
|
||||||
|
|
||||||
|
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