Skip to content
Snippets Groups Projects
Commit 8b49aaa4 authored by junwonj2's avatar junwonj2
Browse files

submission for week 4

parent 557d8f64
No related branches found
No related tags found
No related merge requests found
Showing
with 1566 additions and 389 deletions
package com.example.junwon.finalproject;
import android.app.Fragment;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.ListView;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.w3c.dom.Text;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import me.grantland.widget.AutofitTextView;
/**
* Created by Jun Won on 2017-12-08.
*/
public class ActorListFragment extends Fragment {
View view;
ListView mListView;
int movie_id;
String character;
String name;
String profile_path;
int actor_id;
String credit_id;
int gender;
Bitmap bit;
List<ActorInfo> ActorList = new ArrayList<>();
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
view = inflater.inflate(R.layout.collection_fragment, container, false);
mListView = (ListView) view.findViewById(R.id.collection_listview);
setListViewScrollable();
getMovieIdFromBundle();
getActorListData();
mListView.setFocusable(false);
return view;
}
/**
* Make listview scrollable when in the scrollview
*/
private void setListViewScrollable() {
mListView.setOnTouchListener(new ListView.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
int action = event.getAction();
switch (action) {
case MotionEvent.ACTION_DOWN:
// Disallow ScrollView to intercept touch events.
v.getParent().requestDisallowInterceptTouchEvent(true);
break;
case MotionEvent.ACTION_UP:
// Allow ScrollView to intercept touch events.
v.getParent().requestDisallowInterceptTouchEvent(false);
break;
}
// Handle ListView touch events.
v.onTouchEvent(event);
return true;
}
});
}
/**
* Get data from bundle in the previous fragment replacing
*/
private void getMovieIdFromBundle() {
Bundle bundle = getArguments();
movie_id = bundle.getInt("movie_id");
}
/**
* get data of actor list and show it to the frame
*/
public void getActorListData() {
new AsyncTask() {
@Override
protected Object doInBackground(Object[] params) {
try {
JSONObject JsonObject = new JSONObject(HttpRequest.get("http://api.themoviedb.org/3/movie/" + movie_id + "/casts",
true, "api_key", MainActivity.getApi_key()).body());
JSONArray JsonArray = JsonObject.getJSONArray("cast");
for (int i = 0; i < JsonArray.length(); i++) {
JSONObject cast_JsonObject = JsonArray.getJSONObject(i);
character = cast_JsonObject.getString("character");
credit_id = cast_JsonObject.getString("credit_id");
gender = cast_JsonObject.getInt("gender");
actor_id = cast_JsonObject.getInt("id");
name = cast_JsonObject.getString("name");
profile_path = cast_JsonObject.getString("profile_path");
bit = getBitmap("http://image.tmdb.org/t/p/w185" + profile_path);
ActorInfo actorInfo = new ActorInfo(character, credit_id, gender, actor_id, name, bit);
ActorList.add(actorInfo);
}
} catch (JSONException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute(Object o) {
CustomAdapter customAdapter = new CustomAdapter();
mListView.setAdapter(customAdapter);
mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
ActorInfo actorInfo = ActorList.get(position);
Bundle bundle = new Bundle();
bundle.putInt("person_id", actorInfo.actor_id);
Fragment fragment = new DetailedActorFragment();
fragment.setArguments(bundle);
getFragmentManager().beginTransaction().replace(R.id.main_frame, fragment).addToBackStack(null).commit();
}
});
}
}.execute();
}
/**
* get bitmap image from the link indicated
*
* @param actual_link link to get the image
* @return bitmap image
* @throws IOException exception for IO
*/
private Bitmap getBitmap(String actual_link) throws IOException {
URL urlConnection = new URL(actual_link);
HttpURLConnection connection = (HttpURLConnection) urlConnection.openConnection();
connection.connect();
InputStream input = connection.getInputStream();
return BitmapFactory.decodeStream(input);
}
/**
* private class about actor info
*/
private class ActorInfo {
String character;
String name;
Bitmap bitmap;
int actor_id;
String credit_id;
int gender;
/**
* Constructor of Actor Info
*
* @param character character string
* @param credit_id credit id string
* @param gender gender as integer
* @param actor_id int as actor id
* @param name name as string
* @param bitmap bitmap as Bitmap file
*/
public ActorInfo(String character, String credit_id, int gender, int actor_id, String name, Bitmap bitmap) {
this.character = character;
this.name = name;
this.actor_id = actor_id;
this.credit_id = credit_id;
this.gender = gender;
this.bitmap = bitmap;
}
}
/**
* custom adapter about listview
*/
private class CustomAdapter extends BaseAdapter {
@Override
public int getCount() {
return ActorList.size();
}
@Override
public Object getItem(int position) {
return ActorList.get(position);
}
@Override
public long getItemId(int position) {
return 0;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
convertView = getActivity().getLayoutInflater().inflate(R.layout.actor_list_fragment, null);
AutofitTextView actor_character = (AutofitTextView) convertView.findViewById(R.id.actor_character);
AutofitTextView actor_name = (AutofitTextView) convertView.findViewById(R.id.actor_name);
AutofitTextView actor_gender = (AutofitTextView) convertView.findViewById(R.id.actor_gender);
ImageView actor_image = (ImageView) convertView.findViewById(R.id.actor_image);
ActorInfo actorInfo = ActorList.get(position);
actor_character.setText("Character: " + actorInfo.character);
actor_name.setText("Name: " + actorInfo.name);
int gender = actorInfo.gender;
if (gender == 1) {
actor_gender.setText("Gender: F");
} else {
actor_gender.setText("Gender: M");
}
actor_image.setImageBitmap(actorInfo.bitmap);
return convertView;
}
}
}
package com.example.junwon.finalproject;
import android.graphics.Bitmap;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Created by Jun Won on 2017-12-09.
*/
public class CacheBitmapImage {
static Map<Integer, Bitmap> cacheImage = new HashMap();
/**
* function that put the image bitmap into the class
*
* @param movie_id movie id to get from hashmap
* @param bitmap image to put in hashmap
*/
public static void putImage(int movie_id, Bitmap bitmap) {
cacheImage.put(movie_id, bitmap);
}
/**
* boolean function that checks if it is in cache map
*
* @param movie_id movie id to check if it is in hashmap
* @return true if it is in hash, false if it is not
*/
static boolean isInCache(int movie_id) {
if (cacheImage.get(movie_id) == null)
return false;
return true;
}
/**
* get bimap from hashmap
*
* @param movie_id movie id to get it from hashmap
* @return bitmap returning of its key
*/
static Bitmap getImage(int movie_id) {
return cacheImage.get(movie_id);
}
}
package com.example.junwon.finalproject;
import android.app.Fragment;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.constraint.solver.Cache;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
/**
* Created by Jun Won on 2017-12-10.
*/
public class DetailedActorFragment extends Fragment {
View view;
int person_id;
ImageView actorPoster;
TextView actorGender;
TextView actorBirthday;
TextView actorPlaceOfBirth;
TextView actorDetailName;
TextView actorDetailBiography;
TextView actorDetailHomepage;
ActorInfo actorInfo;
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
view = inflater.inflate(R.layout.custom_actor_fragment, container, false);
getPersonId();
saveAllVariables();
getDataAndSetToText();
setHasOptionsMenu(true);
return view;
}
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
menu.clear();
super.onCreateOptionsMenu(menu, inflater);
}
/**
* getting person id from bundle
*/
private void getPersonId() {
Bundle bundle = getArguments();
person_id = bundle.getInt("person_id");
}
/**
* get data from json file and set it to text in the frame
*/
private void getDataAndSetToText() {
new AsyncTask() {
@Override
protected void onPostExecute(Object o) {
actorPoster.setImageBitmap(actorInfo.bitmap);
if (actorInfo.gender == 1) {
actorGender.setText("Gender: F");
} else {
actorGender.setText("Gender: M");
}
actorBirthday.setText("Birthday: " + actorInfo.birthday);
actorPlaceOfBirth.setText("Place of Birth: " + actorInfo.place_of_birth);
actorDetailName.setText(actorInfo.name);
actorDetailBiography.setText(actorInfo.biography);
actorDetailHomepage.setText("Homepage: " + actorInfo.homepage);
Fragment fragment = new DetailedActorMovieListFragment();
Bundle bundle = new Bundle();
bundle.putInt("person_id", person_id);
fragment.setArguments(bundle);
getFragmentManager().beginTransaction().replace(R.id.actor_detail_movielist, fragment).commit();
}
@Override
protected Object doInBackground(Object[] params) {
try {
JSONObject JsonObject = new JSONObject(HttpRequest.get("https://api.themoviedb.org/3/person/" + person_id,
true, "api_key", MainActivity.getApi_key()).body());
String birthday = JsonObject.getString("birthday");
int id = JsonObject.getInt("id");
int gender = JsonObject.getInt("gender");
String name = JsonObject.getString("name");
String biography = JsonObject.getString("biography");
String place_of_birth = JsonObject.getString("place_of_birth");
String profile_path = JsonObject.getString("profile_path");
String homepage = JsonObject.getString("homepage");
Bitmap bitmap = null;
if (!CacheBitmapImage.isInCache(id)) {
bitmap = getBitmap("http://image.tmdb.org/t/p/w185" + profile_path);
CacheBitmapImage.putImage(id, bitmap);
} else {
bitmap = CacheBitmapImage.getImage(id);
}
actorInfo = new ActorInfo(birthday, id, gender, name, biography, place_of_birth, profile_path, homepage, bitmap);
} catch (JSONException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
}.execute();
}
/**
* get bitmap image from the link indicated
*
* @param actual_link link to get the image
* @return bitmap image
* @throws IOException exception for IO
*/
private Bitmap getBitmap(String actual_link) throws IOException {
URL urlConnection = new URL(actual_link);
HttpURLConnection connection = (HttpURLConnection) urlConnection.openConnection();
connection.connect();
InputStream input = connection.getInputStream();
return BitmapFactory.decodeStream(input);
}
/**
* save all variables that requires in this frame
*/
private void saveAllVariables() {
actorPoster = (ImageView) view.findViewById(R.id.detailed_actor_poster);
actorGender = (TextView) view.findViewById(R.id.actor_detail_gender);
actorBirthday = (TextView) view.findViewById(R.id.actor_detail_birthday);
actorPlaceOfBirth = (TextView) view.findViewById(R.id.actor_detail_placeofbirth);
actorDetailName = (TextView) view.findViewById(R.id.actor_detail_name);
actorDetailBiography = (TextView) view.findViewById(R.id.actor_detail_biography);
actorDetailHomepage = (TextView) view.findViewById(R.id.actor_detail_homepage);
}
/**
* class that holds info of actors
*/
private class ActorInfo {
String birthday;
int id;
int gender;
String name;
String biography;
String place_of_birth;
String profile_path;
String homepage;
Bitmap bitmap;
public ActorInfo(String birthday, int id, int gender,
String name, String biography, String place_of_birth, String profile_path, String homepage, Bitmap bitmap) {
this.birthday = birthday;
this.id = id;
this.gender = gender;
this.name = name;
this.biography = biography;
this.place_of_birth = place_of_birth;
this.profile_path = profile_path;
this.homepage = homepage;
this.bitmap = bitmap;
}
}
}
package com.example.junwon.finalproject;
import android.app.Fragment;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
/**
* Created by Jun Won on 2017-12-10.
*/
public class DetailedActorMovieListFragment extends Fragment {
View view;
int person_id;
List<ActorMovieListInfo> actorMovieListInfoList = new ArrayList<>();
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
view = inflater.inflate(R.layout.collection_fragment, container, false);
getPersonId();
getDataAndSetText();
return view;
}
/**
* get person id from bundle
*/
private void getPersonId() {
Bundle bundle = getArguments();
person_id = bundle.getInt("person_id");
}
/**
* let listview scrollable in the scrollview
*
* @param listView the listview to contribute to this function
*/
private void setListViewScrollable(ListView listView) {
listView.setOnTouchListener(new ListView.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
int action = event.getAction();
switch (action) {
case MotionEvent.ACTION_DOWN:
// Disallow ScrollView to intercept touch events.
v.getParent().requestDisallowInterceptTouchEvent(true);
break;
case MotionEvent.ACTION_UP:
// Allow ScrollView to intercept touch events.
v.getParent().requestDisallowInterceptTouchEvent(false);
break;
}
// Handle ListView touch events.
v.onTouchEvent(event);
return true;
}
});
}
/**
* get data from json file and set it as a text or poster it
*/
private void getDataAndSetText() {
new AsyncTask() {
@Override
protected void onPostExecute(Object o) {
ListView listView = (ListView) view.findViewById(R.id.collection_listview);
CustomAdapter customAdapter = new CustomAdapter();
listView.setAdapter(customAdapter);
listView.setFocusable(false);
setListViewScrollable(listView);
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
int movie_id = actorMovieListInfoList.get(position).id;
Bundle bundle = new Bundle();
bundle.putInt("movie_id", movie_id);
Fragment fragment = new DetailedMovieFragment();
fragment.setArguments(bundle);
getFragmentManager().beginTransaction().replace(R.id.main_frame, fragment).addToBackStack(null).commit();
}
});
}
@Override
protected Object doInBackground(Object[] params) {
try {
JSONObject jsonObject = new JSONObject(HttpRequest.get("https://api.themoviedb.org/3/person/" + person_id + "/movie_credits",
true, "api_key", MainActivity.getApi_key()).body());
JSONArray castArray = jsonObject.getJSONArray("cast");
for (int i = 0; i < castArray.length(); i++) {
JSONObject JsonObject = castArray.getJSONObject(i);
String character = JsonObject.getString("character");
String poster_path = JsonObject.getString("poster_path");
int id = JsonObject.getInt("id");
Bitmap bitmap = null;
if (!CacheBitmapImage.isInCache(id)) {
bitmap = getBitmap("http://image.tmdb.org/t/p/w185" + poster_path);
CacheBitmapImage.putImage(id, bitmap);
} else {
bitmap = CacheBitmapImage.getImage(id);
}
String title = JsonObject.getString("title");
String release_date = JsonObject.getString("release_date");
int vote_average = JsonObject.getInt("vote_average");
ActorMovieListInfo actorMovieListInfo = new ActorMovieListInfo(character, bitmap, id, title, release_date, vote_average);
actorMovieListInfoList.add(actorMovieListInfo);
}
} catch (JSONException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
}.execute();
}
/**
* get bitmap image from the link indicated
*
* @param actual_link link to get the image
* @return bitmap image
* @throws IOException exception for IO
*/
private Bitmap getBitmap(String actual_link) throws IOException {
URL urlConnection = new URL(actual_link);
HttpURLConnection connection = (HttpURLConnection) urlConnection.openConnection();
connection.connect();
InputStream input = connection.getInputStream();
return BitmapFactory.decodeStream(input);
}
/**
* class that holds info of its actor
*/
private class ActorMovieListInfo {
String character;
Bitmap bitmap;
int id;
String title;
String release_date;
int vote_average;
/**
* constructor of its class setting all of its variables
*/
public ActorMovieListInfo(String character, Bitmap bitmap, int id, String title, String release_date, int vote_average) {
this.character = character;
this.bitmap = bitmap;
this.id = id;
this.title = title;
this.release_date = release_date;
this.vote_average = vote_average;
}
}
/**
* custom adapter to apply as a listview
*/
private class CustomAdapter extends BaseAdapter {
ImageView poster;
TextView character;
TextView title;
TextView vote_average;
TextView release_date;
@Override
public int getCount() {
return actorMovieListInfoList.size();
}
@Override
public Object getItem(int position) {
return actorMovieListInfoList.get(position);
}
@Override
public long getItemId(int position) {
return 0;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
convertView = getActivity().getLayoutInflater().inflate(R.layout.custom_actor_movielist_fragment, null);
setAllVariables(convertView);
setDataToVariables(position);
return convertView;
}
/**
* set the text or image as a given data
* @param position the position to get a hatch
*/
private void setDataToVariables(int position) {
ActorMovieListInfo actorMovieListInfo = actorMovieListInfoList.get(position);
poster.setImageBitmap(actorMovieListInfo.bitmap);
character.setText(actorMovieListInfo.character);
title.setText(actorMovieListInfo.title);
vote_average.setText(String.valueOf(actorMovieListInfo.vote_average));
release_date.setText(actorMovieListInfo.release_date);
}
/**
*
* @param convertView
*/
private void setAllVariables(View convertView) {
poster = (ImageView) convertView.findViewById(R.id.custom_actor_movielist_poster);
character = (TextView) convertView.findViewById(R.id.custom_actor_movielist_character);
title = (TextView) convertView.findViewById(R.id.custom_actor_movielist_title);
vote_average = (TextView) convertView.findViewById(R.id.custom_actor_movielist_vote_average);
release_date = (TextView) convertView.findViewById(R.id.custom_actor_movielist_release_date);
}
}
}
......@@ -35,7 +35,6 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
private NavigationView navigationView;
private Toolbar mToolbar;
private final static String api_key = "7a3ab68737e6c2d44b1c27c3d1b90f0a";
private String request_token = "d19a2da47e00634e9b751d571cd04f35ca700d90";
private final static String session_id = "e61370e64733ae8adad24c5772016227b799667c";
private static Bitmap bitmap = null;
public Map<Integer, String> genre_map = new HashMap<>();
......
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="100dp"
android:orientation="vertical">
<ImageView
android:id="@+id/actor_image"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_weight="1" />
<LinearLayout
android:id="@+id/linearLayout4"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:layout_toEndOf="@+id/actor_image"
android:layout_toRightOf="@+id/actor_image"
android:orientation="vertical">
<me.grantland.widget.AutofitTextView
android:id="@+id/actor_character"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:maxLines="1"
android:text="TextView"
android:textSize="25sp" />
<me.grantland.widget.AutofitTextView
android:id="@+id/actor_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:maxLines="1"
android:text="TextView"
android:textSize="25sp" />
<me.grantland.widget.AutofitTextView
android:id="@+id/actor_gender"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:maxLines="1"
android:text="TextView"
android:textSize="25sp" />
</LinearLayout>
</RelativeLayout>
\ No newline at end of file
......@@ -4,7 +4,8 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/list_grad"
android:orientation="vertical">
android:orientation="vertical"
android:id="@+id/collection_fragment_container">
<ListView
......
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@color/cardview_dark_background"
android:theme="@style/ThemeOverlay.AppCompat.Dark">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/detailed_actor_poster"
android:layout_width="100dp"
android:layout_height="150dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="15dp"
android:layout_marginStart="15dp"
android:layout_marginTop="15dp"
app:srcCompat="@mipmap/ic_launcher" />
<TextView
android:id="@+id/textView"
android:layout_width="130dp"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/detailed_actor_poster"
android:layout_alignStart="@+id/detailed_actor_poster"
android:layout_below="@+id/detailed_actor_poster"
android:layout_marginTop="15dp"
android:text="Known for: Acting" />
<TextView
android:id="@+id/actor_detail_gender"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="@+id/textView"
android:layout_alignLeft="@+id/textView"
android:layout_alignRight="@+id/textView"
android:layout_alignStart="@+id/textView"
android:layout_below="@+id/textView"
android:text="TextView" />
<TextView
android:id="@+id/actor_detail_birthday"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="@+id/actor_detail_gender"
android:layout_alignLeft="@+id/actor_detail_gender"
android:layout_alignRight="@+id/actor_detail_gender"
android:layout_alignStart="@+id/actor_detail_gender"
android:layout_below="@+id/actor_detail_gender"
android:text="TextView" />
<TextView
android:id="@+id/actor_detail_placeofbirth"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="@+id/actor_detail_birthday"
android:layout_alignLeft="@+id/actor_detail_birthday"
android:layout_alignRight="@+id/actor_detail_birthday"
android:layout_alignStart="@+id/actor_detail_birthday"
android:layout_below="@+id/actor_detail_birthday"
android:text="TextView" />
<TextView
android:id="@+id/actor_detail_name"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/actor_detail_biography"
android:layout_alignParentTop="true"
android:layout_alignStart="@+id/actor_detail_biography"
android:layout_marginTop="15dp"
android:text="TextView"
android:textStyle="bold" />
<TextView
android:id="@+id/actor_detail_biography"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/actor_detail_placeofbirth"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_below="@+id/actor_detail_name"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="13dp"
android:text="TextView" />
<TextView
android:id="@+id/actor_detail_homepage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="@+id/actor_detail_placeofbirth"
android:layout_alignLeft="@+id/actor_detail_placeofbirth"
android:layout_alignRight="@+id/actor_detail_placeofbirth"
android:layout_alignStart="@+id/actor_detail_placeofbirth"
android:layout_below="@+id/actor_detail_placeofbirth"
android:text="TextView" />
</RelativeLayout>
<FrameLayout
android:id="@+id/actor_detail_movielist"
android:layout_width="match_parent"
android:layout_height="300dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="15dp">
</FrameLayout>
</LinearLayout>
</ScrollView>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/custom_actor_movielist_poster"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
app:srcCompat="@mipmap/ic_launcher" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_alignParentTop="true"
android:layout_toEndOf="@+id/custom_actor_movielist_poster"
android:layout_toRightOf="@+id/custom_actor_movielist_poster"
android:orientation="vertical">
<TextView
android:id="@+id/custom_actor_movielist_character"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toEndOf="@+id/custom_actor_movielist_poster"
android:layout_toRightOf="@+id/custom_actor_movielist_poster"
android:text="TextView"
android:layout_weight="1"/>
<TextView
android:id="@+id/custom_actor_movielist_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/custom_actor_movielist_character"
android:layout_toEndOf="@+id/custom_actor_movielist_poster"
android:layout_toRightOf="@+id/custom_actor_movielist_poster"
android:text="TextView"
android:layout_weight="1"/>
<TextView
android:id="@+id/custom_actor_movielist_vote_average"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/custom_actor_movielist_title"
android:layout_toEndOf="@+id/custom_actor_movielist_poster"
android:layout_toRightOf="@+id/custom_actor_movielist_poster"
android:text="TextView"
android:layout_weight="1"/>
<TextView
android:id="@+id/custom_actor_movielist_release_date"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/custom_actor_movielist_vote_average"
android:layout_toEndOf="@+id/custom_actor_movielist_poster"
android:layout_toRightOf="@+id/custom_actor_movielist_poster"
android:text="TextView"
android:layout_weight="1"/>
</LinearLayout>
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/holo_purple"
android:orientation="vertical"
android:theme="@style/ThemeOverlay.AppCompat.Dark">
android:theme="@style/ThemeOverlay.AppCompat.Dark"
android:nestedScrollingEnabled="false"
android:overScrollMode="never"
android:scrollbars="none"
android:id="@+id/detailed_movie_fragment_frame">
<RelativeLayout
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/linearLayout2"
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_alignEnd="@+id/linearLayout3"
android:layout_alignLeft="@+id/linearLayout3"
android:layout_alignRight="@+id/linearLayout3"
android:layout_alignStart="@+id/linearLayout3"
android:layout_below="@+id/linearLayout3"
android:layout_marginTop="10dp"
android:orientation="vertical">
<TextView
android:id="@+id/textView3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Overview" />
<me.grantland.widget.AutofitTextView
android:id="@+id/overview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:maxLines="5"
android:text="TextView" />
</LinearLayout>
<TextView
android:id="@+id/tagline"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="15dp"
android:text="TextView" />
<LinearLayout
android:id="@+id/linearLayout3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignEnd="@+id/linearLayout"
android:layout_alignLeft="@+id/main_poster"
android:layout_alignRight="@+id/linearLayout"
android:layout_alignStart="@+id/main_poster"
android:layout_centerVertical="true"
android:orientation="vertical">
android:orientation="vertical"
android:id="@+id/scrollViewLinearLayout">
<TextView
android:id="@+id/textView10"
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Production Companies" />
<me.grantland.widget.AutofitTextView
android:id="@+id/production_companies"
android:orientation="vertical">
<TextView
android:id="@+id/tagline"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="15dp"
android:text="TextView" />
<ImageView
android:id="@+id/banner_image"
android:layout_width="match_parent"
android:layout_height="150dp"
android:layout_below="@+id/tagline"
android:layout_centerHorizontal="true"
app:srcCompat="@mipmap/ic_launcher" />
<ImageView
android:id="@+id/main_poster"
android:layout_width="100dp"
android:layout_height="150dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="15dp"
android:layout_marginTop="100dp"
app:srcCompat="@mipmap/ic_launcher" />
<LinearLayout
android:id="@+id/linearLayout2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/main_poster"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="10dp"
android:orientation="vertical">
<TextView
android:id="@+id/textView3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Overview" />
<me.grantland.widget.AutofitTextView
android:id="@+id/overview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="5"
android:text="TextView" />
</LinearLayout>
<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_alignBottom="@+id/main_poster"
android:layout_below="@+id/banner_image"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_toEndOf="@+id/main_poster"
android:layout_toRightOf="@+id/main_poster"
android:orientation="vertical">
<RatingBar
android:id="@+id/rating_bar"
style="?android:attr/ratingBarStyleSmall"
android:layout_width="wrap_content"
android:layout_height="20dp"
android:isIndicator="true"
android:numStars="5"
android:rating="5" />
<me.grantland.widget.AutofitTextView
android:id="@+id/detail_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="1"
android:text="TextView"
android:textSize="30sp" />
<me.grantland.widget.AutofitTextView
android:id="@+id/detail_genre"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:maxLines="1"
android:text="TextView"
app:sizeToFit="true" />
</LinearLayout>
<LinearLayout
android:id="@+id/linearLayout3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/linearLayout2"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="10dp"
android:orientation="vertical">
<TextView
android:id="@+id/textView10"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Production Companies" />
<me.grantland.widget.AutofitTextView
android:id="@+id/production_companies"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="2"
android:text="TextView" />
</LinearLayout>
</RelativeLayout>
<FrameLayout
android:id="@+id/detailed_recommended_frame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:maxLines="2"
android:text="TextView" />
</LinearLayout>
<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_alignBottom="@+id/main_poster"
android:layout_below="@+id/banner_image"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_toEndOf="@+id/main_poster"
android:layout_toRightOf="@+id/main_poster"
android:orientation="vertical">
<RatingBar
android:id="@+id/rating_bar"
style="?android:attr/ratingBarStyleSmall"
android:layout_width="wrap_content"
android:layout_height="20dp"
android:isIndicator="true"
android:numStars="5"
android:rating="5" />
<me.grantland.widget.AutofitTextView
android:id="@+id/detail_title"
android:layout_height="500dp"
android:layout_alignEnd="@+id/linearLayout2"
android:layout_alignLeft="@+id/linearLayout2"
android:layout_alignParentBottom="true"
android:layout_alignRight="@+id/linearLayout2"
android:layout_alignStart="@+id/linearLayout2"
android:layout_below="@+id/linearLayout2"
android:orientation="horizontal"
android:layout_marginTop="10dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"></FrameLayout>
<FrameLayout
android:id="@+id/actor_frame"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="1"
android:text="TextView"
android:textSize="30sp" />
android:layout_height="500dp"
android:layout_alignEnd="@+id/linearLayout2"
android:layout_alignLeft="@+id/linearLayout2"
android:layout_alignParentBottom="true"
android:layout_alignRight="@+id/linearLayout2"
android:layout_alignStart="@+id/linearLayout2"
android:layout_below="@+id/linearLayout2"
android:orientation="horizontal"
android:layout_marginTop="20dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"></FrameLayout>
<me.grantland.widget.AutofitTextView
android:id="@+id/detail_genre"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:maxLines="1"
android:text="TextView"
app:sizeToFit="true" />
</LinearLayout>
<ImageView
android:id="@+id/banner_image"
android:layout_width="match_parent"
android:layout_height="150dp"
android:layout_below="@+id/tagline"
android:layout_centerHorizontal="true"
app:srcCompat="@mipmap/ic_launcher" />
<ImageView
android:id="@+id/main_poster"
android:layout_width="100dp"
android:layout_height="150dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="15dp"
android:layout_marginTop="100dp"
app:srcCompat="@mipmap/ic_launcher" />
<FrameLayout
android:id="@+id/detailed_recommended_frame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:layout_alignLeft="@+id/linearLayout2"
android:layout_alignStart="@+id/linearLayout2"
android:layout_alignRight="@+id/linearLayout2"
android:layout_alignEnd="@+id/linearLayout2"
android:layout_below="@+id/linearLayout2"
android:layout_alignParentBottom="true"></FrameLayout>
</RelativeLayout>
</RelativeLayout>
\ No newline at end of file
</ScrollView>
</LinearLayout>
\ No newline at end of file
......@@ -23,6 +23,8 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import static junit.framework.TestCase.assertEquals;
/**
* Example local unit test, which will execute on the development machine (host).
*
......@@ -148,4 +150,22 @@ public class ExampleUnitTest {
System.out.println("doRecentWork: " + "Integer" + map2.get("b"));
}
}
@Test
public void testActorDataInfo() {
String body = HttpRequest.get("http://api.themoviedb.org/3/movie/49521/casts", true, "api_key", api_key).body();
System.out.println(body);
}
@Test
public void testCharacterDataInfo() {
String body = HttpRequest.get("https://api.themoviedb.org/3/person/73968/movie_credits", true, "api_key", api_key).body();
System.out.println(body);
}
@Test
public void testActorDetailInfo() {
String body = HttpRequest.get("https://api.themoviedb.org/3/person/73968", true, "api_key", api_key).body();
System.out.println(body);
}
}
\ No newline at end of file
No preview for this file type
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment