Changeset View
Changeset View
Standalone View
Standalone View
src/it/reyboz/bustorino/ActivityAbout.java
Show All 11 Lines | BusTO - Arrival times for Turin public transports. | ||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
GNU General Public License for more details. | GNU General Public License for more details. | ||||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | ||||
along with this program. If not, see <http://www.gnu.org/licenses/>. | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||||
*/ | */ | ||||
package it.reyboz.bustorino; | package it.reyboz.bustorino; | ||||
import androidx.appcompat.widget.Toolbar; | |||||
import androidx.core.app.NavUtils; | import androidx.core.app.NavUtils; | ||||
import androidx.appcompat.app.ActionBar; | import androidx.appcompat.app.ActionBar; | ||||
import androidx.appcompat.app.AppCompatActivity; | import androidx.appcompat.app.AppCompatActivity; | ||||
import android.text.Html; | import android.text.Html; | ||||
import android.text.Spanned; | import android.text.Spanned; | ||||
import android.text.method.LinkMovementMethod; | import android.text.method.LinkMovementMethod; | ||||
import android.os.Bundle; | import android.os.Bundle; | ||||
import android.view.MenuItem; | import android.view.MenuItem; | ||||
import android.widget.TextView; | import android.widget.TextView; | ||||
public class ActivityAbout extends AppCompatActivity { | public class ActivityAbout extends AppCompatActivity { | ||||
@Override | @Override | ||||
protected void onCreate(Bundle savedInstanceState) { | protected void onCreate(Bundle savedInstanceState) { | ||||
super.onCreate(savedInstanceState); | super.onCreate(savedInstanceState); | ||||
setContentView(R.layout.activity_about); | setContentView(R.layout.activity_about); | ||||
Spanned htmlText = Html.fromHtml(getResources().getString( | Spanned htmlText = Html.fromHtml(getResources().getString( | ||||
R.string.about_history)); | R.string.about_history)); | ||||
TextView aboutTextView = (TextView) findViewById(R.id.aboutTextView); | TextView aboutTextView = (TextView) findViewById(R.id.aboutTextView); | ||||
assert aboutTextView != null; | assert aboutTextView != null; | ||||
aboutTextView.setText(htmlText); | aboutTextView.setText(htmlText); | ||||
aboutTextView.setMovementMethod(LinkMovementMethod.getInstance()); | aboutTextView.setMovementMethod(LinkMovementMethod.getInstance()); | ||||
// Back button | Toolbar mToolbar = findViewById(R.id.default_toolbar); | ||||
ActionBar ab = getSupportActionBar(); | setSupportActionBar(mToolbar); | ||||
assert ab != null; | if (getSupportActionBar()!=null) | ||||
ab.setDisplayHomeAsUpEnabled(true); | getSupportActionBar().setDisplayHomeAsUpEnabled(true); | ||||
} | } | ||||
@Override | @Override | ||||
public boolean onOptionsItemSelected(MenuItem item) { | public boolean onOptionsItemSelected(MenuItem item) { | ||||
switch (item.getItemId()) { | |||||
// Respond to the action bar's Up/Home button | // Respond to the action bar's Up/Home button | ||||
case android.R.id.home: | if (item.getItemId() == android.R.id.home) {//NavUtils.navigateUpFromSameTask(this); | ||||
NavUtils.navigateUpFromSameTask(this); | onBackPressed(); | ||||
return true; | return true; | ||||
} | } | ||||
return super.onOptionsItemSelected(item); | return super.onOptionsItemSelected(item); | ||||
} | } | ||||
} | } |
Public contents are in Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) or GNU Free Documentation License (at your option) unless otherwise noted. · Contact / Register