diff --git a/app/src/main/java/it/reyboz/bustorino/ActivityAbout.java b/app/src/main/java/it/reyboz/bustorino/ActivityAbout.java deleted file mode 100644 index cbed07c..0000000 --- a/app/src/main/java/it/reyboz/bustorino/ActivityAbout.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - BusTO - Arrival times for Turin public transports. - Copyright (C) 2014 Valerio Bozzolan - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - */ -package it.reyboz.bustorino; - -import android.content.Intent; -import android.net.Uri; -import android.util.Log; -import androidx.appcompat.widget.Toolbar; -import androidx.appcompat.app.AppCompatActivity; -import android.text.Html; -import android.text.Spanned; -import android.text.method.LinkMovementMethod; -import android.os.Bundle; -import android.view.MenuItem; -import android.view.View; -import android.widget.Button; -import android.widget.TextView; -import android.widget.Toast; - -import it.reyboz.bustorino.backend.utils; -import it.reyboz.bustorino.middleware.BarcodeScanUtils; - -public class ActivityAbout extends AppCompatActivity { - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_about); - Spanned htmlText = utils.convertHtml(getResources().getString( - R.string.about_history)); - TextView aboutTextView = findViewById(R.id.aboutTextView); - assert aboutTextView != null; - aboutTextView.setText(htmlText); - aboutTextView.setMovementMethod(LinkMovementMethod.getInstance()); - - Toolbar mToolbar = findViewById(R.id.default_toolbar); - setSupportActionBar(mToolbar); - if (getSupportActionBar()!=null) - getSupportActionBar().setDisplayHomeAsUpEnabled(true); - - TextView versionText = findViewById(R.id.versionTextView); - Log.d("BusTO About", "The version text view is: "+versionText); - versionText.setText(getResources().getText(R.string.app_version)+": "+BuildConfig.VERSION_NAME); - - Button openTelegramButton = findViewById(R.id.openTelegramButton); - openTelegramButton.setOnClickListener(view -> { - - Intent trueIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("tg://resolve?domain=busto_fdroid")); - if(BarcodeScanUtils.checkTargetPackageExists(this, trueIntent)) - startActivity(trueIntent); - else{ - Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://t.me/busto_fdroid")); - startActivity(intent); - // Toast.makeText(this, "Install Telegram and retry", Toast.LENGTH_SHORT).show(); - } - - }); - } - - @Override - public boolean onOptionsItemSelected(MenuItem item) { - // Respond to the action bar's Up/Home button - if (item.getItemId() == android.R.id.home) {//NavUtils.navigateUpFromSameTask(this); - onBackPressed(); - return true; - } - return super.onOptionsItemSelected(item); - } -} diff --git a/app/src/main/java/it/reyboz/bustorino/ActivityAbout.kt b/app/src/main/java/it/reyboz/bustorino/ActivityAbout.kt new file mode 100644 index 0000000..7c930c5 --- /dev/null +++ b/app/src/main/java/it/reyboz/bustorino/ActivityAbout.kt @@ -0,0 +1,105 @@ +/* + BusTO - Arrival times for Turin public transports. + Copyright (C) 2014 Valerio Bozzolan + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + */ +package it.reyboz.bustorino + +import android.content.Intent +import android.net.Uri +import android.os.Bundle +import android.text.method.LinkMovementMethod +import android.util.Log +import android.view.MenuItem +import android.view.View +import android.widget.Button +import android.widget.TextView +import androidx.appcompat.app.AppCompatActivity +import it.reyboz.bustorino.backend.utils +import it.reyboz.bustorino.middleware.BarcodeScanUtils + +class ActivityAbout : AppCompatActivity() { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_about) + //TOP TEXT VIEW + val topTextView = checkNotNull(findViewById(R.id.topTextView)) + val telegramTextView= checkNotNull(findViewById(R.id.telegramTextView)) + val howTextView = checkNotNull(findViewById(R.id.howDoesItWorkTextView)) + val bottomTextView= checkNotNull(findViewById(R.id.bottomAboutTextView)) + + val textviews = arrayOf(topTextView, telegramTextView,howTextView,bottomTextView) + val stringsForTextViews = arrayOf(R.string.about_history_top, R.string.about_channel, R.string.about_how, R.string.about_history_bottom) + + for (i in 0 until 4) { + val htmlText = utils.convertHtml( + resources.getString( + stringsForTextViews[i] + ) + ) + //val aboutTextView = checkNotNull(findViewById(R.id.aboutTextView)) + val textView = textviews[i] + textView.text = htmlText + textView.movementMethod = LinkMovementMethod.getInstance() + } + + /*Toolbar mToolbar = findViewById(R.id.default_toolbar); + setSupportActionBar(mToolbar); + + */ + if (supportActionBar != null) supportActionBar!!.setDisplayHomeAsUpEnabled(true) + + val versionText = findViewById(R.id.versionTextView) + Log.d("BusTO About", "The version text view is: $versionText") + versionText.text = resources.getText(R.string.app_version).toString() + ": " + BuildConfig.VERSION_NAME + + val openTelegramButton = findViewById