package com.hewgill.android.nzsldict;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.MenuItem;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;

public class WordActivity extends BaseActivity {

    private TextView gloss;
    private TextView minor;
    private TextView maori;
    private ImageView handshape;
    private ImageView location;
    private ImageView diagram;
    private ViewPager viewPager;
    private Dictionary.DictItem item;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.word);
        setupAppToolbar();
        Intent intent = getIntent();
        item = (Dictionary.DictItem) intent.getSerializableExtra("item");

        gloss = (TextView) findViewById(R.id.gloss);
        minor = (TextView) findViewById(R.id.minor);
        maori = (TextView) findViewById(R.id.maori);
        //handshape = (ImageView) findViewById(R.id.handshape);
        //location = (ImageView) findViewById(R.id.location);
        viewPager = (ViewPager) findViewById(R.id.sign_media_pager);
        setupSignMediaPager(viewPager);
        TabLayout tabLayout = (TabLayout) findViewById(R.id.sign_tabs);
        tabLayout.setupWithViewPager(viewPager);

        gloss.setText(item.gloss);
        minor.setText(item.minor);
        maori.setText(item.maori);
//        handshape.setImageResource(getApplicationContext().getResources().getIdentifier(item.handshapeImage(), "drawable", getPackageName()));
//        location.setImageResource(getApplicationContext().getResources().getIdentifier(item.locationImage(), "drawable", getPackageName()));
    }

    private void setupSignMediaPager(ViewPager viewPager) {
        ViewPagerAdapter adapter = new ViewPagerAdapter(getSupportFragmentManager());
        adapter.addFragment(SignIllustrationFragment.newInstance(item), "Illustration");
        adapter.addFragment(SignVideoFragment.newInstance(item), "Video");
        viewPager.setAdapter(adapter);
    }

    class ViewPagerAdapter extends FragmentPagerAdapter {
        private final List<Fragment> mFragmentList = new ArrayList<>();
        private final List<String> mFragmentTitleList = new ArrayList<>();

        public ViewPagerAdapter(FragmentManager manager) {
            super(manager);
        }

        @Override
        public Fragment getItem(int position) {
            return mFragmentList.get(position);
        }

        @Override
        public int getCount() {
            return mFragmentList.size();
        }

        public void addFragment(Fragment fragment, String title) {
            mFragmentList.add(fragment);
            mFragmentTitleList.add(title);
        }

        @Override
        public CharSequence getPageTitle(int position) {
            return mFragmentTitleList.get(position);
        }
    }
}

@@ -51,149 +51,22 @@
 oid.
-app.Activity;%0Aimport android.content.Intent;%0Aimport android.graphics.Color;%0Aimport android.graphics.drawable.Drawable;%0Aimport android.net.Uri
+content.Intent
 ;%0Aim
@@ -337,286 +337,25 @@
 oid.
-support.v7.app.AppCompatActivity;%0Aimport android.support.v7.widget.Toolbar;%0Aimport android.util.Log;%0Aimport android.view.MenuItem;%0Aimport android.view.View;%0Aimport android.widget.ImageView;%0Aimport android.widget.TextView;%0A%0Aimport java.io.IOException;%0Aimport java.io.InputStream;
+widget.TextView;%0A
 %0Aimp
@@ -541,104 +541,8 @@
 ri;%0A
-    private ImageView handshape;%0A    private ImageView location;%0A    private ImageView diagram;%0A
     
@@ -1065,134 +1065,8 @@
 i);%0A
-        //handshape = (ImageView) findViewById(R.id.handshape);%0A        //location = (ImageView) findViewById(R.id.location);%0A
     
@@ -1401,296 +1401,8 @@
 i);%0A
-//        handshape.setImageResource(getApplicationContext().getResources().getIdentifier(item.handshapeImage(), %22drawable%22, getPackageName()));%0A//        location.setImageResource(getApplicationContext().getResources().getIdentifier(item.locationImage(), %22drawable%22, getPackageName()));%0A
     

Reformat word activity