Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added onClick for About section #224

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions src/main/java/dk/aau/netsec/hostage/ui/fragment/AboutFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,20 @@

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.media.Image;
import android.net.Uri;
import android.os.Bundle;
import android.text.method.LinkMovementMethod;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import androidx.fragment.app.Fragment;

Expand Down Expand Up @@ -45,6 +50,44 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
rootView = inflater.inflate(R.layout.fragment_about, container, false);
PackageManager manager = Hostage.getContext().getPackageManager();
PackageInfo info = null;

ImageView img_1 = (ImageView) rootView.findViewById(R.id.img_1);
ImageView img_2 = (ImageView) rootView.findViewById(R.id.img_2);
ImageView img_3 = (ImageView) rootView.findViewById(R.id.img_3);
ImageView img_4 = (ImageView) rootView.findViewById(R.id.img_4);

img_1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.tu-darmstadt.de/"));
startActivity(browserIntent);
}
});

img_2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.en.aau.dk/"));
startActivity(browserIntent);
}
});

img_3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://northsearegion.eu/"));
startActivity(browserIntent);
}
});

img_4.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://keep.eu/projects/22182/Building-COMpetencies-for-C-EN/"));
startActivity(browserIntent);
}
});

try {
info = manager.getPackageInfo(Hostage.getContext().getPackageName(), 0);
} catch (PackageManager.NameNotFoundException e) {
Expand Down
4 changes: 4 additions & 0 deletions src/main/res/layout/fragment_about.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@


<ImageView
android:id="@+id/img_1"
android:layout_width="162dp"
android:layout_height="89dp"
android:layout_marginLeft="5dp"
Expand All @@ -74,6 +75,7 @@


<ImageView
android:id="@+id/img_2"
android:layout_width="161dp"
android:layout_height="89dp"
android:layout_marginLeft="5dp"
Expand Down Expand Up @@ -118,6 +120,7 @@
android:textColor="@android:color/holo_blue_dark"/>

<ImageView
android:id="@+id/img_3"
android:layout_width="240dp"
android:layout_height="92dp"
android:layout_marginLeft="5dp"
Expand All @@ -139,6 +142,7 @@
android:paddingTop="33dp">

<ImageView
android:id="@+id/img_4"
android:layout_width="100dp"
android:layout_height="92dp"
android:layout_marginLeft="5dp"
Expand Down