Made setting content of ViewPager in ItemActivity (old DetailActivity) (this sets images)
This commit is contained in:
parent
efd2ad054b
commit
b987854fb2
@ -63,7 +63,9 @@ public class ItemPresenter implements MainContract.ItemPresenter {
|
||||
for (Bitmap bitmap : bitmaps) {
|
||||
uriStrings.add(processImages(bitmap).toString());
|
||||
}
|
||||
// TODO: setViewPagerContent()
|
||||
String[] uriStringsArray = new String[uriStrings.size()];
|
||||
uriStrings.toArray(uriStringsArray);
|
||||
mView.setViewPagerContent(uriStringsArray);
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
|
@ -1,7 +1,6 @@
|
||||
package ru.volgorobot.vrcatalog;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@ -67,6 +66,6 @@ public interface MainContract {
|
||||
|
||||
interface ItemView {
|
||||
void onFailureAnswer(int errorCode);
|
||||
void setViewPagerContent(Uri uri);
|
||||
void setViewPagerContent(String[] uris);
|
||||
}
|
||||
}
|
||||
|
@ -170,6 +170,7 @@ public class ViewBinderPresenter implements MainContract.ViewBinderPresenter {
|
||||
switch (result.getErrorCode()) {
|
||||
case 0: {
|
||||
Intent intent = new Intent(context, DetailActivity.class);
|
||||
intent.putExtra("itemID", result.getData().getID().toString());
|
||||
intent.putExtra("detailName", result.getData().getName());
|
||||
intent.putExtra("detailQuantity", result.getData().getNumber().toString());
|
||||
intent.putExtra("detailPrice", result.getData().getPrice());
|
||||
|
@ -7,8 +7,8 @@ import me.texy.treeview.base.BaseNodeViewBinder;
|
||||
import me.texy.treeview.base.BaseNodeViewFactory;
|
||||
import ru.volgorobot.vrcatalog.MainContract;
|
||||
import ru.volgorobot.vrcatalog.nodeViewBinders.ThirdLevelNodeViewBinder;
|
||||
import ru.volgorobot.vrcatalog.searchNodeViewBinders.SecondLevelNodeViewBinder;
|
||||
import ru.volgorobot.vrcatalog.searchNodeViewBinders.FirstLevelNodeViewBinder;
|
||||
import ru.volgorobot.vrcatalog.searchNodeViewBinders.SecondLevelNodeViewBinder;
|
||||
|
||||
public class SearchableNodeViewFactory extends BaseNodeViewFactory {
|
||||
private Context context;
|
||||
|
@ -2,7 +2,6 @@ package ru.volgorobot.vrcatalog.view;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
|
||||
import ru.volgorobot.vrcatalog.R;
|
||||
|
@ -1,8 +1,8 @@
|
||||
package ru.volgorobot.vrcatalog.view;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.util.Log;
|
||||
@ -16,6 +16,7 @@ import java.util.HashMap;
|
||||
import ru.volgorobot.vrcatalog.ItemPresenter;
|
||||
import ru.volgorobot.vrcatalog.MainContract;
|
||||
import ru.volgorobot.vrcatalog.R;
|
||||
import ru.volgorobot.vrcatalog.additional.ImagePagerAdapter;
|
||||
|
||||
public class DetailActivity extends AppCompatActivity implements MainContract.ItemView {
|
||||
TextView nameView;
|
||||
@ -26,6 +27,7 @@ public class DetailActivity extends AppCompatActivity implements MainContract.It
|
||||
TextView datasheetView;
|
||||
EditText notesView;
|
||||
private MainContract.ItemPresenter mPresenter;
|
||||
private ViewPager viewPager;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
@ -35,7 +37,6 @@ public class DetailActivity extends AppCompatActivity implements MainContract.It
|
||||
getSupportActionBar().setHomeButtonEnabled(true);
|
||||
initializeViews();
|
||||
mPresenter = new ItemPresenter(DetailActivity.this, this);
|
||||
|
||||
Intent intent = getIntent();
|
||||
|
||||
HashMap<String, String> extrasMap = getIntentExtras(intent);
|
||||
@ -47,6 +48,7 @@ public class DetailActivity extends AppCompatActivity implements MainContract.It
|
||||
analogueView.setText(extrasMap.get("detailAnalogue"));
|
||||
datasheetView.setText(extrasMap.get("detailDatasheet"));
|
||||
notesView.setText(extrasMap.get("detailNotes"));
|
||||
mPresenter.getImagesByItemID(Integer.parseInt(extrasMap.get("itemID")));
|
||||
}
|
||||
|
||||
void initializeViews() {
|
||||
@ -58,6 +60,7 @@ public class DetailActivity extends AppCompatActivity implements MainContract.It
|
||||
analogueView = findViewById(R.id.analogue);
|
||||
datasheetView = findViewById(R.id.datasheet);
|
||||
datasheetView.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
viewPager = findViewById(R.id.viewPager);
|
||||
}
|
||||
|
||||
HashMap<String, String> getIntentExtras(Intent intent) {
|
||||
@ -140,7 +143,9 @@ public class DetailActivity extends AppCompatActivity implements MainContract.It
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setViewPagerContent(Uri uri) {
|
||||
|
||||
public void setViewPagerContent(String[] uris) {
|
||||
ImagePagerAdapter imagePagerAdapter = new ImagePagerAdapter(DetailActivity.this, uris);
|
||||
viewPager.setAdapter(imagePagerAdapter);
|
||||
imagePagerAdapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,6 @@ import android.support.design.widget.NavigationView;
|
||||
import android.support.v4.view.GravityCompat;
|
||||
import android.support.v4.view.MenuItemCompat;
|
||||
import android.support.v4.widget.DrawerLayout;
|
||||
import android.support.v4.widget.NestedScrollView;
|
||||
import android.support.v4.widget.SwipeRefreshLayout;
|
||||
import android.support.v7.app.ActionBarDrawerToggle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
@ -17,7 +16,6 @@ import android.support.v7.widget.DefaultItemAnimator;
|
||||
import android.support.v7.widget.SearchView;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
|
@ -2,10 +2,10 @@ package ru.volgorobot.vrcatalog.view;
|
||||
|
||||
import android.app.SearchManager;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.widget.NestedScrollView;
|
||||
import android.support.v4.widget.SwipeRefreshLayout;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.widget.DefaultItemAnimator;
|
||||
import android.util.Log;
|
||||
import android.view.MenuItem;
|
||||
@ -13,7 +13,6 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
package ru.volgorobot.vrcatalog.view;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
|
||||
import ru.volgorobot.vrcatalog.R;
|
||||
|
Loading…
Reference in New Issue
Block a user