diff --git a/app/src/main/java/io/spaceapi/community/myhackerspace/AboutLayout.java b/app/src/main/java/io/spaceapi/community/myhackerspace/AboutLayout.java index 341d009..5a087d9 100644 --- a/app/src/main/java/io/spaceapi/community/myhackerspace/AboutLayout.java +++ b/app/src/main/java/io/spaceapi/community/myhackerspace/AboutLayout.java @@ -1,17 +1,8 @@ package io.spaceapi.community.myhackerspace; -import static android.view.ViewGroup.LayoutParams.MATCH_PARENT; -import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT; - -import android.Manifest; import android.content.Context; -import android.content.Intent; -import android.net.Uri; import android.util.AttributeSet; import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.Button; import android.widget.LinearLayout; import android.widget.TextView; @@ -36,38 +27,14 @@ public AboutLayout(Context context, AttributeSet attrs, int defStyleAttr, int de } public void init() { - Button openRepoButton = findViewById(R.id.about_open_repo_button); - openRepoButton.setOnClickListener(new OnClickListener() { - @Override - public void onClick(View v) { - TextView repository = (TextView)findViewById(R.id.about_repository); - String url = (String) repository.getText(); - openWebPage(url); - } - }); TextView version = findViewById(R.id.about_version_text); version.setText(BuildConfig.VERSION_NAME + " (" + Integer.toString(BuildConfig.VERSION_CODE) + ")"); } public static AboutLayout create(Context context) { - // use xml layout, see https://stackoverflow.com/a/13889257 LayoutInflater layoutInflater = LayoutInflater.from(context); AboutLayout about = (AboutLayout) layoutInflater.inflate(R.layout.about, null, false); about.init(); return about; } - - public void openWebPage(String url) { - // from https://stackoverflow.com/a/43981160 - Uri webpage = Uri.parse(url); - - Intent intent = new Intent(Intent.ACTION_VIEW, webpage); - - if (intent.resolveActivity(getContext().getPackageManager()) != null) { - getContext().startActivity(intent); - }else{ -//Page not found - } - } - } diff --git a/app/src/main/res/layout/about.xml b/app/src/main/res/layout/about.xml index 9a829d7..dc7da2b 100644 --- a/app/src/main/res/layout/about.xml +++ b/app/src/main/res/layout/about.xml @@ -2,6 +2,8 @@ + android:layout_marginStart="1sp" + android:text="{version}" /> @@ -46,12 +50,7 @@ android:id="@+id/about_repository" android:layout_width="match_parent" android:layout_height="wrap_content" + android:autoLink="web" android:text="@string/about_repository_url" /> -