repo_name stringlengths 7 104 | file_path stringlengths 13 198 | context stringlengths 67 7.15k | import_statement stringlengths 16 4.43k | code stringlengths 40 6.98k | prompt stringlengths 227 8.27k | next_line stringlengths 8 795 |
|---|---|---|---|---|---|---|
WSDOT/Archetypes | archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/MenuViewGwtImpl.java | // Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/shared/Topic.java
// public class Topic implements Serializable {
//
// private static final long serialVersionUID = -134211444131752658L;
// private String name;
//
// public Topic() {
// }
//
// public Topic(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
| import java.util.List;
import gov.wa.wsdot.apps.mgwt.shared.Topic;
import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;
import com.googlecode.mgwt.dom.client.event.tap.TapEvent;
import com.googlecode.mgwt.ui.client.widget.button.image.AboutImageButton;
import com.googlecode.mgwt.ui.client.widget.list.celllist.BasicCell;
import com.googlecode.mgwt.ui.client.widget.list.celllist.CellList;
import com.googlecode.mgwt.ui.client.widget.list.celllist.CellSelectedEvent; | package gov.wa.wsdot.apps.mgwt.client.activities;
public class MenuViewGwtImpl extends Composite implements MenuView {
/**
* The UiBinder interface.
*/
interface MenuViewGwtImplUiBinder extends
UiBinder<Widget, MenuViewGwtImpl> {
}
/**
* The UiBinder used to generate the view.
*/
private static MenuViewGwtImplUiBinder uiBinder = GWT
.create(MenuViewGwtImplUiBinder.class);
@UiField
AboutImageButton aboutButton;
@UiField(provided = true) | // Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/shared/Topic.java
// public class Topic implements Serializable {
//
// private static final long serialVersionUID = -134211444131752658L;
// private String name;
//
// public Topic() {
// }
//
// public Topic(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/MenuViewGwtImpl.java
import java.util.List;
import gov.wa.wsdot.apps.mgwt.shared.Topic;
import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;
import com.googlecode.mgwt.dom.client.event.tap.TapEvent;
import com.googlecode.mgwt.ui.client.widget.button.image.AboutImageButton;
import com.googlecode.mgwt.ui.client.widget.list.celllist.BasicCell;
import com.googlecode.mgwt.ui.client.widget.list.celllist.CellList;
import com.googlecode.mgwt.ui.client.widget.list.celllist.CellSelectedEvent;
package gov.wa.wsdot.apps.mgwt.client.activities;
public class MenuViewGwtImpl extends Composite implements MenuView {
/**
* The UiBinder interface.
*/
interface MenuViewGwtImplUiBinder extends
UiBinder<Widget, MenuViewGwtImpl> {
}
/**
* The UiBinder used to generate the view.
*/
private static MenuViewGwtImplUiBinder uiBinder = GWT
.create(MenuViewGwtImplUiBinder.class);
@UiField
AboutImageButton aboutButton;
@UiField(provided = true) | CellList<Topic> cellList; |
WSDOT/Archetypes | archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/widget/button/image/MenuImageButton.java | // Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/widget/image/LocalImageHolder.java
// public class LocalImageHolder {
// private static final LocalImageHolderAppearance APPEARANCE = GWT
// .create(LocalImageHolderAppearance.class);
//
// public interface LocalImageHolderAppearance {
// public interface Images {
// ImageResource menu();
// }
//
// Images get();
// }
//
// public static Images get() {
// return APPEARANCE.get();
// }
// }
| import gov.wa.wsdot.apps.mgwt.client.widget.image.LocalImageHolder;
import com.googlecode.mgwt.ui.client.widget.button.ImageButton; | package gov.wa.wsdot.apps.mgwt.client.widget.button.image;
public class MenuImageButton extends ImageButton {
public MenuImageButton() { | // Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/widget/image/LocalImageHolder.java
// public class LocalImageHolder {
// private static final LocalImageHolderAppearance APPEARANCE = GWT
// .create(LocalImageHolderAppearance.class);
//
// public interface LocalImageHolderAppearance {
// public interface Images {
// ImageResource menu();
// }
//
// Images get();
// }
//
// public static Images get() {
// return APPEARANCE.get();
// }
// }
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/widget/button/image/MenuImageButton.java
import gov.wa.wsdot.apps.mgwt.client.widget.image.LocalImageHolder;
import com.googlecode.mgwt.ui.client.widget.button.ImageButton;
package gov.wa.wsdot.apps.mgwt.client.widget.button.image;
public class MenuImageButton extends ImageButton {
public MenuImageButton() { | super(LocalImageHolder.get().menu()); |
WSDOT/Archetypes | archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/home/HomeActivity.java | // Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/ClientFactory.java
// public interface ClientFactory {
//
// public HomeView getHomeView();
// public EventBus getEventBus();
// public PlaceController getPlaceController();
// public SwipeMenu getSwipeMenu();
//
// /**
// * @return
// */
// public AboutView getAboutView();
// public SampleView getSampleView();
// public MenuView getMenuView();
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/sample/SamplePlace.java
// public class SamplePlace extends Place {
//
// public static class SamplePlaceTokenizer implements
// PlaceTokenizer<SamplePlace> {
//
// @Override
// public SamplePlace getPlace(String token) {
// return new SamplePlace();
// }
//
// @Override
// public String getToken(SamplePlace place) {
// return "";
// }
//
// }
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/shared/Topic.java
// public class Topic implements Serializable {
//
// private static final long serialVersionUID = -134211444131752658L;
// private String name;
//
// public Topic() {
// }
//
// public Topic(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
| import java.util.ArrayList;
import java.util.List;
import gov.wa.wsdot.apps.mgwt.client.ClientFactory;
import gov.wa.wsdot.apps.mgwt.client.activities.sample.SamplePlace;
import gov.wa.wsdot.apps.mgwt.shared.Topic;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.google.web.bindery.event.shared.EventBus;
import com.googlecode.mgwt.mvp.client.MGWTAbstractActivity; | package gov.wa.wsdot.apps.mgwt.client.activities.home;
public class HomeActivity extends MGWTAbstractActivity implements
HomeView.Presenter {
| // Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/ClientFactory.java
// public interface ClientFactory {
//
// public HomeView getHomeView();
// public EventBus getEventBus();
// public PlaceController getPlaceController();
// public SwipeMenu getSwipeMenu();
//
// /**
// * @return
// */
// public AboutView getAboutView();
// public SampleView getSampleView();
// public MenuView getMenuView();
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/sample/SamplePlace.java
// public class SamplePlace extends Place {
//
// public static class SamplePlaceTokenizer implements
// PlaceTokenizer<SamplePlace> {
//
// @Override
// public SamplePlace getPlace(String token) {
// return new SamplePlace();
// }
//
// @Override
// public String getToken(SamplePlace place) {
// return "";
// }
//
// }
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/shared/Topic.java
// public class Topic implements Serializable {
//
// private static final long serialVersionUID = -134211444131752658L;
// private String name;
//
// public Topic() {
// }
//
// public Topic(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/home/HomeActivity.java
import java.util.ArrayList;
import java.util.List;
import gov.wa.wsdot.apps.mgwt.client.ClientFactory;
import gov.wa.wsdot.apps.mgwt.client.activities.sample.SamplePlace;
import gov.wa.wsdot.apps.mgwt.shared.Topic;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.google.web.bindery.event.shared.EventBus;
import com.googlecode.mgwt.mvp.client.MGWTAbstractActivity;
package gov.wa.wsdot.apps.mgwt.client.activities.home;
public class HomeActivity extends MGWTAbstractActivity implements
HomeView.Presenter {
| private final ClientFactory clientFactory; |
WSDOT/Archetypes | archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/home/HomeActivity.java | // Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/ClientFactory.java
// public interface ClientFactory {
//
// public HomeView getHomeView();
// public EventBus getEventBus();
// public PlaceController getPlaceController();
// public SwipeMenu getSwipeMenu();
//
// /**
// * @return
// */
// public AboutView getAboutView();
// public SampleView getSampleView();
// public MenuView getMenuView();
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/sample/SamplePlace.java
// public class SamplePlace extends Place {
//
// public static class SamplePlaceTokenizer implements
// PlaceTokenizer<SamplePlace> {
//
// @Override
// public SamplePlace getPlace(String token) {
// return new SamplePlace();
// }
//
// @Override
// public String getToken(SamplePlace place) {
// return "";
// }
//
// }
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/shared/Topic.java
// public class Topic implements Serializable {
//
// private static final long serialVersionUID = -134211444131752658L;
// private String name;
//
// public Topic() {
// }
//
// public Topic(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
| import java.util.ArrayList;
import java.util.List;
import gov.wa.wsdot.apps.mgwt.client.ClientFactory;
import gov.wa.wsdot.apps.mgwt.client.activities.sample.SamplePlace;
import gov.wa.wsdot.apps.mgwt.shared.Topic;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.google.web.bindery.event.shared.EventBus;
import com.googlecode.mgwt.mvp.client.MGWTAbstractActivity; | package gov.wa.wsdot.apps.mgwt.client.activities.home;
public class HomeActivity extends MGWTAbstractActivity implements
HomeView.Presenter {
private final ClientFactory clientFactory;
private HomeView view;
public HomeActivity(ClientFactory clientFactory) {
this.clientFactory = clientFactory;
}
@Override
public void start(AcceptsOneWidget panel, EventBus eventBus) {
view = clientFactory.getHomeView();
view.setPresenter(this);
view.render(createTopicsList());
view.refresh();
panel.setWidget(view);
}
| // Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/ClientFactory.java
// public interface ClientFactory {
//
// public HomeView getHomeView();
// public EventBus getEventBus();
// public PlaceController getPlaceController();
// public SwipeMenu getSwipeMenu();
//
// /**
// * @return
// */
// public AboutView getAboutView();
// public SampleView getSampleView();
// public MenuView getMenuView();
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/sample/SamplePlace.java
// public class SamplePlace extends Place {
//
// public static class SamplePlaceTokenizer implements
// PlaceTokenizer<SamplePlace> {
//
// @Override
// public SamplePlace getPlace(String token) {
// return new SamplePlace();
// }
//
// @Override
// public String getToken(SamplePlace place) {
// return "";
// }
//
// }
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/shared/Topic.java
// public class Topic implements Serializable {
//
// private static final long serialVersionUID = -134211444131752658L;
// private String name;
//
// public Topic() {
// }
//
// public Topic(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/home/HomeActivity.java
import java.util.ArrayList;
import java.util.List;
import gov.wa.wsdot.apps.mgwt.client.ClientFactory;
import gov.wa.wsdot.apps.mgwt.client.activities.sample.SamplePlace;
import gov.wa.wsdot.apps.mgwt.shared.Topic;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.google.web.bindery.event.shared.EventBus;
import com.googlecode.mgwt.mvp.client.MGWTAbstractActivity;
package gov.wa.wsdot.apps.mgwt.client.activities.home;
public class HomeActivity extends MGWTAbstractActivity implements
HomeView.Presenter {
private final ClientFactory clientFactory;
private HomeView view;
public HomeActivity(ClientFactory clientFactory) {
this.clientFactory = clientFactory;
}
@Override
public void start(AcceptsOneWidget panel, EventBus eventBus) {
view = clientFactory.getHomeView();
view.setPresenter(this);
view.render(createTopicsList());
view.refresh();
panel.setWidget(view);
}
| private List<Topic> createTopicsList() { |
WSDOT/Archetypes | archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/home/HomeActivity.java | // Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/ClientFactory.java
// public interface ClientFactory {
//
// public HomeView getHomeView();
// public EventBus getEventBus();
// public PlaceController getPlaceController();
// public SwipeMenu getSwipeMenu();
//
// /**
// * @return
// */
// public AboutView getAboutView();
// public SampleView getSampleView();
// public MenuView getMenuView();
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/sample/SamplePlace.java
// public class SamplePlace extends Place {
//
// public static class SamplePlaceTokenizer implements
// PlaceTokenizer<SamplePlace> {
//
// @Override
// public SamplePlace getPlace(String token) {
// return new SamplePlace();
// }
//
// @Override
// public String getToken(SamplePlace place) {
// return "";
// }
//
// }
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/shared/Topic.java
// public class Topic implements Serializable {
//
// private static final long serialVersionUID = -134211444131752658L;
// private String name;
//
// public Topic() {
// }
//
// public Topic(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
| import java.util.ArrayList;
import java.util.List;
import gov.wa.wsdot.apps.mgwt.client.ClientFactory;
import gov.wa.wsdot.apps.mgwt.client.activities.sample.SamplePlace;
import gov.wa.wsdot.apps.mgwt.shared.Topic;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.google.web.bindery.event.shared.EventBus;
import com.googlecode.mgwt.mvp.client.MGWTAbstractActivity; | package gov.wa.wsdot.apps.mgwt.client.activities.home;
public class HomeActivity extends MGWTAbstractActivity implements
HomeView.Presenter {
private final ClientFactory clientFactory;
private HomeView view;
public HomeActivity(ClientFactory clientFactory) {
this.clientFactory = clientFactory;
}
@Override
public void start(AcceptsOneWidget panel, EventBus eventBus) {
view = clientFactory.getHomeView();
view.setPresenter(this);
view.render(createTopicsList());
view.refresh();
panel.setWidget(view);
}
private List<Topic> createTopicsList() {
ArrayList<Topic> list = new ArrayList<Topic>();
list.add(new Topic("Sample Activity"));
return list;
}
@Override
public void onItemSelected(int index) {
if (index == 0) { | // Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/ClientFactory.java
// public interface ClientFactory {
//
// public HomeView getHomeView();
// public EventBus getEventBus();
// public PlaceController getPlaceController();
// public SwipeMenu getSwipeMenu();
//
// /**
// * @return
// */
// public AboutView getAboutView();
// public SampleView getSampleView();
// public MenuView getMenuView();
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/sample/SamplePlace.java
// public class SamplePlace extends Place {
//
// public static class SamplePlaceTokenizer implements
// PlaceTokenizer<SamplePlace> {
//
// @Override
// public SamplePlace getPlace(String token) {
// return new SamplePlace();
// }
//
// @Override
// public String getToken(SamplePlace place) {
// return "";
// }
//
// }
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/shared/Topic.java
// public class Topic implements Serializable {
//
// private static final long serialVersionUID = -134211444131752658L;
// private String name;
//
// public Topic() {
// }
//
// public Topic(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/home/HomeActivity.java
import java.util.ArrayList;
import java.util.List;
import gov.wa.wsdot.apps.mgwt.client.ClientFactory;
import gov.wa.wsdot.apps.mgwt.client.activities.sample.SamplePlace;
import gov.wa.wsdot.apps.mgwt.shared.Topic;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.google.web.bindery.event.shared.EventBus;
import com.googlecode.mgwt.mvp.client.MGWTAbstractActivity;
package gov.wa.wsdot.apps.mgwt.client.activities.home;
public class HomeActivity extends MGWTAbstractActivity implements
HomeView.Presenter {
private final ClientFactory clientFactory;
private HomeView view;
public HomeActivity(ClientFactory clientFactory) {
this.clientFactory = clientFactory;
}
@Override
public void start(AcceptsOneWidget panel, EventBus eventBus) {
view = clientFactory.getHomeView();
view.setPresenter(this);
view.render(createTopicsList());
view.refresh();
panel.setWidget(view);
}
private List<Topic> createTopicsList() {
ArrayList<Topic> list = new ArrayList<Topic>();
list.add(new Topic("Sample Activity"));
return list;
}
@Override
public void onItemSelected(int index) {
if (index == 0) { | clientFactory.getPlaceController().goTo(new SamplePlace()); |
WSDOT/Archetypes | archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/MenuActivity.java | // Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/ClientFactory.java
// public interface ClientFactory {
//
// public HomeView getHomeView();
// public EventBus getEventBus();
// public PlaceController getPlaceController();
// public SwipeMenu getSwipeMenu();
//
// /**
// * @return
// */
// public AboutView getAboutView();
// public SampleView getSampleView();
// public MenuView getMenuView();
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/about/AboutPlace.java
// public class AboutPlace extends Place {
//
// public static class AboutPlaceTokenizer implements
// PlaceTokenizer<AboutPlace> {
//
// @Override
// public AboutPlace getPlace(String token) {
// return new AboutPlace();
// }
//
// @Override
// public String getToken(AboutPlace place) {
// return "";
// }
//
// }
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/shared/Topic.java
// public class Topic implements Serializable {
//
// private static final long serialVersionUID = -134211444131752658L;
// private String name;
//
// public Topic() {
// }
//
// public Topic(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
| import java.util.ArrayList;
import java.util.List;
import gov.wa.wsdot.apps.mgwt.client.ClientFactory;
import gov.wa.wsdot.apps.mgwt.client.activities.about.AboutPlace;
import gov.wa.wsdot.apps.mgwt.shared.Topic;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.google.web.bindery.event.shared.EventBus;
import com.googlecode.mgwt.mvp.client.MGWTAbstractActivity; | package gov.wa.wsdot.apps.mgwt.client.activities;
public class MenuActivity extends MGWTAbstractActivity implements
MenuView.Presenter {
| // Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/ClientFactory.java
// public interface ClientFactory {
//
// public HomeView getHomeView();
// public EventBus getEventBus();
// public PlaceController getPlaceController();
// public SwipeMenu getSwipeMenu();
//
// /**
// * @return
// */
// public AboutView getAboutView();
// public SampleView getSampleView();
// public MenuView getMenuView();
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/about/AboutPlace.java
// public class AboutPlace extends Place {
//
// public static class AboutPlaceTokenizer implements
// PlaceTokenizer<AboutPlace> {
//
// @Override
// public AboutPlace getPlace(String token) {
// return new AboutPlace();
// }
//
// @Override
// public String getToken(AboutPlace place) {
// return "";
// }
//
// }
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/shared/Topic.java
// public class Topic implements Serializable {
//
// private static final long serialVersionUID = -134211444131752658L;
// private String name;
//
// public Topic() {
// }
//
// public Topic(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/MenuActivity.java
import java.util.ArrayList;
import java.util.List;
import gov.wa.wsdot.apps.mgwt.client.ClientFactory;
import gov.wa.wsdot.apps.mgwt.client.activities.about.AboutPlace;
import gov.wa.wsdot.apps.mgwt.shared.Topic;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.google.web.bindery.event.shared.EventBus;
import com.googlecode.mgwt.mvp.client.MGWTAbstractActivity;
package gov.wa.wsdot.apps.mgwt.client.activities;
public class MenuActivity extends MGWTAbstractActivity implements
MenuView.Presenter {
| private final ClientFactory clientFactory; |
WSDOT/Archetypes | archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/MenuActivity.java | // Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/ClientFactory.java
// public interface ClientFactory {
//
// public HomeView getHomeView();
// public EventBus getEventBus();
// public PlaceController getPlaceController();
// public SwipeMenu getSwipeMenu();
//
// /**
// * @return
// */
// public AboutView getAboutView();
// public SampleView getSampleView();
// public MenuView getMenuView();
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/about/AboutPlace.java
// public class AboutPlace extends Place {
//
// public static class AboutPlaceTokenizer implements
// PlaceTokenizer<AboutPlace> {
//
// @Override
// public AboutPlace getPlace(String token) {
// return new AboutPlace();
// }
//
// @Override
// public String getToken(AboutPlace place) {
// return "";
// }
//
// }
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/shared/Topic.java
// public class Topic implements Serializable {
//
// private static final long serialVersionUID = -134211444131752658L;
// private String name;
//
// public Topic() {
// }
//
// public Topic(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
| import java.util.ArrayList;
import java.util.List;
import gov.wa.wsdot.apps.mgwt.client.ClientFactory;
import gov.wa.wsdot.apps.mgwt.client.activities.about.AboutPlace;
import gov.wa.wsdot.apps.mgwt.shared.Topic;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.google.web.bindery.event.shared.EventBus;
import com.googlecode.mgwt.mvp.client.MGWTAbstractActivity; | panel.setWidget(view);
}
@Override
public void onStop() {
view.setPresenter(null);
}
@Override
public void onItemSelected(int index) {
if (index == 0) {
clientFactory.getSwipeMenu().close(false);
//clientFactory.getPlaceController().goTo(new MenuItemOnePlace());
return;
}
if (index == 1) {
clientFactory.getSwipeMenu().close(false);
//clientFactory.getPlaceController().goTo(new MenuItemTwoPlace());
return;
}
if (index == 2) {
clientFactory.getSwipeMenu().close(false);
//clientFactory.getPlaceController().goTo(new MenuItemThreePlace());
return;
}
}
@Override
public void onAboutButtonPressed() {
clientFactory.getSwipeMenu().close(false); | // Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/ClientFactory.java
// public interface ClientFactory {
//
// public HomeView getHomeView();
// public EventBus getEventBus();
// public PlaceController getPlaceController();
// public SwipeMenu getSwipeMenu();
//
// /**
// * @return
// */
// public AboutView getAboutView();
// public SampleView getSampleView();
// public MenuView getMenuView();
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/about/AboutPlace.java
// public class AboutPlace extends Place {
//
// public static class AboutPlaceTokenizer implements
// PlaceTokenizer<AboutPlace> {
//
// @Override
// public AboutPlace getPlace(String token) {
// return new AboutPlace();
// }
//
// @Override
// public String getToken(AboutPlace place) {
// return "";
// }
//
// }
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/shared/Topic.java
// public class Topic implements Serializable {
//
// private static final long serialVersionUID = -134211444131752658L;
// private String name;
//
// public Topic() {
// }
//
// public Topic(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/MenuActivity.java
import java.util.ArrayList;
import java.util.List;
import gov.wa.wsdot.apps.mgwt.client.ClientFactory;
import gov.wa.wsdot.apps.mgwt.client.activities.about.AboutPlace;
import gov.wa.wsdot.apps.mgwt.shared.Topic;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.google.web.bindery.event.shared.EventBus;
import com.googlecode.mgwt.mvp.client.MGWTAbstractActivity;
panel.setWidget(view);
}
@Override
public void onStop() {
view.setPresenter(null);
}
@Override
public void onItemSelected(int index) {
if (index == 0) {
clientFactory.getSwipeMenu().close(false);
//clientFactory.getPlaceController().goTo(new MenuItemOnePlace());
return;
}
if (index == 1) {
clientFactory.getSwipeMenu().close(false);
//clientFactory.getPlaceController().goTo(new MenuItemTwoPlace());
return;
}
if (index == 2) {
clientFactory.getSwipeMenu().close(false);
//clientFactory.getPlaceController().goTo(new MenuItemThreePlace());
return;
}
}
@Override
public void onAboutButtonPressed() {
clientFactory.getSwipeMenu().close(false); | clientFactory.getPlaceController().goTo(new AboutPlace()); |
WSDOT/Archetypes | archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/MenuActivity.java | // Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/ClientFactory.java
// public interface ClientFactory {
//
// public HomeView getHomeView();
// public EventBus getEventBus();
// public PlaceController getPlaceController();
// public SwipeMenu getSwipeMenu();
//
// /**
// * @return
// */
// public AboutView getAboutView();
// public SampleView getSampleView();
// public MenuView getMenuView();
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/about/AboutPlace.java
// public class AboutPlace extends Place {
//
// public static class AboutPlaceTokenizer implements
// PlaceTokenizer<AboutPlace> {
//
// @Override
// public AboutPlace getPlace(String token) {
// return new AboutPlace();
// }
//
// @Override
// public String getToken(AboutPlace place) {
// return "";
// }
//
// }
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/shared/Topic.java
// public class Topic implements Serializable {
//
// private static final long serialVersionUID = -134211444131752658L;
// private String name;
//
// public Topic() {
// }
//
// public Topic(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
| import java.util.ArrayList;
import java.util.List;
import gov.wa.wsdot.apps.mgwt.client.ClientFactory;
import gov.wa.wsdot.apps.mgwt.client.activities.about.AboutPlace;
import gov.wa.wsdot.apps.mgwt.shared.Topic;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.google.web.bindery.event.shared.EventBus;
import com.googlecode.mgwt.mvp.client.MGWTAbstractActivity; | @Override
public void onStop() {
view.setPresenter(null);
}
@Override
public void onItemSelected(int index) {
if (index == 0) {
clientFactory.getSwipeMenu().close(false);
//clientFactory.getPlaceController().goTo(new MenuItemOnePlace());
return;
}
if (index == 1) {
clientFactory.getSwipeMenu().close(false);
//clientFactory.getPlaceController().goTo(new MenuItemTwoPlace());
return;
}
if (index == 2) {
clientFactory.getSwipeMenu().close(false);
//clientFactory.getPlaceController().goTo(new MenuItemThreePlace());
return;
}
}
@Override
public void onAboutButtonPressed() {
clientFactory.getSwipeMenu().close(false);
clientFactory.getPlaceController().goTo(new AboutPlace());
}
| // Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/ClientFactory.java
// public interface ClientFactory {
//
// public HomeView getHomeView();
// public EventBus getEventBus();
// public PlaceController getPlaceController();
// public SwipeMenu getSwipeMenu();
//
// /**
// * @return
// */
// public AboutView getAboutView();
// public SampleView getSampleView();
// public MenuView getMenuView();
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/about/AboutPlace.java
// public class AboutPlace extends Place {
//
// public static class AboutPlaceTokenizer implements
// PlaceTokenizer<AboutPlace> {
//
// @Override
// public AboutPlace getPlace(String token) {
// return new AboutPlace();
// }
//
// @Override
// public String getToken(AboutPlace place) {
// return "";
// }
//
// }
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/shared/Topic.java
// public class Topic implements Serializable {
//
// private static final long serialVersionUID = -134211444131752658L;
// private String name;
//
// public Topic() {
// }
//
// public Topic(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/MenuActivity.java
import java.util.ArrayList;
import java.util.List;
import gov.wa.wsdot.apps.mgwt.client.ClientFactory;
import gov.wa.wsdot.apps.mgwt.client.activities.about.AboutPlace;
import gov.wa.wsdot.apps.mgwt.shared.Topic;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.google.web.bindery.event.shared.EventBus;
import com.googlecode.mgwt.mvp.client.MGWTAbstractActivity;
@Override
public void onStop() {
view.setPresenter(null);
}
@Override
public void onItemSelected(int index) {
if (index == 0) {
clientFactory.getSwipeMenu().close(false);
//clientFactory.getPlaceController().goTo(new MenuItemOnePlace());
return;
}
if (index == 1) {
clientFactory.getSwipeMenu().close(false);
//clientFactory.getPlaceController().goTo(new MenuItemTwoPlace());
return;
}
if (index == 2) {
clientFactory.getSwipeMenu().close(false);
//clientFactory.getPlaceController().goTo(new MenuItemThreePlace());
return;
}
}
@Override
public void onAboutButtonPressed() {
clientFactory.getSwipeMenu().close(false);
clientFactory.getPlaceController().goTo(new AboutPlace());
}
| private List<Topic> createTopicsList() { |
WSDOT/Archetypes | archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/home/HomeViewGwtImpl.java | // Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/widget/button/image/MenuImageButton.java
// public class MenuImageButton extends ImageButton {
//
// public MenuImageButton() {
// super(LocalImageHolder.get().menu());
// }
//
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/shared/Topic.java
// public class Topic implements Serializable {
//
// private static final long serialVersionUID = -134211444131752658L;
// private String name;
//
// public Topic() {
// }
//
// public Topic(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
| import java.util.List;
import gov.wa.wsdot.apps.mgwt.client.widget.button.image.MenuImageButton;
import gov.wa.wsdot.apps.mgwt.shared.Topic;
import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;
import com.googlecode.mgwt.dom.client.event.tap.TapEvent;
import com.googlecode.mgwt.ui.client.widget.list.celllist.BasicCell;
import com.googlecode.mgwt.ui.client.widget.list.celllist.CellList;
import com.googlecode.mgwt.ui.client.widget.list.celllist.CellSelectedEvent;
import com.googlecode.mgwt.ui.client.widget.panel.scroll.ScrollPanel; | package gov.wa.wsdot.apps.mgwt.client.activities.home;
public class HomeViewGwtImpl extends Composite implements HomeView {
/**
* The UiBinder interface.
*/
interface HomeViewGwtImplUiBinder extends UiBinder<Widget, HomeViewGwtImpl> {
}
/**
* The UiBinder used to generate the view.
*/
private static HomeViewGwtImplUiBinder uiBinder = GWT
.create(HomeViewGwtImplUiBinder.class);
@UiField | // Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/widget/button/image/MenuImageButton.java
// public class MenuImageButton extends ImageButton {
//
// public MenuImageButton() {
// super(LocalImageHolder.get().menu());
// }
//
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/shared/Topic.java
// public class Topic implements Serializable {
//
// private static final long serialVersionUID = -134211444131752658L;
// private String name;
//
// public Topic() {
// }
//
// public Topic(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/home/HomeViewGwtImpl.java
import java.util.List;
import gov.wa.wsdot.apps.mgwt.client.widget.button.image.MenuImageButton;
import gov.wa.wsdot.apps.mgwt.shared.Topic;
import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;
import com.googlecode.mgwt.dom.client.event.tap.TapEvent;
import com.googlecode.mgwt.ui.client.widget.list.celllist.BasicCell;
import com.googlecode.mgwt.ui.client.widget.list.celllist.CellList;
import com.googlecode.mgwt.ui.client.widget.list.celllist.CellSelectedEvent;
import com.googlecode.mgwt.ui.client.widget.panel.scroll.ScrollPanel;
package gov.wa.wsdot.apps.mgwt.client.activities.home;
public class HomeViewGwtImpl extends Composite implements HomeView {
/**
* The UiBinder interface.
*/
interface HomeViewGwtImplUiBinder extends UiBinder<Widget, HomeViewGwtImpl> {
}
/**
* The UiBinder used to generate the view.
*/
private static HomeViewGwtImplUiBinder uiBinder = GWT
.create(HomeViewGwtImplUiBinder.class);
@UiField | MenuImageButton menuButton; |
WSDOT/Archetypes | archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/home/HomeViewGwtImpl.java | // Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/widget/button/image/MenuImageButton.java
// public class MenuImageButton extends ImageButton {
//
// public MenuImageButton() {
// super(LocalImageHolder.get().menu());
// }
//
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/shared/Topic.java
// public class Topic implements Serializable {
//
// private static final long serialVersionUID = -134211444131752658L;
// private String name;
//
// public Topic() {
// }
//
// public Topic(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
| import java.util.List;
import gov.wa.wsdot.apps.mgwt.client.widget.button.image.MenuImageButton;
import gov.wa.wsdot.apps.mgwt.shared.Topic;
import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;
import com.googlecode.mgwt.dom.client.event.tap.TapEvent;
import com.googlecode.mgwt.ui.client.widget.list.celllist.BasicCell;
import com.googlecode.mgwt.ui.client.widget.list.celllist.CellList;
import com.googlecode.mgwt.ui.client.widget.list.celllist.CellSelectedEvent;
import com.googlecode.mgwt.ui.client.widget.panel.scroll.ScrollPanel; | package gov.wa.wsdot.apps.mgwt.client.activities.home;
public class HomeViewGwtImpl extends Composite implements HomeView {
/**
* The UiBinder interface.
*/
interface HomeViewGwtImplUiBinder extends UiBinder<Widget, HomeViewGwtImpl> {
}
/**
* The UiBinder used to generate the view.
*/
private static HomeViewGwtImplUiBinder uiBinder = GWT
.create(HomeViewGwtImplUiBinder.class);
@UiField
MenuImageButton menuButton;
@UiField
ScrollPanel scrollPanel;
@UiField(provided = true) | // Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/widget/button/image/MenuImageButton.java
// public class MenuImageButton extends ImageButton {
//
// public MenuImageButton() {
// super(LocalImageHolder.get().menu());
// }
//
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/shared/Topic.java
// public class Topic implements Serializable {
//
// private static final long serialVersionUID = -134211444131752658L;
// private String name;
//
// public Topic() {
// }
//
// public Topic(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/home/HomeViewGwtImpl.java
import java.util.List;
import gov.wa.wsdot.apps.mgwt.client.widget.button.image.MenuImageButton;
import gov.wa.wsdot.apps.mgwt.shared.Topic;
import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;
import com.googlecode.mgwt.dom.client.event.tap.TapEvent;
import com.googlecode.mgwt.ui.client.widget.list.celllist.BasicCell;
import com.googlecode.mgwt.ui.client.widget.list.celllist.CellList;
import com.googlecode.mgwt.ui.client.widget.list.celllist.CellSelectedEvent;
import com.googlecode.mgwt.ui.client.widget.panel.scroll.ScrollPanel;
package gov.wa.wsdot.apps.mgwt.client.activities.home;
public class HomeViewGwtImpl extends Composite implements HomeView {
/**
* The UiBinder interface.
*/
interface HomeViewGwtImplUiBinder extends UiBinder<Widget, HomeViewGwtImpl> {
}
/**
* The UiBinder used to generate the view.
*/
private static HomeViewGwtImplUiBinder uiBinder = GWT
.create(HomeViewGwtImplUiBinder.class);
@UiField
MenuImageButton menuButton;
@UiField
ScrollPanel scrollPanel;
@UiField(provided = true) | CellList<Topic> cellList; |
WSDOT/Archetypes | archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/about/AboutActivity.java | // Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/ClientFactory.java
// public interface ClientFactory {
//
// public HomeView getHomeView();
// public EventBus getEventBus();
// public PlaceController getPlaceController();
//
// /**
// * @return
// */
// public AboutView getAboutView();
// public SampleView getSampleView();
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/event/ActionEvent.java
// public class ActionEvent extends Event<ActionEvent.Handler> {
//
// public interface Handler {
// void onAction(ActionEvent event);
// }
//
// private static final Type<ActionEvent.Handler> TYPE = new Type<ActionEvent.Handler>();
//
// public static void fire(EventBus eventBus, String sourceName) {
// eventBus.fireEventFromSource(new ActionEvent(), sourceName);
// }
//
// public static HandlerRegistration register(EventBus eventBus,
// String sourceName, Handler handler) {
//
// return eventBus.addHandlerToSource(TYPE, sourceName, handler);
// }
//
// @Override
// public Type<Handler> getAssociatedType() {
// return TYPE;
// }
//
// @Override
// protected void dispatch(ActionEvent.Handler handler) {
// handler.onAction(this);
// }
//
// protected ActionEvent() {
// }
//
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/event/ActionNames.java
// public interface ActionNames {
// public static final String BACK = "back";
// public static final String ANIMATION_END = "ae";
// }
| import gov.wa.wsdot.apps.mgwtbasic.client.ClientFactory;
import gov.wa.wsdot.apps.mgwtbasic.client.event.ActionEvent;
import gov.wa.wsdot.apps.mgwtbasic.client.event.ActionNames;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.googlecode.mgwt.mvp.client.MGWTAbstractActivity; | package gov.wa.wsdot.apps.mgwtbasic.client.activities.about;
public class AboutActivity extends MGWTAbstractActivity implements
AboutView.Presenter {
| // Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/ClientFactory.java
// public interface ClientFactory {
//
// public HomeView getHomeView();
// public EventBus getEventBus();
// public PlaceController getPlaceController();
//
// /**
// * @return
// */
// public AboutView getAboutView();
// public SampleView getSampleView();
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/event/ActionEvent.java
// public class ActionEvent extends Event<ActionEvent.Handler> {
//
// public interface Handler {
// void onAction(ActionEvent event);
// }
//
// private static final Type<ActionEvent.Handler> TYPE = new Type<ActionEvent.Handler>();
//
// public static void fire(EventBus eventBus, String sourceName) {
// eventBus.fireEventFromSource(new ActionEvent(), sourceName);
// }
//
// public static HandlerRegistration register(EventBus eventBus,
// String sourceName, Handler handler) {
//
// return eventBus.addHandlerToSource(TYPE, sourceName, handler);
// }
//
// @Override
// public Type<Handler> getAssociatedType() {
// return TYPE;
// }
//
// @Override
// protected void dispatch(ActionEvent.Handler handler) {
// handler.onAction(this);
// }
//
// protected ActionEvent() {
// }
//
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/event/ActionNames.java
// public interface ActionNames {
// public static final String BACK = "back";
// public static final String ANIMATION_END = "ae";
// }
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/about/AboutActivity.java
import gov.wa.wsdot.apps.mgwtbasic.client.ClientFactory;
import gov.wa.wsdot.apps.mgwtbasic.client.event.ActionEvent;
import gov.wa.wsdot.apps.mgwtbasic.client.event.ActionNames;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.googlecode.mgwt.mvp.client.MGWTAbstractActivity;
package gov.wa.wsdot.apps.mgwtbasic.client.activities.about;
public class AboutActivity extends MGWTAbstractActivity implements
AboutView.Presenter {
| private final ClientFactory clientFactory; |
WSDOT/Archetypes | archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/about/AboutActivity.java | // Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/ClientFactory.java
// public interface ClientFactory {
//
// public HomeView getHomeView();
// public EventBus getEventBus();
// public PlaceController getPlaceController();
//
// /**
// * @return
// */
// public AboutView getAboutView();
// public SampleView getSampleView();
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/event/ActionEvent.java
// public class ActionEvent extends Event<ActionEvent.Handler> {
//
// public interface Handler {
// void onAction(ActionEvent event);
// }
//
// private static final Type<ActionEvent.Handler> TYPE = new Type<ActionEvent.Handler>();
//
// public static void fire(EventBus eventBus, String sourceName) {
// eventBus.fireEventFromSource(new ActionEvent(), sourceName);
// }
//
// public static HandlerRegistration register(EventBus eventBus,
// String sourceName, Handler handler) {
//
// return eventBus.addHandlerToSource(TYPE, sourceName, handler);
// }
//
// @Override
// public Type<Handler> getAssociatedType() {
// return TYPE;
// }
//
// @Override
// protected void dispatch(ActionEvent.Handler handler) {
// handler.onAction(this);
// }
//
// protected ActionEvent() {
// }
//
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/event/ActionNames.java
// public interface ActionNames {
// public static final String BACK = "back";
// public static final String ANIMATION_END = "ae";
// }
| import gov.wa.wsdot.apps.mgwtbasic.client.ClientFactory;
import gov.wa.wsdot.apps.mgwtbasic.client.event.ActionEvent;
import gov.wa.wsdot.apps.mgwtbasic.client.event.ActionNames;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.googlecode.mgwt.mvp.client.MGWTAbstractActivity; | package gov.wa.wsdot.apps.mgwtbasic.client.activities.about;
public class AboutActivity extends MGWTAbstractActivity implements
AboutView.Presenter {
private final ClientFactory clientFactory;
private AboutView view;
private EventBus eventBus;
public AboutActivity(ClientFactory clientFactory) {
this.clientFactory = clientFactory;
}
@Override
public void start(AcceptsOneWidget panel, final EventBus eventBus) {
view = clientFactory.getAboutView();
this.eventBus = eventBus;
view.setPresenter(this);
panel.setWidget(view);
}
@Override
public void onStop() {
view.setPresenter(null);
}
@Override
public void onBackButtonPressed() { | // Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/ClientFactory.java
// public interface ClientFactory {
//
// public HomeView getHomeView();
// public EventBus getEventBus();
// public PlaceController getPlaceController();
//
// /**
// * @return
// */
// public AboutView getAboutView();
// public SampleView getSampleView();
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/event/ActionEvent.java
// public class ActionEvent extends Event<ActionEvent.Handler> {
//
// public interface Handler {
// void onAction(ActionEvent event);
// }
//
// private static final Type<ActionEvent.Handler> TYPE = new Type<ActionEvent.Handler>();
//
// public static void fire(EventBus eventBus, String sourceName) {
// eventBus.fireEventFromSource(new ActionEvent(), sourceName);
// }
//
// public static HandlerRegistration register(EventBus eventBus,
// String sourceName, Handler handler) {
//
// return eventBus.addHandlerToSource(TYPE, sourceName, handler);
// }
//
// @Override
// public Type<Handler> getAssociatedType() {
// return TYPE;
// }
//
// @Override
// protected void dispatch(ActionEvent.Handler handler) {
// handler.onAction(this);
// }
//
// protected ActionEvent() {
// }
//
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/event/ActionNames.java
// public interface ActionNames {
// public static final String BACK = "back";
// public static final String ANIMATION_END = "ae";
// }
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/about/AboutActivity.java
import gov.wa.wsdot.apps.mgwtbasic.client.ClientFactory;
import gov.wa.wsdot.apps.mgwtbasic.client.event.ActionEvent;
import gov.wa.wsdot.apps.mgwtbasic.client.event.ActionNames;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.googlecode.mgwt.mvp.client.MGWTAbstractActivity;
package gov.wa.wsdot.apps.mgwtbasic.client.activities.about;
public class AboutActivity extends MGWTAbstractActivity implements
AboutView.Presenter {
private final ClientFactory clientFactory;
private AboutView view;
private EventBus eventBus;
public AboutActivity(ClientFactory clientFactory) {
this.clientFactory = clientFactory;
}
@Override
public void start(AcceptsOneWidget panel, final EventBus eventBus) {
view = clientFactory.getAboutView();
this.eventBus = eventBus;
view.setPresenter(this);
panel.setWidget(view);
}
@Override
public void onStop() {
view.setPresenter(null);
}
@Override
public void onBackButtonPressed() { | ActionEvent.fire(eventBus, ActionNames.BACK); |
WSDOT/Archetypes | archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/about/AboutActivity.java | // Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/ClientFactory.java
// public interface ClientFactory {
//
// public HomeView getHomeView();
// public EventBus getEventBus();
// public PlaceController getPlaceController();
//
// /**
// * @return
// */
// public AboutView getAboutView();
// public SampleView getSampleView();
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/event/ActionEvent.java
// public class ActionEvent extends Event<ActionEvent.Handler> {
//
// public interface Handler {
// void onAction(ActionEvent event);
// }
//
// private static final Type<ActionEvent.Handler> TYPE = new Type<ActionEvent.Handler>();
//
// public static void fire(EventBus eventBus, String sourceName) {
// eventBus.fireEventFromSource(new ActionEvent(), sourceName);
// }
//
// public static HandlerRegistration register(EventBus eventBus,
// String sourceName, Handler handler) {
//
// return eventBus.addHandlerToSource(TYPE, sourceName, handler);
// }
//
// @Override
// public Type<Handler> getAssociatedType() {
// return TYPE;
// }
//
// @Override
// protected void dispatch(ActionEvent.Handler handler) {
// handler.onAction(this);
// }
//
// protected ActionEvent() {
// }
//
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/event/ActionNames.java
// public interface ActionNames {
// public static final String BACK = "back";
// public static final String ANIMATION_END = "ae";
// }
| import gov.wa.wsdot.apps.mgwtbasic.client.ClientFactory;
import gov.wa.wsdot.apps.mgwtbasic.client.event.ActionEvent;
import gov.wa.wsdot.apps.mgwtbasic.client.event.ActionNames;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.googlecode.mgwt.mvp.client.MGWTAbstractActivity; | package gov.wa.wsdot.apps.mgwtbasic.client.activities.about;
public class AboutActivity extends MGWTAbstractActivity implements
AboutView.Presenter {
private final ClientFactory clientFactory;
private AboutView view;
private EventBus eventBus;
public AboutActivity(ClientFactory clientFactory) {
this.clientFactory = clientFactory;
}
@Override
public void start(AcceptsOneWidget panel, final EventBus eventBus) {
view = clientFactory.getAboutView();
this.eventBus = eventBus;
view.setPresenter(this);
panel.setWidget(view);
}
@Override
public void onStop() {
view.setPresenter(null);
}
@Override
public void onBackButtonPressed() { | // Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/ClientFactory.java
// public interface ClientFactory {
//
// public HomeView getHomeView();
// public EventBus getEventBus();
// public PlaceController getPlaceController();
//
// /**
// * @return
// */
// public AboutView getAboutView();
// public SampleView getSampleView();
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/event/ActionEvent.java
// public class ActionEvent extends Event<ActionEvent.Handler> {
//
// public interface Handler {
// void onAction(ActionEvent event);
// }
//
// private static final Type<ActionEvent.Handler> TYPE = new Type<ActionEvent.Handler>();
//
// public static void fire(EventBus eventBus, String sourceName) {
// eventBus.fireEventFromSource(new ActionEvent(), sourceName);
// }
//
// public static HandlerRegistration register(EventBus eventBus,
// String sourceName, Handler handler) {
//
// return eventBus.addHandlerToSource(TYPE, sourceName, handler);
// }
//
// @Override
// public Type<Handler> getAssociatedType() {
// return TYPE;
// }
//
// @Override
// protected void dispatch(ActionEvent.Handler handler) {
// handler.onAction(this);
// }
//
// protected ActionEvent() {
// }
//
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/event/ActionNames.java
// public interface ActionNames {
// public static final String BACK = "back";
// public static final String ANIMATION_END = "ae";
// }
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/about/AboutActivity.java
import gov.wa.wsdot.apps.mgwtbasic.client.ClientFactory;
import gov.wa.wsdot.apps.mgwtbasic.client.event.ActionEvent;
import gov.wa.wsdot.apps.mgwtbasic.client.event.ActionNames;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.googlecode.mgwt.mvp.client.MGWTAbstractActivity;
package gov.wa.wsdot.apps.mgwtbasic.client.activities.about;
public class AboutActivity extends MGWTAbstractActivity implements
AboutView.Presenter {
private final ClientFactory clientFactory;
private AboutView view;
private EventBus eventBus;
public AboutActivity(ClientFactory clientFactory) {
this.clientFactory = clientFactory;
}
@Override
public void start(AcceptsOneWidget panel, final EventBus eventBus) {
view = clientFactory.getAboutView();
this.eventBus = eventBus;
view.setPresenter(this);
panel.setWidget(view);
}
@Override
public void onStop() {
view.setPresenter(null);
}
@Override
public void onBackButtonPressed() { | ActionEvent.fire(eventBus, ActionNames.BACK); |
WSDOT/Archetypes | archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/sample/SampleActivity.java | // Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/ClientFactory.java
// public interface ClientFactory {
//
// public HomeView getHomeView();
// public EventBus getEventBus();
// public PlaceController getPlaceController();
//
// /**
// * @return
// */
// public AboutView getAboutView();
// public SampleView getSampleView();
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/event/ActionEvent.java
// public class ActionEvent extends Event<ActionEvent.Handler> {
//
// public interface Handler {
// void onAction(ActionEvent event);
// }
//
// private static final Type<ActionEvent.Handler> TYPE = new Type<ActionEvent.Handler>();
//
// public static void fire(EventBus eventBus, String sourceName) {
// eventBus.fireEventFromSource(new ActionEvent(), sourceName);
// }
//
// public static HandlerRegistration register(EventBus eventBus,
// String sourceName, Handler handler) {
//
// return eventBus.addHandlerToSource(TYPE, sourceName, handler);
// }
//
// @Override
// public Type<Handler> getAssociatedType() {
// return TYPE;
// }
//
// @Override
// protected void dispatch(ActionEvent.Handler handler) {
// handler.onAction(this);
// }
//
// protected ActionEvent() {
// }
//
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/event/ActionNames.java
// public interface ActionNames {
// public static final String BACK = "back";
// public static final String ANIMATION_END = "ae";
// }
| import gov.wa.wsdot.apps.mgwtbasic.client.ClientFactory;
import gov.wa.wsdot.apps.mgwtbasic.client.event.ActionEvent;
import gov.wa.wsdot.apps.mgwtbasic.client.event.ActionNames;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.googlecode.mgwt.mvp.client.MGWTAbstractActivity; | package gov.wa.wsdot.apps.mgwtbasic.client.activities.sample;
public class SampleActivity extends MGWTAbstractActivity implements
SampleView.Presenter {
| // Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/ClientFactory.java
// public interface ClientFactory {
//
// public HomeView getHomeView();
// public EventBus getEventBus();
// public PlaceController getPlaceController();
//
// /**
// * @return
// */
// public AboutView getAboutView();
// public SampleView getSampleView();
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/event/ActionEvent.java
// public class ActionEvent extends Event<ActionEvent.Handler> {
//
// public interface Handler {
// void onAction(ActionEvent event);
// }
//
// private static final Type<ActionEvent.Handler> TYPE = new Type<ActionEvent.Handler>();
//
// public static void fire(EventBus eventBus, String sourceName) {
// eventBus.fireEventFromSource(new ActionEvent(), sourceName);
// }
//
// public static HandlerRegistration register(EventBus eventBus,
// String sourceName, Handler handler) {
//
// return eventBus.addHandlerToSource(TYPE, sourceName, handler);
// }
//
// @Override
// public Type<Handler> getAssociatedType() {
// return TYPE;
// }
//
// @Override
// protected void dispatch(ActionEvent.Handler handler) {
// handler.onAction(this);
// }
//
// protected ActionEvent() {
// }
//
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/event/ActionNames.java
// public interface ActionNames {
// public static final String BACK = "back";
// public static final String ANIMATION_END = "ae";
// }
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/sample/SampleActivity.java
import gov.wa.wsdot.apps.mgwtbasic.client.ClientFactory;
import gov.wa.wsdot.apps.mgwtbasic.client.event.ActionEvent;
import gov.wa.wsdot.apps.mgwtbasic.client.event.ActionNames;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.googlecode.mgwt.mvp.client.MGWTAbstractActivity;
package gov.wa.wsdot.apps.mgwtbasic.client.activities.sample;
public class SampleActivity extends MGWTAbstractActivity implements
SampleView.Presenter {
| private final ClientFactory clientFactory; |
WSDOT/Archetypes | archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/sample/SampleActivity.java | // Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/ClientFactory.java
// public interface ClientFactory {
//
// public HomeView getHomeView();
// public EventBus getEventBus();
// public PlaceController getPlaceController();
//
// /**
// * @return
// */
// public AboutView getAboutView();
// public SampleView getSampleView();
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/event/ActionEvent.java
// public class ActionEvent extends Event<ActionEvent.Handler> {
//
// public interface Handler {
// void onAction(ActionEvent event);
// }
//
// private static final Type<ActionEvent.Handler> TYPE = new Type<ActionEvent.Handler>();
//
// public static void fire(EventBus eventBus, String sourceName) {
// eventBus.fireEventFromSource(new ActionEvent(), sourceName);
// }
//
// public static HandlerRegistration register(EventBus eventBus,
// String sourceName, Handler handler) {
//
// return eventBus.addHandlerToSource(TYPE, sourceName, handler);
// }
//
// @Override
// public Type<Handler> getAssociatedType() {
// return TYPE;
// }
//
// @Override
// protected void dispatch(ActionEvent.Handler handler) {
// handler.onAction(this);
// }
//
// protected ActionEvent() {
// }
//
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/event/ActionNames.java
// public interface ActionNames {
// public static final String BACK = "back";
// public static final String ANIMATION_END = "ae";
// }
| import gov.wa.wsdot.apps.mgwtbasic.client.ClientFactory;
import gov.wa.wsdot.apps.mgwtbasic.client.event.ActionEvent;
import gov.wa.wsdot.apps.mgwtbasic.client.event.ActionNames;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.googlecode.mgwt.mvp.client.MGWTAbstractActivity; | package gov.wa.wsdot.apps.mgwtbasic.client.activities.sample;
public class SampleActivity extends MGWTAbstractActivity implements
SampleView.Presenter {
private final ClientFactory clientFactory;
private SampleView view;
private EventBus eventBus;
public SampleActivity(ClientFactory clientFactory) {
this.clientFactory = clientFactory;
}
@Override
public void start(AcceptsOneWidget panel, final EventBus eventBus) {
view = clientFactory.getSampleView();
this.eventBus = eventBus;
view.setPresenter(this);
panel.setWidget(view);
}
@Override
public void onStop() {
view.setPresenter(null);
}
@Override
public void onBackButtonPressed() { | // Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/ClientFactory.java
// public interface ClientFactory {
//
// public HomeView getHomeView();
// public EventBus getEventBus();
// public PlaceController getPlaceController();
//
// /**
// * @return
// */
// public AboutView getAboutView();
// public SampleView getSampleView();
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/event/ActionEvent.java
// public class ActionEvent extends Event<ActionEvent.Handler> {
//
// public interface Handler {
// void onAction(ActionEvent event);
// }
//
// private static final Type<ActionEvent.Handler> TYPE = new Type<ActionEvent.Handler>();
//
// public static void fire(EventBus eventBus, String sourceName) {
// eventBus.fireEventFromSource(new ActionEvent(), sourceName);
// }
//
// public static HandlerRegistration register(EventBus eventBus,
// String sourceName, Handler handler) {
//
// return eventBus.addHandlerToSource(TYPE, sourceName, handler);
// }
//
// @Override
// public Type<Handler> getAssociatedType() {
// return TYPE;
// }
//
// @Override
// protected void dispatch(ActionEvent.Handler handler) {
// handler.onAction(this);
// }
//
// protected ActionEvent() {
// }
//
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/event/ActionNames.java
// public interface ActionNames {
// public static final String BACK = "back";
// public static final String ANIMATION_END = "ae";
// }
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/sample/SampleActivity.java
import gov.wa.wsdot.apps.mgwtbasic.client.ClientFactory;
import gov.wa.wsdot.apps.mgwtbasic.client.event.ActionEvent;
import gov.wa.wsdot.apps.mgwtbasic.client.event.ActionNames;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.googlecode.mgwt.mvp.client.MGWTAbstractActivity;
package gov.wa.wsdot.apps.mgwtbasic.client.activities.sample;
public class SampleActivity extends MGWTAbstractActivity implements
SampleView.Presenter {
private final ClientFactory clientFactory;
private SampleView view;
private EventBus eventBus;
public SampleActivity(ClientFactory clientFactory) {
this.clientFactory = clientFactory;
}
@Override
public void start(AcceptsOneWidget panel, final EventBus eventBus) {
view = clientFactory.getSampleView();
this.eventBus = eventBus;
view.setPresenter(this);
panel.setWidget(view);
}
@Override
public void onStop() {
view.setPresenter(null);
}
@Override
public void onBackButtonPressed() { | ActionEvent.fire(eventBus, ActionNames.BACK); |
WSDOT/Archetypes | archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/sample/SampleActivity.java | // Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/ClientFactory.java
// public interface ClientFactory {
//
// public HomeView getHomeView();
// public EventBus getEventBus();
// public PlaceController getPlaceController();
//
// /**
// * @return
// */
// public AboutView getAboutView();
// public SampleView getSampleView();
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/event/ActionEvent.java
// public class ActionEvent extends Event<ActionEvent.Handler> {
//
// public interface Handler {
// void onAction(ActionEvent event);
// }
//
// private static final Type<ActionEvent.Handler> TYPE = new Type<ActionEvent.Handler>();
//
// public static void fire(EventBus eventBus, String sourceName) {
// eventBus.fireEventFromSource(new ActionEvent(), sourceName);
// }
//
// public static HandlerRegistration register(EventBus eventBus,
// String sourceName, Handler handler) {
//
// return eventBus.addHandlerToSource(TYPE, sourceName, handler);
// }
//
// @Override
// public Type<Handler> getAssociatedType() {
// return TYPE;
// }
//
// @Override
// protected void dispatch(ActionEvent.Handler handler) {
// handler.onAction(this);
// }
//
// protected ActionEvent() {
// }
//
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/event/ActionNames.java
// public interface ActionNames {
// public static final String BACK = "back";
// public static final String ANIMATION_END = "ae";
// }
| import gov.wa.wsdot.apps.mgwtbasic.client.ClientFactory;
import gov.wa.wsdot.apps.mgwtbasic.client.event.ActionEvent;
import gov.wa.wsdot.apps.mgwtbasic.client.event.ActionNames;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.googlecode.mgwt.mvp.client.MGWTAbstractActivity; | package gov.wa.wsdot.apps.mgwtbasic.client.activities.sample;
public class SampleActivity extends MGWTAbstractActivity implements
SampleView.Presenter {
private final ClientFactory clientFactory;
private SampleView view;
private EventBus eventBus;
public SampleActivity(ClientFactory clientFactory) {
this.clientFactory = clientFactory;
}
@Override
public void start(AcceptsOneWidget panel, final EventBus eventBus) {
view = clientFactory.getSampleView();
this.eventBus = eventBus;
view.setPresenter(this);
panel.setWidget(view);
}
@Override
public void onStop() {
view.setPresenter(null);
}
@Override
public void onBackButtonPressed() { | // Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/ClientFactory.java
// public interface ClientFactory {
//
// public HomeView getHomeView();
// public EventBus getEventBus();
// public PlaceController getPlaceController();
//
// /**
// * @return
// */
// public AboutView getAboutView();
// public SampleView getSampleView();
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/event/ActionEvent.java
// public class ActionEvent extends Event<ActionEvent.Handler> {
//
// public interface Handler {
// void onAction(ActionEvent event);
// }
//
// private static final Type<ActionEvent.Handler> TYPE = new Type<ActionEvent.Handler>();
//
// public static void fire(EventBus eventBus, String sourceName) {
// eventBus.fireEventFromSource(new ActionEvent(), sourceName);
// }
//
// public static HandlerRegistration register(EventBus eventBus,
// String sourceName, Handler handler) {
//
// return eventBus.addHandlerToSource(TYPE, sourceName, handler);
// }
//
// @Override
// public Type<Handler> getAssociatedType() {
// return TYPE;
// }
//
// @Override
// protected void dispatch(ActionEvent.Handler handler) {
// handler.onAction(this);
// }
//
// protected ActionEvent() {
// }
//
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/event/ActionNames.java
// public interface ActionNames {
// public static final String BACK = "back";
// public static final String ANIMATION_END = "ae";
// }
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/sample/SampleActivity.java
import gov.wa.wsdot.apps.mgwtbasic.client.ClientFactory;
import gov.wa.wsdot.apps.mgwtbasic.client.event.ActionEvent;
import gov.wa.wsdot.apps.mgwtbasic.client.event.ActionNames;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.googlecode.mgwt.mvp.client.MGWTAbstractActivity;
package gov.wa.wsdot.apps.mgwtbasic.client.activities.sample;
public class SampleActivity extends MGWTAbstractActivity implements
SampleView.Presenter {
private final ClientFactory clientFactory;
private SampleView view;
private EventBus eventBus;
public SampleActivity(ClientFactory clientFactory) {
this.clientFactory = clientFactory;
}
@Override
public void start(AcceptsOneWidget panel, final EventBus eventBus) {
view = clientFactory.getSampleView();
this.eventBus = eventBus;
view.setPresenter(this);
panel.setWidget(view);
}
@Override
public void onStop() {
view.setPresenter(null);
}
@Override
public void onBackButtonPressed() { | ActionEvent.fire(eventBus, ActionNames.BACK); |
WSDOT/Archetypes | archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/AppHistoryObserver.java | // Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/event/ActionEvent.java
// public class ActionEvent extends Event<ActionEvent.Handler> {
//
// public interface Handler {
// void onAction(ActionEvent event);
// }
//
// private static final Type<ActionEvent.Handler> TYPE = new Type<ActionEvent.Handler>();
//
// public static void fire(EventBus eventBus, String sourceName) {
// eventBus.fireEventFromSource(new ActionEvent(), sourceName);
// }
//
// public static HandlerRegistration register(EventBus eventBus,
// String sourceName, Handler handler) {
//
// return eventBus.addHandlerToSource(TYPE, sourceName, handler);
// }
//
// @Override
// public Type<Handler> getAssociatedType() {
// return TYPE;
// }
//
// @Override
// protected void dispatch(ActionEvent.Handler handler) {
// handler.onAction(this);
// }
//
// protected ActionEvent() {
// }
//
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/event/ActionNames.java
// public interface ActionNames {
// public static final String BACK = "back";
// public static final String ANIMATION_END = "ae";
// }
| import gov.wa.wsdot.apps.mgwt.client.event.ActionEvent;
import gov.wa.wsdot.apps.mgwt.client.event.ActionNames;
import com.google.gwt.place.shared.Place;
import com.google.gwt.user.client.History;
import com.google.web.bindery.event.shared.EventBus;
import com.google.web.bindery.event.shared.HandlerRegistration;
import com.googlecode.mgwt.dom.client.event.mouse.HandlerRegistrationCollection;
import com.googlecode.mgwt.mvp.client.history.HistoryHandler;
import com.googlecode.mgwt.mvp.client.history.HistoryObserver; | package gov.wa.wsdot.apps.mgwt.client;
public class AppHistoryObserver implements HistoryObserver {
@Override
public void onPlaceChange(Place place, HistoryHandler handler) {
}
@Override
public void onHistoryChanged(Place place, HistoryHandler handler) {
}
@Override
public void onAppStarted(Place place, HistoryHandler historyHandler) {
onPhoneNav(place, historyHandler);
}
@Override
public HandlerRegistration bind(EventBus eventBus, final HistoryHandler historyHandler) {
| // Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/event/ActionEvent.java
// public class ActionEvent extends Event<ActionEvent.Handler> {
//
// public interface Handler {
// void onAction(ActionEvent event);
// }
//
// private static final Type<ActionEvent.Handler> TYPE = new Type<ActionEvent.Handler>();
//
// public static void fire(EventBus eventBus, String sourceName) {
// eventBus.fireEventFromSource(new ActionEvent(), sourceName);
// }
//
// public static HandlerRegistration register(EventBus eventBus,
// String sourceName, Handler handler) {
//
// return eventBus.addHandlerToSource(TYPE, sourceName, handler);
// }
//
// @Override
// public Type<Handler> getAssociatedType() {
// return TYPE;
// }
//
// @Override
// protected void dispatch(ActionEvent.Handler handler) {
// handler.onAction(this);
// }
//
// protected ActionEvent() {
// }
//
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/event/ActionNames.java
// public interface ActionNames {
// public static final String BACK = "back";
// public static final String ANIMATION_END = "ae";
// }
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/AppHistoryObserver.java
import gov.wa.wsdot.apps.mgwt.client.event.ActionEvent;
import gov.wa.wsdot.apps.mgwt.client.event.ActionNames;
import com.google.gwt.place.shared.Place;
import com.google.gwt.user.client.History;
import com.google.web.bindery.event.shared.EventBus;
import com.google.web.bindery.event.shared.HandlerRegistration;
import com.googlecode.mgwt.dom.client.event.mouse.HandlerRegistrationCollection;
import com.googlecode.mgwt.mvp.client.history.HistoryHandler;
import com.googlecode.mgwt.mvp.client.history.HistoryObserver;
package gov.wa.wsdot.apps.mgwt.client;
public class AppHistoryObserver implements HistoryObserver {
@Override
public void onPlaceChange(Place place, HistoryHandler handler) {
}
@Override
public void onHistoryChanged(Place place, HistoryHandler handler) {
}
@Override
public void onAppStarted(Place place, HistoryHandler historyHandler) {
onPhoneNav(place, historyHandler);
}
@Override
public HandlerRegistration bind(EventBus eventBus, final HistoryHandler historyHandler) {
| HandlerRegistration backButtonRegistration = ActionEvent.register( |
WSDOT/Archetypes | archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/AppHistoryObserver.java | // Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/event/ActionEvent.java
// public class ActionEvent extends Event<ActionEvent.Handler> {
//
// public interface Handler {
// void onAction(ActionEvent event);
// }
//
// private static final Type<ActionEvent.Handler> TYPE = new Type<ActionEvent.Handler>();
//
// public static void fire(EventBus eventBus, String sourceName) {
// eventBus.fireEventFromSource(new ActionEvent(), sourceName);
// }
//
// public static HandlerRegistration register(EventBus eventBus,
// String sourceName, Handler handler) {
//
// return eventBus.addHandlerToSource(TYPE, sourceName, handler);
// }
//
// @Override
// public Type<Handler> getAssociatedType() {
// return TYPE;
// }
//
// @Override
// protected void dispatch(ActionEvent.Handler handler) {
// handler.onAction(this);
// }
//
// protected ActionEvent() {
// }
//
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/event/ActionNames.java
// public interface ActionNames {
// public static final String BACK = "back";
// public static final String ANIMATION_END = "ae";
// }
| import gov.wa.wsdot.apps.mgwt.client.event.ActionEvent;
import gov.wa.wsdot.apps.mgwt.client.event.ActionNames;
import com.google.gwt.place.shared.Place;
import com.google.gwt.user.client.History;
import com.google.web.bindery.event.shared.EventBus;
import com.google.web.bindery.event.shared.HandlerRegistration;
import com.googlecode.mgwt.dom.client.event.mouse.HandlerRegistrationCollection;
import com.googlecode.mgwt.mvp.client.history.HistoryHandler;
import com.googlecode.mgwt.mvp.client.history.HistoryObserver; | package gov.wa.wsdot.apps.mgwt.client;
public class AppHistoryObserver implements HistoryObserver {
@Override
public void onPlaceChange(Place place, HistoryHandler handler) {
}
@Override
public void onHistoryChanged(Place place, HistoryHandler handler) {
}
@Override
public void onAppStarted(Place place, HistoryHandler historyHandler) {
onPhoneNav(place, historyHandler);
}
@Override
public HandlerRegistration bind(EventBus eventBus, final HistoryHandler historyHandler) {
HandlerRegistration backButtonRegistration = ActionEvent.register( | // Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/event/ActionEvent.java
// public class ActionEvent extends Event<ActionEvent.Handler> {
//
// public interface Handler {
// void onAction(ActionEvent event);
// }
//
// private static final Type<ActionEvent.Handler> TYPE = new Type<ActionEvent.Handler>();
//
// public static void fire(EventBus eventBus, String sourceName) {
// eventBus.fireEventFromSource(new ActionEvent(), sourceName);
// }
//
// public static HandlerRegistration register(EventBus eventBus,
// String sourceName, Handler handler) {
//
// return eventBus.addHandlerToSource(TYPE, sourceName, handler);
// }
//
// @Override
// public Type<Handler> getAssociatedType() {
// return TYPE;
// }
//
// @Override
// protected void dispatch(ActionEvent.Handler handler) {
// handler.onAction(this);
// }
//
// protected ActionEvent() {
// }
//
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/event/ActionNames.java
// public interface ActionNames {
// public static final String BACK = "back";
// public static final String ANIMATION_END = "ae";
// }
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/AppHistoryObserver.java
import gov.wa.wsdot.apps.mgwt.client.event.ActionEvent;
import gov.wa.wsdot.apps.mgwt.client.event.ActionNames;
import com.google.gwt.place.shared.Place;
import com.google.gwt.user.client.History;
import com.google.web.bindery.event.shared.EventBus;
import com.google.web.bindery.event.shared.HandlerRegistration;
import com.googlecode.mgwt.dom.client.event.mouse.HandlerRegistrationCollection;
import com.googlecode.mgwt.mvp.client.history.HistoryHandler;
import com.googlecode.mgwt.mvp.client.history.HistoryObserver;
package gov.wa.wsdot.apps.mgwt.client;
public class AppHistoryObserver implements HistoryObserver {
@Override
public void onPlaceChange(Place place, HistoryHandler handler) {
}
@Override
public void onHistoryChanged(Place place, HistoryHandler handler) {
}
@Override
public void onAppStarted(Place place, HistoryHandler historyHandler) {
onPhoneNav(place, historyHandler);
}
@Override
public HandlerRegistration bind(EventBus eventBus, final HistoryHandler historyHandler) {
HandlerRegistration backButtonRegistration = ActionEvent.register( | eventBus, ActionNames.BACK, new ActionEvent.Handler() { |
WSDOT/Archetypes | archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/AppMainAnimationMapper.java | // Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/about/AboutPlace.java
// public class AboutPlace extends Place {
//
// public static class AboutPlaceTokenizer implements
// PlaceTokenizer<AboutPlace> {
//
// @Override
// public AboutPlace getPlace(String token) {
// return new AboutPlace();
// }
//
// @Override
// public String getToken(AboutPlace place) {
// return "";
// }
//
// }
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/home/HomePlace.java
// public class HomePlace extends Place {
//
// public static class HomePlaceTokenizer implements PlaceTokenizer<HomePlace> {
//
// @Override
// public HomePlace getPlace(String token) {
// return new HomePlace();
// }
//
// @Override
// public String getToken(HomePlace place) {
// return "";
// }
//
// }
//
// @Override
// public int hashCode() {
// return 3;
// }
//
// @Override
// public boolean equals(Object other) {
// if (other == this) {
// return true;
// }
//
// if (other == null) {
// return false;
// }
//
// if (other instanceof HomePlace) {
// return true;
// }
//
// return false;
// }
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/sample/SamplePlace.java
// public class SamplePlace extends Place {
//
// public static class SamplePlaceTokenizer implements
// PlaceTokenizer<SamplePlace> {
//
// @Override
// public SamplePlace getPlace(String token) {
// return new SamplePlace();
// }
//
// @Override
// public String getToken(SamplePlace place) {
// return "";
// }
//
// }
// }
| import gov.wa.wsdot.apps.mgwt.client.activities.about.AboutPlace;
import gov.wa.wsdot.apps.mgwt.client.activities.home.HomePlace;
import gov.wa.wsdot.apps.mgwt.client.activities.sample.SamplePlace;
import com.google.gwt.place.shared.Place;
import com.googlecode.mgwt.mvp.client.AnimationMapper;
import com.googlecode.mgwt.ui.client.widget.animation.Animation;
import com.googlecode.mgwt.ui.client.widget.animation.Animations; | package gov.wa.wsdot.apps.mgwt.client;
public class AppMainAnimationMapper implements AnimationMapper {
@Override
public Animation getAnimation(Place oldPlace, Place newPlace) {
if (oldPlace == null) {
return Animations.FADE;
}
| // Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/about/AboutPlace.java
// public class AboutPlace extends Place {
//
// public static class AboutPlaceTokenizer implements
// PlaceTokenizer<AboutPlace> {
//
// @Override
// public AboutPlace getPlace(String token) {
// return new AboutPlace();
// }
//
// @Override
// public String getToken(AboutPlace place) {
// return "";
// }
//
// }
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/home/HomePlace.java
// public class HomePlace extends Place {
//
// public static class HomePlaceTokenizer implements PlaceTokenizer<HomePlace> {
//
// @Override
// public HomePlace getPlace(String token) {
// return new HomePlace();
// }
//
// @Override
// public String getToken(HomePlace place) {
// return "";
// }
//
// }
//
// @Override
// public int hashCode() {
// return 3;
// }
//
// @Override
// public boolean equals(Object other) {
// if (other == this) {
// return true;
// }
//
// if (other == null) {
// return false;
// }
//
// if (other instanceof HomePlace) {
// return true;
// }
//
// return false;
// }
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/sample/SamplePlace.java
// public class SamplePlace extends Place {
//
// public static class SamplePlaceTokenizer implements
// PlaceTokenizer<SamplePlace> {
//
// @Override
// public SamplePlace getPlace(String token) {
// return new SamplePlace();
// }
//
// @Override
// public String getToken(SamplePlace place) {
// return "";
// }
//
// }
// }
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/AppMainAnimationMapper.java
import gov.wa.wsdot.apps.mgwt.client.activities.about.AboutPlace;
import gov.wa.wsdot.apps.mgwt.client.activities.home.HomePlace;
import gov.wa.wsdot.apps.mgwt.client.activities.sample.SamplePlace;
import com.google.gwt.place.shared.Place;
import com.googlecode.mgwt.mvp.client.AnimationMapper;
import com.googlecode.mgwt.ui.client.widget.animation.Animation;
import com.googlecode.mgwt.ui.client.widget.animation.Animations;
package gov.wa.wsdot.apps.mgwt.client;
public class AppMainAnimationMapper implements AnimationMapper {
@Override
public Animation getAnimation(Place oldPlace, Place newPlace) {
if (oldPlace == null) {
return Animations.FADE;
}
| if (oldPlace instanceof SamplePlace && newPlace instanceof HomePlace) { |
WSDOT/Archetypes | archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/AppMainAnimationMapper.java | // Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/about/AboutPlace.java
// public class AboutPlace extends Place {
//
// public static class AboutPlaceTokenizer implements
// PlaceTokenizer<AboutPlace> {
//
// @Override
// public AboutPlace getPlace(String token) {
// return new AboutPlace();
// }
//
// @Override
// public String getToken(AboutPlace place) {
// return "";
// }
//
// }
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/home/HomePlace.java
// public class HomePlace extends Place {
//
// public static class HomePlaceTokenizer implements PlaceTokenizer<HomePlace> {
//
// @Override
// public HomePlace getPlace(String token) {
// return new HomePlace();
// }
//
// @Override
// public String getToken(HomePlace place) {
// return "";
// }
//
// }
//
// @Override
// public int hashCode() {
// return 3;
// }
//
// @Override
// public boolean equals(Object other) {
// if (other == this) {
// return true;
// }
//
// if (other == null) {
// return false;
// }
//
// if (other instanceof HomePlace) {
// return true;
// }
//
// return false;
// }
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/sample/SamplePlace.java
// public class SamplePlace extends Place {
//
// public static class SamplePlaceTokenizer implements
// PlaceTokenizer<SamplePlace> {
//
// @Override
// public SamplePlace getPlace(String token) {
// return new SamplePlace();
// }
//
// @Override
// public String getToken(SamplePlace place) {
// return "";
// }
//
// }
// }
| import gov.wa.wsdot.apps.mgwt.client.activities.about.AboutPlace;
import gov.wa.wsdot.apps.mgwt.client.activities.home.HomePlace;
import gov.wa.wsdot.apps.mgwt.client.activities.sample.SamplePlace;
import com.google.gwt.place.shared.Place;
import com.googlecode.mgwt.mvp.client.AnimationMapper;
import com.googlecode.mgwt.ui.client.widget.animation.Animation;
import com.googlecode.mgwt.ui.client.widget.animation.Animations; | package gov.wa.wsdot.apps.mgwt.client;
public class AppMainAnimationMapper implements AnimationMapper {
@Override
public Animation getAnimation(Place oldPlace, Place newPlace) {
if (oldPlace == null) {
return Animations.FADE;
}
| // Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/about/AboutPlace.java
// public class AboutPlace extends Place {
//
// public static class AboutPlaceTokenizer implements
// PlaceTokenizer<AboutPlace> {
//
// @Override
// public AboutPlace getPlace(String token) {
// return new AboutPlace();
// }
//
// @Override
// public String getToken(AboutPlace place) {
// return "";
// }
//
// }
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/home/HomePlace.java
// public class HomePlace extends Place {
//
// public static class HomePlaceTokenizer implements PlaceTokenizer<HomePlace> {
//
// @Override
// public HomePlace getPlace(String token) {
// return new HomePlace();
// }
//
// @Override
// public String getToken(HomePlace place) {
// return "";
// }
//
// }
//
// @Override
// public int hashCode() {
// return 3;
// }
//
// @Override
// public boolean equals(Object other) {
// if (other == this) {
// return true;
// }
//
// if (other == null) {
// return false;
// }
//
// if (other instanceof HomePlace) {
// return true;
// }
//
// return false;
// }
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/sample/SamplePlace.java
// public class SamplePlace extends Place {
//
// public static class SamplePlaceTokenizer implements
// PlaceTokenizer<SamplePlace> {
//
// @Override
// public SamplePlace getPlace(String token) {
// return new SamplePlace();
// }
//
// @Override
// public String getToken(SamplePlace place) {
// return "";
// }
//
// }
// }
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/AppMainAnimationMapper.java
import gov.wa.wsdot.apps.mgwt.client.activities.about.AboutPlace;
import gov.wa.wsdot.apps.mgwt.client.activities.home.HomePlace;
import gov.wa.wsdot.apps.mgwt.client.activities.sample.SamplePlace;
import com.google.gwt.place.shared.Place;
import com.googlecode.mgwt.mvp.client.AnimationMapper;
import com.googlecode.mgwt.ui.client.widget.animation.Animation;
import com.googlecode.mgwt.ui.client.widget.animation.Animations;
package gov.wa.wsdot.apps.mgwt.client;
public class AppMainAnimationMapper implements AnimationMapper {
@Override
public Animation getAnimation(Place oldPlace, Place newPlace) {
if (oldPlace == null) {
return Animations.FADE;
}
| if (oldPlace instanceof SamplePlace && newPlace instanceof HomePlace) { |
WSDOT/Archetypes | archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/AppMainAnimationMapper.java | // Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/about/AboutPlace.java
// public class AboutPlace extends Place {
//
// public static class AboutPlaceTokenizer implements
// PlaceTokenizer<AboutPlace> {
//
// @Override
// public AboutPlace getPlace(String token) {
// return new AboutPlace();
// }
//
// @Override
// public String getToken(AboutPlace place) {
// return "";
// }
//
// }
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/home/HomePlace.java
// public class HomePlace extends Place {
//
// public static class HomePlaceTokenizer implements PlaceTokenizer<HomePlace> {
//
// @Override
// public HomePlace getPlace(String token) {
// return new HomePlace();
// }
//
// @Override
// public String getToken(HomePlace place) {
// return "";
// }
//
// }
//
// @Override
// public int hashCode() {
// return 3;
// }
//
// @Override
// public boolean equals(Object other) {
// if (other == this) {
// return true;
// }
//
// if (other == null) {
// return false;
// }
//
// if (other instanceof HomePlace) {
// return true;
// }
//
// return false;
// }
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/sample/SamplePlace.java
// public class SamplePlace extends Place {
//
// public static class SamplePlaceTokenizer implements
// PlaceTokenizer<SamplePlace> {
//
// @Override
// public SamplePlace getPlace(String token) {
// return new SamplePlace();
// }
//
// @Override
// public String getToken(SamplePlace place) {
// return "";
// }
//
// }
// }
| import gov.wa.wsdot.apps.mgwt.client.activities.about.AboutPlace;
import gov.wa.wsdot.apps.mgwt.client.activities.home.HomePlace;
import gov.wa.wsdot.apps.mgwt.client.activities.sample.SamplePlace;
import com.google.gwt.place.shared.Place;
import com.googlecode.mgwt.mvp.client.AnimationMapper;
import com.googlecode.mgwt.ui.client.widget.animation.Animation;
import com.googlecode.mgwt.ui.client.widget.animation.Animations; | package gov.wa.wsdot.apps.mgwt.client;
public class AppMainAnimationMapper implements AnimationMapper {
@Override
public Animation getAnimation(Place oldPlace, Place newPlace) {
if (oldPlace == null) {
return Animations.FADE;
}
if (oldPlace instanceof SamplePlace && newPlace instanceof HomePlace) {
return Animations.FADE_REVERSE;
}
| // Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/about/AboutPlace.java
// public class AboutPlace extends Place {
//
// public static class AboutPlaceTokenizer implements
// PlaceTokenizer<AboutPlace> {
//
// @Override
// public AboutPlace getPlace(String token) {
// return new AboutPlace();
// }
//
// @Override
// public String getToken(AboutPlace place) {
// return "";
// }
//
// }
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/home/HomePlace.java
// public class HomePlace extends Place {
//
// public static class HomePlaceTokenizer implements PlaceTokenizer<HomePlace> {
//
// @Override
// public HomePlace getPlace(String token) {
// return new HomePlace();
// }
//
// @Override
// public String getToken(HomePlace place) {
// return "";
// }
//
// }
//
// @Override
// public int hashCode() {
// return 3;
// }
//
// @Override
// public boolean equals(Object other) {
// if (other == this) {
// return true;
// }
//
// if (other == null) {
// return false;
// }
//
// if (other instanceof HomePlace) {
// return true;
// }
//
// return false;
// }
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/sample/SamplePlace.java
// public class SamplePlace extends Place {
//
// public static class SamplePlaceTokenizer implements
// PlaceTokenizer<SamplePlace> {
//
// @Override
// public SamplePlace getPlace(String token) {
// return new SamplePlace();
// }
//
// @Override
// public String getToken(SamplePlace place) {
// return "";
// }
//
// }
// }
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/AppMainAnimationMapper.java
import gov.wa.wsdot.apps.mgwt.client.activities.about.AboutPlace;
import gov.wa.wsdot.apps.mgwt.client.activities.home.HomePlace;
import gov.wa.wsdot.apps.mgwt.client.activities.sample.SamplePlace;
import com.google.gwt.place.shared.Place;
import com.googlecode.mgwt.mvp.client.AnimationMapper;
import com.googlecode.mgwt.ui.client.widget.animation.Animation;
import com.googlecode.mgwt.ui.client.widget.animation.Animations;
package gov.wa.wsdot.apps.mgwt.client;
public class AppMainAnimationMapper implements AnimationMapper {
@Override
public Animation getAnimation(Place oldPlace, Place newPlace) {
if (oldPlace == null) {
return Animations.FADE;
}
if (oldPlace instanceof SamplePlace && newPlace instanceof HomePlace) {
return Animations.FADE_REVERSE;
}
| if (oldPlace instanceof AboutPlace && newPlace instanceof HomePlace) { |
WSDOT/Archetypes | archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/home/HomeView.java | // Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/shared/Topic.java
// public class Topic implements Serializable {
//
// private static final long serialVersionUID = -134211444131752658L;
// private String name;
//
// public Topic() {
// }
//
// public Topic(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
| import gov.wa.wsdot.apps.mgwtbasic.shared.Topic;
import java.util.List;
import com.google.gwt.user.client.ui.IsWidget; | package gov.wa.wsdot.apps.mgwtbasic.client.activities.home;
public interface HomeView extends IsWidget {
public void setPresenter(Presenter presenter);
public interface Presenter {
public void onAboutButtonPressed();
public void onItemSelected(int index);
}
| // Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/shared/Topic.java
// public class Topic implements Serializable {
//
// private static final long serialVersionUID = -134211444131752658L;
// private String name;
//
// public Topic() {
// }
//
// public Topic(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/home/HomeView.java
import gov.wa.wsdot.apps.mgwtbasic.shared.Topic;
import java.util.List;
import com.google.gwt.user.client.ui.IsWidget;
package gov.wa.wsdot.apps.mgwtbasic.client.activities.home;
public interface HomeView extends IsWidget {
public void setPresenter(Presenter presenter);
public interface Presenter {
public void onAboutButtonPressed();
public void onItemSelected(int index);
}
| public void render(List<Topic> createTopicsList); |
WSDOT/Archetypes | archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/about/AboutActivity.java | // Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/ClientFactory.java
// public interface ClientFactory {
//
// public HomeView getHomeView();
// public EventBus getEventBus();
// public PlaceController getPlaceController();
// public SwipeMenu getSwipeMenu();
//
// /**
// * @return
// */
// public AboutView getAboutView();
// public SampleView getSampleView();
// public MenuView getMenuView();
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/event/ActionEvent.java
// public class ActionEvent extends Event<ActionEvent.Handler> {
//
// public interface Handler {
// void onAction(ActionEvent event);
// }
//
// private static final Type<ActionEvent.Handler> TYPE = new Type<ActionEvent.Handler>();
//
// public static void fire(EventBus eventBus, String sourceName) {
// eventBus.fireEventFromSource(new ActionEvent(), sourceName);
// }
//
// public static HandlerRegistration register(EventBus eventBus,
// String sourceName, Handler handler) {
//
// return eventBus.addHandlerToSource(TYPE, sourceName, handler);
// }
//
// @Override
// public Type<Handler> getAssociatedType() {
// return TYPE;
// }
//
// @Override
// protected void dispatch(ActionEvent.Handler handler) {
// handler.onAction(this);
// }
//
// protected ActionEvent() {
// }
//
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/event/ActionNames.java
// public interface ActionNames {
// public static final String BACK = "back";
// public static final String ANIMATION_END = "ae";
// }
| import gov.wa.wsdot.apps.mgwt.client.ClientFactory;
import gov.wa.wsdot.apps.mgwt.client.event.ActionEvent;
import gov.wa.wsdot.apps.mgwt.client.event.ActionNames;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.googlecode.mgwt.mvp.client.MGWTAbstractActivity; | package gov.wa.wsdot.apps.mgwt.client.activities.about;
public class AboutActivity extends MGWTAbstractActivity implements
AboutView.Presenter {
| // Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/ClientFactory.java
// public interface ClientFactory {
//
// public HomeView getHomeView();
// public EventBus getEventBus();
// public PlaceController getPlaceController();
// public SwipeMenu getSwipeMenu();
//
// /**
// * @return
// */
// public AboutView getAboutView();
// public SampleView getSampleView();
// public MenuView getMenuView();
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/event/ActionEvent.java
// public class ActionEvent extends Event<ActionEvent.Handler> {
//
// public interface Handler {
// void onAction(ActionEvent event);
// }
//
// private static final Type<ActionEvent.Handler> TYPE = new Type<ActionEvent.Handler>();
//
// public static void fire(EventBus eventBus, String sourceName) {
// eventBus.fireEventFromSource(new ActionEvent(), sourceName);
// }
//
// public static HandlerRegistration register(EventBus eventBus,
// String sourceName, Handler handler) {
//
// return eventBus.addHandlerToSource(TYPE, sourceName, handler);
// }
//
// @Override
// public Type<Handler> getAssociatedType() {
// return TYPE;
// }
//
// @Override
// protected void dispatch(ActionEvent.Handler handler) {
// handler.onAction(this);
// }
//
// protected ActionEvent() {
// }
//
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/event/ActionNames.java
// public interface ActionNames {
// public static final String BACK = "back";
// public static final String ANIMATION_END = "ae";
// }
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/about/AboutActivity.java
import gov.wa.wsdot.apps.mgwt.client.ClientFactory;
import gov.wa.wsdot.apps.mgwt.client.event.ActionEvent;
import gov.wa.wsdot.apps.mgwt.client.event.ActionNames;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.googlecode.mgwt.mvp.client.MGWTAbstractActivity;
package gov.wa.wsdot.apps.mgwt.client.activities.about;
public class AboutActivity extends MGWTAbstractActivity implements
AboutView.Presenter {
| private final ClientFactory clientFactory; |
WSDOT/Archetypes | archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/about/AboutActivity.java | // Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/ClientFactory.java
// public interface ClientFactory {
//
// public HomeView getHomeView();
// public EventBus getEventBus();
// public PlaceController getPlaceController();
// public SwipeMenu getSwipeMenu();
//
// /**
// * @return
// */
// public AboutView getAboutView();
// public SampleView getSampleView();
// public MenuView getMenuView();
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/event/ActionEvent.java
// public class ActionEvent extends Event<ActionEvent.Handler> {
//
// public interface Handler {
// void onAction(ActionEvent event);
// }
//
// private static final Type<ActionEvent.Handler> TYPE = new Type<ActionEvent.Handler>();
//
// public static void fire(EventBus eventBus, String sourceName) {
// eventBus.fireEventFromSource(new ActionEvent(), sourceName);
// }
//
// public static HandlerRegistration register(EventBus eventBus,
// String sourceName, Handler handler) {
//
// return eventBus.addHandlerToSource(TYPE, sourceName, handler);
// }
//
// @Override
// public Type<Handler> getAssociatedType() {
// return TYPE;
// }
//
// @Override
// protected void dispatch(ActionEvent.Handler handler) {
// handler.onAction(this);
// }
//
// protected ActionEvent() {
// }
//
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/event/ActionNames.java
// public interface ActionNames {
// public static final String BACK = "back";
// public static final String ANIMATION_END = "ae";
// }
| import gov.wa.wsdot.apps.mgwt.client.ClientFactory;
import gov.wa.wsdot.apps.mgwt.client.event.ActionEvent;
import gov.wa.wsdot.apps.mgwt.client.event.ActionNames;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.googlecode.mgwt.mvp.client.MGWTAbstractActivity; | package gov.wa.wsdot.apps.mgwt.client.activities.about;
public class AboutActivity extends MGWTAbstractActivity implements
AboutView.Presenter {
private final ClientFactory clientFactory;
private AboutView view;
private EventBus eventBus;
public AboutActivity(ClientFactory clientFactory) {
this.clientFactory = clientFactory;
}
@Override
public void start(AcceptsOneWidget panel, final EventBus eventBus) {
view = clientFactory.getAboutView();
this.eventBus = eventBus;
view.setPresenter(this);
panel.setWidget(view);
}
@Override
public void onStop() {
view.setPresenter(null);
}
@Override
public void onBackButtonPressed() { | // Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/ClientFactory.java
// public interface ClientFactory {
//
// public HomeView getHomeView();
// public EventBus getEventBus();
// public PlaceController getPlaceController();
// public SwipeMenu getSwipeMenu();
//
// /**
// * @return
// */
// public AboutView getAboutView();
// public SampleView getSampleView();
// public MenuView getMenuView();
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/event/ActionEvent.java
// public class ActionEvent extends Event<ActionEvent.Handler> {
//
// public interface Handler {
// void onAction(ActionEvent event);
// }
//
// private static final Type<ActionEvent.Handler> TYPE = new Type<ActionEvent.Handler>();
//
// public static void fire(EventBus eventBus, String sourceName) {
// eventBus.fireEventFromSource(new ActionEvent(), sourceName);
// }
//
// public static HandlerRegistration register(EventBus eventBus,
// String sourceName, Handler handler) {
//
// return eventBus.addHandlerToSource(TYPE, sourceName, handler);
// }
//
// @Override
// public Type<Handler> getAssociatedType() {
// return TYPE;
// }
//
// @Override
// protected void dispatch(ActionEvent.Handler handler) {
// handler.onAction(this);
// }
//
// protected ActionEvent() {
// }
//
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/event/ActionNames.java
// public interface ActionNames {
// public static final String BACK = "back";
// public static final String ANIMATION_END = "ae";
// }
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/about/AboutActivity.java
import gov.wa.wsdot.apps.mgwt.client.ClientFactory;
import gov.wa.wsdot.apps.mgwt.client.event.ActionEvent;
import gov.wa.wsdot.apps.mgwt.client.event.ActionNames;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.googlecode.mgwt.mvp.client.MGWTAbstractActivity;
package gov.wa.wsdot.apps.mgwt.client.activities.about;
public class AboutActivity extends MGWTAbstractActivity implements
AboutView.Presenter {
private final ClientFactory clientFactory;
private AboutView view;
private EventBus eventBus;
public AboutActivity(ClientFactory clientFactory) {
this.clientFactory = clientFactory;
}
@Override
public void start(AcceptsOneWidget panel, final EventBus eventBus) {
view = clientFactory.getAboutView();
this.eventBus = eventBus;
view.setPresenter(this);
panel.setWidget(view);
}
@Override
public void onStop() {
view.setPresenter(null);
}
@Override
public void onBackButtonPressed() { | ActionEvent.fire(eventBus, ActionNames.BACK); |
WSDOT/Archetypes | archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/about/AboutActivity.java | // Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/ClientFactory.java
// public interface ClientFactory {
//
// public HomeView getHomeView();
// public EventBus getEventBus();
// public PlaceController getPlaceController();
// public SwipeMenu getSwipeMenu();
//
// /**
// * @return
// */
// public AboutView getAboutView();
// public SampleView getSampleView();
// public MenuView getMenuView();
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/event/ActionEvent.java
// public class ActionEvent extends Event<ActionEvent.Handler> {
//
// public interface Handler {
// void onAction(ActionEvent event);
// }
//
// private static final Type<ActionEvent.Handler> TYPE = new Type<ActionEvent.Handler>();
//
// public static void fire(EventBus eventBus, String sourceName) {
// eventBus.fireEventFromSource(new ActionEvent(), sourceName);
// }
//
// public static HandlerRegistration register(EventBus eventBus,
// String sourceName, Handler handler) {
//
// return eventBus.addHandlerToSource(TYPE, sourceName, handler);
// }
//
// @Override
// public Type<Handler> getAssociatedType() {
// return TYPE;
// }
//
// @Override
// protected void dispatch(ActionEvent.Handler handler) {
// handler.onAction(this);
// }
//
// protected ActionEvent() {
// }
//
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/event/ActionNames.java
// public interface ActionNames {
// public static final String BACK = "back";
// public static final String ANIMATION_END = "ae";
// }
| import gov.wa.wsdot.apps.mgwt.client.ClientFactory;
import gov.wa.wsdot.apps.mgwt.client.event.ActionEvent;
import gov.wa.wsdot.apps.mgwt.client.event.ActionNames;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.googlecode.mgwt.mvp.client.MGWTAbstractActivity; | package gov.wa.wsdot.apps.mgwt.client.activities.about;
public class AboutActivity extends MGWTAbstractActivity implements
AboutView.Presenter {
private final ClientFactory clientFactory;
private AboutView view;
private EventBus eventBus;
public AboutActivity(ClientFactory clientFactory) {
this.clientFactory = clientFactory;
}
@Override
public void start(AcceptsOneWidget panel, final EventBus eventBus) {
view = clientFactory.getAboutView();
this.eventBus = eventBus;
view.setPresenter(this);
panel.setWidget(view);
}
@Override
public void onStop() {
view.setPresenter(null);
}
@Override
public void onBackButtonPressed() { | // Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/ClientFactory.java
// public interface ClientFactory {
//
// public HomeView getHomeView();
// public EventBus getEventBus();
// public PlaceController getPlaceController();
// public SwipeMenu getSwipeMenu();
//
// /**
// * @return
// */
// public AboutView getAboutView();
// public SampleView getSampleView();
// public MenuView getMenuView();
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/event/ActionEvent.java
// public class ActionEvent extends Event<ActionEvent.Handler> {
//
// public interface Handler {
// void onAction(ActionEvent event);
// }
//
// private static final Type<ActionEvent.Handler> TYPE = new Type<ActionEvent.Handler>();
//
// public static void fire(EventBus eventBus, String sourceName) {
// eventBus.fireEventFromSource(new ActionEvent(), sourceName);
// }
//
// public static HandlerRegistration register(EventBus eventBus,
// String sourceName, Handler handler) {
//
// return eventBus.addHandlerToSource(TYPE, sourceName, handler);
// }
//
// @Override
// public Type<Handler> getAssociatedType() {
// return TYPE;
// }
//
// @Override
// protected void dispatch(ActionEvent.Handler handler) {
// handler.onAction(this);
// }
//
// protected ActionEvent() {
// }
//
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/event/ActionNames.java
// public interface ActionNames {
// public static final String BACK = "back";
// public static final String ANIMATION_END = "ae";
// }
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/about/AboutActivity.java
import gov.wa.wsdot.apps.mgwt.client.ClientFactory;
import gov.wa.wsdot.apps.mgwt.client.event.ActionEvent;
import gov.wa.wsdot.apps.mgwt.client.event.ActionNames;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.googlecode.mgwt.mvp.client.MGWTAbstractActivity;
package gov.wa.wsdot.apps.mgwt.client.activities.about;
public class AboutActivity extends MGWTAbstractActivity implements
AboutView.Presenter {
private final ClientFactory clientFactory;
private AboutView view;
private EventBus eventBus;
public AboutActivity(ClientFactory clientFactory) {
this.clientFactory = clientFactory;
}
@Override
public void start(AcceptsOneWidget panel, final EventBus eventBus) {
view = clientFactory.getAboutView();
this.eventBus = eventBus;
view.setPresenter(this);
panel.setWidget(view);
}
@Override
public void onStop() {
view.setPresenter(null);
}
@Override
public void onBackButtonPressed() { | ActionEvent.fire(eventBus, ActionNames.BACK); |
WSDOT/Archetypes | archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/MenuView.java | // Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/shared/Topic.java
// public class Topic implements Serializable {
//
// private static final long serialVersionUID = -134211444131752658L;
// private String name;
//
// public Topic() {
// }
//
// public Topic(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
| import java.util.List;
import gov.wa.wsdot.apps.mgwt.shared.Topic;
import com.google.gwt.user.client.ui.IsWidget; | package gov.wa.wsdot.apps.mgwt.client.activities;
public interface MenuView extends IsWidget {
public void setPresenter(Presenter presenter);
public interface Presenter {
public void onAboutButtonPressed();
public void onItemSelected(int index);
}
| // Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/shared/Topic.java
// public class Topic implements Serializable {
//
// private static final long serialVersionUID = -134211444131752658L;
// private String name;
//
// public Topic() {
// }
//
// public Topic(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/MenuView.java
import java.util.List;
import gov.wa.wsdot.apps.mgwt.shared.Topic;
import com.google.gwt.user.client.ui.IsWidget;
package gov.wa.wsdot.apps.mgwt.client.activities;
public interface MenuView extends IsWidget {
public void setPresenter(Presenter presenter);
public interface Presenter {
public void onAboutButtonPressed();
public void onItemSelected(int index);
}
| public void render(List<Topic> createTopicsList); |
WSDOT/Archetypes | archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/ClientFactory.java | // Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/MenuView.java
// public interface MenuView extends IsWidget {
//
// public void setPresenter(Presenter presenter);
//
// public interface Presenter {
//
// public void onAboutButtonPressed();
//
// public void onItemSelected(int index);
//
// }
//
// public void render(List<Topic> createTopicsList);
//
// public void setSelected(int lastIndex, boolean b);
//
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/about/AboutView.java
// public interface AboutView extends IsWidget {
//
// public void setPresenter(Presenter presenter);
//
// public interface Presenter {
//
// public void onBackButtonPressed();
//
// }
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/home/HomeView.java
// public interface HomeView extends IsWidget {
//
// public void setPresenter(Presenter presenter);
//
// public interface Presenter {
//
// public void onItemSelected(int index);
//
// public void onMenuButtonPressed();
//
// }
//
// public void render(List<Topic> createTopicsList);
//
// public void refresh();
//
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/sample/SampleView.java
// public interface SampleView extends IsWidget {
//
// public void setPresenter(Presenter presenter);
//
// public interface Presenter {
//
// public void onBackButtonPressed();
//
// }
// }
| import gov.wa.wsdot.apps.mgwt.client.activities.MenuView;
import gov.wa.wsdot.apps.mgwt.client.activities.about.AboutView;
import gov.wa.wsdot.apps.mgwt.client.activities.home.HomeView;
import gov.wa.wsdot.apps.mgwt.client.activities.sample.SampleView;
import com.google.gwt.place.shared.PlaceController;
import com.google.web.bindery.event.shared.EventBus;
import com.googlecode.mgwt.ui.client.widget.menu.swipe.SwipeMenu; | package gov.wa.wsdot.apps.mgwt.client;
public interface ClientFactory {
public HomeView getHomeView();
public EventBus getEventBus();
public PlaceController getPlaceController();
public SwipeMenu getSwipeMenu();
/**
* @return
*/ | // Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/MenuView.java
// public interface MenuView extends IsWidget {
//
// public void setPresenter(Presenter presenter);
//
// public interface Presenter {
//
// public void onAboutButtonPressed();
//
// public void onItemSelected(int index);
//
// }
//
// public void render(List<Topic> createTopicsList);
//
// public void setSelected(int lastIndex, boolean b);
//
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/about/AboutView.java
// public interface AboutView extends IsWidget {
//
// public void setPresenter(Presenter presenter);
//
// public interface Presenter {
//
// public void onBackButtonPressed();
//
// }
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/home/HomeView.java
// public interface HomeView extends IsWidget {
//
// public void setPresenter(Presenter presenter);
//
// public interface Presenter {
//
// public void onItemSelected(int index);
//
// public void onMenuButtonPressed();
//
// }
//
// public void render(List<Topic> createTopicsList);
//
// public void refresh();
//
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/sample/SampleView.java
// public interface SampleView extends IsWidget {
//
// public void setPresenter(Presenter presenter);
//
// public interface Presenter {
//
// public void onBackButtonPressed();
//
// }
// }
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/ClientFactory.java
import gov.wa.wsdot.apps.mgwt.client.activities.MenuView;
import gov.wa.wsdot.apps.mgwt.client.activities.about.AboutView;
import gov.wa.wsdot.apps.mgwt.client.activities.home.HomeView;
import gov.wa.wsdot.apps.mgwt.client.activities.sample.SampleView;
import com.google.gwt.place.shared.PlaceController;
import com.google.web.bindery.event.shared.EventBus;
import com.googlecode.mgwt.ui.client.widget.menu.swipe.SwipeMenu;
package gov.wa.wsdot.apps.mgwt.client;
public interface ClientFactory {
public HomeView getHomeView();
public EventBus getEventBus();
public PlaceController getPlaceController();
public SwipeMenu getSwipeMenu();
/**
* @return
*/ | public AboutView getAboutView(); |
WSDOT/Archetypes | archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/ClientFactory.java | // Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/MenuView.java
// public interface MenuView extends IsWidget {
//
// public void setPresenter(Presenter presenter);
//
// public interface Presenter {
//
// public void onAboutButtonPressed();
//
// public void onItemSelected(int index);
//
// }
//
// public void render(List<Topic> createTopicsList);
//
// public void setSelected(int lastIndex, boolean b);
//
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/about/AboutView.java
// public interface AboutView extends IsWidget {
//
// public void setPresenter(Presenter presenter);
//
// public interface Presenter {
//
// public void onBackButtonPressed();
//
// }
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/home/HomeView.java
// public interface HomeView extends IsWidget {
//
// public void setPresenter(Presenter presenter);
//
// public interface Presenter {
//
// public void onItemSelected(int index);
//
// public void onMenuButtonPressed();
//
// }
//
// public void render(List<Topic> createTopicsList);
//
// public void refresh();
//
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/sample/SampleView.java
// public interface SampleView extends IsWidget {
//
// public void setPresenter(Presenter presenter);
//
// public interface Presenter {
//
// public void onBackButtonPressed();
//
// }
// }
| import gov.wa.wsdot.apps.mgwt.client.activities.MenuView;
import gov.wa.wsdot.apps.mgwt.client.activities.about.AboutView;
import gov.wa.wsdot.apps.mgwt.client.activities.home.HomeView;
import gov.wa.wsdot.apps.mgwt.client.activities.sample.SampleView;
import com.google.gwt.place.shared.PlaceController;
import com.google.web.bindery.event.shared.EventBus;
import com.googlecode.mgwt.ui.client.widget.menu.swipe.SwipeMenu; | package gov.wa.wsdot.apps.mgwt.client;
public interface ClientFactory {
public HomeView getHomeView();
public EventBus getEventBus();
public PlaceController getPlaceController();
public SwipeMenu getSwipeMenu();
/**
* @return
*/
public AboutView getAboutView(); | // Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/MenuView.java
// public interface MenuView extends IsWidget {
//
// public void setPresenter(Presenter presenter);
//
// public interface Presenter {
//
// public void onAboutButtonPressed();
//
// public void onItemSelected(int index);
//
// }
//
// public void render(List<Topic> createTopicsList);
//
// public void setSelected(int lastIndex, boolean b);
//
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/about/AboutView.java
// public interface AboutView extends IsWidget {
//
// public void setPresenter(Presenter presenter);
//
// public interface Presenter {
//
// public void onBackButtonPressed();
//
// }
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/home/HomeView.java
// public interface HomeView extends IsWidget {
//
// public void setPresenter(Presenter presenter);
//
// public interface Presenter {
//
// public void onItemSelected(int index);
//
// public void onMenuButtonPressed();
//
// }
//
// public void render(List<Topic> createTopicsList);
//
// public void refresh();
//
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/sample/SampleView.java
// public interface SampleView extends IsWidget {
//
// public void setPresenter(Presenter presenter);
//
// public interface Presenter {
//
// public void onBackButtonPressed();
//
// }
// }
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/ClientFactory.java
import gov.wa.wsdot.apps.mgwt.client.activities.MenuView;
import gov.wa.wsdot.apps.mgwt.client.activities.about.AboutView;
import gov.wa.wsdot.apps.mgwt.client.activities.home.HomeView;
import gov.wa.wsdot.apps.mgwt.client.activities.sample.SampleView;
import com.google.gwt.place.shared.PlaceController;
import com.google.web.bindery.event.shared.EventBus;
import com.googlecode.mgwt.ui.client.widget.menu.swipe.SwipeMenu;
package gov.wa.wsdot.apps.mgwt.client;
public interface ClientFactory {
public HomeView getHomeView();
public EventBus getEventBus();
public PlaceController getPlaceController();
public SwipeMenu getSwipeMenu();
/**
* @return
*/
public AboutView getAboutView(); | public SampleView getSampleView(); |
WSDOT/Archetypes | archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/ClientFactory.java | // Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/MenuView.java
// public interface MenuView extends IsWidget {
//
// public void setPresenter(Presenter presenter);
//
// public interface Presenter {
//
// public void onAboutButtonPressed();
//
// public void onItemSelected(int index);
//
// }
//
// public void render(List<Topic> createTopicsList);
//
// public void setSelected(int lastIndex, boolean b);
//
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/about/AboutView.java
// public interface AboutView extends IsWidget {
//
// public void setPresenter(Presenter presenter);
//
// public interface Presenter {
//
// public void onBackButtonPressed();
//
// }
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/home/HomeView.java
// public interface HomeView extends IsWidget {
//
// public void setPresenter(Presenter presenter);
//
// public interface Presenter {
//
// public void onItemSelected(int index);
//
// public void onMenuButtonPressed();
//
// }
//
// public void render(List<Topic> createTopicsList);
//
// public void refresh();
//
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/sample/SampleView.java
// public interface SampleView extends IsWidget {
//
// public void setPresenter(Presenter presenter);
//
// public interface Presenter {
//
// public void onBackButtonPressed();
//
// }
// }
| import gov.wa.wsdot.apps.mgwt.client.activities.MenuView;
import gov.wa.wsdot.apps.mgwt.client.activities.about.AboutView;
import gov.wa.wsdot.apps.mgwt.client.activities.home.HomeView;
import gov.wa.wsdot.apps.mgwt.client.activities.sample.SampleView;
import com.google.gwt.place.shared.PlaceController;
import com.google.web.bindery.event.shared.EventBus;
import com.googlecode.mgwt.ui.client.widget.menu.swipe.SwipeMenu; | package gov.wa.wsdot.apps.mgwt.client;
public interface ClientFactory {
public HomeView getHomeView();
public EventBus getEventBus();
public PlaceController getPlaceController();
public SwipeMenu getSwipeMenu();
/**
* @return
*/
public AboutView getAboutView();
public SampleView getSampleView(); | // Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/MenuView.java
// public interface MenuView extends IsWidget {
//
// public void setPresenter(Presenter presenter);
//
// public interface Presenter {
//
// public void onAboutButtonPressed();
//
// public void onItemSelected(int index);
//
// }
//
// public void render(List<Topic> createTopicsList);
//
// public void setSelected(int lastIndex, boolean b);
//
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/about/AboutView.java
// public interface AboutView extends IsWidget {
//
// public void setPresenter(Presenter presenter);
//
// public interface Presenter {
//
// public void onBackButtonPressed();
//
// }
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/home/HomeView.java
// public interface HomeView extends IsWidget {
//
// public void setPresenter(Presenter presenter);
//
// public interface Presenter {
//
// public void onItemSelected(int index);
//
// public void onMenuButtonPressed();
//
// }
//
// public void render(List<Topic> createTopicsList);
//
// public void refresh();
//
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/sample/SampleView.java
// public interface SampleView extends IsWidget {
//
// public void setPresenter(Presenter presenter);
//
// public interface Presenter {
//
// public void onBackButtonPressed();
//
// }
// }
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/ClientFactory.java
import gov.wa.wsdot.apps.mgwt.client.activities.MenuView;
import gov.wa.wsdot.apps.mgwt.client.activities.about.AboutView;
import gov.wa.wsdot.apps.mgwt.client.activities.home.HomeView;
import gov.wa.wsdot.apps.mgwt.client.activities.sample.SampleView;
import com.google.gwt.place.shared.PlaceController;
import com.google.web.bindery.event.shared.EventBus;
import com.googlecode.mgwt.ui.client.widget.menu.swipe.SwipeMenu;
package gov.wa.wsdot.apps.mgwt.client;
public interface ClientFactory {
public HomeView getHomeView();
public EventBus getEventBus();
public PlaceController getPlaceController();
public SwipeMenu getSwipeMenu();
/**
* @return
*/
public AboutView getAboutView();
public SampleView getSampleView(); | public MenuView getMenuView(); |
WSDOT/Archetypes | archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/AppEntryPoint.java | // Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/home/HomePlace.java
// public class HomePlace extends Place {
//
// public static class HomePlaceTokenizer implements PlaceTokenizer<HomePlace> {
//
// @Override
// public HomePlace getPlace(String token) {
// return new HomePlace();
// }
//
// @Override
// public String getToken(HomePlace place) {
// return "";
// }
//
// }
//
// @Override
// public int hashCode() {
// return 3;
// }
//
// @Override
// public boolean equals(Object other) {
// if (other == this) {
// return true;
// }
//
// if (other == null) {
// return false;
// }
//
// if (other instanceof HomePlace) {
// return true;
// }
//
// return false;
// }
// }
| import gov.wa.wsdot.apps.mgwt.client.activities.home.HomePlace;
import com.google.gwt.activity.shared.ActivityMapper;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.ui.RootPanel;
import com.googlecode.mgwt.mvp.client.AnimatingActivityManager;
import com.googlecode.mgwt.mvp.client.AnimationMapper;
import com.googlecode.mgwt.mvp.client.history.MGWTPlaceHistoryHandler;
import com.googlecode.mgwt.ui.client.MGWT;
import com.googlecode.mgwt.ui.client.MGWTSettings;
import com.googlecode.mgwt.ui.client.MGWTSettings.ViewPort;
import com.googlecode.mgwt.ui.client.util.SuperDevModeUtil;
import com.googlecode.mgwt.ui.client.widget.animation.AnimationWidget; | package gov.wa.wsdot.apps.mgwt.client;
public class AppEntryPoint implements EntryPoint {
private void start() {
SuperDevModeUtil.showDevMode();
ViewPort viewPort = new MGWTSettings.ViewPort();
viewPort.setUserScaleAble(false).setInitialScale(1.0).setMinimumScale(1.0).setMaximumScale(1.0);
MGWTSettings settings = new MGWTSettings();
settings.setViewPort(viewPort);
settings.setIconUrl("logo.png");
settings.setFullscreen(true);
settings.setFixIOS71BodyBug(true);
settings.setPreventScrolling(true);
MGWT.applySettings(settings);
final ClientFactory clientFactory = new ClientFactoryImpl();
// Start PlaceHistoryHandler with our PlaceHistoryMapper
AppPlaceHistoryMapper historyMapper = GWT.create(AppPlaceHistoryMapper.class);
createPhoneDisplay(clientFactory);
AppHistoryObserver historyObserver = new AppHistoryObserver();
MGWTPlaceHistoryHandler historyHandler = new MGWTPlaceHistoryHandler(historyMapper, historyObserver); | // Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/home/HomePlace.java
// public class HomePlace extends Place {
//
// public static class HomePlaceTokenizer implements PlaceTokenizer<HomePlace> {
//
// @Override
// public HomePlace getPlace(String token) {
// return new HomePlace();
// }
//
// @Override
// public String getToken(HomePlace place) {
// return "";
// }
//
// }
//
// @Override
// public int hashCode() {
// return 3;
// }
//
// @Override
// public boolean equals(Object other) {
// if (other == this) {
// return true;
// }
//
// if (other == null) {
// return false;
// }
//
// if (other instanceof HomePlace) {
// return true;
// }
//
// return false;
// }
// }
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/AppEntryPoint.java
import gov.wa.wsdot.apps.mgwt.client.activities.home.HomePlace;
import com.google.gwt.activity.shared.ActivityMapper;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.ui.RootPanel;
import com.googlecode.mgwt.mvp.client.AnimatingActivityManager;
import com.googlecode.mgwt.mvp.client.AnimationMapper;
import com.googlecode.mgwt.mvp.client.history.MGWTPlaceHistoryHandler;
import com.googlecode.mgwt.ui.client.MGWT;
import com.googlecode.mgwt.ui.client.MGWTSettings;
import com.googlecode.mgwt.ui.client.MGWTSettings.ViewPort;
import com.googlecode.mgwt.ui.client.util.SuperDevModeUtil;
import com.googlecode.mgwt.ui.client.widget.animation.AnimationWidget;
package gov.wa.wsdot.apps.mgwt.client;
public class AppEntryPoint implements EntryPoint {
private void start() {
SuperDevModeUtil.showDevMode();
ViewPort viewPort = new MGWTSettings.ViewPort();
viewPort.setUserScaleAble(false).setInitialScale(1.0).setMinimumScale(1.0).setMaximumScale(1.0);
MGWTSettings settings = new MGWTSettings();
settings.setViewPort(viewPort);
settings.setIconUrl("logo.png");
settings.setFullscreen(true);
settings.setFixIOS71BodyBug(true);
settings.setPreventScrolling(true);
MGWT.applySettings(settings);
final ClientFactory clientFactory = new ClientFactoryImpl();
// Start PlaceHistoryHandler with our PlaceHistoryMapper
AppPlaceHistoryMapper historyMapper = GWT.create(AppPlaceHistoryMapper.class);
createPhoneDisplay(clientFactory);
AppHistoryObserver historyObserver = new AppHistoryObserver();
MGWTPlaceHistoryHandler historyHandler = new MGWTPlaceHistoryHandler(historyMapper, historyObserver); | historyHandler.register(clientFactory.getPlaceController(), clientFactory.getEventBus(), new HomePlace()); |
WSDOT/Archetypes | archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/PhoneAnimationMapper.java | // Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/about/AboutPlace.java
// public class AboutPlace extends Place {
//
// public static class AboutPlaceTokenizer implements
// PlaceTokenizer<AboutPlace> {
//
// @Override
// public AboutPlace getPlace(String token) {
// return new AboutPlace();
// }
//
// @Override
// public String getToken(AboutPlace place) {
// return "";
// }
//
// }
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/home/HomePlace.java
// public class HomePlace extends Place {
//
// public static class HomePlaceTokenizer implements PlaceTokenizer<HomePlace> {
//
// @Override
// public HomePlace getPlace(String token) {
// return new HomePlace();
// }
//
// @Override
// public String getToken(HomePlace place) {
// return "";
// }
//
// }
//
// @Override
// public int hashCode() {
// return 3;
// }
//
// @Override
// public boolean equals(Object other) {
// if (other == this) {
// return true;
// }
//
// if (other == null) {
// return false;
// }
//
// if (other instanceof HomePlace) {
// return true;
// }
//
// return false;
// }
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/sample/SamplePlace.java
// public class SamplePlace extends Place {
//
// public static class SamplePlaceTokenizer implements
// PlaceTokenizer<SamplePlace> {
//
// @Override
// public SamplePlace getPlace(String token) {
// return new SamplePlace();
// }
//
// @Override
// public String getToken(SamplePlace place) {
// return "";
// }
//
// }
// }
| import gov.wa.wsdot.apps.mgwtbasic.client.activities.about.AboutPlace;
import gov.wa.wsdot.apps.mgwtbasic.client.activities.home.HomePlace;
import gov.wa.wsdot.apps.mgwtbasic.client.activities.sample.SamplePlace;
import com.google.gwt.place.shared.Place;
import com.googlecode.mgwt.mvp.client.AnimationMapper;
import com.googlecode.mgwt.ui.client.widget.animation.Animation;
import com.googlecode.mgwt.ui.client.widget.animation.Animations; | package gov.wa.wsdot.apps.mgwtbasic.client;
public class PhoneAnimationMapper implements AnimationMapper {
@Override
public Animation getAnimation(Place oldPlace, Place newPlace) { | // Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/about/AboutPlace.java
// public class AboutPlace extends Place {
//
// public static class AboutPlaceTokenizer implements
// PlaceTokenizer<AboutPlace> {
//
// @Override
// public AboutPlace getPlace(String token) {
// return new AboutPlace();
// }
//
// @Override
// public String getToken(AboutPlace place) {
// return "";
// }
//
// }
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/home/HomePlace.java
// public class HomePlace extends Place {
//
// public static class HomePlaceTokenizer implements PlaceTokenizer<HomePlace> {
//
// @Override
// public HomePlace getPlace(String token) {
// return new HomePlace();
// }
//
// @Override
// public String getToken(HomePlace place) {
// return "";
// }
//
// }
//
// @Override
// public int hashCode() {
// return 3;
// }
//
// @Override
// public boolean equals(Object other) {
// if (other == this) {
// return true;
// }
//
// if (other == null) {
// return false;
// }
//
// if (other instanceof HomePlace) {
// return true;
// }
//
// return false;
// }
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/sample/SamplePlace.java
// public class SamplePlace extends Place {
//
// public static class SamplePlaceTokenizer implements
// PlaceTokenizer<SamplePlace> {
//
// @Override
// public SamplePlace getPlace(String token) {
// return new SamplePlace();
// }
//
// @Override
// public String getToken(SamplePlace place) {
// return "";
// }
//
// }
// }
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/PhoneAnimationMapper.java
import gov.wa.wsdot.apps.mgwtbasic.client.activities.about.AboutPlace;
import gov.wa.wsdot.apps.mgwtbasic.client.activities.home.HomePlace;
import gov.wa.wsdot.apps.mgwtbasic.client.activities.sample.SamplePlace;
import com.google.gwt.place.shared.Place;
import com.googlecode.mgwt.mvp.client.AnimationMapper;
import com.googlecode.mgwt.ui.client.widget.animation.Animation;
import com.googlecode.mgwt.ui.client.widget.animation.Animations;
package gov.wa.wsdot.apps.mgwtbasic.client;
public class PhoneAnimationMapper implements AnimationMapper {
@Override
public Animation getAnimation(Place oldPlace, Place newPlace) { | if (oldPlace instanceof AboutPlace && newPlace instanceof HomePlace) { |
WSDOT/Archetypes | archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/PhoneAnimationMapper.java | // Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/about/AboutPlace.java
// public class AboutPlace extends Place {
//
// public static class AboutPlaceTokenizer implements
// PlaceTokenizer<AboutPlace> {
//
// @Override
// public AboutPlace getPlace(String token) {
// return new AboutPlace();
// }
//
// @Override
// public String getToken(AboutPlace place) {
// return "";
// }
//
// }
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/home/HomePlace.java
// public class HomePlace extends Place {
//
// public static class HomePlaceTokenizer implements PlaceTokenizer<HomePlace> {
//
// @Override
// public HomePlace getPlace(String token) {
// return new HomePlace();
// }
//
// @Override
// public String getToken(HomePlace place) {
// return "";
// }
//
// }
//
// @Override
// public int hashCode() {
// return 3;
// }
//
// @Override
// public boolean equals(Object other) {
// if (other == this) {
// return true;
// }
//
// if (other == null) {
// return false;
// }
//
// if (other instanceof HomePlace) {
// return true;
// }
//
// return false;
// }
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/sample/SamplePlace.java
// public class SamplePlace extends Place {
//
// public static class SamplePlaceTokenizer implements
// PlaceTokenizer<SamplePlace> {
//
// @Override
// public SamplePlace getPlace(String token) {
// return new SamplePlace();
// }
//
// @Override
// public String getToken(SamplePlace place) {
// return "";
// }
//
// }
// }
| import gov.wa.wsdot.apps.mgwtbasic.client.activities.about.AboutPlace;
import gov.wa.wsdot.apps.mgwtbasic.client.activities.home.HomePlace;
import gov.wa.wsdot.apps.mgwtbasic.client.activities.sample.SamplePlace;
import com.google.gwt.place.shared.Place;
import com.googlecode.mgwt.mvp.client.AnimationMapper;
import com.googlecode.mgwt.ui.client.widget.animation.Animation;
import com.googlecode.mgwt.ui.client.widget.animation.Animations; | package gov.wa.wsdot.apps.mgwtbasic.client;
public class PhoneAnimationMapper implements AnimationMapper {
@Override
public Animation getAnimation(Place oldPlace, Place newPlace) { | // Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/about/AboutPlace.java
// public class AboutPlace extends Place {
//
// public static class AboutPlaceTokenizer implements
// PlaceTokenizer<AboutPlace> {
//
// @Override
// public AboutPlace getPlace(String token) {
// return new AboutPlace();
// }
//
// @Override
// public String getToken(AboutPlace place) {
// return "";
// }
//
// }
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/home/HomePlace.java
// public class HomePlace extends Place {
//
// public static class HomePlaceTokenizer implements PlaceTokenizer<HomePlace> {
//
// @Override
// public HomePlace getPlace(String token) {
// return new HomePlace();
// }
//
// @Override
// public String getToken(HomePlace place) {
// return "";
// }
//
// }
//
// @Override
// public int hashCode() {
// return 3;
// }
//
// @Override
// public boolean equals(Object other) {
// if (other == this) {
// return true;
// }
//
// if (other == null) {
// return false;
// }
//
// if (other instanceof HomePlace) {
// return true;
// }
//
// return false;
// }
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/sample/SamplePlace.java
// public class SamplePlace extends Place {
//
// public static class SamplePlaceTokenizer implements
// PlaceTokenizer<SamplePlace> {
//
// @Override
// public SamplePlace getPlace(String token) {
// return new SamplePlace();
// }
//
// @Override
// public String getToken(SamplePlace place) {
// return "";
// }
//
// }
// }
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/PhoneAnimationMapper.java
import gov.wa.wsdot.apps.mgwtbasic.client.activities.about.AboutPlace;
import gov.wa.wsdot.apps.mgwtbasic.client.activities.home.HomePlace;
import gov.wa.wsdot.apps.mgwtbasic.client.activities.sample.SamplePlace;
import com.google.gwt.place.shared.Place;
import com.googlecode.mgwt.mvp.client.AnimationMapper;
import com.googlecode.mgwt.ui.client.widget.animation.Animation;
import com.googlecode.mgwt.ui.client.widget.animation.Animations;
package gov.wa.wsdot.apps.mgwtbasic.client;
public class PhoneAnimationMapper implements AnimationMapper {
@Override
public Animation getAnimation(Place oldPlace, Place newPlace) { | if (oldPlace instanceof AboutPlace && newPlace instanceof HomePlace) { |
WSDOT/Archetypes | archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/PhoneAnimationMapper.java | // Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/about/AboutPlace.java
// public class AboutPlace extends Place {
//
// public static class AboutPlaceTokenizer implements
// PlaceTokenizer<AboutPlace> {
//
// @Override
// public AboutPlace getPlace(String token) {
// return new AboutPlace();
// }
//
// @Override
// public String getToken(AboutPlace place) {
// return "";
// }
//
// }
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/home/HomePlace.java
// public class HomePlace extends Place {
//
// public static class HomePlaceTokenizer implements PlaceTokenizer<HomePlace> {
//
// @Override
// public HomePlace getPlace(String token) {
// return new HomePlace();
// }
//
// @Override
// public String getToken(HomePlace place) {
// return "";
// }
//
// }
//
// @Override
// public int hashCode() {
// return 3;
// }
//
// @Override
// public boolean equals(Object other) {
// if (other == this) {
// return true;
// }
//
// if (other == null) {
// return false;
// }
//
// if (other instanceof HomePlace) {
// return true;
// }
//
// return false;
// }
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/sample/SamplePlace.java
// public class SamplePlace extends Place {
//
// public static class SamplePlaceTokenizer implements
// PlaceTokenizer<SamplePlace> {
//
// @Override
// public SamplePlace getPlace(String token) {
// return new SamplePlace();
// }
//
// @Override
// public String getToken(SamplePlace place) {
// return "";
// }
//
// }
// }
| import gov.wa.wsdot.apps.mgwtbasic.client.activities.about.AboutPlace;
import gov.wa.wsdot.apps.mgwtbasic.client.activities.home.HomePlace;
import gov.wa.wsdot.apps.mgwtbasic.client.activities.sample.SamplePlace;
import com.google.gwt.place.shared.Place;
import com.googlecode.mgwt.mvp.client.AnimationMapper;
import com.googlecode.mgwt.ui.client.widget.animation.Animation;
import com.googlecode.mgwt.ui.client.widget.animation.Animations; | package gov.wa.wsdot.apps.mgwtbasic.client;
public class PhoneAnimationMapper implements AnimationMapper {
@Override
public Animation getAnimation(Place oldPlace, Place newPlace) {
if (oldPlace instanceof AboutPlace && newPlace instanceof HomePlace) {
return Animations.SLIDE_REVERSE;
}
| // Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/about/AboutPlace.java
// public class AboutPlace extends Place {
//
// public static class AboutPlaceTokenizer implements
// PlaceTokenizer<AboutPlace> {
//
// @Override
// public AboutPlace getPlace(String token) {
// return new AboutPlace();
// }
//
// @Override
// public String getToken(AboutPlace place) {
// return "";
// }
//
// }
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/home/HomePlace.java
// public class HomePlace extends Place {
//
// public static class HomePlaceTokenizer implements PlaceTokenizer<HomePlace> {
//
// @Override
// public HomePlace getPlace(String token) {
// return new HomePlace();
// }
//
// @Override
// public String getToken(HomePlace place) {
// return "";
// }
//
// }
//
// @Override
// public int hashCode() {
// return 3;
// }
//
// @Override
// public boolean equals(Object other) {
// if (other == this) {
// return true;
// }
//
// if (other == null) {
// return false;
// }
//
// if (other instanceof HomePlace) {
// return true;
// }
//
// return false;
// }
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/sample/SamplePlace.java
// public class SamplePlace extends Place {
//
// public static class SamplePlaceTokenizer implements
// PlaceTokenizer<SamplePlace> {
//
// @Override
// public SamplePlace getPlace(String token) {
// return new SamplePlace();
// }
//
// @Override
// public String getToken(SamplePlace place) {
// return "";
// }
//
// }
// }
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/PhoneAnimationMapper.java
import gov.wa.wsdot.apps.mgwtbasic.client.activities.about.AboutPlace;
import gov.wa.wsdot.apps.mgwtbasic.client.activities.home.HomePlace;
import gov.wa.wsdot.apps.mgwtbasic.client.activities.sample.SamplePlace;
import com.google.gwt.place.shared.Place;
import com.googlecode.mgwt.mvp.client.AnimationMapper;
import com.googlecode.mgwt.ui.client.widget.animation.Animation;
import com.googlecode.mgwt.ui.client.widget.animation.Animations;
package gov.wa.wsdot.apps.mgwtbasic.client;
public class PhoneAnimationMapper implements AnimationMapper {
@Override
public Animation getAnimation(Place oldPlace, Place newPlace) {
if (oldPlace instanceof AboutPlace && newPlace instanceof HomePlace) {
return Animations.SLIDE_REVERSE;
}
| if (oldPlace instanceof SamplePlace && newPlace instanceof HomePlace) { |
WSDOT/Archetypes | archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/sample/SampleActivity.java | // Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/ClientFactory.java
// public interface ClientFactory {
//
// public HomeView getHomeView();
// public EventBus getEventBus();
// public PlaceController getPlaceController();
// public SwipeMenu getSwipeMenu();
//
// /**
// * @return
// */
// public AboutView getAboutView();
// public SampleView getSampleView();
// public MenuView getMenuView();
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/event/ActionEvent.java
// public class ActionEvent extends Event<ActionEvent.Handler> {
//
// public interface Handler {
// void onAction(ActionEvent event);
// }
//
// private static final Type<ActionEvent.Handler> TYPE = new Type<ActionEvent.Handler>();
//
// public static void fire(EventBus eventBus, String sourceName) {
// eventBus.fireEventFromSource(new ActionEvent(), sourceName);
// }
//
// public static HandlerRegistration register(EventBus eventBus,
// String sourceName, Handler handler) {
//
// return eventBus.addHandlerToSource(TYPE, sourceName, handler);
// }
//
// @Override
// public Type<Handler> getAssociatedType() {
// return TYPE;
// }
//
// @Override
// protected void dispatch(ActionEvent.Handler handler) {
// handler.onAction(this);
// }
//
// protected ActionEvent() {
// }
//
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/event/ActionNames.java
// public interface ActionNames {
// public static final String BACK = "back";
// public static final String ANIMATION_END = "ae";
// }
| import gov.wa.wsdot.apps.mgwt.client.ClientFactory;
import gov.wa.wsdot.apps.mgwt.client.event.ActionEvent;
import gov.wa.wsdot.apps.mgwt.client.event.ActionNames;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.googlecode.mgwt.mvp.client.MGWTAbstractActivity; | package gov.wa.wsdot.apps.mgwt.client.activities.sample;
public class SampleActivity extends MGWTAbstractActivity implements
SampleView.Presenter {
| // Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/ClientFactory.java
// public interface ClientFactory {
//
// public HomeView getHomeView();
// public EventBus getEventBus();
// public PlaceController getPlaceController();
// public SwipeMenu getSwipeMenu();
//
// /**
// * @return
// */
// public AboutView getAboutView();
// public SampleView getSampleView();
// public MenuView getMenuView();
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/event/ActionEvent.java
// public class ActionEvent extends Event<ActionEvent.Handler> {
//
// public interface Handler {
// void onAction(ActionEvent event);
// }
//
// private static final Type<ActionEvent.Handler> TYPE = new Type<ActionEvent.Handler>();
//
// public static void fire(EventBus eventBus, String sourceName) {
// eventBus.fireEventFromSource(new ActionEvent(), sourceName);
// }
//
// public static HandlerRegistration register(EventBus eventBus,
// String sourceName, Handler handler) {
//
// return eventBus.addHandlerToSource(TYPE, sourceName, handler);
// }
//
// @Override
// public Type<Handler> getAssociatedType() {
// return TYPE;
// }
//
// @Override
// protected void dispatch(ActionEvent.Handler handler) {
// handler.onAction(this);
// }
//
// protected ActionEvent() {
// }
//
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/event/ActionNames.java
// public interface ActionNames {
// public static final String BACK = "back";
// public static final String ANIMATION_END = "ae";
// }
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/sample/SampleActivity.java
import gov.wa.wsdot.apps.mgwt.client.ClientFactory;
import gov.wa.wsdot.apps.mgwt.client.event.ActionEvent;
import gov.wa.wsdot.apps.mgwt.client.event.ActionNames;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.googlecode.mgwt.mvp.client.MGWTAbstractActivity;
package gov.wa.wsdot.apps.mgwt.client.activities.sample;
public class SampleActivity extends MGWTAbstractActivity implements
SampleView.Presenter {
| private final ClientFactory clientFactory; |
WSDOT/Archetypes | archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/sample/SampleActivity.java | // Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/ClientFactory.java
// public interface ClientFactory {
//
// public HomeView getHomeView();
// public EventBus getEventBus();
// public PlaceController getPlaceController();
// public SwipeMenu getSwipeMenu();
//
// /**
// * @return
// */
// public AboutView getAboutView();
// public SampleView getSampleView();
// public MenuView getMenuView();
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/event/ActionEvent.java
// public class ActionEvent extends Event<ActionEvent.Handler> {
//
// public interface Handler {
// void onAction(ActionEvent event);
// }
//
// private static final Type<ActionEvent.Handler> TYPE = new Type<ActionEvent.Handler>();
//
// public static void fire(EventBus eventBus, String sourceName) {
// eventBus.fireEventFromSource(new ActionEvent(), sourceName);
// }
//
// public static HandlerRegistration register(EventBus eventBus,
// String sourceName, Handler handler) {
//
// return eventBus.addHandlerToSource(TYPE, sourceName, handler);
// }
//
// @Override
// public Type<Handler> getAssociatedType() {
// return TYPE;
// }
//
// @Override
// protected void dispatch(ActionEvent.Handler handler) {
// handler.onAction(this);
// }
//
// protected ActionEvent() {
// }
//
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/event/ActionNames.java
// public interface ActionNames {
// public static final String BACK = "back";
// public static final String ANIMATION_END = "ae";
// }
| import gov.wa.wsdot.apps.mgwt.client.ClientFactory;
import gov.wa.wsdot.apps.mgwt.client.event.ActionEvent;
import gov.wa.wsdot.apps.mgwt.client.event.ActionNames;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.googlecode.mgwt.mvp.client.MGWTAbstractActivity; | package gov.wa.wsdot.apps.mgwt.client.activities.sample;
public class SampleActivity extends MGWTAbstractActivity implements
SampleView.Presenter {
private final ClientFactory clientFactory;
private SampleView view;
private EventBus eventBus;
public SampleActivity(ClientFactory clientFactory) {
this.clientFactory = clientFactory;
}
@Override
public void start(AcceptsOneWidget panel, final EventBus eventBus) {
view = clientFactory.getSampleView();
this.eventBus = eventBus;
view.setPresenter(this);
panel.setWidget(view);
}
@Override
public void onStop() {
view.setPresenter(null);
}
@Override
public void onBackButtonPressed() { | // Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/ClientFactory.java
// public interface ClientFactory {
//
// public HomeView getHomeView();
// public EventBus getEventBus();
// public PlaceController getPlaceController();
// public SwipeMenu getSwipeMenu();
//
// /**
// * @return
// */
// public AboutView getAboutView();
// public SampleView getSampleView();
// public MenuView getMenuView();
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/event/ActionEvent.java
// public class ActionEvent extends Event<ActionEvent.Handler> {
//
// public interface Handler {
// void onAction(ActionEvent event);
// }
//
// private static final Type<ActionEvent.Handler> TYPE = new Type<ActionEvent.Handler>();
//
// public static void fire(EventBus eventBus, String sourceName) {
// eventBus.fireEventFromSource(new ActionEvent(), sourceName);
// }
//
// public static HandlerRegistration register(EventBus eventBus,
// String sourceName, Handler handler) {
//
// return eventBus.addHandlerToSource(TYPE, sourceName, handler);
// }
//
// @Override
// public Type<Handler> getAssociatedType() {
// return TYPE;
// }
//
// @Override
// protected void dispatch(ActionEvent.Handler handler) {
// handler.onAction(this);
// }
//
// protected ActionEvent() {
// }
//
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/event/ActionNames.java
// public interface ActionNames {
// public static final String BACK = "back";
// public static final String ANIMATION_END = "ae";
// }
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/sample/SampleActivity.java
import gov.wa.wsdot.apps.mgwt.client.ClientFactory;
import gov.wa.wsdot.apps.mgwt.client.event.ActionEvent;
import gov.wa.wsdot.apps.mgwt.client.event.ActionNames;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.googlecode.mgwt.mvp.client.MGWTAbstractActivity;
package gov.wa.wsdot.apps.mgwt.client.activities.sample;
public class SampleActivity extends MGWTAbstractActivity implements
SampleView.Presenter {
private final ClientFactory clientFactory;
private SampleView view;
private EventBus eventBus;
public SampleActivity(ClientFactory clientFactory) {
this.clientFactory = clientFactory;
}
@Override
public void start(AcceptsOneWidget panel, final EventBus eventBus) {
view = clientFactory.getSampleView();
this.eventBus = eventBus;
view.setPresenter(this);
panel.setWidget(view);
}
@Override
public void onStop() {
view.setPresenter(null);
}
@Override
public void onBackButtonPressed() { | ActionEvent.fire(eventBus, ActionNames.BACK); |
WSDOT/Archetypes | archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/sample/SampleActivity.java | // Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/ClientFactory.java
// public interface ClientFactory {
//
// public HomeView getHomeView();
// public EventBus getEventBus();
// public PlaceController getPlaceController();
// public SwipeMenu getSwipeMenu();
//
// /**
// * @return
// */
// public AboutView getAboutView();
// public SampleView getSampleView();
// public MenuView getMenuView();
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/event/ActionEvent.java
// public class ActionEvent extends Event<ActionEvent.Handler> {
//
// public interface Handler {
// void onAction(ActionEvent event);
// }
//
// private static final Type<ActionEvent.Handler> TYPE = new Type<ActionEvent.Handler>();
//
// public static void fire(EventBus eventBus, String sourceName) {
// eventBus.fireEventFromSource(new ActionEvent(), sourceName);
// }
//
// public static HandlerRegistration register(EventBus eventBus,
// String sourceName, Handler handler) {
//
// return eventBus.addHandlerToSource(TYPE, sourceName, handler);
// }
//
// @Override
// public Type<Handler> getAssociatedType() {
// return TYPE;
// }
//
// @Override
// protected void dispatch(ActionEvent.Handler handler) {
// handler.onAction(this);
// }
//
// protected ActionEvent() {
// }
//
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/event/ActionNames.java
// public interface ActionNames {
// public static final String BACK = "back";
// public static final String ANIMATION_END = "ae";
// }
| import gov.wa.wsdot.apps.mgwt.client.ClientFactory;
import gov.wa.wsdot.apps.mgwt.client.event.ActionEvent;
import gov.wa.wsdot.apps.mgwt.client.event.ActionNames;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.googlecode.mgwt.mvp.client.MGWTAbstractActivity; | package gov.wa.wsdot.apps.mgwt.client.activities.sample;
public class SampleActivity extends MGWTAbstractActivity implements
SampleView.Presenter {
private final ClientFactory clientFactory;
private SampleView view;
private EventBus eventBus;
public SampleActivity(ClientFactory clientFactory) {
this.clientFactory = clientFactory;
}
@Override
public void start(AcceptsOneWidget panel, final EventBus eventBus) {
view = clientFactory.getSampleView();
this.eventBus = eventBus;
view.setPresenter(this);
panel.setWidget(view);
}
@Override
public void onStop() {
view.setPresenter(null);
}
@Override
public void onBackButtonPressed() { | // Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/ClientFactory.java
// public interface ClientFactory {
//
// public HomeView getHomeView();
// public EventBus getEventBus();
// public PlaceController getPlaceController();
// public SwipeMenu getSwipeMenu();
//
// /**
// * @return
// */
// public AboutView getAboutView();
// public SampleView getSampleView();
// public MenuView getMenuView();
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/event/ActionEvent.java
// public class ActionEvent extends Event<ActionEvent.Handler> {
//
// public interface Handler {
// void onAction(ActionEvent event);
// }
//
// private static final Type<ActionEvent.Handler> TYPE = new Type<ActionEvent.Handler>();
//
// public static void fire(EventBus eventBus, String sourceName) {
// eventBus.fireEventFromSource(new ActionEvent(), sourceName);
// }
//
// public static HandlerRegistration register(EventBus eventBus,
// String sourceName, Handler handler) {
//
// return eventBus.addHandlerToSource(TYPE, sourceName, handler);
// }
//
// @Override
// public Type<Handler> getAssociatedType() {
// return TYPE;
// }
//
// @Override
// protected void dispatch(ActionEvent.Handler handler) {
// handler.onAction(this);
// }
//
// protected ActionEvent() {
// }
//
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/event/ActionNames.java
// public interface ActionNames {
// public static final String BACK = "back";
// public static final String ANIMATION_END = "ae";
// }
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/sample/SampleActivity.java
import gov.wa.wsdot.apps.mgwt.client.ClientFactory;
import gov.wa.wsdot.apps.mgwt.client.event.ActionEvent;
import gov.wa.wsdot.apps.mgwt.client.event.ActionNames;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.googlecode.mgwt.mvp.client.MGWTAbstractActivity;
package gov.wa.wsdot.apps.mgwt.client.activities.sample;
public class SampleActivity extends MGWTAbstractActivity implements
SampleView.Presenter {
private final ClientFactory clientFactory;
private SampleView view;
private EventBus eventBus;
public SampleActivity(ClientFactory clientFactory) {
this.clientFactory = clientFactory;
}
@Override
public void start(AcceptsOneWidget panel, final EventBus eventBus) {
view = clientFactory.getSampleView();
this.eventBus = eventBus;
view.setPresenter(this);
panel.setWidget(view);
}
@Override
public void onStop() {
view.setPresenter(null);
}
@Override
public void onBackButtonPressed() { | ActionEvent.fire(eventBus, ActionNames.BACK); |
WSDOT/Archetypes | archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/ClientFactory.java | // Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/about/AboutView.java
// public interface AboutView extends IsWidget {
//
// public void setPresenter(Presenter presenter);
//
// public interface Presenter {
//
// public void onBackButtonPressed();
//
// }
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/home/HomeView.java
// public interface HomeView extends IsWidget {
//
// public void setPresenter(Presenter presenter);
//
// public interface Presenter {
//
// public void onAboutButtonPressed();
//
// public void onItemSelected(int index);
//
// }
//
// public void render(List<Topic> createTopicsList);
//
// public void refresh();
//
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/sample/SampleView.java
// public interface SampleView extends IsWidget {
//
// public void setPresenter(Presenter presenter);
//
// public interface Presenter {
//
// public void onBackButtonPressed();
//
// }
// }
| import gov.wa.wsdot.apps.mgwtbasic.client.activities.about.AboutView;
import gov.wa.wsdot.apps.mgwtbasic.client.activities.home.HomeView;
import gov.wa.wsdot.apps.mgwtbasic.client.activities.sample.SampleView;
import com.google.gwt.place.shared.PlaceController;
import com.google.web.bindery.event.shared.EventBus; | package gov.wa.wsdot.apps.mgwtbasic.client;
public interface ClientFactory {
public HomeView getHomeView();
public EventBus getEventBus();
public PlaceController getPlaceController();
/**
* @return
*/ | // Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/about/AboutView.java
// public interface AboutView extends IsWidget {
//
// public void setPresenter(Presenter presenter);
//
// public interface Presenter {
//
// public void onBackButtonPressed();
//
// }
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/home/HomeView.java
// public interface HomeView extends IsWidget {
//
// public void setPresenter(Presenter presenter);
//
// public interface Presenter {
//
// public void onAboutButtonPressed();
//
// public void onItemSelected(int index);
//
// }
//
// public void render(List<Topic> createTopicsList);
//
// public void refresh();
//
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/sample/SampleView.java
// public interface SampleView extends IsWidget {
//
// public void setPresenter(Presenter presenter);
//
// public interface Presenter {
//
// public void onBackButtonPressed();
//
// }
// }
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/ClientFactory.java
import gov.wa.wsdot.apps.mgwtbasic.client.activities.about.AboutView;
import gov.wa.wsdot.apps.mgwtbasic.client.activities.home.HomeView;
import gov.wa.wsdot.apps.mgwtbasic.client.activities.sample.SampleView;
import com.google.gwt.place.shared.PlaceController;
import com.google.web.bindery.event.shared.EventBus;
package gov.wa.wsdot.apps.mgwtbasic.client;
public interface ClientFactory {
public HomeView getHomeView();
public EventBus getEventBus();
public PlaceController getPlaceController();
/**
* @return
*/ | public AboutView getAboutView(); |
WSDOT/Archetypes | archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/ClientFactory.java | // Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/about/AboutView.java
// public interface AboutView extends IsWidget {
//
// public void setPresenter(Presenter presenter);
//
// public interface Presenter {
//
// public void onBackButtonPressed();
//
// }
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/home/HomeView.java
// public interface HomeView extends IsWidget {
//
// public void setPresenter(Presenter presenter);
//
// public interface Presenter {
//
// public void onAboutButtonPressed();
//
// public void onItemSelected(int index);
//
// }
//
// public void render(List<Topic> createTopicsList);
//
// public void refresh();
//
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/sample/SampleView.java
// public interface SampleView extends IsWidget {
//
// public void setPresenter(Presenter presenter);
//
// public interface Presenter {
//
// public void onBackButtonPressed();
//
// }
// }
| import gov.wa.wsdot.apps.mgwtbasic.client.activities.about.AboutView;
import gov.wa.wsdot.apps.mgwtbasic.client.activities.home.HomeView;
import gov.wa.wsdot.apps.mgwtbasic.client.activities.sample.SampleView;
import com.google.gwt.place.shared.PlaceController;
import com.google.web.bindery.event.shared.EventBus; | package gov.wa.wsdot.apps.mgwtbasic.client;
public interface ClientFactory {
public HomeView getHomeView();
public EventBus getEventBus();
public PlaceController getPlaceController();
/**
* @return
*/
public AboutView getAboutView(); | // Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/about/AboutView.java
// public interface AboutView extends IsWidget {
//
// public void setPresenter(Presenter presenter);
//
// public interface Presenter {
//
// public void onBackButtonPressed();
//
// }
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/home/HomeView.java
// public interface HomeView extends IsWidget {
//
// public void setPresenter(Presenter presenter);
//
// public interface Presenter {
//
// public void onAboutButtonPressed();
//
// public void onItemSelected(int index);
//
// }
//
// public void render(List<Topic> createTopicsList);
//
// public void refresh();
//
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/sample/SampleView.java
// public interface SampleView extends IsWidget {
//
// public void setPresenter(Presenter presenter);
//
// public interface Presenter {
//
// public void onBackButtonPressed();
//
// }
// }
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/ClientFactory.java
import gov.wa.wsdot.apps.mgwtbasic.client.activities.about.AboutView;
import gov.wa.wsdot.apps.mgwtbasic.client.activities.home.HomeView;
import gov.wa.wsdot.apps.mgwtbasic.client.activities.sample.SampleView;
import com.google.gwt.place.shared.PlaceController;
import com.google.web.bindery.event.shared.EventBus;
package gov.wa.wsdot.apps.mgwtbasic.client;
public interface ClientFactory {
public HomeView getHomeView();
public EventBus getEventBus();
public PlaceController getPlaceController();
/**
* @return
*/
public AboutView getAboutView(); | public SampleView getSampleView(); |
WSDOT/Archetypes | archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/widget/image/LocalImageHolder.java | // Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/widget/image/LocalImageHolder.java
// public interface Images {
// ImageResource menu();
// }
| import gov.wa.wsdot.apps.mgwt.client.widget.image.LocalImageHolder.LocalImageHolderAppearance.Images;
import com.google.gwt.core.shared.GWT;
import com.google.gwt.resources.client.ImageResource; | package gov.wa.wsdot.apps.mgwt.client.widget.image;
public class LocalImageHolder {
private static final LocalImageHolderAppearance APPEARANCE = GWT
.create(LocalImageHolderAppearance.class);
public interface LocalImageHolderAppearance { | // Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/widget/image/LocalImageHolder.java
// public interface Images {
// ImageResource menu();
// }
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/widget/image/LocalImageHolder.java
import gov.wa.wsdot.apps.mgwt.client.widget.image.LocalImageHolder.LocalImageHolderAppearance.Images;
import com.google.gwt.core.shared.GWT;
import com.google.gwt.resources.client.ImageResource;
package gov.wa.wsdot.apps.mgwt.client.widget.image;
public class LocalImageHolder {
private static final LocalImageHolderAppearance APPEARANCE = GWT
.create(LocalImageHolderAppearance.class);
public interface LocalImageHolderAppearance { | public interface Images { |
WSDOT/Archetypes | archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/home/HomeView.java | // Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/shared/Topic.java
// public class Topic implements Serializable {
//
// private static final long serialVersionUID = -134211444131752658L;
// private String name;
//
// public Topic() {
// }
//
// public Topic(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
| import gov.wa.wsdot.apps.mgwt.shared.Topic;
import java.util.List;
import com.google.gwt.user.client.ui.IsWidget; | package gov.wa.wsdot.apps.mgwt.client.activities.home;
public interface HomeView extends IsWidget {
public void setPresenter(Presenter presenter);
public interface Presenter {
public void onItemSelected(int index);
public void onMenuButtonPressed();
}
| // Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/shared/Topic.java
// public class Topic implements Serializable {
//
// private static final long serialVersionUID = -134211444131752658L;
// private String name;
//
// public Topic() {
// }
//
// public Topic(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/home/HomeView.java
import gov.wa.wsdot.apps.mgwt.shared.Topic;
import java.util.List;
import com.google.gwt.user.client.ui.IsWidget;
package gov.wa.wsdot.apps.mgwt.client.activities.home;
public interface HomeView extends IsWidget {
public void setPresenter(Presenter presenter);
public interface Presenter {
public void onItemSelected(int index);
public void onMenuButtonPressed();
}
| public void render(List<Topic> createTopicsList); |
WSDOT/Archetypes | archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/AppHistoryObserver.java | // Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/event/ActionEvent.java
// public class ActionEvent extends Event<ActionEvent.Handler> {
//
// public interface Handler {
// void onAction(ActionEvent event);
// }
//
// private static final Type<ActionEvent.Handler> TYPE = new Type<ActionEvent.Handler>();
//
// public static void fire(EventBus eventBus, String sourceName) {
// eventBus.fireEventFromSource(new ActionEvent(), sourceName);
// }
//
// public static HandlerRegistration register(EventBus eventBus,
// String sourceName, Handler handler) {
//
// return eventBus.addHandlerToSource(TYPE, sourceName, handler);
// }
//
// @Override
// public Type<Handler> getAssociatedType() {
// return TYPE;
// }
//
// @Override
// protected void dispatch(ActionEvent.Handler handler) {
// handler.onAction(this);
// }
//
// protected ActionEvent() {
// }
//
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/event/ActionNames.java
// public interface ActionNames {
// public static final String BACK = "back";
// public static final String ANIMATION_END = "ae";
// }
| import gov.wa.wsdot.apps.mgwtbasic.client.event.ActionEvent;
import gov.wa.wsdot.apps.mgwtbasic.client.event.ActionNames;
import com.google.gwt.place.shared.Place;
import com.google.gwt.user.client.History;
import com.google.web.bindery.event.shared.EventBus;
import com.google.web.bindery.event.shared.HandlerRegistration;
import com.googlecode.mgwt.dom.client.event.mouse.HandlerRegistrationCollection;
import com.googlecode.mgwt.mvp.client.history.HistoryHandler;
import com.googlecode.mgwt.mvp.client.history.HistoryObserver; | package gov.wa.wsdot.apps.mgwtbasic.client;
public class AppHistoryObserver implements HistoryObserver {
@Override
public void onPlaceChange(Place place, HistoryHandler handler) {
}
@Override
public void onHistoryChanged(Place place, HistoryHandler handler) {
}
@Override
public void onAppStarted(Place place, HistoryHandler historyHandler) {
onPhoneNav(place, historyHandler);
}
@Override
public HandlerRegistration bind(EventBus eventBus, final HistoryHandler historyHandler) {
| // Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/event/ActionEvent.java
// public class ActionEvent extends Event<ActionEvent.Handler> {
//
// public interface Handler {
// void onAction(ActionEvent event);
// }
//
// private static final Type<ActionEvent.Handler> TYPE = new Type<ActionEvent.Handler>();
//
// public static void fire(EventBus eventBus, String sourceName) {
// eventBus.fireEventFromSource(new ActionEvent(), sourceName);
// }
//
// public static HandlerRegistration register(EventBus eventBus,
// String sourceName, Handler handler) {
//
// return eventBus.addHandlerToSource(TYPE, sourceName, handler);
// }
//
// @Override
// public Type<Handler> getAssociatedType() {
// return TYPE;
// }
//
// @Override
// protected void dispatch(ActionEvent.Handler handler) {
// handler.onAction(this);
// }
//
// protected ActionEvent() {
// }
//
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/event/ActionNames.java
// public interface ActionNames {
// public static final String BACK = "back";
// public static final String ANIMATION_END = "ae";
// }
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/AppHistoryObserver.java
import gov.wa.wsdot.apps.mgwtbasic.client.event.ActionEvent;
import gov.wa.wsdot.apps.mgwtbasic.client.event.ActionNames;
import com.google.gwt.place.shared.Place;
import com.google.gwt.user.client.History;
import com.google.web.bindery.event.shared.EventBus;
import com.google.web.bindery.event.shared.HandlerRegistration;
import com.googlecode.mgwt.dom.client.event.mouse.HandlerRegistrationCollection;
import com.googlecode.mgwt.mvp.client.history.HistoryHandler;
import com.googlecode.mgwt.mvp.client.history.HistoryObserver;
package gov.wa.wsdot.apps.mgwtbasic.client;
public class AppHistoryObserver implements HistoryObserver {
@Override
public void onPlaceChange(Place place, HistoryHandler handler) {
}
@Override
public void onHistoryChanged(Place place, HistoryHandler handler) {
}
@Override
public void onAppStarted(Place place, HistoryHandler historyHandler) {
onPhoneNav(place, historyHandler);
}
@Override
public HandlerRegistration bind(EventBus eventBus, final HistoryHandler historyHandler) {
| HandlerRegistration backButtonRegistration = ActionEvent.register( |
WSDOT/Archetypes | archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/AppHistoryObserver.java | // Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/event/ActionEvent.java
// public class ActionEvent extends Event<ActionEvent.Handler> {
//
// public interface Handler {
// void onAction(ActionEvent event);
// }
//
// private static final Type<ActionEvent.Handler> TYPE = new Type<ActionEvent.Handler>();
//
// public static void fire(EventBus eventBus, String sourceName) {
// eventBus.fireEventFromSource(new ActionEvent(), sourceName);
// }
//
// public static HandlerRegistration register(EventBus eventBus,
// String sourceName, Handler handler) {
//
// return eventBus.addHandlerToSource(TYPE, sourceName, handler);
// }
//
// @Override
// public Type<Handler> getAssociatedType() {
// return TYPE;
// }
//
// @Override
// protected void dispatch(ActionEvent.Handler handler) {
// handler.onAction(this);
// }
//
// protected ActionEvent() {
// }
//
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/event/ActionNames.java
// public interface ActionNames {
// public static final String BACK = "back";
// public static final String ANIMATION_END = "ae";
// }
| import gov.wa.wsdot.apps.mgwtbasic.client.event.ActionEvent;
import gov.wa.wsdot.apps.mgwtbasic.client.event.ActionNames;
import com.google.gwt.place.shared.Place;
import com.google.gwt.user.client.History;
import com.google.web.bindery.event.shared.EventBus;
import com.google.web.bindery.event.shared.HandlerRegistration;
import com.googlecode.mgwt.dom.client.event.mouse.HandlerRegistrationCollection;
import com.googlecode.mgwt.mvp.client.history.HistoryHandler;
import com.googlecode.mgwt.mvp.client.history.HistoryObserver; | package gov.wa.wsdot.apps.mgwtbasic.client;
public class AppHistoryObserver implements HistoryObserver {
@Override
public void onPlaceChange(Place place, HistoryHandler handler) {
}
@Override
public void onHistoryChanged(Place place, HistoryHandler handler) {
}
@Override
public void onAppStarted(Place place, HistoryHandler historyHandler) {
onPhoneNav(place, historyHandler);
}
@Override
public HandlerRegistration bind(EventBus eventBus, final HistoryHandler historyHandler) {
HandlerRegistration backButtonRegistration = ActionEvent.register( | // Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/event/ActionEvent.java
// public class ActionEvent extends Event<ActionEvent.Handler> {
//
// public interface Handler {
// void onAction(ActionEvent event);
// }
//
// private static final Type<ActionEvent.Handler> TYPE = new Type<ActionEvent.Handler>();
//
// public static void fire(EventBus eventBus, String sourceName) {
// eventBus.fireEventFromSource(new ActionEvent(), sourceName);
// }
//
// public static HandlerRegistration register(EventBus eventBus,
// String sourceName, Handler handler) {
//
// return eventBus.addHandlerToSource(TYPE, sourceName, handler);
// }
//
// @Override
// public Type<Handler> getAssociatedType() {
// return TYPE;
// }
//
// @Override
// protected void dispatch(ActionEvent.Handler handler) {
// handler.onAction(this);
// }
//
// protected ActionEvent() {
// }
//
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/event/ActionNames.java
// public interface ActionNames {
// public static final String BACK = "back";
// public static final String ANIMATION_END = "ae";
// }
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/AppHistoryObserver.java
import gov.wa.wsdot.apps.mgwtbasic.client.event.ActionEvent;
import gov.wa.wsdot.apps.mgwtbasic.client.event.ActionNames;
import com.google.gwt.place.shared.Place;
import com.google.gwt.user.client.History;
import com.google.web.bindery.event.shared.EventBus;
import com.google.web.bindery.event.shared.HandlerRegistration;
import com.googlecode.mgwt.dom.client.event.mouse.HandlerRegistrationCollection;
import com.googlecode.mgwt.mvp.client.history.HistoryHandler;
import com.googlecode.mgwt.mvp.client.history.HistoryObserver;
package gov.wa.wsdot.apps.mgwtbasic.client;
public class AppHistoryObserver implements HistoryObserver {
@Override
public void onPlaceChange(Place place, HistoryHandler handler) {
}
@Override
public void onHistoryChanged(Place place, HistoryHandler handler) {
}
@Override
public void onAppStarted(Place place, HistoryHandler historyHandler) {
onPhoneNav(place, historyHandler);
}
@Override
public HandlerRegistration bind(EventBus eventBus, final HistoryHandler historyHandler) {
HandlerRegistration backButtonRegistration = ActionEvent.register( | eventBus, ActionNames.BACK, new ActionEvent.Handler() { |
WSDOT/Archetypes | archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/home/HomeActivity.java | // Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/ClientFactory.java
// public interface ClientFactory {
//
// public HomeView getHomeView();
// public EventBus getEventBus();
// public PlaceController getPlaceController();
//
// /**
// * @return
// */
// public AboutView getAboutView();
// public SampleView getSampleView();
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/about/AboutPlace.java
// public class AboutPlace extends Place {
//
// public static class AboutPlaceTokenizer implements
// PlaceTokenizer<AboutPlace> {
//
// @Override
// public AboutPlace getPlace(String token) {
// return new AboutPlace();
// }
//
// @Override
// public String getToken(AboutPlace place) {
// return "";
// }
//
// }
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/sample/SamplePlace.java
// public class SamplePlace extends Place {
//
// public static class SamplePlaceTokenizer implements
// PlaceTokenizer<SamplePlace> {
//
// @Override
// public SamplePlace getPlace(String token) {
// return new SamplePlace();
// }
//
// @Override
// public String getToken(SamplePlace place) {
// return "";
// }
//
// }
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/shared/Topic.java
// public class Topic implements Serializable {
//
// private static final long serialVersionUID = -134211444131752658L;
// private String name;
//
// public Topic() {
// }
//
// public Topic(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
| import java.util.ArrayList;
import java.util.List;
import gov.wa.wsdot.apps.mgwtbasic.client.ClientFactory;
import gov.wa.wsdot.apps.mgwtbasic.client.activities.about.AboutPlace;
import gov.wa.wsdot.apps.mgwtbasic.client.activities.sample.SamplePlace;
import gov.wa.wsdot.apps.mgwtbasic.shared.Topic;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.google.web.bindery.event.shared.EventBus;
import com.googlecode.mgwt.mvp.client.MGWTAbstractActivity; | package gov.wa.wsdot.apps.mgwtbasic.client.activities.home;
public class HomeActivity extends MGWTAbstractActivity implements
HomeView.Presenter {
| // Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/ClientFactory.java
// public interface ClientFactory {
//
// public HomeView getHomeView();
// public EventBus getEventBus();
// public PlaceController getPlaceController();
//
// /**
// * @return
// */
// public AboutView getAboutView();
// public SampleView getSampleView();
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/about/AboutPlace.java
// public class AboutPlace extends Place {
//
// public static class AboutPlaceTokenizer implements
// PlaceTokenizer<AboutPlace> {
//
// @Override
// public AboutPlace getPlace(String token) {
// return new AboutPlace();
// }
//
// @Override
// public String getToken(AboutPlace place) {
// return "";
// }
//
// }
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/sample/SamplePlace.java
// public class SamplePlace extends Place {
//
// public static class SamplePlaceTokenizer implements
// PlaceTokenizer<SamplePlace> {
//
// @Override
// public SamplePlace getPlace(String token) {
// return new SamplePlace();
// }
//
// @Override
// public String getToken(SamplePlace place) {
// return "";
// }
//
// }
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/shared/Topic.java
// public class Topic implements Serializable {
//
// private static final long serialVersionUID = -134211444131752658L;
// private String name;
//
// public Topic() {
// }
//
// public Topic(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/home/HomeActivity.java
import java.util.ArrayList;
import java.util.List;
import gov.wa.wsdot.apps.mgwtbasic.client.ClientFactory;
import gov.wa.wsdot.apps.mgwtbasic.client.activities.about.AboutPlace;
import gov.wa.wsdot.apps.mgwtbasic.client.activities.sample.SamplePlace;
import gov.wa.wsdot.apps.mgwtbasic.shared.Topic;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.google.web.bindery.event.shared.EventBus;
import com.googlecode.mgwt.mvp.client.MGWTAbstractActivity;
package gov.wa.wsdot.apps.mgwtbasic.client.activities.home;
public class HomeActivity extends MGWTAbstractActivity implements
HomeView.Presenter {
| private final ClientFactory clientFactory; |
WSDOT/Archetypes | archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/home/HomeActivity.java | // Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/ClientFactory.java
// public interface ClientFactory {
//
// public HomeView getHomeView();
// public EventBus getEventBus();
// public PlaceController getPlaceController();
//
// /**
// * @return
// */
// public AboutView getAboutView();
// public SampleView getSampleView();
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/about/AboutPlace.java
// public class AboutPlace extends Place {
//
// public static class AboutPlaceTokenizer implements
// PlaceTokenizer<AboutPlace> {
//
// @Override
// public AboutPlace getPlace(String token) {
// return new AboutPlace();
// }
//
// @Override
// public String getToken(AboutPlace place) {
// return "";
// }
//
// }
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/sample/SamplePlace.java
// public class SamplePlace extends Place {
//
// public static class SamplePlaceTokenizer implements
// PlaceTokenizer<SamplePlace> {
//
// @Override
// public SamplePlace getPlace(String token) {
// return new SamplePlace();
// }
//
// @Override
// public String getToken(SamplePlace place) {
// return "";
// }
//
// }
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/shared/Topic.java
// public class Topic implements Serializable {
//
// private static final long serialVersionUID = -134211444131752658L;
// private String name;
//
// public Topic() {
// }
//
// public Topic(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
| import java.util.ArrayList;
import java.util.List;
import gov.wa.wsdot.apps.mgwtbasic.client.ClientFactory;
import gov.wa.wsdot.apps.mgwtbasic.client.activities.about.AboutPlace;
import gov.wa.wsdot.apps.mgwtbasic.client.activities.sample.SamplePlace;
import gov.wa.wsdot.apps.mgwtbasic.shared.Topic;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.google.web.bindery.event.shared.EventBus;
import com.googlecode.mgwt.mvp.client.MGWTAbstractActivity; | package gov.wa.wsdot.apps.mgwtbasic.client.activities.home;
public class HomeActivity extends MGWTAbstractActivity implements
HomeView.Presenter {
private final ClientFactory clientFactory;
private HomeView view;
public HomeActivity(ClientFactory clientFactory) {
this.clientFactory = clientFactory;
}
@Override
public void start(AcceptsOneWidget panel, EventBus eventBus) {
view = clientFactory.getHomeView();
view.setPresenter(this);
view.render(createTopicsList());
view.refresh();
panel.setWidget(view);
}
| // Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/ClientFactory.java
// public interface ClientFactory {
//
// public HomeView getHomeView();
// public EventBus getEventBus();
// public PlaceController getPlaceController();
//
// /**
// * @return
// */
// public AboutView getAboutView();
// public SampleView getSampleView();
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/about/AboutPlace.java
// public class AboutPlace extends Place {
//
// public static class AboutPlaceTokenizer implements
// PlaceTokenizer<AboutPlace> {
//
// @Override
// public AboutPlace getPlace(String token) {
// return new AboutPlace();
// }
//
// @Override
// public String getToken(AboutPlace place) {
// return "";
// }
//
// }
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/sample/SamplePlace.java
// public class SamplePlace extends Place {
//
// public static class SamplePlaceTokenizer implements
// PlaceTokenizer<SamplePlace> {
//
// @Override
// public SamplePlace getPlace(String token) {
// return new SamplePlace();
// }
//
// @Override
// public String getToken(SamplePlace place) {
// return "";
// }
//
// }
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/shared/Topic.java
// public class Topic implements Serializable {
//
// private static final long serialVersionUID = -134211444131752658L;
// private String name;
//
// public Topic() {
// }
//
// public Topic(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/home/HomeActivity.java
import java.util.ArrayList;
import java.util.List;
import gov.wa.wsdot.apps.mgwtbasic.client.ClientFactory;
import gov.wa.wsdot.apps.mgwtbasic.client.activities.about.AboutPlace;
import gov.wa.wsdot.apps.mgwtbasic.client.activities.sample.SamplePlace;
import gov.wa.wsdot.apps.mgwtbasic.shared.Topic;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.google.web.bindery.event.shared.EventBus;
import com.googlecode.mgwt.mvp.client.MGWTAbstractActivity;
package gov.wa.wsdot.apps.mgwtbasic.client.activities.home;
public class HomeActivity extends MGWTAbstractActivity implements
HomeView.Presenter {
private final ClientFactory clientFactory;
private HomeView view;
public HomeActivity(ClientFactory clientFactory) {
this.clientFactory = clientFactory;
}
@Override
public void start(AcceptsOneWidget panel, EventBus eventBus) {
view = clientFactory.getHomeView();
view.setPresenter(this);
view.render(createTopicsList());
view.refresh();
panel.setWidget(view);
}
| private List<Topic> createTopicsList() { |
WSDOT/Archetypes | archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/home/HomeActivity.java | // Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/ClientFactory.java
// public interface ClientFactory {
//
// public HomeView getHomeView();
// public EventBus getEventBus();
// public PlaceController getPlaceController();
//
// /**
// * @return
// */
// public AboutView getAboutView();
// public SampleView getSampleView();
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/about/AboutPlace.java
// public class AboutPlace extends Place {
//
// public static class AboutPlaceTokenizer implements
// PlaceTokenizer<AboutPlace> {
//
// @Override
// public AboutPlace getPlace(String token) {
// return new AboutPlace();
// }
//
// @Override
// public String getToken(AboutPlace place) {
// return "";
// }
//
// }
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/sample/SamplePlace.java
// public class SamplePlace extends Place {
//
// public static class SamplePlaceTokenizer implements
// PlaceTokenizer<SamplePlace> {
//
// @Override
// public SamplePlace getPlace(String token) {
// return new SamplePlace();
// }
//
// @Override
// public String getToken(SamplePlace place) {
// return "";
// }
//
// }
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/shared/Topic.java
// public class Topic implements Serializable {
//
// private static final long serialVersionUID = -134211444131752658L;
// private String name;
//
// public Topic() {
// }
//
// public Topic(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
| import java.util.ArrayList;
import java.util.List;
import gov.wa.wsdot.apps.mgwtbasic.client.ClientFactory;
import gov.wa.wsdot.apps.mgwtbasic.client.activities.about.AboutPlace;
import gov.wa.wsdot.apps.mgwtbasic.client.activities.sample.SamplePlace;
import gov.wa.wsdot.apps.mgwtbasic.shared.Topic;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.google.web.bindery.event.shared.EventBus;
import com.googlecode.mgwt.mvp.client.MGWTAbstractActivity; | package gov.wa.wsdot.apps.mgwtbasic.client.activities.home;
public class HomeActivity extends MGWTAbstractActivity implements
HomeView.Presenter {
private final ClientFactory clientFactory;
private HomeView view;
public HomeActivity(ClientFactory clientFactory) {
this.clientFactory = clientFactory;
}
@Override
public void start(AcceptsOneWidget panel, EventBus eventBus) {
view = clientFactory.getHomeView();
view.setPresenter(this);
view.render(createTopicsList());
view.refresh();
panel.setWidget(view);
}
private List<Topic> createTopicsList() {
ArrayList<Topic> list = new ArrayList<Topic>();
list.add(new Topic("Sample Activity"));
return list;
}
@Override
public void onAboutButtonPressed() { | // Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/ClientFactory.java
// public interface ClientFactory {
//
// public HomeView getHomeView();
// public EventBus getEventBus();
// public PlaceController getPlaceController();
//
// /**
// * @return
// */
// public AboutView getAboutView();
// public SampleView getSampleView();
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/about/AboutPlace.java
// public class AboutPlace extends Place {
//
// public static class AboutPlaceTokenizer implements
// PlaceTokenizer<AboutPlace> {
//
// @Override
// public AboutPlace getPlace(String token) {
// return new AboutPlace();
// }
//
// @Override
// public String getToken(AboutPlace place) {
// return "";
// }
//
// }
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/sample/SamplePlace.java
// public class SamplePlace extends Place {
//
// public static class SamplePlaceTokenizer implements
// PlaceTokenizer<SamplePlace> {
//
// @Override
// public SamplePlace getPlace(String token) {
// return new SamplePlace();
// }
//
// @Override
// public String getToken(SamplePlace place) {
// return "";
// }
//
// }
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/shared/Topic.java
// public class Topic implements Serializable {
//
// private static final long serialVersionUID = -134211444131752658L;
// private String name;
//
// public Topic() {
// }
//
// public Topic(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/home/HomeActivity.java
import java.util.ArrayList;
import java.util.List;
import gov.wa.wsdot.apps.mgwtbasic.client.ClientFactory;
import gov.wa.wsdot.apps.mgwtbasic.client.activities.about.AboutPlace;
import gov.wa.wsdot.apps.mgwtbasic.client.activities.sample.SamplePlace;
import gov.wa.wsdot.apps.mgwtbasic.shared.Topic;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.google.web.bindery.event.shared.EventBus;
import com.googlecode.mgwt.mvp.client.MGWTAbstractActivity;
package gov.wa.wsdot.apps.mgwtbasic.client.activities.home;
public class HomeActivity extends MGWTAbstractActivity implements
HomeView.Presenter {
private final ClientFactory clientFactory;
private HomeView view;
public HomeActivity(ClientFactory clientFactory) {
this.clientFactory = clientFactory;
}
@Override
public void start(AcceptsOneWidget panel, EventBus eventBus) {
view = clientFactory.getHomeView();
view.setPresenter(this);
view.render(createTopicsList());
view.refresh();
panel.setWidget(view);
}
private List<Topic> createTopicsList() {
ArrayList<Topic> list = new ArrayList<Topic>();
list.add(new Topic("Sample Activity"));
return list;
}
@Override
public void onAboutButtonPressed() { | clientFactory.getPlaceController().goTo(new AboutPlace()); |
WSDOT/Archetypes | archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/home/HomeActivity.java | // Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/ClientFactory.java
// public interface ClientFactory {
//
// public HomeView getHomeView();
// public EventBus getEventBus();
// public PlaceController getPlaceController();
//
// /**
// * @return
// */
// public AboutView getAboutView();
// public SampleView getSampleView();
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/about/AboutPlace.java
// public class AboutPlace extends Place {
//
// public static class AboutPlaceTokenizer implements
// PlaceTokenizer<AboutPlace> {
//
// @Override
// public AboutPlace getPlace(String token) {
// return new AboutPlace();
// }
//
// @Override
// public String getToken(AboutPlace place) {
// return "";
// }
//
// }
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/sample/SamplePlace.java
// public class SamplePlace extends Place {
//
// public static class SamplePlaceTokenizer implements
// PlaceTokenizer<SamplePlace> {
//
// @Override
// public SamplePlace getPlace(String token) {
// return new SamplePlace();
// }
//
// @Override
// public String getToken(SamplePlace place) {
// return "";
// }
//
// }
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/shared/Topic.java
// public class Topic implements Serializable {
//
// private static final long serialVersionUID = -134211444131752658L;
// private String name;
//
// public Topic() {
// }
//
// public Topic(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
| import java.util.ArrayList;
import java.util.List;
import gov.wa.wsdot.apps.mgwtbasic.client.ClientFactory;
import gov.wa.wsdot.apps.mgwtbasic.client.activities.about.AboutPlace;
import gov.wa.wsdot.apps.mgwtbasic.client.activities.sample.SamplePlace;
import gov.wa.wsdot.apps.mgwtbasic.shared.Topic;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.google.web.bindery.event.shared.EventBus;
import com.googlecode.mgwt.mvp.client.MGWTAbstractActivity; | package gov.wa.wsdot.apps.mgwtbasic.client.activities.home;
public class HomeActivity extends MGWTAbstractActivity implements
HomeView.Presenter {
private final ClientFactory clientFactory;
private HomeView view;
public HomeActivity(ClientFactory clientFactory) {
this.clientFactory = clientFactory;
}
@Override
public void start(AcceptsOneWidget panel, EventBus eventBus) {
view = clientFactory.getHomeView();
view.setPresenter(this);
view.render(createTopicsList());
view.refresh();
panel.setWidget(view);
}
private List<Topic> createTopicsList() {
ArrayList<Topic> list = new ArrayList<Topic>();
list.add(new Topic("Sample Activity"));
return list;
}
@Override
public void onAboutButtonPressed() {
clientFactory.getPlaceController().goTo(new AboutPlace());
}
@Override
public void onItemSelected(int index) {
if (index == 0) { | // Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/ClientFactory.java
// public interface ClientFactory {
//
// public HomeView getHomeView();
// public EventBus getEventBus();
// public PlaceController getPlaceController();
//
// /**
// * @return
// */
// public AboutView getAboutView();
// public SampleView getSampleView();
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/about/AboutPlace.java
// public class AboutPlace extends Place {
//
// public static class AboutPlaceTokenizer implements
// PlaceTokenizer<AboutPlace> {
//
// @Override
// public AboutPlace getPlace(String token) {
// return new AboutPlace();
// }
//
// @Override
// public String getToken(AboutPlace place) {
// return "";
// }
//
// }
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/sample/SamplePlace.java
// public class SamplePlace extends Place {
//
// public static class SamplePlaceTokenizer implements
// PlaceTokenizer<SamplePlace> {
//
// @Override
// public SamplePlace getPlace(String token) {
// return new SamplePlace();
// }
//
// @Override
// public String getToken(SamplePlace place) {
// return "";
// }
//
// }
// }
//
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/shared/Topic.java
// public class Topic implements Serializable {
//
// private static final long serialVersionUID = -134211444131752658L;
// private String name;
//
// public Topic() {
// }
//
// public Topic(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/home/HomeActivity.java
import java.util.ArrayList;
import java.util.List;
import gov.wa.wsdot.apps.mgwtbasic.client.ClientFactory;
import gov.wa.wsdot.apps.mgwtbasic.client.activities.about.AboutPlace;
import gov.wa.wsdot.apps.mgwtbasic.client.activities.sample.SamplePlace;
import gov.wa.wsdot.apps.mgwtbasic.shared.Topic;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.google.web.bindery.event.shared.EventBus;
import com.googlecode.mgwt.mvp.client.MGWTAbstractActivity;
package gov.wa.wsdot.apps.mgwtbasic.client.activities.home;
public class HomeActivity extends MGWTAbstractActivity implements
HomeView.Presenter {
private final ClientFactory clientFactory;
private HomeView view;
public HomeActivity(ClientFactory clientFactory) {
this.clientFactory = clientFactory;
}
@Override
public void start(AcceptsOneWidget panel, EventBus eventBus) {
view = clientFactory.getHomeView();
view.setPresenter(this);
view.render(createTopicsList());
view.refresh();
panel.setWidget(view);
}
private List<Topic> createTopicsList() {
ArrayList<Topic> list = new ArrayList<Topic>();
list.add(new Topic("Sample Activity"));
return list;
}
@Override
public void onAboutButtonPressed() {
clientFactory.getPlaceController().goTo(new AboutPlace());
}
@Override
public void onItemSelected(int index) {
if (index == 0) { | clientFactory.getPlaceController().goTo(new SamplePlace()); |
WSDOT/Archetypes | archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/AppNavActivityMapper.java | // Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/MenuActivity.java
// public class MenuActivity extends MGWTAbstractActivity implements
// MenuView.Presenter {
//
// private final ClientFactory clientFactory;
// private MenuView view;
// private EventBus eventBus;
//
// public MenuActivity(ClientFactory clientFactory) {
// this.clientFactory = clientFactory;
// }
//
// @Override
// public void start(AcceptsOneWidget panel, final EventBus eventBus) {
// view = clientFactory.getMenuView();
// this.eventBus = eventBus;
// view.setPresenter(this);
// view.render(createTopicsList());
//
// panel.setWidget(view);
// }
//
// @Override
// public void onStop() {
// view.setPresenter(null);
// }
//
// @Override
// public void onItemSelected(int index) {
// if (index == 0) {
// clientFactory.getSwipeMenu().close(false);
// //clientFactory.getPlaceController().goTo(new MenuItemOnePlace());
// return;
// }
// if (index == 1) {
// clientFactory.getSwipeMenu().close(false);
// //clientFactory.getPlaceController().goTo(new MenuItemTwoPlace());
// return;
// }
// if (index == 2) {
// clientFactory.getSwipeMenu().close(false);
// //clientFactory.getPlaceController().goTo(new MenuItemThreePlace());
// return;
// }
// }
//
// @Override
// public void onAboutButtonPressed() {
// clientFactory.getSwipeMenu().close(false);
// clientFactory.getPlaceController().goTo(new AboutPlace());
// }
//
// private List<Topic> createTopicsList() {
// ArrayList<Topic> list = new ArrayList<Topic>();
//
// list.add(new Topic("Menu Item One"));
// list.add(new Topic("Menu Item Two"));
// list.add(new Topic("Menu Item Three"));
//
// return list;
// }
//
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/home/HomePlace.java
// public class HomePlace extends Place {
//
// public static class HomePlaceTokenizer implements PlaceTokenizer<HomePlace> {
//
// @Override
// public HomePlace getPlace(String token) {
// return new HomePlace();
// }
//
// @Override
// public String getToken(HomePlace place) {
// return "";
// }
//
// }
//
// @Override
// public int hashCode() {
// return 3;
// }
//
// @Override
// public boolean equals(Object other) {
// if (other == this) {
// return true;
// }
//
// if (other == null) {
// return false;
// }
//
// if (other instanceof HomePlace) {
// return true;
// }
//
// return false;
// }
// }
| import gov.wa.wsdot.apps.mgwt.client.activities.MenuActivity;
import gov.wa.wsdot.apps.mgwt.client.activities.home.HomePlace;
import com.google.gwt.activity.shared.Activity;
import com.google.gwt.activity.shared.ActivityMapper;
import com.google.gwt.place.shared.Place; | package gov.wa.wsdot.apps.mgwt.client;
public class AppNavActivityMapper implements ActivityMapper {
private final ClientFactory clientFactory;
public AppNavActivityMapper(ClientFactory clientFactory) {
this.clientFactory = clientFactory;
}
| // Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/MenuActivity.java
// public class MenuActivity extends MGWTAbstractActivity implements
// MenuView.Presenter {
//
// private final ClientFactory clientFactory;
// private MenuView view;
// private EventBus eventBus;
//
// public MenuActivity(ClientFactory clientFactory) {
// this.clientFactory = clientFactory;
// }
//
// @Override
// public void start(AcceptsOneWidget panel, final EventBus eventBus) {
// view = clientFactory.getMenuView();
// this.eventBus = eventBus;
// view.setPresenter(this);
// view.render(createTopicsList());
//
// panel.setWidget(view);
// }
//
// @Override
// public void onStop() {
// view.setPresenter(null);
// }
//
// @Override
// public void onItemSelected(int index) {
// if (index == 0) {
// clientFactory.getSwipeMenu().close(false);
// //clientFactory.getPlaceController().goTo(new MenuItemOnePlace());
// return;
// }
// if (index == 1) {
// clientFactory.getSwipeMenu().close(false);
// //clientFactory.getPlaceController().goTo(new MenuItemTwoPlace());
// return;
// }
// if (index == 2) {
// clientFactory.getSwipeMenu().close(false);
// //clientFactory.getPlaceController().goTo(new MenuItemThreePlace());
// return;
// }
// }
//
// @Override
// public void onAboutButtonPressed() {
// clientFactory.getSwipeMenu().close(false);
// clientFactory.getPlaceController().goTo(new AboutPlace());
// }
//
// private List<Topic> createTopicsList() {
// ArrayList<Topic> list = new ArrayList<Topic>();
//
// list.add(new Topic("Menu Item One"));
// list.add(new Topic("Menu Item Two"));
// list.add(new Topic("Menu Item Three"));
//
// return list;
// }
//
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/home/HomePlace.java
// public class HomePlace extends Place {
//
// public static class HomePlaceTokenizer implements PlaceTokenizer<HomePlace> {
//
// @Override
// public HomePlace getPlace(String token) {
// return new HomePlace();
// }
//
// @Override
// public String getToken(HomePlace place) {
// return "";
// }
//
// }
//
// @Override
// public int hashCode() {
// return 3;
// }
//
// @Override
// public boolean equals(Object other) {
// if (other == this) {
// return true;
// }
//
// if (other == null) {
// return false;
// }
//
// if (other instanceof HomePlace) {
// return true;
// }
//
// return false;
// }
// }
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/AppNavActivityMapper.java
import gov.wa.wsdot.apps.mgwt.client.activities.MenuActivity;
import gov.wa.wsdot.apps.mgwt.client.activities.home.HomePlace;
import com.google.gwt.activity.shared.Activity;
import com.google.gwt.activity.shared.ActivityMapper;
import com.google.gwt.place.shared.Place;
package gov.wa.wsdot.apps.mgwt.client;
public class AppNavActivityMapper implements ActivityMapper {
private final ClientFactory clientFactory;
public AppNavActivityMapper(ClientFactory clientFactory) {
this.clientFactory = clientFactory;
}
| private MenuActivity menuActivity; |
WSDOT/Archetypes | archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/AppNavActivityMapper.java | // Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/MenuActivity.java
// public class MenuActivity extends MGWTAbstractActivity implements
// MenuView.Presenter {
//
// private final ClientFactory clientFactory;
// private MenuView view;
// private EventBus eventBus;
//
// public MenuActivity(ClientFactory clientFactory) {
// this.clientFactory = clientFactory;
// }
//
// @Override
// public void start(AcceptsOneWidget panel, final EventBus eventBus) {
// view = clientFactory.getMenuView();
// this.eventBus = eventBus;
// view.setPresenter(this);
// view.render(createTopicsList());
//
// panel.setWidget(view);
// }
//
// @Override
// public void onStop() {
// view.setPresenter(null);
// }
//
// @Override
// public void onItemSelected(int index) {
// if (index == 0) {
// clientFactory.getSwipeMenu().close(false);
// //clientFactory.getPlaceController().goTo(new MenuItemOnePlace());
// return;
// }
// if (index == 1) {
// clientFactory.getSwipeMenu().close(false);
// //clientFactory.getPlaceController().goTo(new MenuItemTwoPlace());
// return;
// }
// if (index == 2) {
// clientFactory.getSwipeMenu().close(false);
// //clientFactory.getPlaceController().goTo(new MenuItemThreePlace());
// return;
// }
// }
//
// @Override
// public void onAboutButtonPressed() {
// clientFactory.getSwipeMenu().close(false);
// clientFactory.getPlaceController().goTo(new AboutPlace());
// }
//
// private List<Topic> createTopicsList() {
// ArrayList<Topic> list = new ArrayList<Topic>();
//
// list.add(new Topic("Menu Item One"));
// list.add(new Topic("Menu Item Two"));
// list.add(new Topic("Menu Item Three"));
//
// return list;
// }
//
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/home/HomePlace.java
// public class HomePlace extends Place {
//
// public static class HomePlaceTokenizer implements PlaceTokenizer<HomePlace> {
//
// @Override
// public HomePlace getPlace(String token) {
// return new HomePlace();
// }
//
// @Override
// public String getToken(HomePlace place) {
// return "";
// }
//
// }
//
// @Override
// public int hashCode() {
// return 3;
// }
//
// @Override
// public boolean equals(Object other) {
// if (other == this) {
// return true;
// }
//
// if (other == null) {
// return false;
// }
//
// if (other instanceof HomePlace) {
// return true;
// }
//
// return false;
// }
// }
| import gov.wa.wsdot.apps.mgwt.client.activities.MenuActivity;
import gov.wa.wsdot.apps.mgwt.client.activities.home.HomePlace;
import com.google.gwt.activity.shared.Activity;
import com.google.gwt.activity.shared.ActivityMapper;
import com.google.gwt.place.shared.Place; | package gov.wa.wsdot.apps.mgwt.client;
public class AppNavActivityMapper implements ActivityMapper {
private final ClientFactory clientFactory;
public AppNavActivityMapper(ClientFactory clientFactory) {
this.clientFactory = clientFactory;
}
private MenuActivity menuActivity;
private Activity getMenuActivity() {
if (menuActivity == null) {
menuActivity = new MenuActivity(clientFactory);
}
return menuActivity;
}
@Override
public Activity getActivity(Place place) { | // Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/MenuActivity.java
// public class MenuActivity extends MGWTAbstractActivity implements
// MenuView.Presenter {
//
// private final ClientFactory clientFactory;
// private MenuView view;
// private EventBus eventBus;
//
// public MenuActivity(ClientFactory clientFactory) {
// this.clientFactory = clientFactory;
// }
//
// @Override
// public void start(AcceptsOneWidget panel, final EventBus eventBus) {
// view = clientFactory.getMenuView();
// this.eventBus = eventBus;
// view.setPresenter(this);
// view.render(createTopicsList());
//
// panel.setWidget(view);
// }
//
// @Override
// public void onStop() {
// view.setPresenter(null);
// }
//
// @Override
// public void onItemSelected(int index) {
// if (index == 0) {
// clientFactory.getSwipeMenu().close(false);
// //clientFactory.getPlaceController().goTo(new MenuItemOnePlace());
// return;
// }
// if (index == 1) {
// clientFactory.getSwipeMenu().close(false);
// //clientFactory.getPlaceController().goTo(new MenuItemTwoPlace());
// return;
// }
// if (index == 2) {
// clientFactory.getSwipeMenu().close(false);
// //clientFactory.getPlaceController().goTo(new MenuItemThreePlace());
// return;
// }
// }
//
// @Override
// public void onAboutButtonPressed() {
// clientFactory.getSwipeMenu().close(false);
// clientFactory.getPlaceController().goTo(new AboutPlace());
// }
//
// private List<Topic> createTopicsList() {
// ArrayList<Topic> list = new ArrayList<Topic>();
//
// list.add(new Topic("Menu Item One"));
// list.add(new Topic("Menu Item Two"));
// list.add(new Topic("Menu Item Three"));
//
// return list;
// }
//
// }
//
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/activities/home/HomePlace.java
// public class HomePlace extends Place {
//
// public static class HomePlaceTokenizer implements PlaceTokenizer<HomePlace> {
//
// @Override
// public HomePlace getPlace(String token) {
// return new HomePlace();
// }
//
// @Override
// public String getToken(HomePlace place) {
// return "";
// }
//
// }
//
// @Override
// public int hashCode() {
// return 3;
// }
//
// @Override
// public boolean equals(Object other) {
// if (other == this) {
// return true;
// }
//
// if (other == null) {
// return false;
// }
//
// if (other instanceof HomePlace) {
// return true;
// }
//
// return false;
// }
// }
// Path: archetypes/mgwt-basic-swipemenu/src/main/java/gov/wa/wsdot/apps/mgwt/client/AppNavActivityMapper.java
import gov.wa.wsdot.apps.mgwt.client.activities.MenuActivity;
import gov.wa.wsdot.apps.mgwt.client.activities.home.HomePlace;
import com.google.gwt.activity.shared.Activity;
import com.google.gwt.activity.shared.ActivityMapper;
import com.google.gwt.place.shared.Place;
package gov.wa.wsdot.apps.mgwt.client;
public class AppNavActivityMapper implements ActivityMapper {
private final ClientFactory clientFactory;
public AppNavActivityMapper(ClientFactory clientFactory) {
this.clientFactory = clientFactory;
}
private MenuActivity menuActivity;
private Activity getMenuActivity() {
if (menuActivity == null) {
menuActivity = new MenuActivity(clientFactory);
}
return menuActivity;
}
@Override
public Activity getActivity(Place place) { | if (place instanceof HomePlace) { |
WSDOT/Archetypes | archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/home/HomeViewGwtImpl.java | // Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/shared/Topic.java
// public class Topic implements Serializable {
//
// private static final long serialVersionUID = -134211444131752658L;
// private String name;
//
// public Topic() {
// }
//
// public Topic(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
| import gov.wa.wsdot.apps.mgwtbasic.shared.Topic;
import java.util.List;
import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;
import com.googlecode.mgwt.dom.client.event.tap.TapEvent;
import com.googlecode.mgwt.ui.client.widget.button.image.AboutImageButton;
import com.googlecode.mgwt.ui.client.widget.list.celllist.BasicCell;
import com.googlecode.mgwt.ui.client.widget.list.celllist.CellList;
import com.googlecode.mgwt.ui.client.widget.list.celllist.CellSelectedEvent;
import com.googlecode.mgwt.ui.client.widget.panel.scroll.ScrollPanel; | package gov.wa.wsdot.apps.mgwtbasic.client.activities.home;
public class HomeViewGwtImpl extends Composite implements HomeView {
/**
* The UiBinder interface.
*/
interface HomeViewGwtImplUiBinder extends UiBinder<Widget, HomeViewGwtImpl> {
}
/**
* The UiBinder used to generate the view.
*/
private static HomeViewGwtImplUiBinder uiBinder = GWT
.create(HomeViewGwtImplUiBinder.class);
@UiField
AboutImageButton aboutButton;
@UiField
ScrollPanel scrollPanel;
@UiField(provided = true) | // Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/shared/Topic.java
// public class Topic implements Serializable {
//
// private static final long serialVersionUID = -134211444131752658L;
// private String name;
//
// public Topic() {
// }
//
// public Topic(String name) {
// this.name = name;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
// Path: archetypes/mgwt-basic/src/main/java/gov/wa/wsdot/apps/mgwtbasic/client/activities/home/HomeViewGwtImpl.java
import gov.wa.wsdot.apps.mgwtbasic.shared.Topic;
import java.util.List;
import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;
import com.googlecode.mgwt.dom.client.event.tap.TapEvent;
import com.googlecode.mgwt.ui.client.widget.button.image.AboutImageButton;
import com.googlecode.mgwt.ui.client.widget.list.celllist.BasicCell;
import com.googlecode.mgwt.ui.client.widget.list.celllist.CellList;
import com.googlecode.mgwt.ui.client.widget.list.celllist.CellSelectedEvent;
import com.googlecode.mgwt.ui.client.widget.panel.scroll.ScrollPanel;
package gov.wa.wsdot.apps.mgwtbasic.client.activities.home;
public class HomeViewGwtImpl extends Composite implements HomeView {
/**
* The UiBinder interface.
*/
interface HomeViewGwtImplUiBinder extends UiBinder<Widget, HomeViewGwtImpl> {
}
/**
* The UiBinder used to generate the view.
*/
private static HomeViewGwtImplUiBinder uiBinder = GWT
.create(HomeViewGwtImplUiBinder.class);
@UiField
AboutImageButton aboutButton;
@UiField
ScrollPanel scrollPanel;
@UiField(provided = true) | CellList<Topic> cellList; |
Scandit/barcodescanner-sdk-cordova | src/android/com/mirasense/scanditsdk/plugin/SubViewPickerController.java | // Path: src/android/com/mirasense/scanditsdk/plugin/BarcodePickerWithSearchBar.java
// public static class Constraints {
// private Integer mLeftMargin = null;
// private Integer mTopMargin = null;
// private Integer mRightMargin = null;
// private Integer mBottomMargin = null;
// private Integer mWidth = null;
// private Integer mHeight = null;
//
// public Constraints() {}
//
// public Constraints(Rect margins) {
// if (margins != null) {
// mLeftMargin = margins.left;
// mTopMargin = margins.top;
// mRightMargin = margins.right;
// mBottomMargin = margins.bottom;
// }
// }
//
// public Integer getLeftMargin() {
// if (mLeftMargin == null && (mRightMargin == null || mWidth == null)) return 0;
// return mLeftMargin;
// }
// public void setLeftMargin(Integer value) { mLeftMargin = value; }
//
// public Integer getTopMargin() {
// if (mTopMargin == null && (mBottomMargin == null || mHeight == null)) return 0;
// return mTopMargin;
// }
// public void setTopMargin(Integer value) { mTopMargin = value; }
//
// public Integer getRightMargin() {
// return mRightMargin;
// }
// public void setRightMargin(Integer value) { mRightMargin = value; }
//
// public Integer getBottomMargin() {
// return mBottomMargin;
// }
// public void setBottomMargin(Integer value) { mBottomMargin = value; }
//
// public Integer getWidth() {
// if (mLeftMargin != null && mRightMargin != null) return null;
// return mWidth;
// }
// public void setWidth(Integer value) { mWidth = value; }
//
// public Integer getHeight() {
// if (mTopMargin != null && mBottomMargin != null) return null;
// return mHeight;
// }
// public void setHeight(Integer value) { mHeight = value; }
// }
| import android.app.Activity;
import android.content.Intent;
import android.graphics.Point;
import android.os.Bundle;
import android.os.Looper;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.webkit.WebView;
import android.widget.RelativeLayout;
import com.mirasense.scanditsdk.plugin.BarcodePickerWithSearchBar.Constraints;
import com.scandit.barcodepicker.OnScanListener;
import com.scandit.barcodepicker.ProcessFrameListener;
import com.scandit.barcodepicker.LicenseValidationListener;
import com.scandit.barcodepicker.PropertyChangeListener;
import com.scandit.barcodepicker.ScanSession;
import com.scandit.barcodepicker.ScanSettings;
import com.scandit.barcodepicker.ocr.RecognizedText;
import com.scandit.barcodepicker.ocr.TextRecognitionListener;
import com.scandit.base.util.JSONParseException;
import com.scandit.recognition.TrackedBarcode;
import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaPlugin;
import org.apache.cordova.CordovaWebView;
import org.apache.cordova.PluginResult;
import org.json.JSONArray;
import org.json.JSONObject;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean; | }
});
}
@Override
public void updateLayout(final Bundle layoutOptions) {
final Activity pluginActivity = mPlugin.cordova.getActivity();
runOnUiThread(new Runnable() {
@Override
public void run() {
PhonegapParamParser.updateLayout(pluginActivity, mPickerStateMachine.getPicker(),
layoutOptions, mScreenDimensions);
callPickerResizedListener(layoutOptions);
}
});
}
private void runOnUiThread(Runnable r) {
mPlugin.cordova.getActivity().runOnUiThread(r);
}
private void internalUpdateUI(Bundle overlayOptions, Bundle options) {
BarcodePickerWithSearchBar picker = mPickerStateMachine.getPicker();
UIParamParser.updatePickerUI(picker, overlayOptions);
PhonegapParamParser.updatePicker(picker, overlayOptions, this);
}
private void callPickerResizedListener(Bundle bundle) {
ResizeScannerInterface listener = resizeListener.get();
if (listener != null) { | // Path: src/android/com/mirasense/scanditsdk/plugin/BarcodePickerWithSearchBar.java
// public static class Constraints {
// private Integer mLeftMargin = null;
// private Integer mTopMargin = null;
// private Integer mRightMargin = null;
// private Integer mBottomMargin = null;
// private Integer mWidth = null;
// private Integer mHeight = null;
//
// public Constraints() {}
//
// public Constraints(Rect margins) {
// if (margins != null) {
// mLeftMargin = margins.left;
// mTopMargin = margins.top;
// mRightMargin = margins.right;
// mBottomMargin = margins.bottom;
// }
// }
//
// public Integer getLeftMargin() {
// if (mLeftMargin == null && (mRightMargin == null || mWidth == null)) return 0;
// return mLeftMargin;
// }
// public void setLeftMargin(Integer value) { mLeftMargin = value; }
//
// public Integer getTopMargin() {
// if (mTopMargin == null && (mBottomMargin == null || mHeight == null)) return 0;
// return mTopMargin;
// }
// public void setTopMargin(Integer value) { mTopMargin = value; }
//
// public Integer getRightMargin() {
// return mRightMargin;
// }
// public void setRightMargin(Integer value) { mRightMargin = value; }
//
// public Integer getBottomMargin() {
// return mBottomMargin;
// }
// public void setBottomMargin(Integer value) { mBottomMargin = value; }
//
// public Integer getWidth() {
// if (mLeftMargin != null && mRightMargin != null) return null;
// return mWidth;
// }
// public void setWidth(Integer value) { mWidth = value; }
//
// public Integer getHeight() {
// if (mTopMargin != null && mBottomMargin != null) return null;
// return mHeight;
// }
// public void setHeight(Integer value) { mHeight = value; }
// }
// Path: src/android/com/mirasense/scanditsdk/plugin/SubViewPickerController.java
import android.app.Activity;
import android.content.Intent;
import android.graphics.Point;
import android.os.Bundle;
import android.os.Looper;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.webkit.WebView;
import android.widget.RelativeLayout;
import com.mirasense.scanditsdk.plugin.BarcodePickerWithSearchBar.Constraints;
import com.scandit.barcodepicker.OnScanListener;
import com.scandit.barcodepicker.ProcessFrameListener;
import com.scandit.barcodepicker.LicenseValidationListener;
import com.scandit.barcodepicker.PropertyChangeListener;
import com.scandit.barcodepicker.ScanSession;
import com.scandit.barcodepicker.ScanSettings;
import com.scandit.barcodepicker.ocr.RecognizedText;
import com.scandit.barcodepicker.ocr.TextRecognitionListener;
import com.scandit.base.util.JSONParseException;
import com.scandit.recognition.TrackedBarcode;
import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaPlugin;
import org.apache.cordova.CordovaWebView;
import org.apache.cordova.PluginResult;
import org.json.JSONArray;
import org.json.JSONObject;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;
}
});
}
@Override
public void updateLayout(final Bundle layoutOptions) {
final Activity pluginActivity = mPlugin.cordova.getActivity();
runOnUiThread(new Runnable() {
@Override
public void run() {
PhonegapParamParser.updateLayout(pluginActivity, mPickerStateMachine.getPicker(),
layoutOptions, mScreenDimensions);
callPickerResizedListener(layoutOptions);
}
});
}
private void runOnUiThread(Runnable r) {
mPlugin.cordova.getActivity().runOnUiThread(r);
}
private void internalUpdateUI(Bundle overlayOptions, Bundle options) {
BarcodePickerWithSearchBar picker = mPickerStateMachine.getPicker();
UIParamParser.updatePickerUI(picker, overlayOptions);
PhonegapParamParser.updatePicker(picker, overlayOptions, this);
}
private void callPickerResizedListener(Bundle bundle) {
ResizeScannerInterface listener = resizeListener.get();
if (listener != null) { | Constraints portrait = PhonegapParamParser.extractConstraints(bundle, |
kdgregory/pathfinder | lib-core/src/test/java/com/kdgregory/pathfinder/util/TestInvocationOptions.java | // Path: lib-core/src/main/java/com/kdgregory/pathfinder/core/InvocationOptions.java
// public enum InvocationOptions
// {
// SHOW_JSP(
// "--showJSP", "--hideJSP", true,
// "Display client-accessible JSP files as destination URLs."),
//
// SHOW_HTML(
// "--showHTML", "--hideHTML", true,
// "Display client-accessible static HTML content as destination URLs."),
//
// SHOW_STATIC(
// "--showStatic", "--hideStatic", false,
// "Display client-accessible static content other than HTML"
// + " (eg, JS and CSS) as destination URLs."),
//
// SHOW_REQUEST_PARAMS(
// "--showRequestParams", "--hideRequestParams", false,
// "For mappings that identify individual request parameters (eg, Spring3) "
// + "show those parameters in the mapping output."),
//
// DEBUG(
// "--debug", "", false,
// "Enable debug-level logging to StdErr."),
//
// VERBOSE(
// "--verbose", "", false,
// "Enable verbose debugging (implies --debug).");
//
// //----------------------------------------------------------------------------
// // Instance variables and constructor
// //----------------------------------------------------------------------------
//
// private String cliEnable;
// private String cliDisable;
// private boolean defaultValue;
// private String description;
//
// private InvocationOptions(String cliEnable, String cliDisable, boolean defaultValue, String description)
// {
// this.cliEnable = cliEnable;
// this.cliDisable = cliDisable;
// this.defaultValue = defaultValue;
// this.description = description;
// }
//
//
// //----------------------------------------------------------------------------
// // Instance methods
// //----------------------------------------------------------------------------
//
// /**
// * Returns the string value of the "enable" command-line option.
// */
// public String getEnableString()
// {
// return cliEnable;
// }
//
//
// /**
// * Returns the string value of the "disable" command-line option.
// */
// public String getDisableString()
// {
// return cliDisable;
// }
//
//
// /**
// * Given a map of options, returns an indication of whether this
// * option is enabled. If the option is not in the map, it is
// * considered disabled.
// */
// public boolean isEnabled(Map<InvocationOptions,Boolean> map)
// {
// Boolean value = map.get(this);
// return (value != null) ? value.booleanValue() : false;
// }
//
//
// //----------------------------------------------------------------------------
// // Static utility methods Utilities
// //----------------------------------------------------------------------------
//
// /**
// * Writes all options to StdOut.
// */
// public static void dump(PrintStream out)
// {
// for (InvocationOptions option : InvocationOptions.values())
// {
// out.println();
//
// out.print(" " + option.cliEnable);
// if (option.defaultValue)
// out.println(" (default)");
// else
// out.println();
//
// if (! StringUtil.isBlank(option.cliDisable))
// {
// out.print(" " + option.cliDisable);
// if (option.defaultValue)
// out.println();
// else
// out.println(" (default)");
// }
//
// out.println(" " + option.description);
// }
// out.println();
// }
//
//
// /**
// * Processes the command line, removing all arguments that start with "--"
// * (whether or not they're a define invocation argument).
// */
// public static String[] removeInvocationArguments(String... argv)
// {
// List<String> result = new ArrayList<String>(argv.length);
// for (String arg : argv)
// {
// if (!arg.startsWith("--"))
// result.add(arg);
// }
// return result.toArray(new String[result.size()]);
// }
//
//
// /**
// * Extract all options from the command-line arguments. Missing arguments
// * will be filled with their default values.
// */
// public static Map<InvocationOptions,Boolean> parseCli(String... argv)
// {
// Map<InvocationOptions,Boolean> result = new EnumMap<InvocationOptions,Boolean>(InvocationOptions.class);
// for (InvocationOptions value : values())
// result.put(value, Boolean.valueOf(value.defaultValue));
//
// for (String arg : argv)
// {
// for (InvocationOptions option : InvocationOptions.values())
// {
// if (arg.equals(option.cliEnable))
// result.put(option, Boolean.TRUE);
// else if (arg.equals(option.cliDisable))
// result.put(option, Boolean.FALSE);
// }
// }
// return result;
// }
// }
| import java.util.Map;
import org.junit.Test;
import static org.junit.Assert.*;
import com.kdgregory.pathfinder.core.InvocationOptions; | // Copyright (c) Keith D Gregory
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.kdgregory.pathfinder.util;
public class TestInvocationOptions
{
@Test
public void testRemoveInvocationArguments() throws Exception
{
// note single dash on -baz | // Path: lib-core/src/main/java/com/kdgregory/pathfinder/core/InvocationOptions.java
// public enum InvocationOptions
// {
// SHOW_JSP(
// "--showJSP", "--hideJSP", true,
// "Display client-accessible JSP files as destination URLs."),
//
// SHOW_HTML(
// "--showHTML", "--hideHTML", true,
// "Display client-accessible static HTML content as destination URLs."),
//
// SHOW_STATIC(
// "--showStatic", "--hideStatic", false,
// "Display client-accessible static content other than HTML"
// + " (eg, JS and CSS) as destination URLs."),
//
// SHOW_REQUEST_PARAMS(
// "--showRequestParams", "--hideRequestParams", false,
// "For mappings that identify individual request parameters (eg, Spring3) "
// + "show those parameters in the mapping output."),
//
// DEBUG(
// "--debug", "", false,
// "Enable debug-level logging to StdErr."),
//
// VERBOSE(
// "--verbose", "", false,
// "Enable verbose debugging (implies --debug).");
//
// //----------------------------------------------------------------------------
// // Instance variables and constructor
// //----------------------------------------------------------------------------
//
// private String cliEnable;
// private String cliDisable;
// private boolean defaultValue;
// private String description;
//
// private InvocationOptions(String cliEnable, String cliDisable, boolean defaultValue, String description)
// {
// this.cliEnable = cliEnable;
// this.cliDisable = cliDisable;
// this.defaultValue = defaultValue;
// this.description = description;
// }
//
//
// //----------------------------------------------------------------------------
// // Instance methods
// //----------------------------------------------------------------------------
//
// /**
// * Returns the string value of the "enable" command-line option.
// */
// public String getEnableString()
// {
// return cliEnable;
// }
//
//
// /**
// * Returns the string value of the "disable" command-line option.
// */
// public String getDisableString()
// {
// return cliDisable;
// }
//
//
// /**
// * Given a map of options, returns an indication of whether this
// * option is enabled. If the option is not in the map, it is
// * considered disabled.
// */
// public boolean isEnabled(Map<InvocationOptions,Boolean> map)
// {
// Boolean value = map.get(this);
// return (value != null) ? value.booleanValue() : false;
// }
//
//
// //----------------------------------------------------------------------------
// // Static utility methods Utilities
// //----------------------------------------------------------------------------
//
// /**
// * Writes all options to StdOut.
// */
// public static void dump(PrintStream out)
// {
// for (InvocationOptions option : InvocationOptions.values())
// {
// out.println();
//
// out.print(" " + option.cliEnable);
// if (option.defaultValue)
// out.println(" (default)");
// else
// out.println();
//
// if (! StringUtil.isBlank(option.cliDisable))
// {
// out.print(" " + option.cliDisable);
// if (option.defaultValue)
// out.println();
// else
// out.println(" (default)");
// }
//
// out.println(" " + option.description);
// }
// out.println();
// }
//
//
// /**
// * Processes the command line, removing all arguments that start with "--"
// * (whether or not they're a define invocation argument).
// */
// public static String[] removeInvocationArguments(String... argv)
// {
// List<String> result = new ArrayList<String>(argv.length);
// for (String arg : argv)
// {
// if (!arg.startsWith("--"))
// result.add(arg);
// }
// return result.toArray(new String[result.size()]);
// }
//
//
// /**
// * Extract all options from the command-line arguments. Missing arguments
// * will be filled with their default values.
// */
// public static Map<InvocationOptions,Boolean> parseCli(String... argv)
// {
// Map<InvocationOptions,Boolean> result = new EnumMap<InvocationOptions,Boolean>(InvocationOptions.class);
// for (InvocationOptions value : values())
// result.put(value, Boolean.valueOf(value.defaultValue));
//
// for (String arg : argv)
// {
// for (InvocationOptions option : InvocationOptions.values())
// {
// if (arg.equals(option.cliEnable))
// result.put(option, Boolean.TRUE);
// else if (arg.equals(option.cliDisable))
// result.put(option, Boolean.FALSE);
// }
// }
// return result;
// }
// }
// Path: lib-core/src/test/java/com/kdgregory/pathfinder/util/TestInvocationOptions.java
import java.util.Map;
import org.junit.Test;
import static org.junit.Assert.*;
import com.kdgregory.pathfinder.core.InvocationOptions;
// Copyright (c) Keith D Gregory
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.kdgregory.pathfinder.util;
public class TestInvocationOptions
{
@Test
public void testRemoveInvocationArguments() throws Exception
{
// note single dash on -baz | String[] result = InvocationOptions.removeInvocationArguments("foo", "--bar", "-baz"); |
kdgregory/pathfinder | lib-servlet/src/main/java/com/kdgregory/pathfinder/servlet/JspDestination.java | // Path: lib-core/src/main/java/com/kdgregory/pathfinder/core/Destination.java
// public interface Destination
// {
// /**
// * Returns an indication of whether this destination should be
// * displayed at all, given the current invocation options.
// */
// public boolean isDisplayed(Map<InvocationOptions, Boolean> options);
//
// /**
// * Returns a formatted description of this destination, taking into
// * consideration the specified invocation options.
// */
// public String toString(Map<InvocationOptions, Boolean> options);
// }
//
// Path: lib-core/src/main/java/com/kdgregory/pathfinder/core/InvocationOptions.java
// public enum InvocationOptions
// {
// SHOW_JSP(
// "--showJSP", "--hideJSP", true,
// "Display client-accessible JSP files as destination URLs."),
//
// SHOW_HTML(
// "--showHTML", "--hideHTML", true,
// "Display client-accessible static HTML content as destination URLs."),
//
// SHOW_STATIC(
// "--showStatic", "--hideStatic", false,
// "Display client-accessible static content other than HTML"
// + " (eg, JS and CSS) as destination URLs."),
//
// SHOW_REQUEST_PARAMS(
// "--showRequestParams", "--hideRequestParams", false,
// "For mappings that identify individual request parameters (eg, Spring3) "
// + "show those parameters in the mapping output."),
//
// DEBUG(
// "--debug", "", false,
// "Enable debug-level logging to StdErr."),
//
// VERBOSE(
// "--verbose", "", false,
// "Enable verbose debugging (implies --debug).");
//
// //----------------------------------------------------------------------------
// // Instance variables and constructor
// //----------------------------------------------------------------------------
//
// private String cliEnable;
// private String cliDisable;
// private boolean defaultValue;
// private String description;
//
// private InvocationOptions(String cliEnable, String cliDisable, boolean defaultValue, String description)
// {
// this.cliEnable = cliEnable;
// this.cliDisable = cliDisable;
// this.defaultValue = defaultValue;
// this.description = description;
// }
//
//
// //----------------------------------------------------------------------------
// // Instance methods
// //----------------------------------------------------------------------------
//
// /**
// * Returns the string value of the "enable" command-line option.
// */
// public String getEnableString()
// {
// return cliEnable;
// }
//
//
// /**
// * Returns the string value of the "disable" command-line option.
// */
// public String getDisableString()
// {
// return cliDisable;
// }
//
//
// /**
// * Given a map of options, returns an indication of whether this
// * option is enabled. If the option is not in the map, it is
// * considered disabled.
// */
// public boolean isEnabled(Map<InvocationOptions,Boolean> map)
// {
// Boolean value = map.get(this);
// return (value != null) ? value.booleanValue() : false;
// }
//
//
// //----------------------------------------------------------------------------
// // Static utility methods Utilities
// //----------------------------------------------------------------------------
//
// /**
// * Writes all options to StdOut.
// */
// public static void dump(PrintStream out)
// {
// for (InvocationOptions option : InvocationOptions.values())
// {
// out.println();
//
// out.print(" " + option.cliEnable);
// if (option.defaultValue)
// out.println(" (default)");
// else
// out.println();
//
// if (! StringUtil.isBlank(option.cliDisable))
// {
// out.print(" " + option.cliDisable);
// if (option.defaultValue)
// out.println();
// else
// out.println(" (default)");
// }
//
// out.println(" " + option.description);
// }
// out.println();
// }
//
//
// /**
// * Processes the command line, removing all arguments that start with "--"
// * (whether or not they're a define invocation argument).
// */
// public static String[] removeInvocationArguments(String... argv)
// {
// List<String> result = new ArrayList<String>(argv.length);
// for (String arg : argv)
// {
// if (!arg.startsWith("--"))
// result.add(arg);
// }
// return result.toArray(new String[result.size()]);
// }
//
//
// /**
// * Extract all options from the command-line arguments. Missing arguments
// * will be filled with their default values.
// */
// public static Map<InvocationOptions,Boolean> parseCli(String... argv)
// {
// Map<InvocationOptions,Boolean> result = new EnumMap<InvocationOptions,Boolean>(InvocationOptions.class);
// for (InvocationOptions value : values())
// result.put(value, Boolean.valueOf(value.defaultValue));
//
// for (String arg : argv)
// {
// for (InvocationOptions option : InvocationOptions.values())
// {
// if (arg.equals(option.cliEnable))
// result.put(option, Boolean.TRUE);
// else if (arg.equals(option.cliDisable))
// result.put(option, Boolean.FALSE);
// }
// }
// return result;
// }
// }
| import java.util.Map;
import com.kdgregory.pathfinder.core.Destination;
import com.kdgregory.pathfinder.core.InvocationOptions; | // Copyright (c) Keith D Gregory
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.kdgregory.pathfinder.servlet;
class JspDestination
implements Destination
{
private String filename;
public JspDestination(String filename)
{
this.filename = filename;
}
@Override | // Path: lib-core/src/main/java/com/kdgregory/pathfinder/core/Destination.java
// public interface Destination
// {
// /**
// * Returns an indication of whether this destination should be
// * displayed at all, given the current invocation options.
// */
// public boolean isDisplayed(Map<InvocationOptions, Boolean> options);
//
// /**
// * Returns a formatted description of this destination, taking into
// * consideration the specified invocation options.
// */
// public String toString(Map<InvocationOptions, Boolean> options);
// }
//
// Path: lib-core/src/main/java/com/kdgregory/pathfinder/core/InvocationOptions.java
// public enum InvocationOptions
// {
// SHOW_JSP(
// "--showJSP", "--hideJSP", true,
// "Display client-accessible JSP files as destination URLs."),
//
// SHOW_HTML(
// "--showHTML", "--hideHTML", true,
// "Display client-accessible static HTML content as destination URLs."),
//
// SHOW_STATIC(
// "--showStatic", "--hideStatic", false,
// "Display client-accessible static content other than HTML"
// + " (eg, JS and CSS) as destination URLs."),
//
// SHOW_REQUEST_PARAMS(
// "--showRequestParams", "--hideRequestParams", false,
// "For mappings that identify individual request parameters (eg, Spring3) "
// + "show those parameters in the mapping output."),
//
// DEBUG(
// "--debug", "", false,
// "Enable debug-level logging to StdErr."),
//
// VERBOSE(
// "--verbose", "", false,
// "Enable verbose debugging (implies --debug).");
//
// //----------------------------------------------------------------------------
// // Instance variables and constructor
// //----------------------------------------------------------------------------
//
// private String cliEnable;
// private String cliDisable;
// private boolean defaultValue;
// private String description;
//
// private InvocationOptions(String cliEnable, String cliDisable, boolean defaultValue, String description)
// {
// this.cliEnable = cliEnable;
// this.cliDisable = cliDisable;
// this.defaultValue = defaultValue;
// this.description = description;
// }
//
//
// //----------------------------------------------------------------------------
// // Instance methods
// //----------------------------------------------------------------------------
//
// /**
// * Returns the string value of the "enable" command-line option.
// */
// public String getEnableString()
// {
// return cliEnable;
// }
//
//
// /**
// * Returns the string value of the "disable" command-line option.
// */
// public String getDisableString()
// {
// return cliDisable;
// }
//
//
// /**
// * Given a map of options, returns an indication of whether this
// * option is enabled. If the option is not in the map, it is
// * considered disabled.
// */
// public boolean isEnabled(Map<InvocationOptions,Boolean> map)
// {
// Boolean value = map.get(this);
// return (value != null) ? value.booleanValue() : false;
// }
//
//
// //----------------------------------------------------------------------------
// // Static utility methods Utilities
// //----------------------------------------------------------------------------
//
// /**
// * Writes all options to StdOut.
// */
// public static void dump(PrintStream out)
// {
// for (InvocationOptions option : InvocationOptions.values())
// {
// out.println();
//
// out.print(" " + option.cliEnable);
// if (option.defaultValue)
// out.println(" (default)");
// else
// out.println();
//
// if (! StringUtil.isBlank(option.cliDisable))
// {
// out.print(" " + option.cliDisable);
// if (option.defaultValue)
// out.println();
// else
// out.println(" (default)");
// }
//
// out.println(" " + option.description);
// }
// out.println();
// }
//
//
// /**
// * Processes the command line, removing all arguments that start with "--"
// * (whether or not they're a define invocation argument).
// */
// public static String[] removeInvocationArguments(String... argv)
// {
// List<String> result = new ArrayList<String>(argv.length);
// for (String arg : argv)
// {
// if (!arg.startsWith("--"))
// result.add(arg);
// }
// return result.toArray(new String[result.size()]);
// }
//
//
// /**
// * Extract all options from the command-line arguments. Missing arguments
// * will be filled with their default values.
// */
// public static Map<InvocationOptions,Boolean> parseCli(String... argv)
// {
// Map<InvocationOptions,Boolean> result = new EnumMap<InvocationOptions,Boolean>(InvocationOptions.class);
// for (InvocationOptions value : values())
// result.put(value, Boolean.valueOf(value.defaultValue));
//
// for (String arg : argv)
// {
// for (InvocationOptions option : InvocationOptions.values())
// {
// if (arg.equals(option.cliEnable))
// result.put(option, Boolean.TRUE);
// else if (arg.equals(option.cliDisable))
// result.put(option, Boolean.FALSE);
// }
// }
// return result;
// }
// }
// Path: lib-servlet/src/main/java/com/kdgregory/pathfinder/servlet/JspDestination.java
import java.util.Map;
import com.kdgregory.pathfinder.core.Destination;
import com.kdgregory.pathfinder.core.InvocationOptions;
// Copyright (c) Keith D Gregory
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.kdgregory.pathfinder.servlet;
class JspDestination
implements Destination
{
private String filename;
public JspDestination(String filename)
{
this.filename = filename;
}
@Override | public boolean isDisplayed(Map<InvocationOptions,Boolean> options) |
kdgregory/pathfinder | lib-core/src/test/java/com/kdgregory/pathfinder/core/TestPathRepo.java | // Path: lib-core/src/main/java/com/kdgregory/pathfinder/core/impl/PathRepoImpl.java
// public class PathRepoImpl
// implements PathRepo
// {
// private SortedMap<String,SortedMap<HttpMethod,Destination>> urlMap
// = new TreeMap<String,SortedMap<HttpMethod,Destination>>();
//
//
// //----------------------------------------------------------------------------
// // PathRepo
// //----------------------------------------------------------------------------
//
// @Override
// public void put(String url, Destination dest)
// {
// getOrCreateDestMap(url).clear();
// put(url, HttpMethod.ALL, dest);
// }
//
//
// @Override
// public void put(String url, HttpMethod method, Destination dest)
// {
// SortedMap<HttpMethod,Destination> destMap = getOrCreateDestMap(url);
// destMap.put(method, dest);
// }
//
//
// @Override
// public void put(String url, Map<HttpMethod,Destination> destMap)
// {
// SortedMap<HttpMethod,Destination> internal = getOrCreateDestMap(url);
// internal.clear();
// internal.putAll(destMap);
// }
//
//
// @Override
// public Destination get(String url, HttpMethod method)
// {
// SortedMap<HttpMethod,Destination> destMap = getOrCreateDestMap(url);
// Destination dest = destMap.get(method);
// if (dest != null)
// return dest;
//
// return destMap.get(HttpMethod.ALL);
// }
//
//
// @Override
// public Map<HttpMethod,Destination> get(String url)
// {
// return Collections.unmodifiableMap(getOrCreateDestMap(url));
// }
//
//
// @Override
// public void remove(String url, HttpMethod method)
// {
// Map<HttpMethod,Destination> destMap = urlMap.get(url);
// if (destMap == null)
// return;
//
// if (method.equals(HttpMethod.ALL))
// {
// destMap.clear();
// return;
// }
//
// if (destMap.containsKey(HttpMethod.ALL))
// {
// Destination dest = destMap.remove(HttpMethod.ALL);
// destMap.put(HttpMethod.GET, dest);
// destMap.put(HttpMethod.POST, dest);
// destMap.put(HttpMethod.PUT, dest);
// destMap.put(HttpMethod.DELETE, dest);
// }
//
// destMap.remove(method);
// }
//
//
// @Override
// public Iterator<String> iterator()
// {
// List<String> urls = new ArrayList<String>(urlMap.size());
// for (Map.Entry<String,SortedMap<HttpMethod,Destination>> entry : urlMap.entrySet())
// {
// if (entry.getValue().size() > 0)
// urls.add(entry.getKey());
// }
// return urls.iterator();
// }
//
//
// @Override
// public int urlCount()
// {
// int count = 0;
// for (Map.Entry<String,SortedMap<HttpMethod,Destination>> entry : urlMap.entrySet())
// {
// count += (entry.getValue().size() > 0) ? 1 : 0;
// }
//
// return count;
// }
//
//
// //----------------------------------------------------------------------------
// // Otheer Public Methods
// //----------------------------------------------------------------------------
//
// @Override
// public String toString()
// {
// StringBuilder sb = new StringBuilder(64 * urlMap.size());
// sb.append("[");
// for (String url : urlMap.keySet())
// {
// if (sb.length() > 1)
// sb.append(",");
// sb.append(url);
// }
// sb.append("]");
// return sb.toString();
// }
//
//
// //----------------------------------------------------------------------------
// // Private methods
// //----------------------------------------------------------------------------
//
// private SortedMap<HttpMethod,Destination> getOrCreateDestMap(String url)
// {
// SortedMap<HttpMethod,Destination> destMap = urlMap.get(url);
// if (destMap == null)
// {
// destMap = new TreeMap<HttpMethod,Destination>();
// urlMap.put(url, destMap);
// }
// return destMap;
// }
// }
| import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import org.junit.Test;
import static org.junit.Assert.*;
import com.kdgregory.pathfinder.core.impl.PathRepoImpl; | {
throw new IllegalStateException("we shouldn't be testing output");
}
@Override
public String toString(Map<InvocationOptions,Boolean> options)
{
throw new IllegalStateException("we shouldn't be testing output");
}
}
//----------------------------------------------------------------------------
// TestCases
//----------------------------------------------------------------------------
@Test
public void testMethodStrings() throws Exception
{
assertEquals("ALL", "", HttpMethod.ALL.toString());
assertEquals("GET", "GET", HttpMethod.GET.toString());
assertEquals("POST", "POST", HttpMethod.POST.toString());
assertEquals("PUT", "PUT", HttpMethod.PUT.toString());
assertEquals("DELETE", "DELETE", HttpMethod.DELETE.toString());
}
@Test
public void testPutAndGetWithExplicitMethod() throws Exception
{ | // Path: lib-core/src/main/java/com/kdgregory/pathfinder/core/impl/PathRepoImpl.java
// public class PathRepoImpl
// implements PathRepo
// {
// private SortedMap<String,SortedMap<HttpMethod,Destination>> urlMap
// = new TreeMap<String,SortedMap<HttpMethod,Destination>>();
//
//
// //----------------------------------------------------------------------------
// // PathRepo
// //----------------------------------------------------------------------------
//
// @Override
// public void put(String url, Destination dest)
// {
// getOrCreateDestMap(url).clear();
// put(url, HttpMethod.ALL, dest);
// }
//
//
// @Override
// public void put(String url, HttpMethod method, Destination dest)
// {
// SortedMap<HttpMethod,Destination> destMap = getOrCreateDestMap(url);
// destMap.put(method, dest);
// }
//
//
// @Override
// public void put(String url, Map<HttpMethod,Destination> destMap)
// {
// SortedMap<HttpMethod,Destination> internal = getOrCreateDestMap(url);
// internal.clear();
// internal.putAll(destMap);
// }
//
//
// @Override
// public Destination get(String url, HttpMethod method)
// {
// SortedMap<HttpMethod,Destination> destMap = getOrCreateDestMap(url);
// Destination dest = destMap.get(method);
// if (dest != null)
// return dest;
//
// return destMap.get(HttpMethod.ALL);
// }
//
//
// @Override
// public Map<HttpMethod,Destination> get(String url)
// {
// return Collections.unmodifiableMap(getOrCreateDestMap(url));
// }
//
//
// @Override
// public void remove(String url, HttpMethod method)
// {
// Map<HttpMethod,Destination> destMap = urlMap.get(url);
// if (destMap == null)
// return;
//
// if (method.equals(HttpMethod.ALL))
// {
// destMap.clear();
// return;
// }
//
// if (destMap.containsKey(HttpMethod.ALL))
// {
// Destination dest = destMap.remove(HttpMethod.ALL);
// destMap.put(HttpMethod.GET, dest);
// destMap.put(HttpMethod.POST, dest);
// destMap.put(HttpMethod.PUT, dest);
// destMap.put(HttpMethod.DELETE, dest);
// }
//
// destMap.remove(method);
// }
//
//
// @Override
// public Iterator<String> iterator()
// {
// List<String> urls = new ArrayList<String>(urlMap.size());
// for (Map.Entry<String,SortedMap<HttpMethod,Destination>> entry : urlMap.entrySet())
// {
// if (entry.getValue().size() > 0)
// urls.add(entry.getKey());
// }
// return urls.iterator();
// }
//
//
// @Override
// public int urlCount()
// {
// int count = 0;
// for (Map.Entry<String,SortedMap<HttpMethod,Destination>> entry : urlMap.entrySet())
// {
// count += (entry.getValue().size() > 0) ? 1 : 0;
// }
//
// return count;
// }
//
//
// //----------------------------------------------------------------------------
// // Otheer Public Methods
// //----------------------------------------------------------------------------
//
// @Override
// public String toString()
// {
// StringBuilder sb = new StringBuilder(64 * urlMap.size());
// sb.append("[");
// for (String url : urlMap.keySet())
// {
// if (sb.length() > 1)
// sb.append(",");
// sb.append(url);
// }
// sb.append("]");
// return sb.toString();
// }
//
//
// //----------------------------------------------------------------------------
// // Private methods
// //----------------------------------------------------------------------------
//
// private SortedMap<HttpMethod,Destination> getOrCreateDestMap(String url)
// {
// SortedMap<HttpMethod,Destination> destMap = urlMap.get(url);
// if (destMap == null)
// {
// destMap = new TreeMap<HttpMethod,Destination>();
// urlMap.put(url, destMap);
// }
// return destMap;
// }
// }
// Path: lib-core/src/test/java/com/kdgregory/pathfinder/core/TestPathRepo.java
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import org.junit.Test;
import static org.junit.Assert.*;
import com.kdgregory.pathfinder.core.impl.PathRepoImpl;
{
throw new IllegalStateException("we shouldn't be testing output");
}
@Override
public String toString(Map<InvocationOptions,Boolean> options)
{
throw new IllegalStateException("we shouldn't be testing output");
}
}
//----------------------------------------------------------------------------
// TestCases
//----------------------------------------------------------------------------
@Test
public void testMethodStrings() throws Exception
{
assertEquals("ALL", "", HttpMethod.ALL.toString());
assertEquals("GET", "GET", HttpMethod.GET.toString());
assertEquals("POST", "POST", HttpMethod.POST.toString());
assertEquals("PUT", "PUT", HttpMethod.PUT.toString());
assertEquals("DELETE", "DELETE", HttpMethod.DELETE.toString());
}
@Test
public void testPutAndGetWithExplicitMethod() throws Exception
{ | PathRepoImpl repo = new PathRepoImpl(); |
kdgregory/pathfinder | lib-servlet/src/main/java/com/kdgregory/pathfinder/servlet/ServletDestination.java | // Path: lib-core/src/main/java/com/kdgregory/pathfinder/core/Destination.java
// public interface Destination
// {
// /**
// * Returns an indication of whether this destination should be
// * displayed at all, given the current invocation options.
// */
// public boolean isDisplayed(Map<InvocationOptions, Boolean> options);
//
// /**
// * Returns a formatted description of this destination, taking into
// * consideration the specified invocation options.
// */
// public String toString(Map<InvocationOptions, Boolean> options);
// }
//
// Path: lib-core/src/main/java/com/kdgregory/pathfinder/core/InvocationOptions.java
// public enum InvocationOptions
// {
// SHOW_JSP(
// "--showJSP", "--hideJSP", true,
// "Display client-accessible JSP files as destination URLs."),
//
// SHOW_HTML(
// "--showHTML", "--hideHTML", true,
// "Display client-accessible static HTML content as destination URLs."),
//
// SHOW_STATIC(
// "--showStatic", "--hideStatic", false,
// "Display client-accessible static content other than HTML"
// + " (eg, JS and CSS) as destination URLs."),
//
// SHOW_REQUEST_PARAMS(
// "--showRequestParams", "--hideRequestParams", false,
// "For mappings that identify individual request parameters (eg, Spring3) "
// + "show those parameters in the mapping output."),
//
// DEBUG(
// "--debug", "", false,
// "Enable debug-level logging to StdErr."),
//
// VERBOSE(
// "--verbose", "", false,
// "Enable verbose debugging (implies --debug).");
//
// //----------------------------------------------------------------------------
// // Instance variables and constructor
// //----------------------------------------------------------------------------
//
// private String cliEnable;
// private String cliDisable;
// private boolean defaultValue;
// private String description;
//
// private InvocationOptions(String cliEnable, String cliDisable, boolean defaultValue, String description)
// {
// this.cliEnable = cliEnable;
// this.cliDisable = cliDisable;
// this.defaultValue = defaultValue;
// this.description = description;
// }
//
//
// //----------------------------------------------------------------------------
// // Instance methods
// //----------------------------------------------------------------------------
//
// /**
// * Returns the string value of the "enable" command-line option.
// */
// public String getEnableString()
// {
// return cliEnable;
// }
//
//
// /**
// * Returns the string value of the "disable" command-line option.
// */
// public String getDisableString()
// {
// return cliDisable;
// }
//
//
// /**
// * Given a map of options, returns an indication of whether this
// * option is enabled. If the option is not in the map, it is
// * considered disabled.
// */
// public boolean isEnabled(Map<InvocationOptions,Boolean> map)
// {
// Boolean value = map.get(this);
// return (value != null) ? value.booleanValue() : false;
// }
//
//
// //----------------------------------------------------------------------------
// // Static utility methods Utilities
// //----------------------------------------------------------------------------
//
// /**
// * Writes all options to StdOut.
// */
// public static void dump(PrintStream out)
// {
// for (InvocationOptions option : InvocationOptions.values())
// {
// out.println();
//
// out.print(" " + option.cliEnable);
// if (option.defaultValue)
// out.println(" (default)");
// else
// out.println();
//
// if (! StringUtil.isBlank(option.cliDisable))
// {
// out.print(" " + option.cliDisable);
// if (option.defaultValue)
// out.println();
// else
// out.println(" (default)");
// }
//
// out.println(" " + option.description);
// }
// out.println();
// }
//
//
// /**
// * Processes the command line, removing all arguments that start with "--"
// * (whether or not they're a define invocation argument).
// */
// public static String[] removeInvocationArguments(String... argv)
// {
// List<String> result = new ArrayList<String>(argv.length);
// for (String arg : argv)
// {
// if (!arg.startsWith("--"))
// result.add(arg);
// }
// return result.toArray(new String[result.size()]);
// }
//
//
// /**
// * Extract all options from the command-line arguments. Missing arguments
// * will be filled with their default values.
// */
// public static Map<InvocationOptions,Boolean> parseCli(String... argv)
// {
// Map<InvocationOptions,Boolean> result = new EnumMap<InvocationOptions,Boolean>(InvocationOptions.class);
// for (InvocationOptions value : values())
// result.put(value, Boolean.valueOf(value.defaultValue));
//
// for (String arg : argv)
// {
// for (InvocationOptions option : InvocationOptions.values())
// {
// if (arg.equals(option.cliEnable))
// result.put(option, Boolean.TRUE);
// else if (arg.equals(option.cliDisable))
// result.put(option, Boolean.FALSE);
// }
// }
// return result;
// }
// }
| import java.util.Map;
import com.kdgregory.pathfinder.core.Destination;
import com.kdgregory.pathfinder.core.InvocationOptions; | // Copyright (c) Keith D Gregory
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.kdgregory.pathfinder.servlet;
class ServletDestination
implements Destination
{
private String servletClass;
public ServletDestination(String servletClass)
{
this.servletClass = servletClass;
}
@Override | // Path: lib-core/src/main/java/com/kdgregory/pathfinder/core/Destination.java
// public interface Destination
// {
// /**
// * Returns an indication of whether this destination should be
// * displayed at all, given the current invocation options.
// */
// public boolean isDisplayed(Map<InvocationOptions, Boolean> options);
//
// /**
// * Returns a formatted description of this destination, taking into
// * consideration the specified invocation options.
// */
// public String toString(Map<InvocationOptions, Boolean> options);
// }
//
// Path: lib-core/src/main/java/com/kdgregory/pathfinder/core/InvocationOptions.java
// public enum InvocationOptions
// {
// SHOW_JSP(
// "--showJSP", "--hideJSP", true,
// "Display client-accessible JSP files as destination URLs."),
//
// SHOW_HTML(
// "--showHTML", "--hideHTML", true,
// "Display client-accessible static HTML content as destination URLs."),
//
// SHOW_STATIC(
// "--showStatic", "--hideStatic", false,
// "Display client-accessible static content other than HTML"
// + " (eg, JS and CSS) as destination URLs."),
//
// SHOW_REQUEST_PARAMS(
// "--showRequestParams", "--hideRequestParams", false,
// "For mappings that identify individual request parameters (eg, Spring3) "
// + "show those parameters in the mapping output."),
//
// DEBUG(
// "--debug", "", false,
// "Enable debug-level logging to StdErr."),
//
// VERBOSE(
// "--verbose", "", false,
// "Enable verbose debugging (implies --debug).");
//
// //----------------------------------------------------------------------------
// // Instance variables and constructor
// //----------------------------------------------------------------------------
//
// private String cliEnable;
// private String cliDisable;
// private boolean defaultValue;
// private String description;
//
// private InvocationOptions(String cliEnable, String cliDisable, boolean defaultValue, String description)
// {
// this.cliEnable = cliEnable;
// this.cliDisable = cliDisable;
// this.defaultValue = defaultValue;
// this.description = description;
// }
//
//
// //----------------------------------------------------------------------------
// // Instance methods
// //----------------------------------------------------------------------------
//
// /**
// * Returns the string value of the "enable" command-line option.
// */
// public String getEnableString()
// {
// return cliEnable;
// }
//
//
// /**
// * Returns the string value of the "disable" command-line option.
// */
// public String getDisableString()
// {
// return cliDisable;
// }
//
//
// /**
// * Given a map of options, returns an indication of whether this
// * option is enabled. If the option is not in the map, it is
// * considered disabled.
// */
// public boolean isEnabled(Map<InvocationOptions,Boolean> map)
// {
// Boolean value = map.get(this);
// return (value != null) ? value.booleanValue() : false;
// }
//
//
// //----------------------------------------------------------------------------
// // Static utility methods Utilities
// //----------------------------------------------------------------------------
//
// /**
// * Writes all options to StdOut.
// */
// public static void dump(PrintStream out)
// {
// for (InvocationOptions option : InvocationOptions.values())
// {
// out.println();
//
// out.print(" " + option.cliEnable);
// if (option.defaultValue)
// out.println(" (default)");
// else
// out.println();
//
// if (! StringUtil.isBlank(option.cliDisable))
// {
// out.print(" " + option.cliDisable);
// if (option.defaultValue)
// out.println();
// else
// out.println(" (default)");
// }
//
// out.println(" " + option.description);
// }
// out.println();
// }
//
//
// /**
// * Processes the command line, removing all arguments that start with "--"
// * (whether or not they're a define invocation argument).
// */
// public static String[] removeInvocationArguments(String... argv)
// {
// List<String> result = new ArrayList<String>(argv.length);
// for (String arg : argv)
// {
// if (!arg.startsWith("--"))
// result.add(arg);
// }
// return result.toArray(new String[result.size()]);
// }
//
//
// /**
// * Extract all options from the command-line arguments. Missing arguments
// * will be filled with their default values.
// */
// public static Map<InvocationOptions,Boolean> parseCli(String... argv)
// {
// Map<InvocationOptions,Boolean> result = new EnumMap<InvocationOptions,Boolean>(InvocationOptions.class);
// for (InvocationOptions value : values())
// result.put(value, Boolean.valueOf(value.defaultValue));
//
// for (String arg : argv)
// {
// for (InvocationOptions option : InvocationOptions.values())
// {
// if (arg.equals(option.cliEnable))
// result.put(option, Boolean.TRUE);
// else if (arg.equals(option.cliDisable))
// result.put(option, Boolean.FALSE);
// }
// }
// return result;
// }
// }
// Path: lib-servlet/src/main/java/com/kdgregory/pathfinder/servlet/ServletDestination.java
import java.util.Map;
import com.kdgregory.pathfinder.core.Destination;
import com.kdgregory.pathfinder.core.InvocationOptions;
// Copyright (c) Keith D Gregory
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.kdgregory.pathfinder.servlet;
class ServletDestination
implements Destination
{
private String servletClass;
public ServletDestination(String servletClass)
{
this.servletClass = servletClass;
}
@Override | public boolean isDisplayed(Map<InvocationOptions,Boolean> options) |
kdgregory/pathfinder | lib-core/src/main/java/com/kdgregory/pathfinder/core/impl/PathRepoImpl.java | // Path: lib-core/src/main/java/com/kdgregory/pathfinder/core/Destination.java
// public interface Destination
// {
// /**
// * Returns an indication of whether this destination should be
// * displayed at all, given the current invocation options.
// */
// public boolean isDisplayed(Map<InvocationOptions, Boolean> options);
//
// /**
// * Returns a formatted description of this destination, taking into
// * consideration the specified invocation options.
// */
// public String toString(Map<InvocationOptions, Boolean> options);
// }
//
// Path: lib-core/src/main/java/com/kdgregory/pathfinder/core/HttpMethod.java
// public enum HttpMethod
// {
// ALL(""),
// GET("GET"),
// POST("POST"),
// PUT("PUT"),
// DELETE("DELETE");
//
// private String stringValue;
//
// HttpMethod(String stringValue)
// {
// this.stringValue = stringValue;
// }
//
// @Override
// public String toString()
// {
// return stringValue;
// }
// }
//
// Path: lib-core/src/main/java/com/kdgregory/pathfinder/core/PathRepo.java
// public interface PathRepo
// extends Iterable<String>
// {
// /**
// * Returns the number of URLs in the repository. Note that multiple actions
// * for the same URL are only counted once.
// */
// public int urlCount();
//
//
// /**
// * Stores a destination that responds to all request methods. Will replace
// * all existing destinations for the URL.
// */
// public void put(String url, Destination dest);
//
//
// /**
// * Stores a destination that responds to a specific request method. If
// * there is an existing "all" entry, it will be overridden for just the
// * method stored.
// */
// public void put(String url, HttpMethod method, Destination dest);
//
//
// /**
// * Stores a map of destinations, replacing the existing map for that URL.
// */
// public void put(String url, Map<HttpMethod,Destination> destMap);
//
//
// /**
// * Retrieves the destination for a given URL and method. If the URL has
// * been stored with "ALL" methods, will return that destination unless
// * the URL has also been stored with a specific method. Returns null if
// * there's no destination for a URL and method.
// */
// public Destination get(String url, HttpMethod method);
//
//
// /**
// * Retrieves an unmodifiable view of the destination map for a given URL.
// * The returned map will be sorted by method.
// * <p>
// * Note 1: this method will never return null, but the map may be empty.
// * <p>
// * Note 2: the map may contain a single mapping, for "ALL"; the caller
// * is responsible for translating this to individual mappings
// * if desired.
// */
// public Map<HttpMethod,Destination> get(String url);
//
//
// /**
// * Removes the destination(s) associated with the given URL and method.
// * If the passed method is "ALL", will remove all destinations (even if
// * they were added individually).
// */
// public void remove(String url, HttpMethod method);
//
//
// /**
// * Returns an iterator over the URLs in this repository. These URLs
// * will be sorted in alphanumeric order. Only those URLs that have active
// * mappings are returned.
// */
// @Override
// public Iterator<String> iterator();
// }
| import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.SortedMap;
import java.util.TreeMap;
import com.kdgregory.pathfinder.core.Destination;
import com.kdgregory.pathfinder.core.HttpMethod;
import com.kdgregory.pathfinder.core.PathRepo; | // Copyright (c) Keith D Gregory
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.kdgregory.pathfinder.core.impl;
/**
* Holds all of the paths that have been discovered. A path is a tuple of URL,
* HTTP method, and destination (which may be a handler class, or a JSP). URLs
* are relative to the context root.
* <p>
* The storage mechanism is a map-of-maps, with the URL as outer key. Inspectors
* are allowed (and expected) to completely replace the destinations that belong
* to a particular URL. Both maps are sorted, to result in consisted output.
* <p>
* This class is not intended for use by concurrent threads.
*/
public class PathRepoImpl
implements PathRepo
{ | // Path: lib-core/src/main/java/com/kdgregory/pathfinder/core/Destination.java
// public interface Destination
// {
// /**
// * Returns an indication of whether this destination should be
// * displayed at all, given the current invocation options.
// */
// public boolean isDisplayed(Map<InvocationOptions, Boolean> options);
//
// /**
// * Returns a formatted description of this destination, taking into
// * consideration the specified invocation options.
// */
// public String toString(Map<InvocationOptions, Boolean> options);
// }
//
// Path: lib-core/src/main/java/com/kdgregory/pathfinder/core/HttpMethod.java
// public enum HttpMethod
// {
// ALL(""),
// GET("GET"),
// POST("POST"),
// PUT("PUT"),
// DELETE("DELETE");
//
// private String stringValue;
//
// HttpMethod(String stringValue)
// {
// this.stringValue = stringValue;
// }
//
// @Override
// public String toString()
// {
// return stringValue;
// }
// }
//
// Path: lib-core/src/main/java/com/kdgregory/pathfinder/core/PathRepo.java
// public interface PathRepo
// extends Iterable<String>
// {
// /**
// * Returns the number of URLs in the repository. Note that multiple actions
// * for the same URL are only counted once.
// */
// public int urlCount();
//
//
// /**
// * Stores a destination that responds to all request methods. Will replace
// * all existing destinations for the URL.
// */
// public void put(String url, Destination dest);
//
//
// /**
// * Stores a destination that responds to a specific request method. If
// * there is an existing "all" entry, it will be overridden for just the
// * method stored.
// */
// public void put(String url, HttpMethod method, Destination dest);
//
//
// /**
// * Stores a map of destinations, replacing the existing map for that URL.
// */
// public void put(String url, Map<HttpMethod,Destination> destMap);
//
//
// /**
// * Retrieves the destination for a given URL and method. If the URL has
// * been stored with "ALL" methods, will return that destination unless
// * the URL has also been stored with a specific method. Returns null if
// * there's no destination for a URL and method.
// */
// public Destination get(String url, HttpMethod method);
//
//
// /**
// * Retrieves an unmodifiable view of the destination map for a given URL.
// * The returned map will be sorted by method.
// * <p>
// * Note 1: this method will never return null, but the map may be empty.
// * <p>
// * Note 2: the map may contain a single mapping, for "ALL"; the caller
// * is responsible for translating this to individual mappings
// * if desired.
// */
// public Map<HttpMethod,Destination> get(String url);
//
//
// /**
// * Removes the destination(s) associated with the given URL and method.
// * If the passed method is "ALL", will remove all destinations (even if
// * they were added individually).
// */
// public void remove(String url, HttpMethod method);
//
//
// /**
// * Returns an iterator over the URLs in this repository. These URLs
// * will be sorted in alphanumeric order. Only those URLs that have active
// * mappings are returned.
// */
// @Override
// public Iterator<String> iterator();
// }
// Path: lib-core/src/main/java/com/kdgregory/pathfinder/core/impl/PathRepoImpl.java
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.SortedMap;
import java.util.TreeMap;
import com.kdgregory.pathfinder.core.Destination;
import com.kdgregory.pathfinder.core.HttpMethod;
import com.kdgregory.pathfinder.core.PathRepo;
// Copyright (c) Keith D Gregory
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.kdgregory.pathfinder.core.impl;
/**
* Holds all of the paths that have been discovered. A path is a tuple of URL,
* HTTP method, and destination (which may be a handler class, or a JSP). URLs
* are relative to the context root.
* <p>
* The storage mechanism is a map-of-maps, with the URL as outer key. Inspectors
* are allowed (and expected) to completely replace the destinations that belong
* to a particular URL. Both maps are sorted, to result in consisted output.
* <p>
* This class is not intended for use by concurrent threads.
*/
public class PathRepoImpl
implements PathRepo
{ | private SortedMap<String,SortedMap<HttpMethod,Destination>> urlMap |
kdgregory/pathfinder | lib-core/src/main/java/com/kdgregory/pathfinder/core/impl/PathRepoImpl.java | // Path: lib-core/src/main/java/com/kdgregory/pathfinder/core/Destination.java
// public interface Destination
// {
// /**
// * Returns an indication of whether this destination should be
// * displayed at all, given the current invocation options.
// */
// public boolean isDisplayed(Map<InvocationOptions, Boolean> options);
//
// /**
// * Returns a formatted description of this destination, taking into
// * consideration the specified invocation options.
// */
// public String toString(Map<InvocationOptions, Boolean> options);
// }
//
// Path: lib-core/src/main/java/com/kdgregory/pathfinder/core/HttpMethod.java
// public enum HttpMethod
// {
// ALL(""),
// GET("GET"),
// POST("POST"),
// PUT("PUT"),
// DELETE("DELETE");
//
// private String stringValue;
//
// HttpMethod(String stringValue)
// {
// this.stringValue = stringValue;
// }
//
// @Override
// public String toString()
// {
// return stringValue;
// }
// }
//
// Path: lib-core/src/main/java/com/kdgregory/pathfinder/core/PathRepo.java
// public interface PathRepo
// extends Iterable<String>
// {
// /**
// * Returns the number of URLs in the repository. Note that multiple actions
// * for the same URL are only counted once.
// */
// public int urlCount();
//
//
// /**
// * Stores a destination that responds to all request methods. Will replace
// * all existing destinations for the URL.
// */
// public void put(String url, Destination dest);
//
//
// /**
// * Stores a destination that responds to a specific request method. If
// * there is an existing "all" entry, it will be overridden for just the
// * method stored.
// */
// public void put(String url, HttpMethod method, Destination dest);
//
//
// /**
// * Stores a map of destinations, replacing the existing map for that URL.
// */
// public void put(String url, Map<HttpMethod,Destination> destMap);
//
//
// /**
// * Retrieves the destination for a given URL and method. If the URL has
// * been stored with "ALL" methods, will return that destination unless
// * the URL has also been stored with a specific method. Returns null if
// * there's no destination for a URL and method.
// */
// public Destination get(String url, HttpMethod method);
//
//
// /**
// * Retrieves an unmodifiable view of the destination map for a given URL.
// * The returned map will be sorted by method.
// * <p>
// * Note 1: this method will never return null, but the map may be empty.
// * <p>
// * Note 2: the map may contain a single mapping, for "ALL"; the caller
// * is responsible for translating this to individual mappings
// * if desired.
// */
// public Map<HttpMethod,Destination> get(String url);
//
//
// /**
// * Removes the destination(s) associated with the given URL and method.
// * If the passed method is "ALL", will remove all destinations (even if
// * they were added individually).
// */
// public void remove(String url, HttpMethod method);
//
//
// /**
// * Returns an iterator over the URLs in this repository. These URLs
// * will be sorted in alphanumeric order. Only those URLs that have active
// * mappings are returned.
// */
// @Override
// public Iterator<String> iterator();
// }
| import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.SortedMap;
import java.util.TreeMap;
import com.kdgregory.pathfinder.core.Destination;
import com.kdgregory.pathfinder.core.HttpMethod;
import com.kdgregory.pathfinder.core.PathRepo; | // Copyright (c) Keith D Gregory
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.kdgregory.pathfinder.core.impl;
/**
* Holds all of the paths that have been discovered. A path is a tuple of URL,
* HTTP method, and destination (which may be a handler class, or a JSP). URLs
* are relative to the context root.
* <p>
* The storage mechanism is a map-of-maps, with the URL as outer key. Inspectors
* are allowed (and expected) to completely replace the destinations that belong
* to a particular URL. Both maps are sorted, to result in consisted output.
* <p>
* This class is not intended for use by concurrent threads.
*/
public class PathRepoImpl
implements PathRepo
{ | // Path: lib-core/src/main/java/com/kdgregory/pathfinder/core/Destination.java
// public interface Destination
// {
// /**
// * Returns an indication of whether this destination should be
// * displayed at all, given the current invocation options.
// */
// public boolean isDisplayed(Map<InvocationOptions, Boolean> options);
//
// /**
// * Returns a formatted description of this destination, taking into
// * consideration the specified invocation options.
// */
// public String toString(Map<InvocationOptions, Boolean> options);
// }
//
// Path: lib-core/src/main/java/com/kdgregory/pathfinder/core/HttpMethod.java
// public enum HttpMethod
// {
// ALL(""),
// GET("GET"),
// POST("POST"),
// PUT("PUT"),
// DELETE("DELETE");
//
// private String stringValue;
//
// HttpMethod(String stringValue)
// {
// this.stringValue = stringValue;
// }
//
// @Override
// public String toString()
// {
// return stringValue;
// }
// }
//
// Path: lib-core/src/main/java/com/kdgregory/pathfinder/core/PathRepo.java
// public interface PathRepo
// extends Iterable<String>
// {
// /**
// * Returns the number of URLs in the repository. Note that multiple actions
// * for the same URL are only counted once.
// */
// public int urlCount();
//
//
// /**
// * Stores a destination that responds to all request methods. Will replace
// * all existing destinations for the URL.
// */
// public void put(String url, Destination dest);
//
//
// /**
// * Stores a destination that responds to a specific request method. If
// * there is an existing "all" entry, it will be overridden for just the
// * method stored.
// */
// public void put(String url, HttpMethod method, Destination dest);
//
//
// /**
// * Stores a map of destinations, replacing the existing map for that URL.
// */
// public void put(String url, Map<HttpMethod,Destination> destMap);
//
//
// /**
// * Retrieves the destination for a given URL and method. If the URL has
// * been stored with "ALL" methods, will return that destination unless
// * the URL has also been stored with a specific method. Returns null if
// * there's no destination for a URL and method.
// */
// public Destination get(String url, HttpMethod method);
//
//
// /**
// * Retrieves an unmodifiable view of the destination map for a given URL.
// * The returned map will be sorted by method.
// * <p>
// * Note 1: this method will never return null, but the map may be empty.
// * <p>
// * Note 2: the map may contain a single mapping, for "ALL"; the caller
// * is responsible for translating this to individual mappings
// * if desired.
// */
// public Map<HttpMethod,Destination> get(String url);
//
//
// /**
// * Removes the destination(s) associated with the given URL and method.
// * If the passed method is "ALL", will remove all destinations (even if
// * they were added individually).
// */
// public void remove(String url, HttpMethod method);
//
//
// /**
// * Returns an iterator over the URLs in this repository. These URLs
// * will be sorted in alphanumeric order. Only those URLs that have active
// * mappings are returned.
// */
// @Override
// public Iterator<String> iterator();
// }
// Path: lib-core/src/main/java/com/kdgregory/pathfinder/core/impl/PathRepoImpl.java
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.SortedMap;
import java.util.TreeMap;
import com.kdgregory.pathfinder.core.Destination;
import com.kdgregory.pathfinder.core.HttpMethod;
import com.kdgregory.pathfinder.core.PathRepo;
// Copyright (c) Keith D Gregory
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.kdgregory.pathfinder.core.impl;
/**
* Holds all of the paths that have been discovered. A path is a tuple of URL,
* HTTP method, and destination (which may be a handler class, or a JSP). URLs
* are relative to the context root.
* <p>
* The storage mechanism is a map-of-maps, with the URL as outer key. Inspectors
* are allowed (and expected) to completely replace the destinations that belong
* to a particular URL. Both maps are sorted, to result in consisted output.
* <p>
* This class is not intended for use by concurrent threads.
*/
public class PathRepoImpl
implements PathRepo
{ | private SortedMap<String,SortedMap<HttpMethod,Destination>> urlMap |
kdgregory/pathfinder | lib-core/src/main/java/com/kdgregory/pathfinder/util/ClasspathScanner.java | // Path: lib-core/src/main/java/com/kdgregory/pathfinder/core/WarMachine.java
// public interface WarMachine
// {
// /**
// * Returns the <code>web.xml</code> as a parsed XML DOM. Implementations
// * may return a shared, modifiable instance of the DOM; callers must not
// * modify the returned object.
// * <p>
// * Note: the method {@link getWebXmlPath} should be used to retrieve data
// * from this DOM.
// */
// public Document getWebXml();
//
//
// /**
// * Returns an XPath that may be used to retrieve content from this WAR's
// * <code>web.xml</code>. Elements within the file must be prefixed with
// * the "j2ee" namespace prefix; the actual namespace will depend on the
// * version of the servlet spec in use.
// */
// public XPathWrapper getWebXmlPath(String path);
//
//
// /**
// * Joins the <code>servlet</code> and <code>servlet-mapping</code> entries from
// * <code>web.xml</code>. The result is ordered alphabetically.
// */
// public List<ServletMapping> getServletMappings();
//
//
// /**
// * Returns a list of all entries in the WAR, prefixed with a leading slash.
// */
// public List<String> getAllFiles();
//
//
// /**
// * Returns a list of the "public" entries in the WAR: those not under
// * META-INF or WEB-INF. This is where you'll find the JSPs.
// */
// public List<String> getPublicFiles();
//
//
// /**
// * Returns a list of the "private" entries in the WAR: those under META-INF
// * and WEB-INF.
// */
// public List<String> getPrivateFiles();
//
//
// /**
// * Returns a list of all files on the classpath: those under WEB-INF/classes
// * and those contained in JARfiles. Note that the return is a Set; if there
// * are multiple classpath files with the same name, one will be chosen
// * arbitrarily.
// */
// public Set<String> getFilesOnClasspath();
//
//
// /**
// * Searches the classpath for classes in a given package, optionally recursing
// * into descendent packages.
// */
// public Set<String> getClassesInPackage(String packageName, boolean recurse);
//
//
// /**
// * Returns a stream for the named file, <code>null</code> if the file doesn't
// * exist. You are encouraged to close this stream, but as it isn't a physical
// * file handle, there isn't a penalty to pay for not closing it.
// */
// public InputStream openFile(String filename)
// throws IOException;
//
//
// /**
// * Opens a file on the WAR's classpath. First looks in <code>WEB-INF/classes</code>,
// * then in each of the JARs in <code>lib</code>.
// */
// public InputStream openClasspathFile(String filename)
// throws IOException;
//
//
// /**
// * Attempts to find the specified class on the classpath, and loads it
// * using BCEL. Returns <code>null</code> if unable to find the classfile.
// */
// public JavaClass loadClass(String classname);
//
//
//
// //----------------------------------------------------------------------------
// // Supporting Objects
// //----------------------------------------------------------------------------
//
// /**
// * Servlet mappings are parsed into objects that implement this interface.
// * Method names are simple translations of the corresponding element name.
// * <p>
// * The natural ordering of this interface is the URL pattern.
// */
// public interface ServletMapping
// extends Comparable<ServletMapping>
// {
// public String getUrlPattern();
//
// public String getServletName();
//
// public String getServletClass();
//
// public Map<String,String> getInitParams();
// }
// }
| import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import org.apache.bcel.classfile.JavaClass;
import net.sf.kdgcommons.lang.StringUtil;
import com.kdgregory.bcelx.classfile.Annotation;
import com.kdgregory.bcelx.parser.AnnotationParser;
import com.kdgregory.pathfinder.core.WarMachine; | // Copyright (c) Keith D Gregory
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.kdgregory.pathfinder.util;
/**
* This class contains the logic to scan a WAR's classpath, applying zero or
* more filters to the classes found there. An unconfigured instance (one
* without filters) returns all classes on the classpath.
*/
public class ClasspathScanner
{
private Map<String,Boolean> basePackages; // packageName -> recurse
private Set<String> includedAnnotations;
//----------------------------------------------------------------------------
// ClasspathScanner
//----------------------------------------------------------------------------
public ClasspathScanner addBasePackage(String packageName, boolean includeSubPackages)
{
if (basePackages == null)
basePackages = new HashMap<String,Boolean>();
basePackages.put(packageName, Boolean.valueOf(includeSubPackages));
return this;
}
public ClasspathScanner addBasePackage(String packageName)
{
return addBasePackage(packageName, true);
}
public ClasspathScanner addIncludedAnnotation(String annotationClass)
{
if (includedAnnotations == null)
includedAnnotations = new HashSet<String>();
includedAnnotations.add(annotationClass);
return this;
}
| // Path: lib-core/src/main/java/com/kdgregory/pathfinder/core/WarMachine.java
// public interface WarMachine
// {
// /**
// * Returns the <code>web.xml</code> as a parsed XML DOM. Implementations
// * may return a shared, modifiable instance of the DOM; callers must not
// * modify the returned object.
// * <p>
// * Note: the method {@link getWebXmlPath} should be used to retrieve data
// * from this DOM.
// */
// public Document getWebXml();
//
//
// /**
// * Returns an XPath that may be used to retrieve content from this WAR's
// * <code>web.xml</code>. Elements within the file must be prefixed with
// * the "j2ee" namespace prefix; the actual namespace will depend on the
// * version of the servlet spec in use.
// */
// public XPathWrapper getWebXmlPath(String path);
//
//
// /**
// * Joins the <code>servlet</code> and <code>servlet-mapping</code> entries from
// * <code>web.xml</code>. The result is ordered alphabetically.
// */
// public List<ServletMapping> getServletMappings();
//
//
// /**
// * Returns a list of all entries in the WAR, prefixed with a leading slash.
// */
// public List<String> getAllFiles();
//
//
// /**
// * Returns a list of the "public" entries in the WAR: those not under
// * META-INF or WEB-INF. This is where you'll find the JSPs.
// */
// public List<String> getPublicFiles();
//
//
// /**
// * Returns a list of the "private" entries in the WAR: those under META-INF
// * and WEB-INF.
// */
// public List<String> getPrivateFiles();
//
//
// /**
// * Returns a list of all files on the classpath: those under WEB-INF/classes
// * and those contained in JARfiles. Note that the return is a Set; if there
// * are multiple classpath files with the same name, one will be chosen
// * arbitrarily.
// */
// public Set<String> getFilesOnClasspath();
//
//
// /**
// * Searches the classpath for classes in a given package, optionally recursing
// * into descendent packages.
// */
// public Set<String> getClassesInPackage(String packageName, boolean recurse);
//
//
// /**
// * Returns a stream for the named file, <code>null</code> if the file doesn't
// * exist. You are encouraged to close this stream, but as it isn't a physical
// * file handle, there isn't a penalty to pay for not closing it.
// */
// public InputStream openFile(String filename)
// throws IOException;
//
//
// /**
// * Opens a file on the WAR's classpath. First looks in <code>WEB-INF/classes</code>,
// * then in each of the JARs in <code>lib</code>.
// */
// public InputStream openClasspathFile(String filename)
// throws IOException;
//
//
// /**
// * Attempts to find the specified class on the classpath, and loads it
// * using BCEL. Returns <code>null</code> if unable to find the classfile.
// */
// public JavaClass loadClass(String classname);
//
//
//
// //----------------------------------------------------------------------------
// // Supporting Objects
// //----------------------------------------------------------------------------
//
// /**
// * Servlet mappings are parsed into objects that implement this interface.
// * Method names are simple translations of the corresponding element name.
// * <p>
// * The natural ordering of this interface is the URL pattern.
// */
// public interface ServletMapping
// extends Comparable<ServletMapping>
// {
// public String getUrlPattern();
//
// public String getServletName();
//
// public String getServletClass();
//
// public Map<String,String> getInitParams();
// }
// }
// Path: lib-core/src/main/java/com/kdgregory/pathfinder/util/ClasspathScanner.java
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import org.apache.bcel.classfile.JavaClass;
import net.sf.kdgcommons.lang.StringUtil;
import com.kdgregory.bcelx.classfile.Annotation;
import com.kdgregory.bcelx.parser.AnnotationParser;
import com.kdgregory.pathfinder.core.WarMachine;
// Copyright (c) Keith D Gregory
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.kdgregory.pathfinder.util;
/**
* This class contains the logic to scan a WAR's classpath, applying zero or
* more filters to the classes found there. An unconfigured instance (one
* without filters) returns all classes on the classpath.
*/
public class ClasspathScanner
{
private Map<String,Boolean> basePackages; // packageName -> recurse
private Set<String> includedAnnotations;
//----------------------------------------------------------------------------
// ClasspathScanner
//----------------------------------------------------------------------------
public ClasspathScanner addBasePackage(String packageName, boolean includeSubPackages)
{
if (basePackages == null)
basePackages = new HashMap<String,Boolean>();
basePackages.put(packageName, Boolean.valueOf(includeSubPackages));
return this;
}
public ClasspathScanner addBasePackage(String packageName)
{
return addBasePackage(packageName, true);
}
public ClasspathScanner addIncludedAnnotation(String annotationClass)
{
if (includedAnnotations == null)
includedAnnotations = new HashSet<String>();
includedAnnotations.add(annotationClass);
return this;
}
| public Map<String,AnnotationParser> scan(WarMachine war) |
kdgregory/pathfinder | lib-spring/src/main/java/com/kdgregory/pathfinder/spring/context/ResourceLoader.java | // Path: lib-core/src/main/java/com/kdgregory/pathfinder/core/WarMachine.java
// public interface WarMachine
// {
// /**
// * Returns the <code>web.xml</code> as a parsed XML DOM. Implementations
// * may return a shared, modifiable instance of the DOM; callers must not
// * modify the returned object.
// * <p>
// * Note: the method {@link getWebXmlPath} should be used to retrieve data
// * from this DOM.
// */
// public Document getWebXml();
//
//
// /**
// * Returns an XPath that may be used to retrieve content from this WAR's
// * <code>web.xml</code>. Elements within the file must be prefixed with
// * the "j2ee" namespace prefix; the actual namespace will depend on the
// * version of the servlet spec in use.
// */
// public XPathWrapper getWebXmlPath(String path);
//
//
// /**
// * Joins the <code>servlet</code> and <code>servlet-mapping</code> entries from
// * <code>web.xml</code>. The result is ordered alphabetically.
// */
// public List<ServletMapping> getServletMappings();
//
//
// /**
// * Returns a list of all entries in the WAR, prefixed with a leading slash.
// */
// public List<String> getAllFiles();
//
//
// /**
// * Returns a list of the "public" entries in the WAR: those not under
// * META-INF or WEB-INF. This is where you'll find the JSPs.
// */
// public List<String> getPublicFiles();
//
//
// /**
// * Returns a list of the "private" entries in the WAR: those under META-INF
// * and WEB-INF.
// */
// public List<String> getPrivateFiles();
//
//
// /**
// * Returns a list of all files on the classpath: those under WEB-INF/classes
// * and those contained in JARfiles. Note that the return is a Set; if there
// * are multiple classpath files with the same name, one will be chosen
// * arbitrarily.
// */
// public Set<String> getFilesOnClasspath();
//
//
// /**
// * Searches the classpath for classes in a given package, optionally recursing
// * into descendent packages.
// */
// public Set<String> getClassesInPackage(String packageName, boolean recurse);
//
//
// /**
// * Returns a stream for the named file, <code>null</code> if the file doesn't
// * exist. You are encouraged to close this stream, but as it isn't a physical
// * file handle, there isn't a penalty to pay for not closing it.
// */
// public InputStream openFile(String filename)
// throws IOException;
//
//
// /**
// * Opens a file on the WAR's classpath. First looks in <code>WEB-INF/classes</code>,
// * then in each of the JARs in <code>lib</code>.
// */
// public InputStream openClasspathFile(String filename)
// throws IOException;
//
//
// /**
// * Attempts to find the specified class on the classpath, and loads it
// * using BCEL. Returns <code>null</code> if unable to find the classfile.
// */
// public JavaClass loadClass(String classname);
//
//
//
// //----------------------------------------------------------------------------
// // Supporting Objects
// //----------------------------------------------------------------------------
//
// /**
// * Servlet mappings are parsed into objects that implement this interface.
// * Method names are simple translations of the corresponding element name.
// * <p>
// * The natural ordering of this interface is the URL pattern.
// */
// public interface ServletMapping
// extends Comparable<ServletMapping>
// {
// public String getUrlPattern();
//
// public String getServletName();
//
// public String getServletClass();
//
// public Map<String,String> getInitParams();
// }
// }
| import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import net.sf.kdgcommons.lang.StringUtil;
import com.kdgregory.pathfinder.core.WarMachine; | // Copyright (c) Keith D Gregory
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.kdgregory.pathfinder.spring.context;
/**
* Attempts to replicate Spring's resource loading logic, retrieving files from
* a WAR. Resources with a scheme are handled as expected, Non-schema resources
* are treated as file paths within the WAR, relative to either the base of the
* WAR or a predefined path.
* <p>
* In addition to resource loading, provides the {@link #decomposeResourceRefs}
* method, which breaks appart a resource list and supports the "classpath*:"
* scheme.
*/
public class ResourceLoader
{ | // Path: lib-core/src/main/java/com/kdgregory/pathfinder/core/WarMachine.java
// public interface WarMachine
// {
// /**
// * Returns the <code>web.xml</code> as a parsed XML DOM. Implementations
// * may return a shared, modifiable instance of the DOM; callers must not
// * modify the returned object.
// * <p>
// * Note: the method {@link getWebXmlPath} should be used to retrieve data
// * from this DOM.
// */
// public Document getWebXml();
//
//
// /**
// * Returns an XPath that may be used to retrieve content from this WAR's
// * <code>web.xml</code>. Elements within the file must be prefixed with
// * the "j2ee" namespace prefix; the actual namespace will depend on the
// * version of the servlet spec in use.
// */
// public XPathWrapper getWebXmlPath(String path);
//
//
// /**
// * Joins the <code>servlet</code> and <code>servlet-mapping</code> entries from
// * <code>web.xml</code>. The result is ordered alphabetically.
// */
// public List<ServletMapping> getServletMappings();
//
//
// /**
// * Returns a list of all entries in the WAR, prefixed with a leading slash.
// */
// public List<String> getAllFiles();
//
//
// /**
// * Returns a list of the "public" entries in the WAR: those not under
// * META-INF or WEB-INF. This is where you'll find the JSPs.
// */
// public List<String> getPublicFiles();
//
//
// /**
// * Returns a list of the "private" entries in the WAR: those under META-INF
// * and WEB-INF.
// */
// public List<String> getPrivateFiles();
//
//
// /**
// * Returns a list of all files on the classpath: those under WEB-INF/classes
// * and those contained in JARfiles. Note that the return is a Set; if there
// * are multiple classpath files with the same name, one will be chosen
// * arbitrarily.
// */
// public Set<String> getFilesOnClasspath();
//
//
// /**
// * Searches the classpath for classes in a given package, optionally recursing
// * into descendent packages.
// */
// public Set<String> getClassesInPackage(String packageName, boolean recurse);
//
//
// /**
// * Returns a stream for the named file, <code>null</code> if the file doesn't
// * exist. You are encouraged to close this stream, but as it isn't a physical
// * file handle, there isn't a penalty to pay for not closing it.
// */
// public InputStream openFile(String filename)
// throws IOException;
//
//
// /**
// * Opens a file on the WAR's classpath. First looks in <code>WEB-INF/classes</code>,
// * then in each of the JARs in <code>lib</code>.
// */
// public InputStream openClasspathFile(String filename)
// throws IOException;
//
//
// /**
// * Attempts to find the specified class on the classpath, and loads it
// * using BCEL. Returns <code>null</code> if unable to find the classfile.
// */
// public JavaClass loadClass(String classname);
//
//
//
// //----------------------------------------------------------------------------
// // Supporting Objects
// //----------------------------------------------------------------------------
//
// /**
// * Servlet mappings are parsed into objects that implement this interface.
// * Method names are simple translations of the corresponding element name.
// * <p>
// * The natural ordering of this interface is the URL pattern.
// */
// public interface ServletMapping
// extends Comparable<ServletMapping>
// {
// public String getUrlPattern();
//
// public String getServletName();
//
// public String getServletClass();
//
// public Map<String,String> getInitParams();
// }
// }
// Path: lib-spring/src/main/java/com/kdgregory/pathfinder/spring/context/ResourceLoader.java
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import net.sf.kdgcommons.lang.StringUtil;
import com.kdgregory.pathfinder.core.WarMachine;
// Copyright (c) Keith D Gregory
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.kdgregory.pathfinder.spring.context;
/**
* Attempts to replicate Spring's resource loading logic, retrieving files from
* a WAR. Resources with a scheme are handled as expected, Non-schema resources
* are treated as file paths within the WAR, relative to either the base of the
* WAR or a predefined path.
* <p>
* In addition to resource loading, provides the {@link #decomposeResourceRefs}
* method, which breaks appart a resource list and supports the "classpath*:"
* scheme.
*/
public class ResourceLoader
{ | private WarMachine war; |
kdgregory/pathfinder | lib-spring/src/main/java/com/kdgregory/pathfinder/spring/context/XmlBeanDefinition.java | // Path: lib-spring/src/main/java/com/kdgregory/pathfinder/spring/InvalidContextException.java
// public class InvalidContextException
// extends RuntimeException
// {
// private static final long serialVersionUID = 1L;
//
//
// public InvalidContextException(String message)
// {
// super(message);
// }
//
//
// public InvalidContextException(String message, Throwable cause)
// {
// super(message, cause);
// }
// }
| import java.io.IOException;
import java.io.StringReader;
import java.util.List;
import java.util.Properties;
import org.w3c.dom.Element;
import net.sf.kdgcommons.lang.StringUtil;
import net.sf.practicalxml.DomUtil;
import net.sf.practicalxml.xpath.XPathWrapperFactory;
import com.kdgregory.pathfinder.spring.InvalidContextException; | {
return def.getAttribute("id").trim();
}
private static String extractBeanName(Element def)
{
return def.getAttribute("name").trim();
}
private static String extractBeanClass(Element def)
{
return def.getAttribute("class").trim();
}
private XmlBeanDefinition resolveParent(boolean failIfNoParent)
{
if (parent != null)
return parent;
// technically, an XML definition could inherit from a non-XML definition
// I'm going to assume that's an extreme corner case, as supporting it
// will make my life more difficult
BeanDefinition p0 = (parentRef != null) ? context.getBean(parentRef) : null;
if (p0 instanceof XmlBeanDefinition)
parent = (XmlBeanDefinition)p0;
if ((parent == null) && failIfNoParent) | // Path: lib-spring/src/main/java/com/kdgregory/pathfinder/spring/InvalidContextException.java
// public class InvalidContextException
// extends RuntimeException
// {
// private static final long serialVersionUID = 1L;
//
//
// public InvalidContextException(String message)
// {
// super(message);
// }
//
//
// public InvalidContextException(String message, Throwable cause)
// {
// super(message, cause);
// }
// }
// Path: lib-spring/src/main/java/com/kdgregory/pathfinder/spring/context/XmlBeanDefinition.java
import java.io.IOException;
import java.io.StringReader;
import java.util.List;
import java.util.Properties;
import org.w3c.dom.Element;
import net.sf.kdgcommons.lang.StringUtil;
import net.sf.practicalxml.DomUtil;
import net.sf.practicalxml.xpath.XPathWrapperFactory;
import com.kdgregory.pathfinder.spring.InvalidContextException;
{
return def.getAttribute("id").trim();
}
private static String extractBeanName(Element def)
{
return def.getAttribute("name").trim();
}
private static String extractBeanClass(Element def)
{
return def.getAttribute("class").trim();
}
private XmlBeanDefinition resolveParent(boolean failIfNoParent)
{
if (parent != null)
return parent;
// technically, an XML definition could inherit from a non-XML definition
// I'm going to assume that's an extreme corner case, as supporting it
// will make my life more difficult
BeanDefinition p0 = (parentRef != null) ? context.getBean(parentRef) : null;
if (p0 instanceof XmlBeanDefinition)
parent = (XmlBeanDefinition)p0;
if ((parent == null) && failIfNoParent) | throw new InvalidContextException("invalid bean definition, parent expected: " + super.getBeanId()); |
kevalpatel2106/android-samples | Calender Read Demo/app/src/main/java/example/calandersync/activity/EventListActivity.java | // Path: Calender Read Demo/app/src/main/java/example/calandersync/pojo/EventPojo.java
// public class EventPojo {
//
// private String title;
// private String description;
//
// public String getDescription() {
// return description;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public String getTitle() {
// return title;
// }
//
// public void setTitle(String title) {
// this.title = title;
// }
// }
//
// Path: Calender Read Demo/app/src/main/java/example/calandersync/utils/DividerItemDecorator.java
// public class DividerItemDecorator extends RecyclerView.ItemDecoration {
// private Drawable mDivider;
//
// public DividerItemDecorator(Drawable divider){
// mDivider = divider;
// }
// @Override
// public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
// super.getItemOffsets(outRect, view, parent, state);
//
// if (parent.getChildAdapterPosition(view) == 0) {
// return;
// }
//
// outRect.top = mDivider.getIntrinsicHeight();
// }
//
// @Override
// public void onDraw(Canvas canvas, RecyclerView parent, RecyclerView.State state) {
// int dividerLeft = parent.getPaddingLeft();
// int dividerRight = parent.getWidth() - parent.getPaddingRight();
//
// int childCount = parent.getChildCount();
// for (int i = 0; i < childCount - 1; i++) {
// View child = parent.getChildAt(i);
//
// RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams();
//
// int dividerTop = child.getBottom() + params.bottomMargin;
// int dividerBottom = dividerTop + mDivider.getIntrinsicHeight();
//
// mDivider.setBounds(dividerLeft, dividerTop, dividerRight, dividerBottom);
// mDivider.draw(canvas);
// }
// }
// }
| import android.content.ContentUris;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.provider.CalendarContract;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.Calendar;
import example.calandersync.R;
import example.calandersync.pojo.EventPojo;
import example.calandersync.utils.DividerItemDecorator; | package example.calandersync.activity;
/**
* This activity will display how to load and display events for the given calender.
*/
public class EventListActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_event_list);
setRecyclerView();
}
private void setRecyclerView() {
RecyclerView eventList = (RecyclerView) findViewById(R.id.event_list);
eventList.setItemAnimator(new DefaultItemAnimator());
eventList.setLayoutManager(new LinearLayoutManager(this));
| // Path: Calender Read Demo/app/src/main/java/example/calandersync/pojo/EventPojo.java
// public class EventPojo {
//
// private String title;
// private String description;
//
// public String getDescription() {
// return description;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public String getTitle() {
// return title;
// }
//
// public void setTitle(String title) {
// this.title = title;
// }
// }
//
// Path: Calender Read Demo/app/src/main/java/example/calandersync/utils/DividerItemDecorator.java
// public class DividerItemDecorator extends RecyclerView.ItemDecoration {
// private Drawable mDivider;
//
// public DividerItemDecorator(Drawable divider){
// mDivider = divider;
// }
// @Override
// public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
// super.getItemOffsets(outRect, view, parent, state);
//
// if (parent.getChildAdapterPosition(view) == 0) {
// return;
// }
//
// outRect.top = mDivider.getIntrinsicHeight();
// }
//
// @Override
// public void onDraw(Canvas canvas, RecyclerView parent, RecyclerView.State state) {
// int dividerLeft = parent.getPaddingLeft();
// int dividerRight = parent.getWidth() - parent.getPaddingRight();
//
// int childCount = parent.getChildCount();
// for (int i = 0; i < childCount - 1; i++) {
// View child = parent.getChildAt(i);
//
// RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams();
//
// int dividerTop = child.getBottom() + params.bottomMargin;
// int dividerBottom = dividerTop + mDivider.getIntrinsicHeight();
//
// mDivider.setBounds(dividerLeft, dividerTop, dividerRight, dividerBottom);
// mDivider.draw(canvas);
// }
// }
// }
// Path: Calender Read Demo/app/src/main/java/example/calandersync/activity/EventListActivity.java
import android.content.ContentUris;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.provider.CalendarContract;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.Calendar;
import example.calandersync.R;
import example.calandersync.pojo.EventPojo;
import example.calandersync.utils.DividerItemDecorator;
package example.calandersync.activity;
/**
* This activity will display how to load and display events for the given calender.
*/
public class EventListActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_event_list);
setRecyclerView();
}
private void setRecyclerView() {
RecyclerView eventList = (RecyclerView) findViewById(R.id.event_list);
eventList.setItemAnimator(new DefaultItemAnimator());
eventList.setLayoutManager(new LinearLayoutManager(this));
| RecyclerView.ItemDecoration dividerItemDecoration = new DividerItemDecorator(ContextCompat.getDrawable(this, R.drawable.line_divider)); |
kevalpatel2106/android-samples | Calender Read Demo/app/src/main/java/example/calandersync/activity/EventListActivity.java | // Path: Calender Read Demo/app/src/main/java/example/calandersync/pojo/EventPojo.java
// public class EventPojo {
//
// private String title;
// private String description;
//
// public String getDescription() {
// return description;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public String getTitle() {
// return title;
// }
//
// public void setTitle(String title) {
// this.title = title;
// }
// }
//
// Path: Calender Read Demo/app/src/main/java/example/calandersync/utils/DividerItemDecorator.java
// public class DividerItemDecorator extends RecyclerView.ItemDecoration {
// private Drawable mDivider;
//
// public DividerItemDecorator(Drawable divider){
// mDivider = divider;
// }
// @Override
// public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
// super.getItemOffsets(outRect, view, parent, state);
//
// if (parent.getChildAdapterPosition(view) == 0) {
// return;
// }
//
// outRect.top = mDivider.getIntrinsicHeight();
// }
//
// @Override
// public void onDraw(Canvas canvas, RecyclerView parent, RecyclerView.State state) {
// int dividerLeft = parent.getPaddingLeft();
// int dividerRight = parent.getWidth() - parent.getPaddingRight();
//
// int childCount = parent.getChildCount();
// for (int i = 0; i < childCount - 1; i++) {
// View child = parent.getChildAt(i);
//
// RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams();
//
// int dividerTop = child.getBottom() + params.bottomMargin;
// int dividerBottom = dividerTop + mDivider.getIntrinsicHeight();
//
// mDivider.setBounds(dividerLeft, dividerTop, dividerRight, dividerBottom);
// mDivider.draw(canvas);
// }
// }
// }
| import android.content.ContentUris;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.provider.CalendarContract;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.Calendar;
import example.calandersync.R;
import example.calandersync.pojo.EventPojo;
import example.calandersync.utils.DividerItemDecorator; | package example.calandersync.activity;
/**
* This activity will display how to load and display events for the given calender.
*/
public class EventListActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_event_list);
setRecyclerView();
}
private void setRecyclerView() {
RecyclerView eventList = (RecyclerView) findViewById(R.id.event_list);
eventList.setItemAnimator(new DefaultItemAnimator());
eventList.setLayoutManager(new LinearLayoutManager(this));
RecyclerView.ItemDecoration dividerItemDecoration = new DividerItemDecorator(ContextCompat.getDrawable(this, R.drawable.line_divider));
eventList.addItemDecoration(dividerItemDecoration);
eventList.setAdapter(new RecyclerViewAdapter(getCalenderEvents()));
}
private class RecyclerViewAdapter extends RecyclerView.Adapter<RecyclerViewAdapter.MyViewHolder> { | // Path: Calender Read Demo/app/src/main/java/example/calandersync/pojo/EventPojo.java
// public class EventPojo {
//
// private String title;
// private String description;
//
// public String getDescription() {
// return description;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public String getTitle() {
// return title;
// }
//
// public void setTitle(String title) {
// this.title = title;
// }
// }
//
// Path: Calender Read Demo/app/src/main/java/example/calandersync/utils/DividerItemDecorator.java
// public class DividerItemDecorator extends RecyclerView.ItemDecoration {
// private Drawable mDivider;
//
// public DividerItemDecorator(Drawable divider){
// mDivider = divider;
// }
// @Override
// public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
// super.getItemOffsets(outRect, view, parent, state);
//
// if (parent.getChildAdapterPosition(view) == 0) {
// return;
// }
//
// outRect.top = mDivider.getIntrinsicHeight();
// }
//
// @Override
// public void onDraw(Canvas canvas, RecyclerView parent, RecyclerView.State state) {
// int dividerLeft = parent.getPaddingLeft();
// int dividerRight = parent.getWidth() - parent.getPaddingRight();
//
// int childCount = parent.getChildCount();
// for (int i = 0; i < childCount - 1; i++) {
// View child = parent.getChildAt(i);
//
// RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams();
//
// int dividerTop = child.getBottom() + params.bottomMargin;
// int dividerBottom = dividerTop + mDivider.getIntrinsicHeight();
//
// mDivider.setBounds(dividerLeft, dividerTop, dividerRight, dividerBottom);
// mDivider.draw(canvas);
// }
// }
// }
// Path: Calender Read Demo/app/src/main/java/example/calandersync/activity/EventListActivity.java
import android.content.ContentUris;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.provider.CalendarContract;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.Calendar;
import example.calandersync.R;
import example.calandersync.pojo.EventPojo;
import example.calandersync.utils.DividerItemDecorator;
package example.calandersync.activity;
/**
* This activity will display how to load and display events for the given calender.
*/
public class EventListActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_event_list);
setRecyclerView();
}
private void setRecyclerView() {
RecyclerView eventList = (RecyclerView) findViewById(R.id.event_list);
eventList.setItemAnimator(new DefaultItemAnimator());
eventList.setLayoutManager(new LinearLayoutManager(this));
RecyclerView.ItemDecoration dividerItemDecoration = new DividerItemDecorator(ContextCompat.getDrawable(this, R.drawable.line_divider));
eventList.addItemDecoration(dividerItemDecoration);
eventList.setAdapter(new RecyclerViewAdapter(getCalenderEvents()));
}
private class RecyclerViewAdapter extends RecyclerView.Adapter<RecyclerViewAdapter.MyViewHolder> { | private ArrayList<EventPojo> mData; |
kevalpatel2106/android-samples | Calender Read Demo/app/src/main/java/example/calandersync/activity/CalenderListActivity.java | // Path: Calender Read Demo/app/src/main/java/example/calandersync/utils/DividerItemDecorator.java
// public class DividerItemDecorator extends RecyclerView.ItemDecoration {
// private Drawable mDivider;
//
// public DividerItemDecorator(Drawable divider){
// mDivider = divider;
// }
// @Override
// public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
// super.getItemOffsets(outRect, view, parent, state);
//
// if (parent.getChildAdapterPosition(view) == 0) {
// return;
// }
//
// outRect.top = mDivider.getIntrinsicHeight();
// }
//
// @Override
// public void onDraw(Canvas canvas, RecyclerView parent, RecyclerView.State state) {
// int dividerLeft = parent.getPaddingLeft();
// int dividerRight = parent.getWidth() - parent.getPaddingRight();
//
// int childCount = parent.getChildCount();
// for (int i = 0; i < childCount - 1; i++) {
// View child = parent.getChildAt(i);
//
// RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams();
//
// int dividerTop = child.getBottom() + params.bottomMargin;
// int dividerBottom = dividerTop + mDivider.getIntrinsicHeight();
//
// mDivider.setBounds(dividerLeft, dividerTop, dividerRight, dividerBottom);
// mDivider.draw(canvas);
// }
// }
// }
//
// Path: Calender Read Demo/app/src/main/java/example/calandersync/pojo/CalenderPojo.java
// public class CalenderPojo {
//
// private String name;
// private long id;
// private int color;
// private String displayName;
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public long getId() {
// return id;
// }
//
// public void setId(long id) {
// this.id = id;
// }
//
// public CalenderPojo(){
// }
//
// @ColorInt
// public int getColor() {
// return color;
// }
//
// public void setColor(@ColorInt int color) {
// this.color = color;
// }
//
// public String getDisplayName() {
// return displayName;
// }
//
// public void setDisplayName(String displayName) {
// this.displayName = displayName;
// }
// }
| import android.Manifest;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.os.Bundle;
import android.provider.CalendarContract;
import android.support.annotation.NonNull;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import java.util.ArrayList;
import example.calandersync.utils.DividerItemDecorator;
import example.calandersync.R;
import example.calandersync.pojo.CalenderPojo; | package example.calandersync.activity;
/**
* This activity will display how to display all the available calenders.
*/
public class CalenderListActivity extends AppCompatActivity {
private static final int REQUEST_CALENDER_PERMISSION = 111;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//check for the calender permission
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_CALENDAR) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.READ_CALENDAR}, REQUEST_CALENDER_PERMISSION);
} else {
//recycle view
setRecyclerView();
}
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if (requestCode == REQUEST_CALENDER_PERMISSION) {
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) setRecyclerView();
}
}
/**
* Set the recycler view to display calender list
*/
public void setRecyclerView() {
RecyclerView calenderList = (RecyclerView) findViewById(R.id.recycler_view);
calenderList.setLayoutManager(new LinearLayoutManager(this));
calenderList.setHasFixedSize(true);
calenderList.setItemAnimator(new DefaultItemAnimator());
| // Path: Calender Read Demo/app/src/main/java/example/calandersync/utils/DividerItemDecorator.java
// public class DividerItemDecorator extends RecyclerView.ItemDecoration {
// private Drawable mDivider;
//
// public DividerItemDecorator(Drawable divider){
// mDivider = divider;
// }
// @Override
// public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
// super.getItemOffsets(outRect, view, parent, state);
//
// if (parent.getChildAdapterPosition(view) == 0) {
// return;
// }
//
// outRect.top = mDivider.getIntrinsicHeight();
// }
//
// @Override
// public void onDraw(Canvas canvas, RecyclerView parent, RecyclerView.State state) {
// int dividerLeft = parent.getPaddingLeft();
// int dividerRight = parent.getWidth() - parent.getPaddingRight();
//
// int childCount = parent.getChildCount();
// for (int i = 0; i < childCount - 1; i++) {
// View child = parent.getChildAt(i);
//
// RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams();
//
// int dividerTop = child.getBottom() + params.bottomMargin;
// int dividerBottom = dividerTop + mDivider.getIntrinsicHeight();
//
// mDivider.setBounds(dividerLeft, dividerTop, dividerRight, dividerBottom);
// mDivider.draw(canvas);
// }
// }
// }
//
// Path: Calender Read Demo/app/src/main/java/example/calandersync/pojo/CalenderPojo.java
// public class CalenderPojo {
//
// private String name;
// private long id;
// private int color;
// private String displayName;
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public long getId() {
// return id;
// }
//
// public void setId(long id) {
// this.id = id;
// }
//
// public CalenderPojo(){
// }
//
// @ColorInt
// public int getColor() {
// return color;
// }
//
// public void setColor(@ColorInt int color) {
// this.color = color;
// }
//
// public String getDisplayName() {
// return displayName;
// }
//
// public void setDisplayName(String displayName) {
// this.displayName = displayName;
// }
// }
// Path: Calender Read Demo/app/src/main/java/example/calandersync/activity/CalenderListActivity.java
import android.Manifest;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.os.Bundle;
import android.provider.CalendarContract;
import android.support.annotation.NonNull;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import java.util.ArrayList;
import example.calandersync.utils.DividerItemDecorator;
import example.calandersync.R;
import example.calandersync.pojo.CalenderPojo;
package example.calandersync.activity;
/**
* This activity will display how to display all the available calenders.
*/
public class CalenderListActivity extends AppCompatActivity {
private static final int REQUEST_CALENDER_PERMISSION = 111;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//check for the calender permission
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_CALENDAR) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.READ_CALENDAR}, REQUEST_CALENDER_PERMISSION);
} else {
//recycle view
setRecyclerView();
}
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if (requestCode == REQUEST_CALENDER_PERMISSION) {
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) setRecyclerView();
}
}
/**
* Set the recycler view to display calender list
*/
public void setRecyclerView() {
RecyclerView calenderList = (RecyclerView) findViewById(R.id.recycler_view);
calenderList.setLayoutManager(new LinearLayoutManager(this));
calenderList.setHasFixedSize(true);
calenderList.setItemAnimator(new DefaultItemAnimator());
| RecyclerView.ItemDecoration dividerItemDecoration = new DividerItemDecorator(ContextCompat.getDrawable(this, R.drawable.line_divider)); |
kevalpatel2106/android-samples | Calender Read Demo/app/src/main/java/example/calandersync/activity/CalenderListActivity.java | // Path: Calender Read Demo/app/src/main/java/example/calandersync/utils/DividerItemDecorator.java
// public class DividerItemDecorator extends RecyclerView.ItemDecoration {
// private Drawable mDivider;
//
// public DividerItemDecorator(Drawable divider){
// mDivider = divider;
// }
// @Override
// public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
// super.getItemOffsets(outRect, view, parent, state);
//
// if (parent.getChildAdapterPosition(view) == 0) {
// return;
// }
//
// outRect.top = mDivider.getIntrinsicHeight();
// }
//
// @Override
// public void onDraw(Canvas canvas, RecyclerView parent, RecyclerView.State state) {
// int dividerLeft = parent.getPaddingLeft();
// int dividerRight = parent.getWidth() - parent.getPaddingRight();
//
// int childCount = parent.getChildCount();
// for (int i = 0; i < childCount - 1; i++) {
// View child = parent.getChildAt(i);
//
// RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams();
//
// int dividerTop = child.getBottom() + params.bottomMargin;
// int dividerBottom = dividerTop + mDivider.getIntrinsicHeight();
//
// mDivider.setBounds(dividerLeft, dividerTop, dividerRight, dividerBottom);
// mDivider.draw(canvas);
// }
// }
// }
//
// Path: Calender Read Demo/app/src/main/java/example/calandersync/pojo/CalenderPojo.java
// public class CalenderPojo {
//
// private String name;
// private long id;
// private int color;
// private String displayName;
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public long getId() {
// return id;
// }
//
// public void setId(long id) {
// this.id = id;
// }
//
// public CalenderPojo(){
// }
//
// @ColorInt
// public int getColor() {
// return color;
// }
//
// public void setColor(@ColorInt int color) {
// this.color = color;
// }
//
// public String getDisplayName() {
// return displayName;
// }
//
// public void setDisplayName(String displayName) {
// this.displayName = displayName;
// }
// }
| import android.Manifest;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.os.Bundle;
import android.provider.CalendarContract;
import android.support.annotation.NonNull;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import java.util.ArrayList;
import example.calandersync.utils.DividerItemDecorator;
import example.calandersync.R;
import example.calandersync.pojo.CalenderPojo; | package example.calandersync.activity;
/**
* This activity will display how to display all the available calenders.
*/
public class CalenderListActivity extends AppCompatActivity {
private static final int REQUEST_CALENDER_PERMISSION = 111;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//check for the calender permission
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_CALENDAR) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.READ_CALENDAR}, REQUEST_CALENDER_PERMISSION);
} else {
//recycle view
setRecyclerView();
}
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if (requestCode == REQUEST_CALENDER_PERMISSION) {
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) setRecyclerView();
}
}
/**
* Set the recycler view to display calender list
*/
public void setRecyclerView() {
RecyclerView calenderList = (RecyclerView) findViewById(R.id.recycler_view);
calenderList.setLayoutManager(new LinearLayoutManager(this));
calenderList.setHasFixedSize(true);
calenderList.setItemAnimator(new DefaultItemAnimator());
RecyclerView.ItemDecoration dividerItemDecoration = new DividerItemDecorator(ContextCompat.getDrawable(this, R.drawable.line_divider));
calenderList.addItemDecoration(dividerItemDecoration);
calenderList.setAdapter(new CalenderListAdapter(getCalenders()));
}
/**
* Adapter to bind calender list
*/
private class CalenderListAdapter extends RecyclerView.Adapter<CalenderListAdapter.ViewHolder> { | // Path: Calender Read Demo/app/src/main/java/example/calandersync/utils/DividerItemDecorator.java
// public class DividerItemDecorator extends RecyclerView.ItemDecoration {
// private Drawable mDivider;
//
// public DividerItemDecorator(Drawable divider){
// mDivider = divider;
// }
// @Override
// public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
// super.getItemOffsets(outRect, view, parent, state);
//
// if (parent.getChildAdapterPosition(view) == 0) {
// return;
// }
//
// outRect.top = mDivider.getIntrinsicHeight();
// }
//
// @Override
// public void onDraw(Canvas canvas, RecyclerView parent, RecyclerView.State state) {
// int dividerLeft = parent.getPaddingLeft();
// int dividerRight = parent.getWidth() - parent.getPaddingRight();
//
// int childCount = parent.getChildCount();
// for (int i = 0; i < childCount - 1; i++) {
// View child = parent.getChildAt(i);
//
// RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams();
//
// int dividerTop = child.getBottom() + params.bottomMargin;
// int dividerBottom = dividerTop + mDivider.getIntrinsicHeight();
//
// mDivider.setBounds(dividerLeft, dividerTop, dividerRight, dividerBottom);
// mDivider.draw(canvas);
// }
// }
// }
//
// Path: Calender Read Demo/app/src/main/java/example/calandersync/pojo/CalenderPojo.java
// public class CalenderPojo {
//
// private String name;
// private long id;
// private int color;
// private String displayName;
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public long getId() {
// return id;
// }
//
// public void setId(long id) {
// this.id = id;
// }
//
// public CalenderPojo(){
// }
//
// @ColorInt
// public int getColor() {
// return color;
// }
//
// public void setColor(@ColorInt int color) {
// this.color = color;
// }
//
// public String getDisplayName() {
// return displayName;
// }
//
// public void setDisplayName(String displayName) {
// this.displayName = displayName;
// }
// }
// Path: Calender Read Demo/app/src/main/java/example/calandersync/activity/CalenderListActivity.java
import android.Manifest;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.os.Bundle;
import android.provider.CalendarContract;
import android.support.annotation.NonNull;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import java.util.ArrayList;
import example.calandersync.utils.DividerItemDecorator;
import example.calandersync.R;
import example.calandersync.pojo.CalenderPojo;
package example.calandersync.activity;
/**
* This activity will display how to display all the available calenders.
*/
public class CalenderListActivity extends AppCompatActivity {
private static final int REQUEST_CALENDER_PERMISSION = 111;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//check for the calender permission
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_CALENDAR) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.READ_CALENDAR}, REQUEST_CALENDER_PERMISSION);
} else {
//recycle view
setRecyclerView();
}
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if (requestCode == REQUEST_CALENDER_PERMISSION) {
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) setRecyclerView();
}
}
/**
* Set the recycler view to display calender list
*/
public void setRecyclerView() {
RecyclerView calenderList = (RecyclerView) findViewById(R.id.recycler_view);
calenderList.setLayoutManager(new LinearLayoutManager(this));
calenderList.setHasFixedSize(true);
calenderList.setItemAnimator(new DefaultItemAnimator());
RecyclerView.ItemDecoration dividerItemDecoration = new DividerItemDecorator(ContextCompat.getDrawable(this, R.drawable.line_divider));
calenderList.addItemDecoration(dividerItemDecoration);
calenderList.setAdapter(new CalenderListAdapter(getCalenders()));
}
/**
* Adapter to bind calender list
*/
private class CalenderListAdapter extends RecyclerView.Adapter<CalenderListAdapter.ViewHolder> { | private ArrayList<CalenderPojo> mData; |
kevalpatel2106/android-samples | SQLiteDemo/app/src/main/java/com/example/android/sqlitedemo/MyAdapter.java | // Path: SQLiteDemo/app/src/main/java/com/example/android/sqlitedemo/Classes/Data.java
// public class Data implements Parcelable {
//
// String name;
// String doj;
// float percentage;
//
// public static final Parcelable.Creator<Data> CREATOR = new Parcelable.Creator<Data>() {
//
// public Data createFromParcel(Parcel in) {
// return new Data(in);
// }
//
// public Data[] newArray(int size) {
//
// return new Data[size];
// }
//
// };
//
// public Data() {
//
// }
//
// public void readFromParcel(Parcel in) {
// name = in.readString();
// doj = in.readString();
// percentage = in.readFloat();
//
// }
//
// public int describeContents() {
// return 0;
// }
//
// public void writeToParcel(Parcel dest, int flags) {
// dest.writeString(name);
// dest.writeString(doj);
// dest.writeFloat(percentage);
// }
// public Data(Parcel in) {
// super();
// readFromParcel(in);
// }
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getDoj() {
// return doj;
// }
//
// public void setDoj(String doj) {
// this.doj = doj;
// }
//
// public float getPercentage() {
// return percentage;
// }
//
// public void setPercentage(float percentage) {
// this.percentage = percentage;
// }
//
//
// }
| import android.content.Context;
import android.support.v7.widget.CardView;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.example.android.sqlitedemo.Classes.Data;
import java.util.List; | package com.example.android.sqlitedemo;
/**
* Created by Nishita Aggarwal on 25-11-2017.
*/
public class MyAdapter extends RecyclerView.Adapter<MyAdapter.CardHolder> {
Context context; | // Path: SQLiteDemo/app/src/main/java/com/example/android/sqlitedemo/Classes/Data.java
// public class Data implements Parcelable {
//
// String name;
// String doj;
// float percentage;
//
// public static final Parcelable.Creator<Data> CREATOR = new Parcelable.Creator<Data>() {
//
// public Data createFromParcel(Parcel in) {
// return new Data(in);
// }
//
// public Data[] newArray(int size) {
//
// return new Data[size];
// }
//
// };
//
// public Data() {
//
// }
//
// public void readFromParcel(Parcel in) {
// name = in.readString();
// doj = in.readString();
// percentage = in.readFloat();
//
// }
//
// public int describeContents() {
// return 0;
// }
//
// public void writeToParcel(Parcel dest, int flags) {
// dest.writeString(name);
// dest.writeString(doj);
// dest.writeFloat(percentage);
// }
// public Data(Parcel in) {
// super();
// readFromParcel(in);
// }
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getDoj() {
// return doj;
// }
//
// public void setDoj(String doj) {
// this.doj = doj;
// }
//
// public float getPercentage() {
// return percentage;
// }
//
// public void setPercentage(float percentage) {
// this.percentage = percentage;
// }
//
//
// }
// Path: SQLiteDemo/app/src/main/java/com/example/android/sqlitedemo/MyAdapter.java
import android.content.Context;
import android.support.v7.widget.CardView;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.example.android.sqlitedemo.Classes.Data;
import java.util.List;
package com.example.android.sqlitedemo;
/**
* Created by Nishita Aggarwal on 25-11-2017.
*/
public class MyAdapter extends RecyclerView.Adapter<MyAdapter.CardHolder> {
Context context; | List<Data> cardArrayList; |
kevalpatel2106/android-samples | SQLiteDemo/app/src/main/java/com/example/android/sqlitedemo/Classes/DisplayFragment.java | // Path: SQLiteDemo/app/src/main/java/com/example/android/sqlitedemo/MyAdapter.java
// public class MyAdapter extends RecyclerView.Adapter<MyAdapter.CardHolder> {
// Context context;
// List<Data> cardArrayList;
//
// public MyAdapter(Context context, List<Data> cardArrayList) {
// this.context = context;
// this.cardArrayList = cardArrayList;
//
// }
//
// @Override
// public CardHolder onCreateViewHolder(ViewGroup parent, int viewType) {
// return new CardHolder(LayoutInflater.from(context).inflate(R.layout.single_row,parent,false));
// }
//
// @Override
// public void onBindViewHolder(CardHolder holder, int position) {
// final Data card=cardArrayList.get(position);
// holder.namedisp.setText(card.getName());
// holder.datedisp.setText(card.getDoj());
// holder.perdisp.setText((String.valueOf(card.getPercentage())));
// }
// @Override
// public int getItemCount() {
// return cardArrayList.size();
// }
//
//
// class CardHolder extends RecyclerView.ViewHolder{
// CardView cardView;
//
// TextView namedisp,datedisp,perdisp;
// public CardHolder(View itemView) {
// super(itemView);
// cardView=itemView.findViewById(R.id.cardView);
// namedisp=itemView.findViewById(R.id.namedisp);
// datedisp=itemView.findViewById(R.id.datedisp);
// perdisp=itemView.findViewById(R.id.perdisp);
// }
// }
// }
| import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.example.android.sqlitedemo.MyAdapter;
import com.example.android.sqlitedemo.R;
import java.util.List; | package com.example.android.sqlitedemo.Classes;
/**
* Created by Nishita Aggarwal on 25-11-2017.
*/
public class DisplayFragment extends Fragment {
private RecyclerView mRecyclerView;
private RecyclerView.Adapter mAdapter;
private RecyclerView.LayoutManager mLayoutManager;
List<Data> dataList;
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View v=inflater.inflate(R.layout.display_fragment,container,false);
dataList=getArguments().getParcelableArrayList("data");
mRecyclerView = v.findViewById(R.id.my_recycler_view);
// use this setting to improve performance if you know that changes
// in content do not change the layout size of the RecyclerView
mRecyclerView.setHasFixedSize(true);
// use a linear layout manager
mLayoutManager = new LinearLayoutManager(this.getContext());
mRecyclerView.setLayoutManager(mLayoutManager);
// specify an adapter (see also next example) | // Path: SQLiteDemo/app/src/main/java/com/example/android/sqlitedemo/MyAdapter.java
// public class MyAdapter extends RecyclerView.Adapter<MyAdapter.CardHolder> {
// Context context;
// List<Data> cardArrayList;
//
// public MyAdapter(Context context, List<Data> cardArrayList) {
// this.context = context;
// this.cardArrayList = cardArrayList;
//
// }
//
// @Override
// public CardHolder onCreateViewHolder(ViewGroup parent, int viewType) {
// return new CardHolder(LayoutInflater.from(context).inflate(R.layout.single_row,parent,false));
// }
//
// @Override
// public void onBindViewHolder(CardHolder holder, int position) {
// final Data card=cardArrayList.get(position);
// holder.namedisp.setText(card.getName());
// holder.datedisp.setText(card.getDoj());
// holder.perdisp.setText((String.valueOf(card.getPercentage())));
// }
// @Override
// public int getItemCount() {
// return cardArrayList.size();
// }
//
//
// class CardHolder extends RecyclerView.ViewHolder{
// CardView cardView;
//
// TextView namedisp,datedisp,perdisp;
// public CardHolder(View itemView) {
// super(itemView);
// cardView=itemView.findViewById(R.id.cardView);
// namedisp=itemView.findViewById(R.id.namedisp);
// datedisp=itemView.findViewById(R.id.datedisp);
// perdisp=itemView.findViewById(R.id.perdisp);
// }
// }
// }
// Path: SQLiteDemo/app/src/main/java/com/example/android/sqlitedemo/Classes/DisplayFragment.java
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.example.android.sqlitedemo.MyAdapter;
import com.example.android.sqlitedemo.R;
import java.util.List;
package com.example.android.sqlitedemo.Classes;
/**
* Created by Nishita Aggarwal on 25-11-2017.
*/
public class DisplayFragment extends Fragment {
private RecyclerView mRecyclerView;
private RecyclerView.Adapter mAdapter;
private RecyclerView.LayoutManager mLayoutManager;
List<Data> dataList;
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View v=inflater.inflate(R.layout.display_fragment,container,false);
dataList=getArguments().getParcelableArrayList("data");
mRecyclerView = v.findViewById(R.id.my_recycler_view);
// use this setting to improve performance if you know that changes
// in content do not change the layout size of the RecyclerView
mRecyclerView.setHasFixedSize(true);
// use a linear layout manager
mLayoutManager = new LinearLayoutManager(this.getContext());
mRecyclerView.setLayoutManager(mLayoutManager);
// specify an adapter (see also next example) | mAdapter = new MyAdapter(this.getContext(),dataList); |
piyell/NeteaseCloudMusic | app/src/main/java/com/zsorg/neteasecloudmusic/callbacks/OnTrackListener.java | // Path: app/src/main/java/com/zsorg/neteasecloudmusic/models/beans/MusicBean.java
// public class MusicBean implements Parcelable{
// private final String mSinger;
// private final String mAlbum;
// private String mPath;
// private String mName;
// private long mDuration;
//
// protected MusicBean(Parcel in) {
// mSinger = in.readString();
// mAlbum = in.readString();
// mPath = in.readString();
// mName = in.readString();
// mDuration = in.readLong();
// }
//
// public static final Creator<MusicBean> CREATOR = new Creator<MusicBean>() {
// @Override
// public MusicBean createFromParcel(Parcel in) {
// return new MusicBean(in);
// }
//
// @Override
// public MusicBean[] newArray(int size) {
// return new MusicBean[size];
// }
// };
//
// @Override
// public int describeContents() {
// return 0;
// }
//
// @Override
// public void writeToParcel(Parcel parcel, int i) {
//
// parcel.writeString(mSinger);
// parcel.writeString(mAlbum);
// parcel.writeString(mPath);
// parcel.writeString(mName);
// parcel.writeLong(mDuration);
// }
//
// @Override
// public int hashCode() {
// return mPath==null?0:mPath.hashCode();
// }
//
// @Override
// public boolean equals(Object obj) {
// return obj instanceof MusicBean && (((MusicBean) obj).hashCode()==hashCode());
// }
//
// public MusicBean(String name, String singer, String album, long duration, String path) {
// mPath = path;
// mName = name;
// mSinger = singer;
// mAlbum = album;
// mDuration = duration;
// }
//
// public String getSinger() {
// return mSinger;
// }
//
// public String getAlbum() {
// return mAlbum;
// }
//
// public String getPath() {
// return mPath;
// }
//
// public void setPath(String mPath) {
// this.mPath = mPath;
// }
//
// public String getName() {
// return mName;
// }
//
// public void setName(String mName) {
// this.mName = mName;
// }
//
// public long getDuration() {
// return mDuration;
// }
//
// public void setDuration(long mDuration) {
// this.mDuration = mDuration;
// }
// }
| import com.zsorg.neteasecloudmusic.models.beans.MusicBean; | package com.zsorg.neteasecloudmusic.callbacks;
/**
* Project:NeteaseCloudMusic
*
* @Author: piyel_000
* Created on 2017/1/24.
* E-mail:piyell@qq.com
*/
public interface OnTrackListener {
void onTrack(int position);
| // Path: app/src/main/java/com/zsorg/neteasecloudmusic/models/beans/MusicBean.java
// public class MusicBean implements Parcelable{
// private final String mSinger;
// private final String mAlbum;
// private String mPath;
// private String mName;
// private long mDuration;
//
// protected MusicBean(Parcel in) {
// mSinger = in.readString();
// mAlbum = in.readString();
// mPath = in.readString();
// mName = in.readString();
// mDuration = in.readLong();
// }
//
// public static final Creator<MusicBean> CREATOR = new Creator<MusicBean>() {
// @Override
// public MusicBean createFromParcel(Parcel in) {
// return new MusicBean(in);
// }
//
// @Override
// public MusicBean[] newArray(int size) {
// return new MusicBean[size];
// }
// };
//
// @Override
// public int describeContents() {
// return 0;
// }
//
// @Override
// public void writeToParcel(Parcel parcel, int i) {
//
// parcel.writeString(mSinger);
// parcel.writeString(mAlbum);
// parcel.writeString(mPath);
// parcel.writeString(mName);
// parcel.writeLong(mDuration);
// }
//
// @Override
// public int hashCode() {
// return mPath==null?0:mPath.hashCode();
// }
//
// @Override
// public boolean equals(Object obj) {
// return obj instanceof MusicBean && (((MusicBean) obj).hashCode()==hashCode());
// }
//
// public MusicBean(String name, String singer, String album, long duration, String path) {
// mPath = path;
// mName = name;
// mSinger = singer;
// mAlbum = album;
// mDuration = duration;
// }
//
// public String getSinger() {
// return mSinger;
// }
//
// public String getAlbum() {
// return mAlbum;
// }
//
// public String getPath() {
// return mPath;
// }
//
// public void setPath(String mPath) {
// this.mPath = mPath;
// }
//
// public String getName() {
// return mName;
// }
//
// public void setName(String mName) {
// this.mName = mName;
// }
//
// public long getDuration() {
// return mDuration;
// }
//
// public void setDuration(long mDuration) {
// this.mDuration = mDuration;
// }
// }
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/callbacks/OnTrackListener.java
import com.zsorg.neteasecloudmusic.models.beans.MusicBean;
package com.zsorg.neteasecloudmusic.callbacks;
/**
* Project:NeteaseCloudMusic
*
* @Author: piyel_000
* Created on 2017/1/24.
* E-mail:piyell@qq.com
*/
public interface OnTrackListener {
void onTrack(int position);
| void onNext(MusicBean bean); |
piyell/NeteaseCloudMusic | app/src/main/java/com/zsorg/neteasecloudmusic/models/ConfigModel.java | // Path: app/src/main/java/com/zsorg/neteasecloudmusic/CONST.java
// public class CONST {
// public static final String MUSIC_TYPE = "MUSIC_TYPE";
// public static final int TYPE_SINGLE = 0;
// public static final int TYPE_SINGER = 1;
// public static final int TYPE_ALBUM = 2;
// public static final int TYPE_FOLDER = 3;
//
// public static final String INTENT_PLAYLIST_ID = "INTENT_PLAYLIST_ID";
// public static final String INTENT_PLAYLIST_POSITION = "INTENT_PLAYLIST_POSITION";
//
// public static final int DEFAULT_PLAYLIST_POSITION = 0;
// public static final int TEMP_PLAYLIST_ID = -1;
//
// public static final int IMAGE_LOADED = 1;
// public static final int IMAGE_REQUEST_LOADING = 2;
// public static final int PLAYLIST_FAVORITE = 0;
//
// public static final String SP_IS_FILTER_60 = "SP_IS_FILTER_60";
// public static final String SP_MUSIC_ORDER = "SP_MUSIC_ORDER";
// public static final int SP_MUSIC_ORDER_DEFAULT = 0;
// public static final int MUSIC_ORDER_LIST = 0;
// public static final int MUSIC_ORDER_SINGLE = 2;
// public static final int MUSIC_ORDER_RANDOM = 1;
// }
//
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/callbacks/ConfigCallback.java
// public interface ConfigCallback {
// void onMusicOrderConfigChanged(int newOrder);
// void onIsShow60sConfigChanged(boolean isShow);
// }
//
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/models/beans/ConfigBean.java
// public class ConfigBean {
// private String mGroupTitle;
// private String mItemTitle;
// private String mItemContent;
// private String mItemRight;
// private boolean mSwitchVisible;
// private boolean mIsSwitchChecked;
// private boolean mIsBottomVisible;
//
// public ConfigBean(String groupTitle, String itemTitle, String content, String itemRight, boolean isSwitchVisible, boolean isSwitchChecked, boolean isBottomVisible) {
// mGroupTitle = groupTitle;
// mItemTitle = itemTitle;
// mItemContent = content;
// mItemRight = itemRight;
// mSwitchVisible = isSwitchVisible;
// mIsSwitchChecked = isSwitchChecked;
// mIsBottomVisible = isBottomVisible;
// }
//
// public String getGroupTitle() {
// return mGroupTitle;
// }
//
// public void setGroupTitle(String mGroupTitle) {
// this.mGroupTitle = mGroupTitle;
// }
//
// public String getItemTitle() {
// return mItemTitle;
// }
//
// public void setItemTitle(String mItemTitle) {
// this.mItemTitle = mItemTitle;
// }
//
// public String getItemContent() {
// return mItemContent;
// }
//
// public void setItemContent(String mItemContent) {
// this.mItemContent = mItemContent;
// }
//
// public String getItemRight() {
// return mItemRight;
// }
//
// public void setItemRight(String mItemRight) {
// this.mItemRight = mItemRight;
// }
//
// public boolean isSwitchVisible() {
// return mSwitchVisible;
// }
//
// public void setRightVisible(boolean mRightVisible) {
// this.mSwitchVisible = mRightVisible;
// }
//
// public void setSwitchChecked(boolean isChecked) {
// this.mIsSwitchChecked = isChecked;
// }
//
// public boolean isSwitchChecked() {
// return mIsSwitchChecked;
// }
//
// public boolean isBottomVisible() {
// return mIsBottomVisible;
// }
//
// public void setIsBottomVisible(boolean mIsBottomVisible) {
// this.mIsBottomVisible = mIsBottomVisible;
// }
// }
| import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.support.annotation.NonNull;
import android.support.annotation.StringRes;
import android.util.Log;
import com.zsorg.neteasecloudmusic.CONST;
import com.zsorg.neteasecloudmusic.callbacks.ConfigCallback;
import com.zsorg.neteasecloudmusic.R;
import com.zsorg.neteasecloudmusic.models.beans.ConfigBean;
import java.lang.ref.SoftReference;
import java.util.ArrayList;
import java.util.List; | package com.zsorg.neteasecloudmusic.models;
/**
* Project:NeteaseCloudMusic
*
* @Author: piyel_000
* Created on 2017/1/31.
* E-mail:piyell@qq.com
*/
public class ConfigModel implements IConfigModel{
private static ConfigModel mModel;
private final SoftReference<Context> mContext;
| // Path: app/src/main/java/com/zsorg/neteasecloudmusic/CONST.java
// public class CONST {
// public static final String MUSIC_TYPE = "MUSIC_TYPE";
// public static final int TYPE_SINGLE = 0;
// public static final int TYPE_SINGER = 1;
// public static final int TYPE_ALBUM = 2;
// public static final int TYPE_FOLDER = 3;
//
// public static final String INTENT_PLAYLIST_ID = "INTENT_PLAYLIST_ID";
// public static final String INTENT_PLAYLIST_POSITION = "INTENT_PLAYLIST_POSITION";
//
// public static final int DEFAULT_PLAYLIST_POSITION = 0;
// public static final int TEMP_PLAYLIST_ID = -1;
//
// public static final int IMAGE_LOADED = 1;
// public static final int IMAGE_REQUEST_LOADING = 2;
// public static final int PLAYLIST_FAVORITE = 0;
//
// public static final String SP_IS_FILTER_60 = "SP_IS_FILTER_60";
// public static final String SP_MUSIC_ORDER = "SP_MUSIC_ORDER";
// public static final int SP_MUSIC_ORDER_DEFAULT = 0;
// public static final int MUSIC_ORDER_LIST = 0;
// public static final int MUSIC_ORDER_SINGLE = 2;
// public static final int MUSIC_ORDER_RANDOM = 1;
// }
//
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/callbacks/ConfigCallback.java
// public interface ConfigCallback {
// void onMusicOrderConfigChanged(int newOrder);
// void onIsShow60sConfigChanged(boolean isShow);
// }
//
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/models/beans/ConfigBean.java
// public class ConfigBean {
// private String mGroupTitle;
// private String mItemTitle;
// private String mItemContent;
// private String mItemRight;
// private boolean mSwitchVisible;
// private boolean mIsSwitchChecked;
// private boolean mIsBottomVisible;
//
// public ConfigBean(String groupTitle, String itemTitle, String content, String itemRight, boolean isSwitchVisible, boolean isSwitchChecked, boolean isBottomVisible) {
// mGroupTitle = groupTitle;
// mItemTitle = itemTitle;
// mItemContent = content;
// mItemRight = itemRight;
// mSwitchVisible = isSwitchVisible;
// mIsSwitchChecked = isSwitchChecked;
// mIsBottomVisible = isBottomVisible;
// }
//
// public String getGroupTitle() {
// return mGroupTitle;
// }
//
// public void setGroupTitle(String mGroupTitle) {
// this.mGroupTitle = mGroupTitle;
// }
//
// public String getItemTitle() {
// return mItemTitle;
// }
//
// public void setItemTitle(String mItemTitle) {
// this.mItemTitle = mItemTitle;
// }
//
// public String getItemContent() {
// return mItemContent;
// }
//
// public void setItemContent(String mItemContent) {
// this.mItemContent = mItemContent;
// }
//
// public String getItemRight() {
// return mItemRight;
// }
//
// public void setItemRight(String mItemRight) {
// this.mItemRight = mItemRight;
// }
//
// public boolean isSwitchVisible() {
// return mSwitchVisible;
// }
//
// public void setRightVisible(boolean mRightVisible) {
// this.mSwitchVisible = mRightVisible;
// }
//
// public void setSwitchChecked(boolean isChecked) {
// this.mIsSwitchChecked = isChecked;
// }
//
// public boolean isSwitchChecked() {
// return mIsSwitchChecked;
// }
//
// public boolean isBottomVisible() {
// return mIsBottomVisible;
// }
//
// public void setIsBottomVisible(boolean mIsBottomVisible) {
// this.mIsBottomVisible = mIsBottomVisible;
// }
// }
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/models/ConfigModel.java
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.support.annotation.NonNull;
import android.support.annotation.StringRes;
import android.util.Log;
import com.zsorg.neteasecloudmusic.CONST;
import com.zsorg.neteasecloudmusic.callbacks.ConfigCallback;
import com.zsorg.neteasecloudmusic.R;
import com.zsorg.neteasecloudmusic.models.beans.ConfigBean;
import java.lang.ref.SoftReference;
import java.util.ArrayList;
import java.util.List;
package com.zsorg.neteasecloudmusic.models;
/**
* Project:NeteaseCloudMusic
*
* @Author: piyel_000
* Created on 2017/1/31.
* E-mail:piyell@qq.com
*/
public class ConfigModel implements IConfigModel{
private static ConfigModel mModel;
private final SoftReference<Context> mContext;
| List<ConfigBean> mList; |
piyell/NeteaseCloudMusic | app/src/main/java/com/zsorg/neteasecloudmusic/models/ConfigModel.java | // Path: app/src/main/java/com/zsorg/neteasecloudmusic/CONST.java
// public class CONST {
// public static final String MUSIC_TYPE = "MUSIC_TYPE";
// public static final int TYPE_SINGLE = 0;
// public static final int TYPE_SINGER = 1;
// public static final int TYPE_ALBUM = 2;
// public static final int TYPE_FOLDER = 3;
//
// public static final String INTENT_PLAYLIST_ID = "INTENT_PLAYLIST_ID";
// public static final String INTENT_PLAYLIST_POSITION = "INTENT_PLAYLIST_POSITION";
//
// public static final int DEFAULT_PLAYLIST_POSITION = 0;
// public static final int TEMP_PLAYLIST_ID = -1;
//
// public static final int IMAGE_LOADED = 1;
// public static final int IMAGE_REQUEST_LOADING = 2;
// public static final int PLAYLIST_FAVORITE = 0;
//
// public static final String SP_IS_FILTER_60 = "SP_IS_FILTER_60";
// public static final String SP_MUSIC_ORDER = "SP_MUSIC_ORDER";
// public static final int SP_MUSIC_ORDER_DEFAULT = 0;
// public static final int MUSIC_ORDER_LIST = 0;
// public static final int MUSIC_ORDER_SINGLE = 2;
// public static final int MUSIC_ORDER_RANDOM = 1;
// }
//
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/callbacks/ConfigCallback.java
// public interface ConfigCallback {
// void onMusicOrderConfigChanged(int newOrder);
// void onIsShow60sConfigChanged(boolean isShow);
// }
//
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/models/beans/ConfigBean.java
// public class ConfigBean {
// private String mGroupTitle;
// private String mItemTitle;
// private String mItemContent;
// private String mItemRight;
// private boolean mSwitchVisible;
// private boolean mIsSwitchChecked;
// private boolean mIsBottomVisible;
//
// public ConfigBean(String groupTitle, String itemTitle, String content, String itemRight, boolean isSwitchVisible, boolean isSwitchChecked, boolean isBottomVisible) {
// mGroupTitle = groupTitle;
// mItemTitle = itemTitle;
// mItemContent = content;
// mItemRight = itemRight;
// mSwitchVisible = isSwitchVisible;
// mIsSwitchChecked = isSwitchChecked;
// mIsBottomVisible = isBottomVisible;
// }
//
// public String getGroupTitle() {
// return mGroupTitle;
// }
//
// public void setGroupTitle(String mGroupTitle) {
// this.mGroupTitle = mGroupTitle;
// }
//
// public String getItemTitle() {
// return mItemTitle;
// }
//
// public void setItemTitle(String mItemTitle) {
// this.mItemTitle = mItemTitle;
// }
//
// public String getItemContent() {
// return mItemContent;
// }
//
// public void setItemContent(String mItemContent) {
// this.mItemContent = mItemContent;
// }
//
// public String getItemRight() {
// return mItemRight;
// }
//
// public void setItemRight(String mItemRight) {
// this.mItemRight = mItemRight;
// }
//
// public boolean isSwitchVisible() {
// return mSwitchVisible;
// }
//
// public void setRightVisible(boolean mRightVisible) {
// this.mSwitchVisible = mRightVisible;
// }
//
// public void setSwitchChecked(boolean isChecked) {
// this.mIsSwitchChecked = isChecked;
// }
//
// public boolean isSwitchChecked() {
// return mIsSwitchChecked;
// }
//
// public boolean isBottomVisible() {
// return mIsBottomVisible;
// }
//
// public void setIsBottomVisible(boolean mIsBottomVisible) {
// this.mIsBottomVisible = mIsBottomVisible;
// }
// }
| import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.support.annotation.NonNull;
import android.support.annotation.StringRes;
import android.util.Log;
import com.zsorg.neteasecloudmusic.CONST;
import com.zsorg.neteasecloudmusic.callbacks.ConfigCallback;
import com.zsorg.neteasecloudmusic.R;
import com.zsorg.neteasecloudmusic.models.beans.ConfigBean;
import java.lang.ref.SoftReference;
import java.util.ArrayList;
import java.util.List; | package com.zsorg.neteasecloudmusic.models;
/**
* Project:NeteaseCloudMusic
*
* @Author: piyel_000
* Created on 2017/1/31.
* E-mail:piyell@qq.com
*/
public class ConfigModel implements IConfigModel{
private static ConfigModel mModel;
private final SoftReference<Context> mContext;
List<ConfigBean> mList;
private final SharedPreferences mSP;
private final String[] orders;
private int mMusicOrder; | // Path: app/src/main/java/com/zsorg/neteasecloudmusic/CONST.java
// public class CONST {
// public static final String MUSIC_TYPE = "MUSIC_TYPE";
// public static final int TYPE_SINGLE = 0;
// public static final int TYPE_SINGER = 1;
// public static final int TYPE_ALBUM = 2;
// public static final int TYPE_FOLDER = 3;
//
// public static final String INTENT_PLAYLIST_ID = "INTENT_PLAYLIST_ID";
// public static final String INTENT_PLAYLIST_POSITION = "INTENT_PLAYLIST_POSITION";
//
// public static final int DEFAULT_PLAYLIST_POSITION = 0;
// public static final int TEMP_PLAYLIST_ID = -1;
//
// public static final int IMAGE_LOADED = 1;
// public static final int IMAGE_REQUEST_LOADING = 2;
// public static final int PLAYLIST_FAVORITE = 0;
//
// public static final String SP_IS_FILTER_60 = "SP_IS_FILTER_60";
// public static final String SP_MUSIC_ORDER = "SP_MUSIC_ORDER";
// public static final int SP_MUSIC_ORDER_DEFAULT = 0;
// public static final int MUSIC_ORDER_LIST = 0;
// public static final int MUSIC_ORDER_SINGLE = 2;
// public static final int MUSIC_ORDER_RANDOM = 1;
// }
//
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/callbacks/ConfigCallback.java
// public interface ConfigCallback {
// void onMusicOrderConfigChanged(int newOrder);
// void onIsShow60sConfigChanged(boolean isShow);
// }
//
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/models/beans/ConfigBean.java
// public class ConfigBean {
// private String mGroupTitle;
// private String mItemTitle;
// private String mItemContent;
// private String mItemRight;
// private boolean mSwitchVisible;
// private boolean mIsSwitchChecked;
// private boolean mIsBottomVisible;
//
// public ConfigBean(String groupTitle, String itemTitle, String content, String itemRight, boolean isSwitchVisible, boolean isSwitchChecked, boolean isBottomVisible) {
// mGroupTitle = groupTitle;
// mItemTitle = itemTitle;
// mItemContent = content;
// mItemRight = itemRight;
// mSwitchVisible = isSwitchVisible;
// mIsSwitchChecked = isSwitchChecked;
// mIsBottomVisible = isBottomVisible;
// }
//
// public String getGroupTitle() {
// return mGroupTitle;
// }
//
// public void setGroupTitle(String mGroupTitle) {
// this.mGroupTitle = mGroupTitle;
// }
//
// public String getItemTitle() {
// return mItemTitle;
// }
//
// public void setItemTitle(String mItemTitle) {
// this.mItemTitle = mItemTitle;
// }
//
// public String getItemContent() {
// return mItemContent;
// }
//
// public void setItemContent(String mItemContent) {
// this.mItemContent = mItemContent;
// }
//
// public String getItemRight() {
// return mItemRight;
// }
//
// public void setItemRight(String mItemRight) {
// this.mItemRight = mItemRight;
// }
//
// public boolean isSwitchVisible() {
// return mSwitchVisible;
// }
//
// public void setRightVisible(boolean mRightVisible) {
// this.mSwitchVisible = mRightVisible;
// }
//
// public void setSwitchChecked(boolean isChecked) {
// this.mIsSwitchChecked = isChecked;
// }
//
// public boolean isSwitchChecked() {
// return mIsSwitchChecked;
// }
//
// public boolean isBottomVisible() {
// return mIsBottomVisible;
// }
//
// public void setIsBottomVisible(boolean mIsBottomVisible) {
// this.mIsBottomVisible = mIsBottomVisible;
// }
// }
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/models/ConfigModel.java
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.support.annotation.NonNull;
import android.support.annotation.StringRes;
import android.util.Log;
import com.zsorg.neteasecloudmusic.CONST;
import com.zsorg.neteasecloudmusic.callbacks.ConfigCallback;
import com.zsorg.neteasecloudmusic.R;
import com.zsorg.neteasecloudmusic.models.beans.ConfigBean;
import java.lang.ref.SoftReference;
import java.util.ArrayList;
import java.util.List;
package com.zsorg.neteasecloudmusic.models;
/**
* Project:NeteaseCloudMusic
*
* @Author: piyel_000
* Created on 2017/1/31.
* E-mail:piyell@qq.com
*/
public class ConfigModel implements IConfigModel{
private static ConfigModel mModel;
private final SoftReference<Context> mContext;
List<ConfigBean> mList;
private final SharedPreferences mSP;
private final String[] orders;
private int mMusicOrder; | private ConfigCallback callback; |
piyell/NeteaseCloudMusic | app/src/main/java/com/zsorg/neteasecloudmusic/models/ConfigModel.java | // Path: app/src/main/java/com/zsorg/neteasecloudmusic/CONST.java
// public class CONST {
// public static final String MUSIC_TYPE = "MUSIC_TYPE";
// public static final int TYPE_SINGLE = 0;
// public static final int TYPE_SINGER = 1;
// public static final int TYPE_ALBUM = 2;
// public static final int TYPE_FOLDER = 3;
//
// public static final String INTENT_PLAYLIST_ID = "INTENT_PLAYLIST_ID";
// public static final String INTENT_PLAYLIST_POSITION = "INTENT_PLAYLIST_POSITION";
//
// public static final int DEFAULT_PLAYLIST_POSITION = 0;
// public static final int TEMP_PLAYLIST_ID = -1;
//
// public static final int IMAGE_LOADED = 1;
// public static final int IMAGE_REQUEST_LOADING = 2;
// public static final int PLAYLIST_FAVORITE = 0;
//
// public static final String SP_IS_FILTER_60 = "SP_IS_FILTER_60";
// public static final String SP_MUSIC_ORDER = "SP_MUSIC_ORDER";
// public static final int SP_MUSIC_ORDER_DEFAULT = 0;
// public static final int MUSIC_ORDER_LIST = 0;
// public static final int MUSIC_ORDER_SINGLE = 2;
// public static final int MUSIC_ORDER_RANDOM = 1;
// }
//
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/callbacks/ConfigCallback.java
// public interface ConfigCallback {
// void onMusicOrderConfigChanged(int newOrder);
// void onIsShow60sConfigChanged(boolean isShow);
// }
//
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/models/beans/ConfigBean.java
// public class ConfigBean {
// private String mGroupTitle;
// private String mItemTitle;
// private String mItemContent;
// private String mItemRight;
// private boolean mSwitchVisible;
// private boolean mIsSwitchChecked;
// private boolean mIsBottomVisible;
//
// public ConfigBean(String groupTitle, String itemTitle, String content, String itemRight, boolean isSwitchVisible, boolean isSwitchChecked, boolean isBottomVisible) {
// mGroupTitle = groupTitle;
// mItemTitle = itemTitle;
// mItemContent = content;
// mItemRight = itemRight;
// mSwitchVisible = isSwitchVisible;
// mIsSwitchChecked = isSwitchChecked;
// mIsBottomVisible = isBottomVisible;
// }
//
// public String getGroupTitle() {
// return mGroupTitle;
// }
//
// public void setGroupTitle(String mGroupTitle) {
// this.mGroupTitle = mGroupTitle;
// }
//
// public String getItemTitle() {
// return mItemTitle;
// }
//
// public void setItemTitle(String mItemTitle) {
// this.mItemTitle = mItemTitle;
// }
//
// public String getItemContent() {
// return mItemContent;
// }
//
// public void setItemContent(String mItemContent) {
// this.mItemContent = mItemContent;
// }
//
// public String getItemRight() {
// return mItemRight;
// }
//
// public void setItemRight(String mItemRight) {
// this.mItemRight = mItemRight;
// }
//
// public boolean isSwitchVisible() {
// return mSwitchVisible;
// }
//
// public void setRightVisible(boolean mRightVisible) {
// this.mSwitchVisible = mRightVisible;
// }
//
// public void setSwitchChecked(boolean isChecked) {
// this.mIsSwitchChecked = isChecked;
// }
//
// public boolean isSwitchChecked() {
// return mIsSwitchChecked;
// }
//
// public boolean isBottomVisible() {
// return mIsBottomVisible;
// }
//
// public void setIsBottomVisible(boolean mIsBottomVisible) {
// this.mIsBottomVisible = mIsBottomVisible;
// }
// }
| import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.support.annotation.NonNull;
import android.support.annotation.StringRes;
import android.util.Log;
import com.zsorg.neteasecloudmusic.CONST;
import com.zsorg.neteasecloudmusic.callbacks.ConfigCallback;
import com.zsorg.neteasecloudmusic.R;
import com.zsorg.neteasecloudmusic.models.beans.ConfigBean;
import java.lang.ref.SoftReference;
import java.util.ArrayList;
import java.util.List; | package com.zsorg.neteasecloudmusic.models;
/**
* Project:NeteaseCloudMusic
*
* @Author: piyel_000
* Created on 2017/1/31.
* E-mail:piyell@qq.com
*/
public class ConfigModel implements IConfigModel{
private static ConfigModel mModel;
private final SoftReference<Context> mContext;
List<ConfigBean> mList;
private final SharedPreferences mSP;
private final String[] orders;
private int mMusicOrder;
private ConfigCallback callback;
@Override
public List<ConfigBean> getConfigList() {
return mList;
}
public void setMusicOrder(int musicOrder) {
mList.get(0).setItemRight(orders[musicOrder]);
mMusicOrder = musicOrder;
SharedPreferences.Editor edit = mSP.edit(); | // Path: app/src/main/java/com/zsorg/neteasecloudmusic/CONST.java
// public class CONST {
// public static final String MUSIC_TYPE = "MUSIC_TYPE";
// public static final int TYPE_SINGLE = 0;
// public static final int TYPE_SINGER = 1;
// public static final int TYPE_ALBUM = 2;
// public static final int TYPE_FOLDER = 3;
//
// public static final String INTENT_PLAYLIST_ID = "INTENT_PLAYLIST_ID";
// public static final String INTENT_PLAYLIST_POSITION = "INTENT_PLAYLIST_POSITION";
//
// public static final int DEFAULT_PLAYLIST_POSITION = 0;
// public static final int TEMP_PLAYLIST_ID = -1;
//
// public static final int IMAGE_LOADED = 1;
// public static final int IMAGE_REQUEST_LOADING = 2;
// public static final int PLAYLIST_FAVORITE = 0;
//
// public static final String SP_IS_FILTER_60 = "SP_IS_FILTER_60";
// public static final String SP_MUSIC_ORDER = "SP_MUSIC_ORDER";
// public static final int SP_MUSIC_ORDER_DEFAULT = 0;
// public static final int MUSIC_ORDER_LIST = 0;
// public static final int MUSIC_ORDER_SINGLE = 2;
// public static final int MUSIC_ORDER_RANDOM = 1;
// }
//
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/callbacks/ConfigCallback.java
// public interface ConfigCallback {
// void onMusicOrderConfigChanged(int newOrder);
// void onIsShow60sConfigChanged(boolean isShow);
// }
//
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/models/beans/ConfigBean.java
// public class ConfigBean {
// private String mGroupTitle;
// private String mItemTitle;
// private String mItemContent;
// private String mItemRight;
// private boolean mSwitchVisible;
// private boolean mIsSwitchChecked;
// private boolean mIsBottomVisible;
//
// public ConfigBean(String groupTitle, String itemTitle, String content, String itemRight, boolean isSwitchVisible, boolean isSwitchChecked, boolean isBottomVisible) {
// mGroupTitle = groupTitle;
// mItemTitle = itemTitle;
// mItemContent = content;
// mItemRight = itemRight;
// mSwitchVisible = isSwitchVisible;
// mIsSwitchChecked = isSwitchChecked;
// mIsBottomVisible = isBottomVisible;
// }
//
// public String getGroupTitle() {
// return mGroupTitle;
// }
//
// public void setGroupTitle(String mGroupTitle) {
// this.mGroupTitle = mGroupTitle;
// }
//
// public String getItemTitle() {
// return mItemTitle;
// }
//
// public void setItemTitle(String mItemTitle) {
// this.mItemTitle = mItemTitle;
// }
//
// public String getItemContent() {
// return mItemContent;
// }
//
// public void setItemContent(String mItemContent) {
// this.mItemContent = mItemContent;
// }
//
// public String getItemRight() {
// return mItemRight;
// }
//
// public void setItemRight(String mItemRight) {
// this.mItemRight = mItemRight;
// }
//
// public boolean isSwitchVisible() {
// return mSwitchVisible;
// }
//
// public void setRightVisible(boolean mRightVisible) {
// this.mSwitchVisible = mRightVisible;
// }
//
// public void setSwitchChecked(boolean isChecked) {
// this.mIsSwitchChecked = isChecked;
// }
//
// public boolean isSwitchChecked() {
// return mIsSwitchChecked;
// }
//
// public boolean isBottomVisible() {
// return mIsBottomVisible;
// }
//
// public void setIsBottomVisible(boolean mIsBottomVisible) {
// this.mIsBottomVisible = mIsBottomVisible;
// }
// }
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/models/ConfigModel.java
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.support.annotation.NonNull;
import android.support.annotation.StringRes;
import android.util.Log;
import com.zsorg.neteasecloudmusic.CONST;
import com.zsorg.neteasecloudmusic.callbacks.ConfigCallback;
import com.zsorg.neteasecloudmusic.R;
import com.zsorg.neteasecloudmusic.models.beans.ConfigBean;
import java.lang.ref.SoftReference;
import java.util.ArrayList;
import java.util.List;
package com.zsorg.neteasecloudmusic.models;
/**
* Project:NeteaseCloudMusic
*
* @Author: piyel_000
* Created on 2017/1/31.
* E-mail:piyell@qq.com
*/
public class ConfigModel implements IConfigModel{
private static ConfigModel mModel;
private final SoftReference<Context> mContext;
List<ConfigBean> mList;
private final SharedPreferences mSP;
private final String[] orders;
private int mMusicOrder;
private ConfigCallback callback;
@Override
public List<ConfigBean> getConfigList() {
return mList;
}
public void setMusicOrder(int musicOrder) {
mList.get(0).setItemRight(orders[musicOrder]);
mMusicOrder = musicOrder;
SharedPreferences.Editor edit = mSP.edit(); | edit.putInt(CONST.SP_MUSIC_ORDER, musicOrder); |
piyell/NeteaseCloudMusic | app/src/main/java/com/zsorg/neteasecloudmusic/models/ImageCacheManager2.java | // Path: app/src/main/java/com/zsorg/neteasecloudmusic/CONST.java
// public class CONST {
// public static final String MUSIC_TYPE = "MUSIC_TYPE";
// public static final int TYPE_SINGLE = 0;
// public static final int TYPE_SINGER = 1;
// public static final int TYPE_ALBUM = 2;
// public static final int TYPE_FOLDER = 3;
//
// public static final String INTENT_PLAYLIST_ID = "INTENT_PLAYLIST_ID";
// public static final String INTENT_PLAYLIST_POSITION = "INTENT_PLAYLIST_POSITION";
//
// public static final int DEFAULT_PLAYLIST_POSITION = 0;
// public static final int TEMP_PLAYLIST_ID = -1;
//
// public static final int IMAGE_LOADED = 1;
// public static final int IMAGE_REQUEST_LOADING = 2;
// public static final int PLAYLIST_FAVORITE = 0;
//
// public static final String SP_IS_FILTER_60 = "SP_IS_FILTER_60";
// public static final String SP_MUSIC_ORDER = "SP_MUSIC_ORDER";
// public static final int SP_MUSIC_ORDER_DEFAULT = 0;
// public static final int MUSIC_ORDER_LIST = 0;
// public static final int MUSIC_ORDER_SINGLE = 2;
// public static final int MUSIC_ORDER_RANDOM = 1;
// }
//
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/utils/MP3Util.java
// public class MP3Util {
// @TargetApi(Build.VERSION_CODES.GINGERBREAD_MR1)
// public static MusicBean parseMP3File(String path) {
// MediaMetadataRetriever mmr = new MediaMetadataRetriever();
// String name = null;
// String singer = null;
// String album = null;
// long duration = 0;
//
//
// try {
// mmr.setDataSource(path);
// name = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_TITLE);
// singer = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_ARTIST);
// album = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_ALBUM);
// duration = Long.valueOf(mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION));
// mmr.release();
// } catch (Exception e) {
// e.printStackTrace();
// return null;
//
// }
// return new MusicBean(name, singer, album, duration, path);
// }
//
// @RequiresApi(api = Build.VERSION_CODES.GINGERBREAD_MR1)
// public static Bitmap getAlbumArtFromMP3File(String path) {
// MediaMetadataRetriever mmr = new MediaMetadataRetriever();
// try {
// mmr.setDataSource(path);
// } catch (IllegalArgumentException e) {
// e.printStackTrace();
// return null;
// }
// byte[] bytes = mmr.getEmbeddedPicture();
// if (null != bytes) {
// return BitmapFactory.decodeByteArray(bytes, 0, bytes.length);
// } else {
// return mmr.getFrameAtTime();
// }
// }
// }
//
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/utils/MusicUtil.java
// public class MusicUtil {
//
// public static boolean isMusic(File file) {
// return null!=file && file.getName().toLowerCase().endsWith(".mp3");
// }
//
// public static String getAlbumArt(Context mContext, String album_id) {
// String[] projection = new String[]{MediaStore.Audio.Albums.ALBUM_ART};
// Cursor cur = mContext.getContentResolver().query(
// MediaStore.Audio.Albums.EXTERNAL_CONTENT_URI,
// projection, MediaStore.Audio.Albums._ID + "=?", new String[]{album_id}, null);
// String album_art = null;
// if (null!=cur && cur.moveToNext()) {
// album_art = cur.getString(0);
// cur.close();
// }
//
// return album_art;
// }
//
// public static String[] getParentAndFileName(String path) {
// if (null!=path) {
// int lastIndex = path.lastIndexOf(File.separatorChar);
// if (lastIndex == path.length() - 1 && lastIndex > 0) {
// String tmp = path.substring(0, lastIndex);
// lastIndex = tmp.lastIndexOf(File.separatorChar);
// }
// String parent = path.substring(0, lastIndex+1);
// String name = path.substring(lastIndex+1, path.length());
// return new String[]{parent,name};
// }
// return new String[]{path,path};
// }
// }
| import android.content.Context;
import android.graphics.Bitmap;
import android.os.Build;
import android.os.Handler;
import android.os.Message;
import android.support.v4.util.LruCache;
import android.widget.ImageView;
import com.zsorg.neteasecloudmusic.CONST;
import com.zsorg.neteasecloudmusic.utils.MP3Util;
import com.zsorg.neteasecloudmusic.utils.MusicUtil;
import java.util.Iterator;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; | if (null == imageCacheManager) {
imageCacheManager = new ImageCacheManager2(context.getApplicationContext());
}
return imageCacheManager;
}
public Bitmap loadCachedBitmap(String mPath) {
// if (null == mPath) {
// return null;
// }
return null != mPath ? (null != fstCacheMap ? (fstCacheMap.get(mPath)) : null) : null;
// if (null != fstCacheMap && null != fstCacheMap.get(mPath) && !fstCacheMap.get(mPath).isRecycled()) {
// return fstCacheMap.get(mPath);
// }
// return null;
}
public void recycle() {
fstCacheMap.evictAll();
requestMap.clear();
context = null;
imageCacheManager = null;
}
public boolean loadImg2Cache(String mPath) {
if ( null != fstCacheMap.get(mPath) && !fstCacheMap.get(mPath).isRecycled()) {
return true;
} else {
Bitmap bitmap = null; | // Path: app/src/main/java/com/zsorg/neteasecloudmusic/CONST.java
// public class CONST {
// public static final String MUSIC_TYPE = "MUSIC_TYPE";
// public static final int TYPE_SINGLE = 0;
// public static final int TYPE_SINGER = 1;
// public static final int TYPE_ALBUM = 2;
// public static final int TYPE_FOLDER = 3;
//
// public static final String INTENT_PLAYLIST_ID = "INTENT_PLAYLIST_ID";
// public static final String INTENT_PLAYLIST_POSITION = "INTENT_PLAYLIST_POSITION";
//
// public static final int DEFAULT_PLAYLIST_POSITION = 0;
// public static final int TEMP_PLAYLIST_ID = -1;
//
// public static final int IMAGE_LOADED = 1;
// public static final int IMAGE_REQUEST_LOADING = 2;
// public static final int PLAYLIST_FAVORITE = 0;
//
// public static final String SP_IS_FILTER_60 = "SP_IS_FILTER_60";
// public static final String SP_MUSIC_ORDER = "SP_MUSIC_ORDER";
// public static final int SP_MUSIC_ORDER_DEFAULT = 0;
// public static final int MUSIC_ORDER_LIST = 0;
// public static final int MUSIC_ORDER_SINGLE = 2;
// public static final int MUSIC_ORDER_RANDOM = 1;
// }
//
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/utils/MP3Util.java
// public class MP3Util {
// @TargetApi(Build.VERSION_CODES.GINGERBREAD_MR1)
// public static MusicBean parseMP3File(String path) {
// MediaMetadataRetriever mmr = new MediaMetadataRetriever();
// String name = null;
// String singer = null;
// String album = null;
// long duration = 0;
//
//
// try {
// mmr.setDataSource(path);
// name = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_TITLE);
// singer = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_ARTIST);
// album = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_ALBUM);
// duration = Long.valueOf(mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION));
// mmr.release();
// } catch (Exception e) {
// e.printStackTrace();
// return null;
//
// }
// return new MusicBean(name, singer, album, duration, path);
// }
//
// @RequiresApi(api = Build.VERSION_CODES.GINGERBREAD_MR1)
// public static Bitmap getAlbumArtFromMP3File(String path) {
// MediaMetadataRetriever mmr = new MediaMetadataRetriever();
// try {
// mmr.setDataSource(path);
// } catch (IllegalArgumentException e) {
// e.printStackTrace();
// return null;
// }
// byte[] bytes = mmr.getEmbeddedPicture();
// if (null != bytes) {
// return BitmapFactory.decodeByteArray(bytes, 0, bytes.length);
// } else {
// return mmr.getFrameAtTime();
// }
// }
// }
//
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/utils/MusicUtil.java
// public class MusicUtil {
//
// public static boolean isMusic(File file) {
// return null!=file && file.getName().toLowerCase().endsWith(".mp3");
// }
//
// public static String getAlbumArt(Context mContext, String album_id) {
// String[] projection = new String[]{MediaStore.Audio.Albums.ALBUM_ART};
// Cursor cur = mContext.getContentResolver().query(
// MediaStore.Audio.Albums.EXTERNAL_CONTENT_URI,
// projection, MediaStore.Audio.Albums._ID + "=?", new String[]{album_id}, null);
// String album_art = null;
// if (null!=cur && cur.moveToNext()) {
// album_art = cur.getString(0);
// cur.close();
// }
//
// return album_art;
// }
//
// public static String[] getParentAndFileName(String path) {
// if (null!=path) {
// int lastIndex = path.lastIndexOf(File.separatorChar);
// if (lastIndex == path.length() - 1 && lastIndex > 0) {
// String tmp = path.substring(0, lastIndex);
// lastIndex = tmp.lastIndexOf(File.separatorChar);
// }
// String parent = path.substring(0, lastIndex+1);
// String name = path.substring(lastIndex+1, path.length());
// return new String[]{parent,name};
// }
// return new String[]{path,path};
// }
// }
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/models/ImageCacheManager2.java
import android.content.Context;
import android.graphics.Bitmap;
import android.os.Build;
import android.os.Handler;
import android.os.Message;
import android.support.v4.util.LruCache;
import android.widget.ImageView;
import com.zsorg.neteasecloudmusic.CONST;
import com.zsorg.neteasecloudmusic.utils.MP3Util;
import com.zsorg.neteasecloudmusic.utils.MusicUtil;
import java.util.Iterator;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
if (null == imageCacheManager) {
imageCacheManager = new ImageCacheManager2(context.getApplicationContext());
}
return imageCacheManager;
}
public Bitmap loadCachedBitmap(String mPath) {
// if (null == mPath) {
// return null;
// }
return null != mPath ? (null != fstCacheMap ? (fstCacheMap.get(mPath)) : null) : null;
// if (null != fstCacheMap && null != fstCacheMap.get(mPath) && !fstCacheMap.get(mPath).isRecycled()) {
// return fstCacheMap.get(mPath);
// }
// return null;
}
public void recycle() {
fstCacheMap.evictAll();
requestMap.clear();
context = null;
imageCacheManager = null;
}
public boolean loadImg2Cache(String mPath) {
if ( null != fstCacheMap.get(mPath) && !fstCacheMap.get(mPath).isRecycled()) {
return true;
} else {
Bitmap bitmap = null; | String picPath = MusicUtil.getAlbumArt(context, mPath); |
piyell/NeteaseCloudMusic | app/src/main/java/com/zsorg/neteasecloudmusic/models/ImageCacheManager2.java | // Path: app/src/main/java/com/zsorg/neteasecloudmusic/CONST.java
// public class CONST {
// public static final String MUSIC_TYPE = "MUSIC_TYPE";
// public static final int TYPE_SINGLE = 0;
// public static final int TYPE_SINGER = 1;
// public static final int TYPE_ALBUM = 2;
// public static final int TYPE_FOLDER = 3;
//
// public static final String INTENT_PLAYLIST_ID = "INTENT_PLAYLIST_ID";
// public static final String INTENT_PLAYLIST_POSITION = "INTENT_PLAYLIST_POSITION";
//
// public static final int DEFAULT_PLAYLIST_POSITION = 0;
// public static final int TEMP_PLAYLIST_ID = -1;
//
// public static final int IMAGE_LOADED = 1;
// public static final int IMAGE_REQUEST_LOADING = 2;
// public static final int PLAYLIST_FAVORITE = 0;
//
// public static final String SP_IS_FILTER_60 = "SP_IS_FILTER_60";
// public static final String SP_MUSIC_ORDER = "SP_MUSIC_ORDER";
// public static final int SP_MUSIC_ORDER_DEFAULT = 0;
// public static final int MUSIC_ORDER_LIST = 0;
// public static final int MUSIC_ORDER_SINGLE = 2;
// public static final int MUSIC_ORDER_RANDOM = 1;
// }
//
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/utils/MP3Util.java
// public class MP3Util {
// @TargetApi(Build.VERSION_CODES.GINGERBREAD_MR1)
// public static MusicBean parseMP3File(String path) {
// MediaMetadataRetriever mmr = new MediaMetadataRetriever();
// String name = null;
// String singer = null;
// String album = null;
// long duration = 0;
//
//
// try {
// mmr.setDataSource(path);
// name = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_TITLE);
// singer = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_ARTIST);
// album = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_ALBUM);
// duration = Long.valueOf(mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION));
// mmr.release();
// } catch (Exception e) {
// e.printStackTrace();
// return null;
//
// }
// return new MusicBean(name, singer, album, duration, path);
// }
//
// @RequiresApi(api = Build.VERSION_CODES.GINGERBREAD_MR1)
// public static Bitmap getAlbumArtFromMP3File(String path) {
// MediaMetadataRetriever mmr = new MediaMetadataRetriever();
// try {
// mmr.setDataSource(path);
// } catch (IllegalArgumentException e) {
// e.printStackTrace();
// return null;
// }
// byte[] bytes = mmr.getEmbeddedPicture();
// if (null != bytes) {
// return BitmapFactory.decodeByteArray(bytes, 0, bytes.length);
// } else {
// return mmr.getFrameAtTime();
// }
// }
// }
//
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/utils/MusicUtil.java
// public class MusicUtil {
//
// public static boolean isMusic(File file) {
// return null!=file && file.getName().toLowerCase().endsWith(".mp3");
// }
//
// public static String getAlbumArt(Context mContext, String album_id) {
// String[] projection = new String[]{MediaStore.Audio.Albums.ALBUM_ART};
// Cursor cur = mContext.getContentResolver().query(
// MediaStore.Audio.Albums.EXTERNAL_CONTENT_URI,
// projection, MediaStore.Audio.Albums._ID + "=?", new String[]{album_id}, null);
// String album_art = null;
// if (null!=cur && cur.moveToNext()) {
// album_art = cur.getString(0);
// cur.close();
// }
//
// return album_art;
// }
//
// public static String[] getParentAndFileName(String path) {
// if (null!=path) {
// int lastIndex = path.lastIndexOf(File.separatorChar);
// if (lastIndex == path.length() - 1 && lastIndex > 0) {
// String tmp = path.substring(0, lastIndex);
// lastIndex = tmp.lastIndexOf(File.separatorChar);
// }
// String parent = path.substring(0, lastIndex+1);
// String name = path.substring(lastIndex+1, path.length());
// return new String[]{parent,name};
// }
// return new String[]{path,path};
// }
// }
| import android.content.Context;
import android.graphics.Bitmap;
import android.os.Build;
import android.os.Handler;
import android.os.Message;
import android.support.v4.util.LruCache;
import android.widget.ImageView;
import com.zsorg.neteasecloudmusic.CONST;
import com.zsorg.neteasecloudmusic.utils.MP3Util;
import com.zsorg.neteasecloudmusic.utils.MusicUtil;
import java.util.Iterator;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; | return imageCacheManager;
}
public Bitmap loadCachedBitmap(String mPath) {
// if (null == mPath) {
// return null;
// }
return null != mPath ? (null != fstCacheMap ? (fstCacheMap.get(mPath)) : null) : null;
// if (null != fstCacheMap && null != fstCacheMap.get(mPath) && !fstCacheMap.get(mPath).isRecycled()) {
// return fstCacheMap.get(mPath);
// }
// return null;
}
public void recycle() {
fstCacheMap.evictAll();
requestMap.clear();
context = null;
imageCacheManager = null;
}
public boolean loadImg2Cache(String mPath) {
if ( null != fstCacheMap.get(mPath) && !fstCacheMap.get(mPath).isRecycled()) {
return true;
} else {
Bitmap bitmap = null;
String picPath = MusicUtil.getAlbumArt(context, mPath);
if (null!=picPath) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD_MR1) { | // Path: app/src/main/java/com/zsorg/neteasecloudmusic/CONST.java
// public class CONST {
// public static final String MUSIC_TYPE = "MUSIC_TYPE";
// public static final int TYPE_SINGLE = 0;
// public static final int TYPE_SINGER = 1;
// public static final int TYPE_ALBUM = 2;
// public static final int TYPE_FOLDER = 3;
//
// public static final String INTENT_PLAYLIST_ID = "INTENT_PLAYLIST_ID";
// public static final String INTENT_PLAYLIST_POSITION = "INTENT_PLAYLIST_POSITION";
//
// public static final int DEFAULT_PLAYLIST_POSITION = 0;
// public static final int TEMP_PLAYLIST_ID = -1;
//
// public static final int IMAGE_LOADED = 1;
// public static final int IMAGE_REQUEST_LOADING = 2;
// public static final int PLAYLIST_FAVORITE = 0;
//
// public static final String SP_IS_FILTER_60 = "SP_IS_FILTER_60";
// public static final String SP_MUSIC_ORDER = "SP_MUSIC_ORDER";
// public static final int SP_MUSIC_ORDER_DEFAULT = 0;
// public static final int MUSIC_ORDER_LIST = 0;
// public static final int MUSIC_ORDER_SINGLE = 2;
// public static final int MUSIC_ORDER_RANDOM = 1;
// }
//
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/utils/MP3Util.java
// public class MP3Util {
// @TargetApi(Build.VERSION_CODES.GINGERBREAD_MR1)
// public static MusicBean parseMP3File(String path) {
// MediaMetadataRetriever mmr = new MediaMetadataRetriever();
// String name = null;
// String singer = null;
// String album = null;
// long duration = 0;
//
//
// try {
// mmr.setDataSource(path);
// name = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_TITLE);
// singer = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_ARTIST);
// album = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_ALBUM);
// duration = Long.valueOf(mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION));
// mmr.release();
// } catch (Exception e) {
// e.printStackTrace();
// return null;
//
// }
// return new MusicBean(name, singer, album, duration, path);
// }
//
// @RequiresApi(api = Build.VERSION_CODES.GINGERBREAD_MR1)
// public static Bitmap getAlbumArtFromMP3File(String path) {
// MediaMetadataRetriever mmr = new MediaMetadataRetriever();
// try {
// mmr.setDataSource(path);
// } catch (IllegalArgumentException e) {
// e.printStackTrace();
// return null;
// }
// byte[] bytes = mmr.getEmbeddedPicture();
// if (null != bytes) {
// return BitmapFactory.decodeByteArray(bytes, 0, bytes.length);
// } else {
// return mmr.getFrameAtTime();
// }
// }
// }
//
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/utils/MusicUtil.java
// public class MusicUtil {
//
// public static boolean isMusic(File file) {
// return null!=file && file.getName().toLowerCase().endsWith(".mp3");
// }
//
// public static String getAlbumArt(Context mContext, String album_id) {
// String[] projection = new String[]{MediaStore.Audio.Albums.ALBUM_ART};
// Cursor cur = mContext.getContentResolver().query(
// MediaStore.Audio.Albums.EXTERNAL_CONTENT_URI,
// projection, MediaStore.Audio.Albums._ID + "=?", new String[]{album_id}, null);
// String album_art = null;
// if (null!=cur && cur.moveToNext()) {
// album_art = cur.getString(0);
// cur.close();
// }
//
// return album_art;
// }
//
// public static String[] getParentAndFileName(String path) {
// if (null!=path) {
// int lastIndex = path.lastIndexOf(File.separatorChar);
// if (lastIndex == path.length() - 1 && lastIndex > 0) {
// String tmp = path.substring(0, lastIndex);
// lastIndex = tmp.lastIndexOf(File.separatorChar);
// }
// String parent = path.substring(0, lastIndex+1);
// String name = path.substring(lastIndex+1, path.length());
// return new String[]{parent,name};
// }
// return new String[]{path,path};
// }
// }
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/models/ImageCacheManager2.java
import android.content.Context;
import android.graphics.Bitmap;
import android.os.Build;
import android.os.Handler;
import android.os.Message;
import android.support.v4.util.LruCache;
import android.widget.ImageView;
import com.zsorg.neteasecloudmusic.CONST;
import com.zsorg.neteasecloudmusic.utils.MP3Util;
import com.zsorg.neteasecloudmusic.utils.MusicUtil;
import java.util.Iterator;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
return imageCacheManager;
}
public Bitmap loadCachedBitmap(String mPath) {
// if (null == mPath) {
// return null;
// }
return null != mPath ? (null != fstCacheMap ? (fstCacheMap.get(mPath)) : null) : null;
// if (null != fstCacheMap && null != fstCacheMap.get(mPath) && !fstCacheMap.get(mPath).isRecycled()) {
// return fstCacheMap.get(mPath);
// }
// return null;
}
public void recycle() {
fstCacheMap.evictAll();
requestMap.clear();
context = null;
imageCacheManager = null;
}
public boolean loadImg2Cache(String mPath) {
if ( null != fstCacheMap.get(mPath) && !fstCacheMap.get(mPath).isRecycled()) {
return true;
} else {
Bitmap bitmap = null;
String picPath = MusicUtil.getAlbumArt(context, mPath);
if (null!=picPath) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD_MR1) { | bitmap = MP3Util.getAlbumArtFromMP3File(picPath); |
piyell/NeteaseCloudMusic | app/src/main/java/com/zsorg/neteasecloudmusic/models/ImageCacheManager2.java | // Path: app/src/main/java/com/zsorg/neteasecloudmusic/CONST.java
// public class CONST {
// public static final String MUSIC_TYPE = "MUSIC_TYPE";
// public static final int TYPE_SINGLE = 0;
// public static final int TYPE_SINGER = 1;
// public static final int TYPE_ALBUM = 2;
// public static final int TYPE_FOLDER = 3;
//
// public static final String INTENT_PLAYLIST_ID = "INTENT_PLAYLIST_ID";
// public static final String INTENT_PLAYLIST_POSITION = "INTENT_PLAYLIST_POSITION";
//
// public static final int DEFAULT_PLAYLIST_POSITION = 0;
// public static final int TEMP_PLAYLIST_ID = -1;
//
// public static final int IMAGE_LOADED = 1;
// public static final int IMAGE_REQUEST_LOADING = 2;
// public static final int PLAYLIST_FAVORITE = 0;
//
// public static final String SP_IS_FILTER_60 = "SP_IS_FILTER_60";
// public static final String SP_MUSIC_ORDER = "SP_MUSIC_ORDER";
// public static final int SP_MUSIC_ORDER_DEFAULT = 0;
// public static final int MUSIC_ORDER_LIST = 0;
// public static final int MUSIC_ORDER_SINGLE = 2;
// public static final int MUSIC_ORDER_RANDOM = 1;
// }
//
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/utils/MP3Util.java
// public class MP3Util {
// @TargetApi(Build.VERSION_CODES.GINGERBREAD_MR1)
// public static MusicBean parseMP3File(String path) {
// MediaMetadataRetriever mmr = new MediaMetadataRetriever();
// String name = null;
// String singer = null;
// String album = null;
// long duration = 0;
//
//
// try {
// mmr.setDataSource(path);
// name = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_TITLE);
// singer = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_ARTIST);
// album = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_ALBUM);
// duration = Long.valueOf(mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION));
// mmr.release();
// } catch (Exception e) {
// e.printStackTrace();
// return null;
//
// }
// return new MusicBean(name, singer, album, duration, path);
// }
//
// @RequiresApi(api = Build.VERSION_CODES.GINGERBREAD_MR1)
// public static Bitmap getAlbumArtFromMP3File(String path) {
// MediaMetadataRetriever mmr = new MediaMetadataRetriever();
// try {
// mmr.setDataSource(path);
// } catch (IllegalArgumentException e) {
// e.printStackTrace();
// return null;
// }
// byte[] bytes = mmr.getEmbeddedPicture();
// if (null != bytes) {
// return BitmapFactory.decodeByteArray(bytes, 0, bytes.length);
// } else {
// return mmr.getFrameAtTime();
// }
// }
// }
//
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/utils/MusicUtil.java
// public class MusicUtil {
//
// public static boolean isMusic(File file) {
// return null!=file && file.getName().toLowerCase().endsWith(".mp3");
// }
//
// public static String getAlbumArt(Context mContext, String album_id) {
// String[] projection = new String[]{MediaStore.Audio.Albums.ALBUM_ART};
// Cursor cur = mContext.getContentResolver().query(
// MediaStore.Audio.Albums.EXTERNAL_CONTENT_URI,
// projection, MediaStore.Audio.Albums._ID + "=?", new String[]{album_id}, null);
// String album_art = null;
// if (null!=cur && cur.moveToNext()) {
// album_art = cur.getString(0);
// cur.close();
// }
//
// return album_art;
// }
//
// public static String[] getParentAndFileName(String path) {
// if (null!=path) {
// int lastIndex = path.lastIndexOf(File.separatorChar);
// if (lastIndex == path.length() - 1 && lastIndex > 0) {
// String tmp = path.substring(0, lastIndex);
// lastIndex = tmp.lastIndexOf(File.separatorChar);
// }
// String parent = path.substring(0, lastIndex+1);
// String name = path.substring(lastIndex+1, path.length());
// return new String[]{parent,name};
// }
// return new String[]{path,path};
// }
// }
| import android.content.Context;
import android.graphics.Bitmap;
import android.os.Build;
import android.os.Handler;
import android.os.Message;
import android.support.v4.util.LruCache;
import android.widget.ImageView;
import com.zsorg.neteasecloudmusic.CONST;
import com.zsorg.neteasecloudmusic.utils.MP3Util;
import com.zsorg.neteasecloudmusic.utils.MusicUtil;
import java.util.Iterator;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; |
public boolean loadImg2Cache(String mPath) {
if ( null != fstCacheMap.get(mPath) && !fstCacheMap.get(mPath).isRecycled()) {
return true;
} else {
Bitmap bitmap = null;
String picPath = MusicUtil.getAlbumArt(context, mPath);
if (null!=picPath) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD_MR1) {
bitmap = MP3Util.getAlbumArtFromMP3File(picPath);
}
}
if (null != bitmap) {
fstCacheMap.put(mPath, bitmap);
return true;
}
}
return false;
}
/**
* 显示已缓存的图片
*
* @param msg
* @return
*/
@Override
public boolean handleMessage(Message msg) {
switch (msg.what) { | // Path: app/src/main/java/com/zsorg/neteasecloudmusic/CONST.java
// public class CONST {
// public static final String MUSIC_TYPE = "MUSIC_TYPE";
// public static final int TYPE_SINGLE = 0;
// public static final int TYPE_SINGER = 1;
// public static final int TYPE_ALBUM = 2;
// public static final int TYPE_FOLDER = 3;
//
// public static final String INTENT_PLAYLIST_ID = "INTENT_PLAYLIST_ID";
// public static final String INTENT_PLAYLIST_POSITION = "INTENT_PLAYLIST_POSITION";
//
// public static final int DEFAULT_PLAYLIST_POSITION = 0;
// public static final int TEMP_PLAYLIST_ID = -1;
//
// public static final int IMAGE_LOADED = 1;
// public static final int IMAGE_REQUEST_LOADING = 2;
// public static final int PLAYLIST_FAVORITE = 0;
//
// public static final String SP_IS_FILTER_60 = "SP_IS_FILTER_60";
// public static final String SP_MUSIC_ORDER = "SP_MUSIC_ORDER";
// public static final int SP_MUSIC_ORDER_DEFAULT = 0;
// public static final int MUSIC_ORDER_LIST = 0;
// public static final int MUSIC_ORDER_SINGLE = 2;
// public static final int MUSIC_ORDER_RANDOM = 1;
// }
//
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/utils/MP3Util.java
// public class MP3Util {
// @TargetApi(Build.VERSION_CODES.GINGERBREAD_MR1)
// public static MusicBean parseMP3File(String path) {
// MediaMetadataRetriever mmr = new MediaMetadataRetriever();
// String name = null;
// String singer = null;
// String album = null;
// long duration = 0;
//
//
// try {
// mmr.setDataSource(path);
// name = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_TITLE);
// singer = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_ARTIST);
// album = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_ALBUM);
// duration = Long.valueOf(mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION));
// mmr.release();
// } catch (Exception e) {
// e.printStackTrace();
// return null;
//
// }
// return new MusicBean(name, singer, album, duration, path);
// }
//
// @RequiresApi(api = Build.VERSION_CODES.GINGERBREAD_MR1)
// public static Bitmap getAlbumArtFromMP3File(String path) {
// MediaMetadataRetriever mmr = new MediaMetadataRetriever();
// try {
// mmr.setDataSource(path);
// } catch (IllegalArgumentException e) {
// e.printStackTrace();
// return null;
// }
// byte[] bytes = mmr.getEmbeddedPicture();
// if (null != bytes) {
// return BitmapFactory.decodeByteArray(bytes, 0, bytes.length);
// } else {
// return mmr.getFrameAtTime();
// }
// }
// }
//
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/utils/MusicUtil.java
// public class MusicUtil {
//
// public static boolean isMusic(File file) {
// return null!=file && file.getName().toLowerCase().endsWith(".mp3");
// }
//
// public static String getAlbumArt(Context mContext, String album_id) {
// String[] projection = new String[]{MediaStore.Audio.Albums.ALBUM_ART};
// Cursor cur = mContext.getContentResolver().query(
// MediaStore.Audio.Albums.EXTERNAL_CONTENT_URI,
// projection, MediaStore.Audio.Albums._ID + "=?", new String[]{album_id}, null);
// String album_art = null;
// if (null!=cur && cur.moveToNext()) {
// album_art = cur.getString(0);
// cur.close();
// }
//
// return album_art;
// }
//
// public static String[] getParentAndFileName(String path) {
// if (null!=path) {
// int lastIndex = path.lastIndexOf(File.separatorChar);
// if (lastIndex == path.length() - 1 && lastIndex > 0) {
// String tmp = path.substring(0, lastIndex);
// lastIndex = tmp.lastIndexOf(File.separatorChar);
// }
// String parent = path.substring(0, lastIndex+1);
// String name = path.substring(lastIndex+1, path.length());
// return new String[]{parent,name};
// }
// return new String[]{path,path};
// }
// }
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/models/ImageCacheManager2.java
import android.content.Context;
import android.graphics.Bitmap;
import android.os.Build;
import android.os.Handler;
import android.os.Message;
import android.support.v4.util.LruCache;
import android.widget.ImageView;
import com.zsorg.neteasecloudmusic.CONST;
import com.zsorg.neteasecloudmusic.utils.MP3Util;
import com.zsorg.neteasecloudmusic.utils.MusicUtil;
import java.util.Iterator;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public boolean loadImg2Cache(String mPath) {
if ( null != fstCacheMap.get(mPath) && !fstCacheMap.get(mPath).isRecycled()) {
return true;
} else {
Bitmap bitmap = null;
String picPath = MusicUtil.getAlbumArt(context, mPath);
if (null!=picPath) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD_MR1) {
bitmap = MP3Util.getAlbumArtFromMP3File(picPath);
}
}
if (null != bitmap) {
fstCacheMap.put(mPath, bitmap);
return true;
}
}
return false;
}
/**
* 显示已缓存的图片
*
* @param msg
* @return
*/
@Override
public boolean handleMessage(Message msg) {
switch (msg.what) { | case CONST.IMAGE_LOADED: |
piyell/NeteaseCloudMusic | app/src/main/java/com/zsorg/neteasecloudmusic/views/viewholders/BaseItemHolder.java | // Path: app/src/main/java/com/zsorg/neteasecloudmusic/BaseHolder.java
// public class BaseHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
//
// private OnItemCLickListener onItemClickListener;
//
// public BaseHolder(View itemView) {
// super(itemView);
// if (null != itemView) {
// itemView.setOnClickListener(this);
// }
// }
//
// public void setOnItemClickListener(OnItemCLickListener onItemClickListener) {
// this.onItemClickListener = onItemClickListener;
// }
//
// @Override
// public void onClick(View view) {
// if (null!=onItemClickListener) {
// onItemClickListener.onItemClick(view,getAdapterPosition());
// }
// }
// }
//
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/callbacks/OnMenuItemClickListener.java
// public interface OnMenuItemClickListener {
// void onMenuItemClick(int menuPosition);
// }
//
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/models/beans/MenuBean.java
// public class MenuBean {
// private String mName;
// private int mIconID;
//
// public MenuBean() {
//
// }
//
// public MenuBean(String name, int iconID) {
// mName = name;
// mIconID = iconID;
// }
//
// public String getName() {
// return mName;
// }
//
// public void setName(String name) {
// this.mName = name;
// }
//
// public int getIconID() {
// return mIconID;
// }
//
// public void setIconID(int iconID) {
// this.mIconID = iconID;
// }
// }
//
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/widgets/MenuDialog.java
// public class MenuDialog extends BaseBottomSheetDialog implements OnItemCLickListener {
//
// private TextView mTitle;
// private List<MenuBean> mMenuList;
// private MenuAdapter mAdapter;
// private OnMenuItemClickListener mMenuItemListener;
//
// public MenuDialog(@NonNull Context context) {
// super(context);
// initMenu();
// }
//
// public MenuDialog(@NonNull Context context, @StyleRes int theme) {
// super(context, theme);
// initMenu();
// }
//
// public MenuDialog(@NonNull Context context, boolean cancelable, OnCancelListener cancelListener) {
// super(context, cancelable, cancelListener);
// initMenu();
// }
//
// @Override
// public void setTitle(CharSequence title) {
// super.setTitle(title);
//
// if (null != mTitle) {
// mTitle.setText(title);
// }
// }
//
// @Override
// public void setTitle(int titleId) {
// super.setTitle(titleId);
// if (null != mTitle) {
// mTitle.setText(getContext().getString(titleId));
// }
// }
//
// public void setTitle(String title) {
// if (null != mTitle) {
// mTitle.setText(title);
// }
// }
//
// public void setOnMenuItemClickListener(OnMenuItemClickListener onMenuItemClickListener) {
// mMenuItemListener = onMenuItemClickListener;
// }
//
//
// public void setMenuList(List<MenuBean> menuList) {
// this.mMenuList = menuList;
// mAdapter.notifyDataSetChanged();
// }
//
// @Override
// public void onItemClick(View view, int position) {
// cancel();
// if (null != mMenuItemListener) {
// mMenuItemListener.onMenuItemClick(position);
// }
// }
//
// private void initMenu() {
// View view =setHeaderView(R.layout.dialog_menu_header);
//
// mTitle = (TextView) findViewById(R.id.tv_title);
//
// mAdapter = new MenuAdapter(getLayoutInflater());
// mAdapter.setOnItemClickListener(this);
// setListAdapter(mAdapter);
// }
//
// private class MenuAdapter extends BaseAdapter<MenuHolder> {
//
// public MenuAdapter(LayoutInflater layoutInflater) {
// super(layoutInflater);
// }
//
// @Override
// public BaseHolder onCreateHolder(ViewGroup parent, int viewType) {
// return new MenuHolder(mInflater.inflate(R.layout.dialog_menu_item, parent, false));
// }
//
// @Override
// public void onBindHolder(MenuHolder holder, int position) {
// MenuBean bean = mMenuList.get(position);
// holder.tvName.setText(bean.getName());
// if (bean.getIconID() > 0) {
// Bitmap bitmap = BitmapFactory.decodeResource(getContext().getResources(), bean.getIconID());
// // holder.ivIcon.setImageDrawable(VectorDrawableCompat.create(getContext().getResources(), bean.getIconID(), null));
// holder.ivIcon.setImageDrawable(new BitmapDrawable(bitmap));
// }
// }
//
// @Override
// public int getDataCount() {
// return mMenuList==null?0:mMenuList.size();
// }
// }
//
// class MenuHolder extends BaseHolder {
// @BindView(R.id.iv_icon)
// ImageView ivIcon;
// @BindView(R.id.tv_name)
// TextView tvName;
//
// public MenuHolder(View itemView) {
// super(itemView);
//
// ButterKnife.bind(this, itemView);
// }
// }
// }
| import android.app.Activity;
import android.view.View;
import com.zsorg.neteasecloudmusic.BaseHolder;
import com.zsorg.neteasecloudmusic.callbacks.OnMenuItemClickListener;
import com.zsorg.neteasecloudmusic.R;
import com.zsorg.neteasecloudmusic.models.beans.MenuBean;
import com.zsorg.neteasecloudmusic.widgets.MenuDialog;
import java.util.List; | package com.zsorg.neteasecloudmusic.views.viewholders;
/**
* Project:NeteaseCloudMusic
*
* @Author: piyel_000
* Created on 2017/1/31.
* E-mail:piyell@qq.com
*/
public class BaseItemHolder extends BaseHolder implements OnMenuItemClickListener {
private String mTitle; | // Path: app/src/main/java/com/zsorg/neteasecloudmusic/BaseHolder.java
// public class BaseHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
//
// private OnItemCLickListener onItemClickListener;
//
// public BaseHolder(View itemView) {
// super(itemView);
// if (null != itemView) {
// itemView.setOnClickListener(this);
// }
// }
//
// public void setOnItemClickListener(OnItemCLickListener onItemClickListener) {
// this.onItemClickListener = onItemClickListener;
// }
//
// @Override
// public void onClick(View view) {
// if (null!=onItemClickListener) {
// onItemClickListener.onItemClick(view,getAdapterPosition());
// }
// }
// }
//
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/callbacks/OnMenuItemClickListener.java
// public interface OnMenuItemClickListener {
// void onMenuItemClick(int menuPosition);
// }
//
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/models/beans/MenuBean.java
// public class MenuBean {
// private String mName;
// private int mIconID;
//
// public MenuBean() {
//
// }
//
// public MenuBean(String name, int iconID) {
// mName = name;
// mIconID = iconID;
// }
//
// public String getName() {
// return mName;
// }
//
// public void setName(String name) {
// this.mName = name;
// }
//
// public int getIconID() {
// return mIconID;
// }
//
// public void setIconID(int iconID) {
// this.mIconID = iconID;
// }
// }
//
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/widgets/MenuDialog.java
// public class MenuDialog extends BaseBottomSheetDialog implements OnItemCLickListener {
//
// private TextView mTitle;
// private List<MenuBean> mMenuList;
// private MenuAdapter mAdapter;
// private OnMenuItemClickListener mMenuItemListener;
//
// public MenuDialog(@NonNull Context context) {
// super(context);
// initMenu();
// }
//
// public MenuDialog(@NonNull Context context, @StyleRes int theme) {
// super(context, theme);
// initMenu();
// }
//
// public MenuDialog(@NonNull Context context, boolean cancelable, OnCancelListener cancelListener) {
// super(context, cancelable, cancelListener);
// initMenu();
// }
//
// @Override
// public void setTitle(CharSequence title) {
// super.setTitle(title);
//
// if (null != mTitle) {
// mTitle.setText(title);
// }
// }
//
// @Override
// public void setTitle(int titleId) {
// super.setTitle(titleId);
// if (null != mTitle) {
// mTitle.setText(getContext().getString(titleId));
// }
// }
//
// public void setTitle(String title) {
// if (null != mTitle) {
// mTitle.setText(title);
// }
// }
//
// public void setOnMenuItemClickListener(OnMenuItemClickListener onMenuItemClickListener) {
// mMenuItemListener = onMenuItemClickListener;
// }
//
//
// public void setMenuList(List<MenuBean> menuList) {
// this.mMenuList = menuList;
// mAdapter.notifyDataSetChanged();
// }
//
// @Override
// public void onItemClick(View view, int position) {
// cancel();
// if (null != mMenuItemListener) {
// mMenuItemListener.onMenuItemClick(position);
// }
// }
//
// private void initMenu() {
// View view =setHeaderView(R.layout.dialog_menu_header);
//
// mTitle = (TextView) findViewById(R.id.tv_title);
//
// mAdapter = new MenuAdapter(getLayoutInflater());
// mAdapter.setOnItemClickListener(this);
// setListAdapter(mAdapter);
// }
//
// private class MenuAdapter extends BaseAdapter<MenuHolder> {
//
// public MenuAdapter(LayoutInflater layoutInflater) {
// super(layoutInflater);
// }
//
// @Override
// public BaseHolder onCreateHolder(ViewGroup parent, int viewType) {
// return new MenuHolder(mInflater.inflate(R.layout.dialog_menu_item, parent, false));
// }
//
// @Override
// public void onBindHolder(MenuHolder holder, int position) {
// MenuBean bean = mMenuList.get(position);
// holder.tvName.setText(bean.getName());
// if (bean.getIconID() > 0) {
// Bitmap bitmap = BitmapFactory.decodeResource(getContext().getResources(), bean.getIconID());
// // holder.ivIcon.setImageDrawable(VectorDrawableCompat.create(getContext().getResources(), bean.getIconID(), null));
// holder.ivIcon.setImageDrawable(new BitmapDrawable(bitmap));
// }
// }
//
// @Override
// public int getDataCount() {
// return mMenuList==null?0:mMenuList.size();
// }
// }
//
// class MenuHolder extends BaseHolder {
// @BindView(R.id.iv_icon)
// ImageView ivIcon;
// @BindView(R.id.tv_name)
// TextView tvName;
//
// public MenuHolder(View itemView) {
// super(itemView);
//
// ButterKnife.bind(this, itemView);
// }
// }
// }
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/views/viewholders/BaseItemHolder.java
import android.app.Activity;
import android.view.View;
import com.zsorg.neteasecloudmusic.BaseHolder;
import com.zsorg.neteasecloudmusic.callbacks.OnMenuItemClickListener;
import com.zsorg.neteasecloudmusic.R;
import com.zsorg.neteasecloudmusic.models.beans.MenuBean;
import com.zsorg.neteasecloudmusic.widgets.MenuDialog;
import java.util.List;
package com.zsorg.neteasecloudmusic.views.viewholders;
/**
* Project:NeteaseCloudMusic
*
* @Author: piyel_000
* Created on 2017/1/31.
* E-mail:piyell@qq.com
*/
public class BaseItemHolder extends BaseHolder implements OnMenuItemClickListener {
private String mTitle; | private List<MenuBean> mMenuList; |
piyell/NeteaseCloudMusic | app/src/main/java/com/zsorg/neteasecloudmusic/fragments/MusicFragment.java | // Path: app/src/main/java/com/zsorg/neteasecloudmusic/adapters/MusicPagerAdapter.java
// public class MusicPagerAdapter extends FragmentPagerAdapter {
// private final ArrayList<SubMusicFragment> mList;
// @BindArray(R.array.music)
// String[] mTabName;
// private int[] mFragmentType = {CONST.TYPE_SINGLE, CONST.TYPE_SINGER, CONST.TYPE_ALBUM, CONST.TYPE_FOLDER};
//
// public MusicPagerAdapter(View view, FragmentManager fm) {
// super(fm);
// ButterKnife.bind(this, view);
//
// mList = new ArrayList<>();
// for (int position=0;position<mFragmentType.length;position++) {
// mList.add(SubMusicFragment.newInstance(mFragmentType[position]));
// }
//
// }
//
// @Override
// public Fragment getItem(int position) {
// return mList.get(position);
// }
//
// @Override
// public int getCount() {
// return mTabName.length;
// }
//
// @Override
// public CharSequence getPageTitle(int position) {
// return mTabName[position];
// }
// }
| import android.net.Uri;
import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.zsorg.neteasecloudmusic.R;
import com.zsorg.neteasecloudmusic.adapters.MusicPagerAdapter;
import butterknife.BindView;
import butterknife.ButterKnife; | package com.zsorg.neteasecloudmusic.fragments;
/**
* A simple {@link Fragment} subclass.
* Activities that contain this fragment must implement the
* {@link MusicFragment.OnFragmentInteractionListener} interface
* to handle interaction events.
* Use the {@link MusicFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class MusicFragment extends Fragment implements ViewPager.OnPageChangeListener {
@BindView(R.id.music_tab)
TabLayout mTabLayout;
@BindView(R.id.music_viewpager)
ViewPager mViewpager;
| // Path: app/src/main/java/com/zsorg/neteasecloudmusic/adapters/MusicPagerAdapter.java
// public class MusicPagerAdapter extends FragmentPagerAdapter {
// private final ArrayList<SubMusicFragment> mList;
// @BindArray(R.array.music)
// String[] mTabName;
// private int[] mFragmentType = {CONST.TYPE_SINGLE, CONST.TYPE_SINGER, CONST.TYPE_ALBUM, CONST.TYPE_FOLDER};
//
// public MusicPagerAdapter(View view, FragmentManager fm) {
// super(fm);
// ButterKnife.bind(this, view);
//
// mList = new ArrayList<>();
// for (int position=0;position<mFragmentType.length;position++) {
// mList.add(SubMusicFragment.newInstance(mFragmentType[position]));
// }
//
// }
//
// @Override
// public Fragment getItem(int position) {
// return mList.get(position);
// }
//
// @Override
// public int getCount() {
// return mTabName.length;
// }
//
// @Override
// public CharSequence getPageTitle(int position) {
// return mTabName[position];
// }
// }
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/fragments/MusicFragment.java
import android.net.Uri;
import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.zsorg.neteasecloudmusic.R;
import com.zsorg.neteasecloudmusic.adapters.MusicPagerAdapter;
import butterknife.BindView;
import butterknife.ButterKnife;
package com.zsorg.neteasecloudmusic.fragments;
/**
* A simple {@link Fragment} subclass.
* Activities that contain this fragment must implement the
* {@link MusicFragment.OnFragmentInteractionListener} interface
* to handle interaction events.
* Use the {@link MusicFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class MusicFragment extends Fragment implements ViewPager.OnPageChangeListener {
@BindView(R.id.music_tab)
TabLayout mTabLayout;
@BindView(R.id.music_viewpager)
ViewPager mViewpager;
| private MusicPagerAdapter mAdapter; |
piyell/NeteaseCloudMusic | app/src/main/java/com/zsorg/neteasecloudmusic/models/PlayerMenuModel.java | // Path: app/src/main/java/com/zsorg/neteasecloudmusic/models/beans/MenuBean.java
// public class MenuBean {
// private String mName;
// private int mIconID;
//
// public MenuBean() {
//
// }
//
// public MenuBean(String name, int iconID) {
// mName = name;
// mIconID = iconID;
// }
//
// public String getName() {
// return mName;
// }
//
// public void setName(String name) {
// this.mName = name;
// }
//
// public int getIconID() {
// return mIconID;
// }
//
// public void setIconID(int iconID) {
// this.mIconID = iconID;
// }
// }
| import android.content.Context;
import android.support.annotation.NonNull;
import com.zsorg.neteasecloudmusic.R;
import com.zsorg.neteasecloudmusic.models.beans.MenuBean;
import java.util.ArrayList;
import java.util.List; | package com.zsorg.neteasecloudmusic.models;
/**
* Project:NeteaseCloudMusic
*
* @Author: piyel_000
* Created on 2017/1/31.
* E-mail:piyell@qq.com
*/
public class PlayerMenuModel implements IMenuModel{
private static PlayerMenuModel mModel;
| // Path: app/src/main/java/com/zsorg/neteasecloudmusic/models/beans/MenuBean.java
// public class MenuBean {
// private String mName;
// private int mIconID;
//
// public MenuBean() {
//
// }
//
// public MenuBean(String name, int iconID) {
// mName = name;
// mIconID = iconID;
// }
//
// public String getName() {
// return mName;
// }
//
// public void setName(String name) {
// this.mName = name;
// }
//
// public int getIconID() {
// return mIconID;
// }
//
// public void setIconID(int iconID) {
// this.mIconID = iconID;
// }
// }
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/models/PlayerMenuModel.java
import android.content.Context;
import android.support.annotation.NonNull;
import com.zsorg.neteasecloudmusic.R;
import com.zsorg.neteasecloudmusic.models.beans.MenuBean;
import java.util.ArrayList;
import java.util.List;
package com.zsorg.neteasecloudmusic.models;
/**
* Project:NeteaseCloudMusic
*
* @Author: piyel_000
* Created on 2017/1/31.
* E-mail:piyell@qq.com
*/
public class PlayerMenuModel implements IMenuModel{
private static PlayerMenuModel mModel;
| List<MenuBean> mList; |
piyell/NeteaseCloudMusic | app/src/main/java/com/zsorg/neteasecloudmusic/activities/SplashActivity.java | // Path: app/src/main/java/com/zsorg/neteasecloudmusic/utils/DebugUtils.java
// public class DebugUtils {
// public static boolean isApkDebugable(Context context) {
// try {
// ApplicationInfo info= context.getApplicationInfo();
// return (info.flags& ApplicationInfo.FLAG_DEBUGGABLE)!=0;
// } catch (Exception e) {
//
// }
// return false;
// }
// }
| import android.content.Intent;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import com.zsorg.neteasecloudmusic.R;
import com.zsorg.neteasecloudmusic.utils.DebugUtils; | package com.zsorg.neteasecloudmusic.activities;
public class SplashActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
//Delay for 2000ms to launch MainActivity | // Path: app/src/main/java/com/zsorg/neteasecloudmusic/utils/DebugUtils.java
// public class DebugUtils {
// public static boolean isApkDebugable(Context context) {
// try {
// ApplicationInfo info= context.getApplicationInfo();
// return (info.flags& ApplicationInfo.FLAG_DEBUGGABLE)!=0;
// } catch (Exception e) {
//
// }
// return false;
// }
// }
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/activities/SplashActivity.java
import android.content.Intent;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import com.zsorg.neteasecloudmusic.R;
import com.zsorg.neteasecloudmusic.utils.DebugUtils;
package com.zsorg.neteasecloudmusic.activities;
public class SplashActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
//Delay for 2000ms to launch MainActivity | if (DebugUtils.isApkDebugable(this)) { |
piyell/NeteaseCloudMusic | app/src/main/java/com/zsorg/neteasecloudmusic/utils/MP3Util.java | // Path: app/src/main/java/com/zsorg/neteasecloudmusic/models/beans/MusicBean.java
// public class MusicBean implements Parcelable{
// private final String mSinger;
// private final String mAlbum;
// private String mPath;
// private String mName;
// private long mDuration;
//
// protected MusicBean(Parcel in) {
// mSinger = in.readString();
// mAlbum = in.readString();
// mPath = in.readString();
// mName = in.readString();
// mDuration = in.readLong();
// }
//
// public static final Creator<MusicBean> CREATOR = new Creator<MusicBean>() {
// @Override
// public MusicBean createFromParcel(Parcel in) {
// return new MusicBean(in);
// }
//
// @Override
// public MusicBean[] newArray(int size) {
// return new MusicBean[size];
// }
// };
//
// @Override
// public int describeContents() {
// return 0;
// }
//
// @Override
// public void writeToParcel(Parcel parcel, int i) {
//
// parcel.writeString(mSinger);
// parcel.writeString(mAlbum);
// parcel.writeString(mPath);
// parcel.writeString(mName);
// parcel.writeLong(mDuration);
// }
//
// @Override
// public int hashCode() {
// return mPath==null?0:mPath.hashCode();
// }
//
// @Override
// public boolean equals(Object obj) {
// return obj instanceof MusicBean && (((MusicBean) obj).hashCode()==hashCode());
// }
//
// public MusicBean(String name, String singer, String album, long duration, String path) {
// mPath = path;
// mName = name;
// mSinger = singer;
// mAlbum = album;
// mDuration = duration;
// }
//
// public String getSinger() {
// return mSinger;
// }
//
// public String getAlbum() {
// return mAlbum;
// }
//
// public String getPath() {
// return mPath;
// }
//
// public void setPath(String mPath) {
// this.mPath = mPath;
// }
//
// public String getName() {
// return mName;
// }
//
// public void setName(String mName) {
// this.mName = mName;
// }
//
// public long getDuration() {
// return mDuration;
// }
//
// public void setDuration(long mDuration) {
// this.mDuration = mDuration;
// }
// }
| import android.annotation.TargetApi;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.media.MediaMetadataRetriever;
import android.os.Build;
import android.support.annotation.RequiresApi;
import com.zsorg.neteasecloudmusic.models.beans.MusicBean;
import java.io.FileInputStream;
import static android.R.attr.duration; | package com.zsorg.neteasecloudmusic.utils;
/**
* Project:NeteaseCloudMusic
*
* @Author: piyel_000
* Created on 2017/1/16.
* E-mail:piyell@qq.com
*/
public class MP3Util {
@TargetApi(Build.VERSION_CODES.GINGERBREAD_MR1) | // Path: app/src/main/java/com/zsorg/neteasecloudmusic/models/beans/MusicBean.java
// public class MusicBean implements Parcelable{
// private final String mSinger;
// private final String mAlbum;
// private String mPath;
// private String mName;
// private long mDuration;
//
// protected MusicBean(Parcel in) {
// mSinger = in.readString();
// mAlbum = in.readString();
// mPath = in.readString();
// mName = in.readString();
// mDuration = in.readLong();
// }
//
// public static final Creator<MusicBean> CREATOR = new Creator<MusicBean>() {
// @Override
// public MusicBean createFromParcel(Parcel in) {
// return new MusicBean(in);
// }
//
// @Override
// public MusicBean[] newArray(int size) {
// return new MusicBean[size];
// }
// };
//
// @Override
// public int describeContents() {
// return 0;
// }
//
// @Override
// public void writeToParcel(Parcel parcel, int i) {
//
// parcel.writeString(mSinger);
// parcel.writeString(mAlbum);
// parcel.writeString(mPath);
// parcel.writeString(mName);
// parcel.writeLong(mDuration);
// }
//
// @Override
// public int hashCode() {
// return mPath==null?0:mPath.hashCode();
// }
//
// @Override
// public boolean equals(Object obj) {
// return obj instanceof MusicBean && (((MusicBean) obj).hashCode()==hashCode());
// }
//
// public MusicBean(String name, String singer, String album, long duration, String path) {
// mPath = path;
// mName = name;
// mSinger = singer;
// mAlbum = album;
// mDuration = duration;
// }
//
// public String getSinger() {
// return mSinger;
// }
//
// public String getAlbum() {
// return mAlbum;
// }
//
// public String getPath() {
// return mPath;
// }
//
// public void setPath(String mPath) {
// this.mPath = mPath;
// }
//
// public String getName() {
// return mName;
// }
//
// public void setName(String mName) {
// this.mName = mName;
// }
//
// public long getDuration() {
// return mDuration;
// }
//
// public void setDuration(long mDuration) {
// this.mDuration = mDuration;
// }
// }
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/utils/MP3Util.java
import android.annotation.TargetApi;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.media.MediaMetadataRetriever;
import android.os.Build;
import android.support.annotation.RequiresApi;
import com.zsorg.neteasecloudmusic.models.beans.MusicBean;
import java.io.FileInputStream;
import static android.R.attr.duration;
package com.zsorg.neteasecloudmusic.utils;
/**
* Project:NeteaseCloudMusic
*
* @Author: piyel_000
* Created on 2017/1/16.
* E-mail:piyell@qq.com
*/
public class MP3Util {
@TargetApi(Build.VERSION_CODES.GINGERBREAD_MR1) | public static MusicBean parseMP3File(String path) { |
piyell/NeteaseCloudMusic | app/src/main/java/com/zsorg/neteasecloudmusic/widgets/BaseBottomSheetDialog.java | // Path: app/src/main/java/com/zsorg/neteasecloudmusic/LineItemDecorator.java
// public class LineItemDecorator extends RecyclerView.ItemDecoration {
//
// private static LineItemDecorator lineItemDecorator;
// private int dimension;
// private boolean isDrawHorizontal=false;
// private boolean isDrawVertical=true;
//
// public LineItemDecorator() {
// super();
// }
//
// public void recycle() {
// lineItemDecorator = null;
// }
//
// public void setDrawHorizontal(boolean isDraw) {
// isDrawHorizontal = isDraw;
// }
//
// public void setDrawVertical(boolean isDraw) {
// isDrawVertical = isDraw;
// }
//
// public static LineItemDecorator getInstance() {
// if (null == lineItemDecorator) {
// synchronized (LineItemDecorator.class) {
// lineItemDecorator = new LineItemDecorator();
// }
// }
// return lineItemDecorator;
// }
//
// @Override
// public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
// super.getItemOffsets(outRect, view, parent, state);
// if (isDrawVertical) {
// outRect.top = 1;
// // outRect.left = dimension;
// // outRect.right = dimension;
// outRect.bottom = 1;
// }
// if (isDrawHorizontal){
// outRect.left = 1;
// // outRect.left = dimension;
// // outRect.right = dimension;
// outRect.right = 1;
// }
// }
//
//
// @Override
// public void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state) {
// super.onDraw(c, parent, state);
// if (isDrawHorizontal) {
// drawHrozontal(c, parent);
// }
// if (isDrawVertical){
// drawVertical(c, parent);
// }
// }
//
//
//
// private void drawVertical(Canvas c, RecyclerView parent) {
// int childCount = parent.getChildCount();
// if (childCount<1)return;
// // int left = parent.getPaddingLeft()+leftView.getLeft()+leftView.getPaddingLeft();
// int left = parent.getPaddingLeft();
// int right = parent.getWidth() - parent.getPaddingRight();
//
// Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
// paint.setColor(Color.LTGRAY);
// for (int i = 0; i < childCount; i++) {
// View child = parent.getChildAt(i);
// RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child
// .getLayoutParams();
// int top = child.getBottom()+params.bottomMargin;
// int bottom = top + 1;
// c.drawRect(left, top, right, bottom, paint);
// }
// }
//
// private void drawHrozontal(Canvas c, RecyclerView parent) {
// int childCount = parent.getChildCount();
// if (childCount<1)return;
// // int left = parent.getPaddingLeft()+leftView.getLeft()+leftView.getPaddingLeft();
// int top = parent.getPaddingTop();
// int bottom = parent.getHeight() - parent.getPaddingBottom();
//
// Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
// paint.setColor(Color.LTGRAY);
// for (int i = 0; i < childCount-1; i++) {
// View child = parent.getChildAt(i);
// RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child
// .getLayoutParams();
// int left = child.getRight()+params.rightMargin;
// int right = left + 1;
// c.drawRect(left, top, right, bottom, paint);
//
// }
// }
//
// }
//
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/utils/ScreenUtil.java
// public class ScreenUtil {
//
// public static int getScreenHeight(Activity activity) {
// DisplayMetrics displaymetrics = new DisplayMetrics();
// activity.getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
// return displaymetrics.heightPixels;
// }
//
// public static int getStatusBarHeight(Context context) {
// int statusBarHeight = 0;
// Resources res = context.getResources();
// int resourceId = res.getIdentifier("status_bar_height", "dimen", "android");
// if (resourceId > 0) {
// statusBarHeight = res.getDimensionPixelSize(resourceId);
// }
// return statusBarHeight;
// }
// }
| import android.app.Activity;
import android.content.Context;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.StyleRes;
import android.support.design.widget.BottomSheetBehavior;
import android.support.design.widget.BottomSheetDialog;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import com.zsorg.neteasecloudmusic.LineItemDecorator;
import com.zsorg.neteasecloudmusic.R;
import com.zsorg.neteasecloudmusic.utils.ScreenUtil;
import butterknife.BindView;
import butterknife.ButterKnife; | super(context);
init();
}
public BaseBottomSheetDialog(@NonNull Context context, @StyleRes int theme) {
super(context, theme);
init();
}
public BaseBottomSheetDialog(@NonNull Context context, boolean cancelable, OnCancelListener cancelListener) {
super(context, cancelable, cancelListener);
init();
}
public BaseBottomSheetDialog setListAdapter(RecyclerView.Adapter adapter) {
rvList.setAdapter(adapter);
return this;
}
public BaseBottomSheetDialog setHeaderView(View view) {
topLayout.addView(view);
return this;
}
public View setHeaderView(int resID) {
return View.inflate(getContext(), resID, topLayout);
}
public void setPeekHeight(Activity activity) {
int measuredHeight = mParent.getMeasuredHeight(); | // Path: app/src/main/java/com/zsorg/neteasecloudmusic/LineItemDecorator.java
// public class LineItemDecorator extends RecyclerView.ItemDecoration {
//
// private static LineItemDecorator lineItemDecorator;
// private int dimension;
// private boolean isDrawHorizontal=false;
// private boolean isDrawVertical=true;
//
// public LineItemDecorator() {
// super();
// }
//
// public void recycle() {
// lineItemDecorator = null;
// }
//
// public void setDrawHorizontal(boolean isDraw) {
// isDrawHorizontal = isDraw;
// }
//
// public void setDrawVertical(boolean isDraw) {
// isDrawVertical = isDraw;
// }
//
// public static LineItemDecorator getInstance() {
// if (null == lineItemDecorator) {
// synchronized (LineItemDecorator.class) {
// lineItemDecorator = new LineItemDecorator();
// }
// }
// return lineItemDecorator;
// }
//
// @Override
// public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
// super.getItemOffsets(outRect, view, parent, state);
// if (isDrawVertical) {
// outRect.top = 1;
// // outRect.left = dimension;
// // outRect.right = dimension;
// outRect.bottom = 1;
// }
// if (isDrawHorizontal){
// outRect.left = 1;
// // outRect.left = dimension;
// // outRect.right = dimension;
// outRect.right = 1;
// }
// }
//
//
// @Override
// public void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state) {
// super.onDraw(c, parent, state);
// if (isDrawHorizontal) {
// drawHrozontal(c, parent);
// }
// if (isDrawVertical){
// drawVertical(c, parent);
// }
// }
//
//
//
// private void drawVertical(Canvas c, RecyclerView parent) {
// int childCount = parent.getChildCount();
// if (childCount<1)return;
// // int left = parent.getPaddingLeft()+leftView.getLeft()+leftView.getPaddingLeft();
// int left = parent.getPaddingLeft();
// int right = parent.getWidth() - parent.getPaddingRight();
//
// Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
// paint.setColor(Color.LTGRAY);
// for (int i = 0; i < childCount; i++) {
// View child = parent.getChildAt(i);
// RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child
// .getLayoutParams();
// int top = child.getBottom()+params.bottomMargin;
// int bottom = top + 1;
// c.drawRect(left, top, right, bottom, paint);
// }
// }
//
// private void drawHrozontal(Canvas c, RecyclerView parent) {
// int childCount = parent.getChildCount();
// if (childCount<1)return;
// // int left = parent.getPaddingLeft()+leftView.getLeft()+leftView.getPaddingLeft();
// int top = parent.getPaddingTop();
// int bottom = parent.getHeight() - parent.getPaddingBottom();
//
// Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
// paint.setColor(Color.LTGRAY);
// for (int i = 0; i < childCount-1; i++) {
// View child = parent.getChildAt(i);
// RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child
// .getLayoutParams();
// int left = child.getRight()+params.rightMargin;
// int right = left + 1;
// c.drawRect(left, top, right, bottom, paint);
//
// }
// }
//
// }
//
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/utils/ScreenUtil.java
// public class ScreenUtil {
//
// public static int getScreenHeight(Activity activity) {
// DisplayMetrics displaymetrics = new DisplayMetrics();
// activity.getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
// return displaymetrics.heightPixels;
// }
//
// public static int getStatusBarHeight(Context context) {
// int statusBarHeight = 0;
// Resources res = context.getResources();
// int resourceId = res.getIdentifier("status_bar_height", "dimen", "android");
// if (resourceId > 0) {
// statusBarHeight = res.getDimensionPixelSize(resourceId);
// }
// return statusBarHeight;
// }
// }
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/widgets/BaseBottomSheetDialog.java
import android.app.Activity;
import android.content.Context;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.StyleRes;
import android.support.design.widget.BottomSheetBehavior;
import android.support.design.widget.BottomSheetDialog;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import com.zsorg.neteasecloudmusic.LineItemDecorator;
import com.zsorg.neteasecloudmusic.R;
import com.zsorg.neteasecloudmusic.utils.ScreenUtil;
import butterknife.BindView;
import butterknife.ButterKnife;
super(context);
init();
}
public BaseBottomSheetDialog(@NonNull Context context, @StyleRes int theme) {
super(context, theme);
init();
}
public BaseBottomSheetDialog(@NonNull Context context, boolean cancelable, OnCancelListener cancelListener) {
super(context, cancelable, cancelListener);
init();
}
public BaseBottomSheetDialog setListAdapter(RecyclerView.Adapter adapter) {
rvList.setAdapter(adapter);
return this;
}
public BaseBottomSheetDialog setHeaderView(View view) {
topLayout.addView(view);
return this;
}
public View setHeaderView(int resID) {
return View.inflate(getContext(), resID, topLayout);
}
public void setPeekHeight(Activity activity) {
int measuredHeight = mParent.getMeasuredHeight(); | int height = ScreenUtil.getScreenHeight(activity) - ScreenUtil.getStatusBarHeight(getContext()); |
piyell/NeteaseCloudMusic | app/src/main/java/com/zsorg/neteasecloudmusic/widgets/BaseBottomSheetDialog.java | // Path: app/src/main/java/com/zsorg/neteasecloudmusic/LineItemDecorator.java
// public class LineItemDecorator extends RecyclerView.ItemDecoration {
//
// private static LineItemDecorator lineItemDecorator;
// private int dimension;
// private boolean isDrawHorizontal=false;
// private boolean isDrawVertical=true;
//
// public LineItemDecorator() {
// super();
// }
//
// public void recycle() {
// lineItemDecorator = null;
// }
//
// public void setDrawHorizontal(boolean isDraw) {
// isDrawHorizontal = isDraw;
// }
//
// public void setDrawVertical(boolean isDraw) {
// isDrawVertical = isDraw;
// }
//
// public static LineItemDecorator getInstance() {
// if (null == lineItemDecorator) {
// synchronized (LineItemDecorator.class) {
// lineItemDecorator = new LineItemDecorator();
// }
// }
// return lineItemDecorator;
// }
//
// @Override
// public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
// super.getItemOffsets(outRect, view, parent, state);
// if (isDrawVertical) {
// outRect.top = 1;
// // outRect.left = dimension;
// // outRect.right = dimension;
// outRect.bottom = 1;
// }
// if (isDrawHorizontal){
// outRect.left = 1;
// // outRect.left = dimension;
// // outRect.right = dimension;
// outRect.right = 1;
// }
// }
//
//
// @Override
// public void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state) {
// super.onDraw(c, parent, state);
// if (isDrawHorizontal) {
// drawHrozontal(c, parent);
// }
// if (isDrawVertical){
// drawVertical(c, parent);
// }
// }
//
//
//
// private void drawVertical(Canvas c, RecyclerView parent) {
// int childCount = parent.getChildCount();
// if (childCount<1)return;
// // int left = parent.getPaddingLeft()+leftView.getLeft()+leftView.getPaddingLeft();
// int left = parent.getPaddingLeft();
// int right = parent.getWidth() - parent.getPaddingRight();
//
// Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
// paint.setColor(Color.LTGRAY);
// for (int i = 0; i < childCount; i++) {
// View child = parent.getChildAt(i);
// RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child
// .getLayoutParams();
// int top = child.getBottom()+params.bottomMargin;
// int bottom = top + 1;
// c.drawRect(left, top, right, bottom, paint);
// }
// }
//
// private void drawHrozontal(Canvas c, RecyclerView parent) {
// int childCount = parent.getChildCount();
// if (childCount<1)return;
// // int left = parent.getPaddingLeft()+leftView.getLeft()+leftView.getPaddingLeft();
// int top = parent.getPaddingTop();
// int bottom = parent.getHeight() - parent.getPaddingBottom();
//
// Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
// paint.setColor(Color.LTGRAY);
// for (int i = 0; i < childCount-1; i++) {
// View child = parent.getChildAt(i);
// RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child
// .getLayoutParams();
// int left = child.getRight()+params.rightMargin;
// int right = left + 1;
// c.drawRect(left, top, right, bottom, paint);
//
// }
// }
//
// }
//
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/utils/ScreenUtil.java
// public class ScreenUtil {
//
// public static int getScreenHeight(Activity activity) {
// DisplayMetrics displaymetrics = new DisplayMetrics();
// activity.getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
// return displaymetrics.heightPixels;
// }
//
// public static int getStatusBarHeight(Context context) {
// int statusBarHeight = 0;
// Resources res = context.getResources();
// int resourceId = res.getIdentifier("status_bar_height", "dimen", "android");
// if (resourceId > 0) {
// statusBarHeight = res.getDimensionPixelSize(resourceId);
// }
// return statusBarHeight;
// }
// }
| import android.app.Activity;
import android.content.Context;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.StyleRes;
import android.support.design.widget.BottomSheetBehavior;
import android.support.design.widget.BottomSheetDialog;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import com.zsorg.neteasecloudmusic.LineItemDecorator;
import com.zsorg.neteasecloudmusic.R;
import com.zsorg.neteasecloudmusic.utils.ScreenUtil;
import butterknife.BindView;
import butterknife.ButterKnife; | int measuredHeight = mParent.getMeasuredHeight();
int height = ScreenUtil.getScreenHeight(activity) - ScreenUtil.getStatusBarHeight(getContext());
measuredHeight = measuredHeight > height * 0.5 ? (int) (height * 0.5) : measuredHeight;
mBehavior.setPeekHeight(measuredHeight);
mBehavior.setHideable(true);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mParent.measure(0, 0);
}
private void init() {
View view = View.inflate(getContext(), R.layout.bottom_sheet_playlist, null);
setContentView(view);
mParent = (View) view.getParent();
mBehavior = BottomSheetBehavior.from(mParent);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
}
ButterKnife.bind(this,view);
| // Path: app/src/main/java/com/zsorg/neteasecloudmusic/LineItemDecorator.java
// public class LineItemDecorator extends RecyclerView.ItemDecoration {
//
// private static LineItemDecorator lineItemDecorator;
// private int dimension;
// private boolean isDrawHorizontal=false;
// private boolean isDrawVertical=true;
//
// public LineItemDecorator() {
// super();
// }
//
// public void recycle() {
// lineItemDecorator = null;
// }
//
// public void setDrawHorizontal(boolean isDraw) {
// isDrawHorizontal = isDraw;
// }
//
// public void setDrawVertical(boolean isDraw) {
// isDrawVertical = isDraw;
// }
//
// public static LineItemDecorator getInstance() {
// if (null == lineItemDecorator) {
// synchronized (LineItemDecorator.class) {
// lineItemDecorator = new LineItemDecorator();
// }
// }
// return lineItemDecorator;
// }
//
// @Override
// public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
// super.getItemOffsets(outRect, view, parent, state);
// if (isDrawVertical) {
// outRect.top = 1;
// // outRect.left = dimension;
// // outRect.right = dimension;
// outRect.bottom = 1;
// }
// if (isDrawHorizontal){
// outRect.left = 1;
// // outRect.left = dimension;
// // outRect.right = dimension;
// outRect.right = 1;
// }
// }
//
//
// @Override
// public void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state) {
// super.onDraw(c, parent, state);
// if (isDrawHorizontal) {
// drawHrozontal(c, parent);
// }
// if (isDrawVertical){
// drawVertical(c, parent);
// }
// }
//
//
//
// private void drawVertical(Canvas c, RecyclerView parent) {
// int childCount = parent.getChildCount();
// if (childCount<1)return;
// // int left = parent.getPaddingLeft()+leftView.getLeft()+leftView.getPaddingLeft();
// int left = parent.getPaddingLeft();
// int right = parent.getWidth() - parent.getPaddingRight();
//
// Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
// paint.setColor(Color.LTGRAY);
// for (int i = 0; i < childCount; i++) {
// View child = parent.getChildAt(i);
// RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child
// .getLayoutParams();
// int top = child.getBottom()+params.bottomMargin;
// int bottom = top + 1;
// c.drawRect(left, top, right, bottom, paint);
// }
// }
//
// private void drawHrozontal(Canvas c, RecyclerView parent) {
// int childCount = parent.getChildCount();
// if (childCount<1)return;
// // int left = parent.getPaddingLeft()+leftView.getLeft()+leftView.getPaddingLeft();
// int top = parent.getPaddingTop();
// int bottom = parent.getHeight() - parent.getPaddingBottom();
//
// Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
// paint.setColor(Color.LTGRAY);
// for (int i = 0; i < childCount-1; i++) {
// View child = parent.getChildAt(i);
// RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child
// .getLayoutParams();
// int left = child.getRight()+params.rightMargin;
// int right = left + 1;
// c.drawRect(left, top, right, bottom, paint);
//
// }
// }
//
// }
//
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/utils/ScreenUtil.java
// public class ScreenUtil {
//
// public static int getScreenHeight(Activity activity) {
// DisplayMetrics displaymetrics = new DisplayMetrics();
// activity.getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
// return displaymetrics.heightPixels;
// }
//
// public static int getStatusBarHeight(Context context) {
// int statusBarHeight = 0;
// Resources res = context.getResources();
// int resourceId = res.getIdentifier("status_bar_height", "dimen", "android");
// if (resourceId > 0) {
// statusBarHeight = res.getDimensionPixelSize(resourceId);
// }
// return statusBarHeight;
// }
// }
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/widgets/BaseBottomSheetDialog.java
import android.app.Activity;
import android.content.Context;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.StyleRes;
import android.support.design.widget.BottomSheetBehavior;
import android.support.design.widget.BottomSheetDialog;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import com.zsorg.neteasecloudmusic.LineItemDecorator;
import com.zsorg.neteasecloudmusic.R;
import com.zsorg.neteasecloudmusic.utils.ScreenUtil;
import butterknife.BindView;
import butterknife.ButterKnife;
int measuredHeight = mParent.getMeasuredHeight();
int height = ScreenUtil.getScreenHeight(activity) - ScreenUtil.getStatusBarHeight(getContext());
measuredHeight = measuredHeight > height * 0.5 ? (int) (height * 0.5) : measuredHeight;
mBehavior.setPeekHeight(measuredHeight);
mBehavior.setHideable(true);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mParent.measure(0, 0);
}
private void init() {
View view = View.inflate(getContext(), R.layout.bottom_sheet_playlist, null);
setContentView(view);
mParent = (View) view.getParent();
mBehavior = BottomSheetBehavior.from(mParent);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
}
ButterKnife.bind(this,view);
| LineItemDecorator decorator = LineItemDecorator.getInstance(); |
piyell/NeteaseCloudMusic | app/src/main/java/com/zsorg/neteasecloudmusic/models/PlayerManager.java | // Path: app/src/main/java/com/zsorg/neteasecloudmusic/CONST.java
// public class CONST {
// public static final String MUSIC_TYPE = "MUSIC_TYPE";
// public static final int TYPE_SINGLE = 0;
// public static final int TYPE_SINGER = 1;
// public static final int TYPE_ALBUM = 2;
// public static final int TYPE_FOLDER = 3;
//
// public static final String INTENT_PLAYLIST_ID = "INTENT_PLAYLIST_ID";
// public static final String INTENT_PLAYLIST_POSITION = "INTENT_PLAYLIST_POSITION";
//
// public static final int DEFAULT_PLAYLIST_POSITION = 0;
// public static final int TEMP_PLAYLIST_ID = -1;
//
// public static final int IMAGE_LOADED = 1;
// public static final int IMAGE_REQUEST_LOADING = 2;
// public static final int PLAYLIST_FAVORITE = 0;
//
// public static final String SP_IS_FILTER_60 = "SP_IS_FILTER_60";
// public static final String SP_MUSIC_ORDER = "SP_MUSIC_ORDER";
// public static final int SP_MUSIC_ORDER_DEFAULT = 0;
// public static final int MUSIC_ORDER_LIST = 0;
// public static final int MUSIC_ORDER_SINGLE = 2;
// public static final int MUSIC_ORDER_RANDOM = 1;
// }
//
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/callbacks/OnTrackListener.java
// public interface OnTrackListener {
// void onTrack(int position);
//
// void onNext(MusicBean bean);
//
// void onPlayStateChange(boolean isPlay);
// }
//
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/models/beans/MusicBean.java
// public class MusicBean implements Parcelable{
// private final String mSinger;
// private final String mAlbum;
// private String mPath;
// private String mName;
// private long mDuration;
//
// protected MusicBean(Parcel in) {
// mSinger = in.readString();
// mAlbum = in.readString();
// mPath = in.readString();
// mName = in.readString();
// mDuration = in.readLong();
// }
//
// public static final Creator<MusicBean> CREATOR = new Creator<MusicBean>() {
// @Override
// public MusicBean createFromParcel(Parcel in) {
// return new MusicBean(in);
// }
//
// @Override
// public MusicBean[] newArray(int size) {
// return new MusicBean[size];
// }
// };
//
// @Override
// public int describeContents() {
// return 0;
// }
//
// @Override
// public void writeToParcel(Parcel parcel, int i) {
//
// parcel.writeString(mSinger);
// parcel.writeString(mAlbum);
// parcel.writeString(mPath);
// parcel.writeString(mName);
// parcel.writeLong(mDuration);
// }
//
// @Override
// public int hashCode() {
// return mPath==null?0:mPath.hashCode();
// }
//
// @Override
// public boolean equals(Object obj) {
// return obj instanceof MusicBean && (((MusicBean) obj).hashCode()==hashCode());
// }
//
// public MusicBean(String name, String singer, String album, long duration, String path) {
// mPath = path;
// mName = name;
// mSinger = singer;
// mAlbum = album;
// mDuration = duration;
// }
//
// public String getSinger() {
// return mSinger;
// }
//
// public String getAlbum() {
// return mAlbum;
// }
//
// public String getPath() {
// return mPath;
// }
//
// public void setPath(String mPath) {
// this.mPath = mPath;
// }
//
// public String getName() {
// return mName;
// }
//
// public void setName(String mName) {
// this.mName = mName;
// }
//
// public long getDuration() {
// return mDuration;
// }
//
// public void setDuration(long mDuration) {
// this.mDuration = mDuration;
// }
// }
| import android.content.Context;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Handler;
import android.os.Looper;
import com.zsorg.neteasecloudmusic.CONST;
import com.zsorg.neteasecloudmusic.callbacks.OnTrackListener;
import com.zsorg.neteasecloudmusic.models.beans.MusicBean;
import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.Random;
import java.util.concurrent.TimeUnit;
import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.functions.Consumer;
import io.reactivex.schedulers.Schedulers; | package com.zsorg.neteasecloudmusic.models;
/**
* Project:NeteaseCloudMusic
*
* @Author: piyel_000
* Created on 2017/1/24.
* E-mail:piyell@qq.com
*/
public class PlayerManager implements MediaPlayer.OnCompletionListener {
private static PlayerManager ourInstance;
private static MediaPlayer mPlayer;
private final ConfigModel mConfigModel;
| // Path: app/src/main/java/com/zsorg/neteasecloudmusic/CONST.java
// public class CONST {
// public static final String MUSIC_TYPE = "MUSIC_TYPE";
// public static final int TYPE_SINGLE = 0;
// public static final int TYPE_SINGER = 1;
// public static final int TYPE_ALBUM = 2;
// public static final int TYPE_FOLDER = 3;
//
// public static final String INTENT_PLAYLIST_ID = "INTENT_PLAYLIST_ID";
// public static final String INTENT_PLAYLIST_POSITION = "INTENT_PLAYLIST_POSITION";
//
// public static final int DEFAULT_PLAYLIST_POSITION = 0;
// public static final int TEMP_PLAYLIST_ID = -1;
//
// public static final int IMAGE_LOADED = 1;
// public static final int IMAGE_REQUEST_LOADING = 2;
// public static final int PLAYLIST_FAVORITE = 0;
//
// public static final String SP_IS_FILTER_60 = "SP_IS_FILTER_60";
// public static final String SP_MUSIC_ORDER = "SP_MUSIC_ORDER";
// public static final int SP_MUSIC_ORDER_DEFAULT = 0;
// public static final int MUSIC_ORDER_LIST = 0;
// public static final int MUSIC_ORDER_SINGLE = 2;
// public static final int MUSIC_ORDER_RANDOM = 1;
// }
//
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/callbacks/OnTrackListener.java
// public interface OnTrackListener {
// void onTrack(int position);
//
// void onNext(MusicBean bean);
//
// void onPlayStateChange(boolean isPlay);
// }
//
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/models/beans/MusicBean.java
// public class MusicBean implements Parcelable{
// private final String mSinger;
// private final String mAlbum;
// private String mPath;
// private String mName;
// private long mDuration;
//
// protected MusicBean(Parcel in) {
// mSinger = in.readString();
// mAlbum = in.readString();
// mPath = in.readString();
// mName = in.readString();
// mDuration = in.readLong();
// }
//
// public static final Creator<MusicBean> CREATOR = new Creator<MusicBean>() {
// @Override
// public MusicBean createFromParcel(Parcel in) {
// return new MusicBean(in);
// }
//
// @Override
// public MusicBean[] newArray(int size) {
// return new MusicBean[size];
// }
// };
//
// @Override
// public int describeContents() {
// return 0;
// }
//
// @Override
// public void writeToParcel(Parcel parcel, int i) {
//
// parcel.writeString(mSinger);
// parcel.writeString(mAlbum);
// parcel.writeString(mPath);
// parcel.writeString(mName);
// parcel.writeLong(mDuration);
// }
//
// @Override
// public int hashCode() {
// return mPath==null?0:mPath.hashCode();
// }
//
// @Override
// public boolean equals(Object obj) {
// return obj instanceof MusicBean && (((MusicBean) obj).hashCode()==hashCode());
// }
//
// public MusicBean(String name, String singer, String album, long duration, String path) {
// mPath = path;
// mName = name;
// mSinger = singer;
// mAlbum = album;
// mDuration = duration;
// }
//
// public String getSinger() {
// return mSinger;
// }
//
// public String getAlbum() {
// return mAlbum;
// }
//
// public String getPath() {
// return mPath;
// }
//
// public void setPath(String mPath) {
// this.mPath = mPath;
// }
//
// public String getName() {
// return mName;
// }
//
// public void setName(String mName) {
// this.mName = mName;
// }
//
// public long getDuration() {
// return mDuration;
// }
//
// public void setDuration(long mDuration) {
// this.mDuration = mDuration;
// }
// }
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/models/PlayerManager.java
import android.content.Context;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Handler;
import android.os.Looper;
import com.zsorg.neteasecloudmusic.CONST;
import com.zsorg.neteasecloudmusic.callbacks.OnTrackListener;
import com.zsorg.neteasecloudmusic.models.beans.MusicBean;
import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.Random;
import java.util.concurrent.TimeUnit;
import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.functions.Consumer;
import io.reactivex.schedulers.Schedulers;
package com.zsorg.neteasecloudmusic.models;
/**
* Project:NeteaseCloudMusic
*
* @Author: piyel_000
* Created on 2017/1/24.
* E-mail:piyell@qq.com
*/
public class PlayerManager implements MediaPlayer.OnCompletionListener {
private static PlayerManager ourInstance;
private static MediaPlayer mPlayer;
private final ConfigModel mConfigModel;
| private List<MusicBean> mCurrentPlaylist; |
piyell/NeteaseCloudMusic | app/src/main/java/com/zsorg/neteasecloudmusic/models/PlayerManager.java | // Path: app/src/main/java/com/zsorg/neteasecloudmusic/CONST.java
// public class CONST {
// public static final String MUSIC_TYPE = "MUSIC_TYPE";
// public static final int TYPE_SINGLE = 0;
// public static final int TYPE_SINGER = 1;
// public static final int TYPE_ALBUM = 2;
// public static final int TYPE_FOLDER = 3;
//
// public static final String INTENT_PLAYLIST_ID = "INTENT_PLAYLIST_ID";
// public static final String INTENT_PLAYLIST_POSITION = "INTENT_PLAYLIST_POSITION";
//
// public static final int DEFAULT_PLAYLIST_POSITION = 0;
// public static final int TEMP_PLAYLIST_ID = -1;
//
// public static final int IMAGE_LOADED = 1;
// public static final int IMAGE_REQUEST_LOADING = 2;
// public static final int PLAYLIST_FAVORITE = 0;
//
// public static final String SP_IS_FILTER_60 = "SP_IS_FILTER_60";
// public static final String SP_MUSIC_ORDER = "SP_MUSIC_ORDER";
// public static final int SP_MUSIC_ORDER_DEFAULT = 0;
// public static final int MUSIC_ORDER_LIST = 0;
// public static final int MUSIC_ORDER_SINGLE = 2;
// public static final int MUSIC_ORDER_RANDOM = 1;
// }
//
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/callbacks/OnTrackListener.java
// public interface OnTrackListener {
// void onTrack(int position);
//
// void onNext(MusicBean bean);
//
// void onPlayStateChange(boolean isPlay);
// }
//
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/models/beans/MusicBean.java
// public class MusicBean implements Parcelable{
// private final String mSinger;
// private final String mAlbum;
// private String mPath;
// private String mName;
// private long mDuration;
//
// protected MusicBean(Parcel in) {
// mSinger = in.readString();
// mAlbum = in.readString();
// mPath = in.readString();
// mName = in.readString();
// mDuration = in.readLong();
// }
//
// public static final Creator<MusicBean> CREATOR = new Creator<MusicBean>() {
// @Override
// public MusicBean createFromParcel(Parcel in) {
// return new MusicBean(in);
// }
//
// @Override
// public MusicBean[] newArray(int size) {
// return new MusicBean[size];
// }
// };
//
// @Override
// public int describeContents() {
// return 0;
// }
//
// @Override
// public void writeToParcel(Parcel parcel, int i) {
//
// parcel.writeString(mSinger);
// parcel.writeString(mAlbum);
// parcel.writeString(mPath);
// parcel.writeString(mName);
// parcel.writeLong(mDuration);
// }
//
// @Override
// public int hashCode() {
// return mPath==null?0:mPath.hashCode();
// }
//
// @Override
// public boolean equals(Object obj) {
// return obj instanceof MusicBean && (((MusicBean) obj).hashCode()==hashCode());
// }
//
// public MusicBean(String name, String singer, String album, long duration, String path) {
// mPath = path;
// mName = name;
// mSinger = singer;
// mAlbum = album;
// mDuration = duration;
// }
//
// public String getSinger() {
// return mSinger;
// }
//
// public String getAlbum() {
// return mAlbum;
// }
//
// public String getPath() {
// return mPath;
// }
//
// public void setPath(String mPath) {
// this.mPath = mPath;
// }
//
// public String getName() {
// return mName;
// }
//
// public void setName(String mName) {
// this.mName = mName;
// }
//
// public long getDuration() {
// return mDuration;
// }
//
// public void setDuration(long mDuration) {
// this.mDuration = mDuration;
// }
// }
| import android.content.Context;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Handler;
import android.os.Looper;
import com.zsorg.neteasecloudmusic.CONST;
import com.zsorg.neteasecloudmusic.callbacks.OnTrackListener;
import com.zsorg.neteasecloudmusic.models.beans.MusicBean;
import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.Random;
import java.util.concurrent.TimeUnit;
import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.functions.Consumer;
import io.reactivex.schedulers.Schedulers; | package com.zsorg.neteasecloudmusic.models;
/**
* Project:NeteaseCloudMusic
*
* @Author: piyel_000
* Created on 2017/1/24.
* E-mail:piyell@qq.com
*/
public class PlayerManager implements MediaPlayer.OnCompletionListener {
private static PlayerManager ourInstance;
private static MediaPlayer mPlayer;
private final ConfigModel mConfigModel;
private List<MusicBean> mCurrentPlaylist;
private int mPosition; | // Path: app/src/main/java/com/zsorg/neteasecloudmusic/CONST.java
// public class CONST {
// public static final String MUSIC_TYPE = "MUSIC_TYPE";
// public static final int TYPE_SINGLE = 0;
// public static final int TYPE_SINGER = 1;
// public static final int TYPE_ALBUM = 2;
// public static final int TYPE_FOLDER = 3;
//
// public static final String INTENT_PLAYLIST_ID = "INTENT_PLAYLIST_ID";
// public static final String INTENT_PLAYLIST_POSITION = "INTENT_PLAYLIST_POSITION";
//
// public static final int DEFAULT_PLAYLIST_POSITION = 0;
// public static final int TEMP_PLAYLIST_ID = -1;
//
// public static final int IMAGE_LOADED = 1;
// public static final int IMAGE_REQUEST_LOADING = 2;
// public static final int PLAYLIST_FAVORITE = 0;
//
// public static final String SP_IS_FILTER_60 = "SP_IS_FILTER_60";
// public static final String SP_MUSIC_ORDER = "SP_MUSIC_ORDER";
// public static final int SP_MUSIC_ORDER_DEFAULT = 0;
// public static final int MUSIC_ORDER_LIST = 0;
// public static final int MUSIC_ORDER_SINGLE = 2;
// public static final int MUSIC_ORDER_RANDOM = 1;
// }
//
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/callbacks/OnTrackListener.java
// public interface OnTrackListener {
// void onTrack(int position);
//
// void onNext(MusicBean bean);
//
// void onPlayStateChange(boolean isPlay);
// }
//
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/models/beans/MusicBean.java
// public class MusicBean implements Parcelable{
// private final String mSinger;
// private final String mAlbum;
// private String mPath;
// private String mName;
// private long mDuration;
//
// protected MusicBean(Parcel in) {
// mSinger = in.readString();
// mAlbum = in.readString();
// mPath = in.readString();
// mName = in.readString();
// mDuration = in.readLong();
// }
//
// public static final Creator<MusicBean> CREATOR = new Creator<MusicBean>() {
// @Override
// public MusicBean createFromParcel(Parcel in) {
// return new MusicBean(in);
// }
//
// @Override
// public MusicBean[] newArray(int size) {
// return new MusicBean[size];
// }
// };
//
// @Override
// public int describeContents() {
// return 0;
// }
//
// @Override
// public void writeToParcel(Parcel parcel, int i) {
//
// parcel.writeString(mSinger);
// parcel.writeString(mAlbum);
// parcel.writeString(mPath);
// parcel.writeString(mName);
// parcel.writeLong(mDuration);
// }
//
// @Override
// public int hashCode() {
// return mPath==null?0:mPath.hashCode();
// }
//
// @Override
// public boolean equals(Object obj) {
// return obj instanceof MusicBean && (((MusicBean) obj).hashCode()==hashCode());
// }
//
// public MusicBean(String name, String singer, String album, long duration, String path) {
// mPath = path;
// mName = name;
// mSinger = singer;
// mAlbum = album;
// mDuration = duration;
// }
//
// public String getSinger() {
// return mSinger;
// }
//
// public String getAlbum() {
// return mAlbum;
// }
//
// public String getPath() {
// return mPath;
// }
//
// public void setPath(String mPath) {
// this.mPath = mPath;
// }
//
// public String getName() {
// return mName;
// }
//
// public void setName(String mName) {
// this.mName = mName;
// }
//
// public long getDuration() {
// return mDuration;
// }
//
// public void setDuration(long mDuration) {
// this.mDuration = mDuration;
// }
// }
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/models/PlayerManager.java
import android.content.Context;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Handler;
import android.os.Looper;
import com.zsorg.neteasecloudmusic.CONST;
import com.zsorg.neteasecloudmusic.callbacks.OnTrackListener;
import com.zsorg.neteasecloudmusic.models.beans.MusicBean;
import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.Random;
import java.util.concurrent.TimeUnit;
import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.functions.Consumer;
import io.reactivex.schedulers.Schedulers;
package com.zsorg.neteasecloudmusic.models;
/**
* Project:NeteaseCloudMusic
*
* @Author: piyel_000
* Created on 2017/1/24.
* E-mail:piyell@qq.com
*/
public class PlayerManager implements MediaPlayer.OnCompletionListener {
private static PlayerManager ourInstance;
private static MediaPlayer mPlayer;
private final ConfigModel mConfigModel;
private List<MusicBean> mCurrentPlaylist;
private int mPosition; | private OnTrackListener onTrackListener; |
piyell/NeteaseCloudMusic | app/src/main/java/com/zsorg/neteasecloudmusic/models/PlayerManager.java | // Path: app/src/main/java/com/zsorg/neteasecloudmusic/CONST.java
// public class CONST {
// public static final String MUSIC_TYPE = "MUSIC_TYPE";
// public static final int TYPE_SINGLE = 0;
// public static final int TYPE_SINGER = 1;
// public static final int TYPE_ALBUM = 2;
// public static final int TYPE_FOLDER = 3;
//
// public static final String INTENT_PLAYLIST_ID = "INTENT_PLAYLIST_ID";
// public static final String INTENT_PLAYLIST_POSITION = "INTENT_PLAYLIST_POSITION";
//
// public static final int DEFAULT_PLAYLIST_POSITION = 0;
// public static final int TEMP_PLAYLIST_ID = -1;
//
// public static final int IMAGE_LOADED = 1;
// public static final int IMAGE_REQUEST_LOADING = 2;
// public static final int PLAYLIST_FAVORITE = 0;
//
// public static final String SP_IS_FILTER_60 = "SP_IS_FILTER_60";
// public static final String SP_MUSIC_ORDER = "SP_MUSIC_ORDER";
// public static final int SP_MUSIC_ORDER_DEFAULT = 0;
// public static final int MUSIC_ORDER_LIST = 0;
// public static final int MUSIC_ORDER_SINGLE = 2;
// public static final int MUSIC_ORDER_RANDOM = 1;
// }
//
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/callbacks/OnTrackListener.java
// public interface OnTrackListener {
// void onTrack(int position);
//
// void onNext(MusicBean bean);
//
// void onPlayStateChange(boolean isPlay);
// }
//
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/models/beans/MusicBean.java
// public class MusicBean implements Parcelable{
// private final String mSinger;
// private final String mAlbum;
// private String mPath;
// private String mName;
// private long mDuration;
//
// protected MusicBean(Parcel in) {
// mSinger = in.readString();
// mAlbum = in.readString();
// mPath = in.readString();
// mName = in.readString();
// mDuration = in.readLong();
// }
//
// public static final Creator<MusicBean> CREATOR = new Creator<MusicBean>() {
// @Override
// public MusicBean createFromParcel(Parcel in) {
// return new MusicBean(in);
// }
//
// @Override
// public MusicBean[] newArray(int size) {
// return new MusicBean[size];
// }
// };
//
// @Override
// public int describeContents() {
// return 0;
// }
//
// @Override
// public void writeToParcel(Parcel parcel, int i) {
//
// parcel.writeString(mSinger);
// parcel.writeString(mAlbum);
// parcel.writeString(mPath);
// parcel.writeString(mName);
// parcel.writeLong(mDuration);
// }
//
// @Override
// public int hashCode() {
// return mPath==null?0:mPath.hashCode();
// }
//
// @Override
// public boolean equals(Object obj) {
// return obj instanceof MusicBean && (((MusicBean) obj).hashCode()==hashCode());
// }
//
// public MusicBean(String name, String singer, String album, long duration, String path) {
// mPath = path;
// mName = name;
// mSinger = singer;
// mAlbum = album;
// mDuration = duration;
// }
//
// public String getSinger() {
// return mSinger;
// }
//
// public String getAlbum() {
// return mAlbum;
// }
//
// public String getPath() {
// return mPath;
// }
//
// public void setPath(String mPath) {
// this.mPath = mPath;
// }
//
// public String getName() {
// return mName;
// }
//
// public void setName(String mName) {
// this.mName = mName;
// }
//
// public long getDuration() {
// return mDuration;
// }
//
// public void setDuration(long mDuration) {
// this.mDuration = mDuration;
// }
// }
| import android.content.Context;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Handler;
import android.os.Looper;
import com.zsorg.neteasecloudmusic.CONST;
import com.zsorg.neteasecloudmusic.callbacks.OnTrackListener;
import com.zsorg.neteasecloudmusic.models.beans.MusicBean;
import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.Random;
import java.util.concurrent.TimeUnit;
import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.functions.Consumer;
import io.reactivex.schedulers.Schedulers; | }
} else if (!isPause) {
playMusic(context);
}
}
public void setOnTrackListener(OnTrackListener listener) {
onTrackListener = listener;
if (null != listener) {
if (null != mPlayer) {
listener.onPlayStateChange(mPlayer.isPlaying());
} else {
listener.onPlayStateChange(false);
}
}
}
public boolean isPause() {
if (null != mPlayer && mPlayer.isPlaying()) {
return false;
}
return true;
}
@Override
public void onCompletion(MediaPlayer mediaPlayer) {
if (null!=mPlayer && !mPlayer.isPlaying() && mPlayer.getCurrentPosition()+200>=mPlayer.getDuration()) {
int musicOrder = mConfigModel.getMusicOrder();
switch (musicOrder) { | // Path: app/src/main/java/com/zsorg/neteasecloudmusic/CONST.java
// public class CONST {
// public static final String MUSIC_TYPE = "MUSIC_TYPE";
// public static final int TYPE_SINGLE = 0;
// public static final int TYPE_SINGER = 1;
// public static final int TYPE_ALBUM = 2;
// public static final int TYPE_FOLDER = 3;
//
// public static final String INTENT_PLAYLIST_ID = "INTENT_PLAYLIST_ID";
// public static final String INTENT_PLAYLIST_POSITION = "INTENT_PLAYLIST_POSITION";
//
// public static final int DEFAULT_PLAYLIST_POSITION = 0;
// public static final int TEMP_PLAYLIST_ID = -1;
//
// public static final int IMAGE_LOADED = 1;
// public static final int IMAGE_REQUEST_LOADING = 2;
// public static final int PLAYLIST_FAVORITE = 0;
//
// public static final String SP_IS_FILTER_60 = "SP_IS_FILTER_60";
// public static final String SP_MUSIC_ORDER = "SP_MUSIC_ORDER";
// public static final int SP_MUSIC_ORDER_DEFAULT = 0;
// public static final int MUSIC_ORDER_LIST = 0;
// public static final int MUSIC_ORDER_SINGLE = 2;
// public static final int MUSIC_ORDER_RANDOM = 1;
// }
//
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/callbacks/OnTrackListener.java
// public interface OnTrackListener {
// void onTrack(int position);
//
// void onNext(MusicBean bean);
//
// void onPlayStateChange(boolean isPlay);
// }
//
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/models/beans/MusicBean.java
// public class MusicBean implements Parcelable{
// private final String mSinger;
// private final String mAlbum;
// private String mPath;
// private String mName;
// private long mDuration;
//
// protected MusicBean(Parcel in) {
// mSinger = in.readString();
// mAlbum = in.readString();
// mPath = in.readString();
// mName = in.readString();
// mDuration = in.readLong();
// }
//
// public static final Creator<MusicBean> CREATOR = new Creator<MusicBean>() {
// @Override
// public MusicBean createFromParcel(Parcel in) {
// return new MusicBean(in);
// }
//
// @Override
// public MusicBean[] newArray(int size) {
// return new MusicBean[size];
// }
// };
//
// @Override
// public int describeContents() {
// return 0;
// }
//
// @Override
// public void writeToParcel(Parcel parcel, int i) {
//
// parcel.writeString(mSinger);
// parcel.writeString(mAlbum);
// parcel.writeString(mPath);
// parcel.writeString(mName);
// parcel.writeLong(mDuration);
// }
//
// @Override
// public int hashCode() {
// return mPath==null?0:mPath.hashCode();
// }
//
// @Override
// public boolean equals(Object obj) {
// return obj instanceof MusicBean && (((MusicBean) obj).hashCode()==hashCode());
// }
//
// public MusicBean(String name, String singer, String album, long duration, String path) {
// mPath = path;
// mName = name;
// mSinger = singer;
// mAlbum = album;
// mDuration = duration;
// }
//
// public String getSinger() {
// return mSinger;
// }
//
// public String getAlbum() {
// return mAlbum;
// }
//
// public String getPath() {
// return mPath;
// }
//
// public void setPath(String mPath) {
// this.mPath = mPath;
// }
//
// public String getName() {
// return mName;
// }
//
// public void setName(String mName) {
// this.mName = mName;
// }
//
// public long getDuration() {
// return mDuration;
// }
//
// public void setDuration(long mDuration) {
// this.mDuration = mDuration;
// }
// }
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/models/PlayerManager.java
import android.content.Context;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Handler;
import android.os.Looper;
import com.zsorg.neteasecloudmusic.CONST;
import com.zsorg.neteasecloudmusic.callbacks.OnTrackListener;
import com.zsorg.neteasecloudmusic.models.beans.MusicBean;
import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.Random;
import java.util.concurrent.TimeUnit;
import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.functions.Consumer;
import io.reactivex.schedulers.Schedulers;
}
} else if (!isPause) {
playMusic(context);
}
}
public void setOnTrackListener(OnTrackListener listener) {
onTrackListener = listener;
if (null != listener) {
if (null != mPlayer) {
listener.onPlayStateChange(mPlayer.isPlaying());
} else {
listener.onPlayStateChange(false);
}
}
}
public boolean isPause() {
if (null != mPlayer && mPlayer.isPlaying()) {
return false;
}
return true;
}
@Override
public void onCompletion(MediaPlayer mediaPlayer) {
if (null!=mPlayer && !mPlayer.isPlaying() && mPlayer.getCurrentPosition()+200>=mPlayer.getDuration()) {
int musicOrder = mConfigModel.getMusicOrder();
switch (musicOrder) { | case CONST.MUSIC_ORDER_SINGLE: |
piyell/NeteaseCloudMusic | app/src/main/java/com/zsorg/neteasecloudmusic/models/SingleSongMenuModel.java | // Path: app/src/main/java/com/zsorg/neteasecloudmusic/models/beans/MenuBean.java
// public class MenuBean {
// private String mName;
// private int mIconID;
//
// public MenuBean() {
//
// }
//
// public MenuBean(String name, int iconID) {
// mName = name;
// mIconID = iconID;
// }
//
// public String getName() {
// return mName;
// }
//
// public void setName(String name) {
// this.mName = name;
// }
//
// public int getIconID() {
// return mIconID;
// }
//
// public void setIconID(int iconID) {
// this.mIconID = iconID;
// }
// }
| import android.content.Context;
import android.support.annotation.NonNull;
import com.zsorg.neteasecloudmusic.R;
import com.zsorg.neteasecloudmusic.models.beans.MenuBean;
import java.util.ArrayList;
import java.util.List; | package com.zsorg.neteasecloudmusic.models;
/**
* Project:NeteaseCloudMusic
*
* @Author: piyel_000
* Created on 2017/1/31.
* E-mail:piyell@qq.com
*/
public class SingleSongMenuModel implements IMenuModel{
private static SingleSongMenuModel mModel;
| // Path: app/src/main/java/com/zsorg/neteasecloudmusic/models/beans/MenuBean.java
// public class MenuBean {
// private String mName;
// private int mIconID;
//
// public MenuBean() {
//
// }
//
// public MenuBean(String name, int iconID) {
// mName = name;
// mIconID = iconID;
// }
//
// public String getName() {
// return mName;
// }
//
// public void setName(String name) {
// this.mName = name;
// }
//
// public int getIconID() {
// return mIconID;
// }
//
// public void setIconID(int iconID) {
// this.mIconID = iconID;
// }
// }
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/models/SingleSongMenuModel.java
import android.content.Context;
import android.support.annotation.NonNull;
import com.zsorg.neteasecloudmusic.R;
import com.zsorg.neteasecloudmusic.models.beans.MenuBean;
import java.util.ArrayList;
import java.util.List;
package com.zsorg.neteasecloudmusic.models;
/**
* Project:NeteaseCloudMusic
*
* @Author: piyel_000
* Created on 2017/1/31.
* E-mail:piyell@qq.com
*/
public class SingleSongMenuModel implements IMenuModel{
private static SingleSongMenuModel mModel;
| List<MenuBean> mList; |
piyell/NeteaseCloudMusic | app/src/main/java/com/zsorg/neteasecloudmusic/adapters/MainAdapter.java | // Path: app/src/main/java/com/zsorg/neteasecloudmusic/fragments/MusicFragment.java
// public class MusicFragment extends Fragment implements ViewPager.OnPageChangeListener {
//
// @BindView(R.id.music_tab)
// TabLayout mTabLayout;
// @BindView(R.id.music_viewpager)
// ViewPager mViewpager;
//
// private MusicPagerAdapter mAdapter;
// private int mCurrentPosition=0;
//
// public MusicFragment() {
// // Required empty public constructor
// }
//
// /**
// * Use this factory method to create a new instance of
// * this fragment using the provided parameters.
// *
// * @return A new instance of fragment MusicFragment.
// */
// public static MusicFragment newInstance() {
// return new MusicFragment();
// }
//
// @Override
// public void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// }
//
// @Override
// public void onResume() {
// super.onResume();
// Fragment fragment = null;
// if (null!=mAdapter) {
// fragment = mAdapter.getItem(mCurrentPosition);
// }
// if (null!=fragment) {
// fragment.onResume();
// }
// }
//
// @Override
// public View onCreateView(LayoutInflater inflater, ViewGroup container,
// Bundle savedInstanceState) {
// // Inflate the layout for this fragment
// View view = inflater.inflate(R.layout.fragment_music, container, false);
// ButterKnife.bind(this, view);
//
// Log.e("tag", "onCreateView");
// mAdapter = new MusicPagerAdapter(view, getChildFragmentManager());
// mViewpager.setAdapter(mAdapter);
// mViewpager.addOnPageChangeListener(this);
// mTabLayout.setupWithViewPager(mViewpager);
//
// return view;
// }
//
// @Override
// public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
//
// }
//
// @Override
// public void onPageSelected(int position) {
// mCurrentPosition = position;
// mAdapter.getItem(mCurrentPosition).onResume();
// }
//
// @Override
// public void onPageScrollStateChanged(int state) {
//
// }
//
// /**
// * This interface must be implemented by activities that contain this
// * fragment to allow an interaction in this fragment to be communicated
// * to the activity and potentially other fragments contained in that
// * activity.
// * <p>
// * See the Android Training lesson <a href=
// * "http://developer.android.com/training/basics/fragments/communicating.html"
// * >Communicating with Other Fragments</a> for more information.
// */
// public interface OnFragmentInteractionListener {
// // TODO: Update argument type and name
// void onFragmentInteraction(Uri uri);
// }
// }
//
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/fragments/PlayListFragment.java
// public class PlayListFragment extends Fragment implements IPlaylistView, OnItemCLickListener {
//
// private PlaylistAdapter mAdapter;
// private PlaylistPresenter mPresenter;
//
// public PlayListFragment() {
// }
//
// @SuppressWarnings("unused")
// public static PlayListFragment newInstance() {
// return new PlayListFragment();
// }
//
// @Override
// public void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
//
// }
//
// @Override
// public void onResume() {
// super.onResume();
// mPresenter.requestList();
// }
//
// @Override
// public View onCreateView(LayoutInflater inflater, ViewGroup container,
// Bundle savedInstanceState) {
// View view = inflater.inflate(R.layout.fragment_play_list, container, false);
//
// // Set the adapter
// if (view instanceof RecyclerView) {
// Context context = view.getContext();
// RecyclerView recyclerView = (RecyclerView) view;
// recyclerView.setLayoutManager(new LinearLayoutManager(context));
// recyclerView.addItemDecoration(LineItemDecorator.getInstance());
// mAdapter = new PlaylistAdapter(getActivity().getLayoutInflater());
// mAdapter.setOnItemClickListener(this);
// mAdapter.addHeaderView(inflater.inflate(R.layout.play_list_header,null));
// recyclerView.setAdapter(mAdapter);
// mPresenter = new PlaylistPresenter(this);
// }
// return view;
// }
//
// @Override
// public void showItems(List<MusicBean> list) {
// if (null != mAdapter && null != list) {
// mAdapter.setDatas(list);
// mAdapter.notifyDataSetChanged();
// }
// }
//
// @Override
// public void onItemClick(View view, int position) {
// if (position>0) {
// MusicBean bean = mAdapter.getDataAtPosition(position);
// MusicListActivity.startMusicList(getContext(), bean.getName(),mPresenter.loadPlaylist((int) bean.getDuration()));
// }
// }
// }
| import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import com.zsorg.neteasecloudmusic.fragments.MusicFragment;
import com.zsorg.neteasecloudmusic.fragments.PlayListFragment;
import java.util.ArrayList; | package com.zsorg.neteasecloudmusic.adapters;
/**
* Created by piyel_000 on 2017/1/2.
*/
public class MainAdapter extends FragmentPagerAdapter implements IFragmentAdapter {
private final ArrayList<Fragment> mList;
public MainAdapter(FragmentManager fm) {
super(fm);
mList = new ArrayList<>(); | // Path: app/src/main/java/com/zsorg/neteasecloudmusic/fragments/MusicFragment.java
// public class MusicFragment extends Fragment implements ViewPager.OnPageChangeListener {
//
// @BindView(R.id.music_tab)
// TabLayout mTabLayout;
// @BindView(R.id.music_viewpager)
// ViewPager mViewpager;
//
// private MusicPagerAdapter mAdapter;
// private int mCurrentPosition=0;
//
// public MusicFragment() {
// // Required empty public constructor
// }
//
// /**
// * Use this factory method to create a new instance of
// * this fragment using the provided parameters.
// *
// * @return A new instance of fragment MusicFragment.
// */
// public static MusicFragment newInstance() {
// return new MusicFragment();
// }
//
// @Override
// public void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// }
//
// @Override
// public void onResume() {
// super.onResume();
// Fragment fragment = null;
// if (null!=mAdapter) {
// fragment = mAdapter.getItem(mCurrentPosition);
// }
// if (null!=fragment) {
// fragment.onResume();
// }
// }
//
// @Override
// public View onCreateView(LayoutInflater inflater, ViewGroup container,
// Bundle savedInstanceState) {
// // Inflate the layout for this fragment
// View view = inflater.inflate(R.layout.fragment_music, container, false);
// ButterKnife.bind(this, view);
//
// Log.e("tag", "onCreateView");
// mAdapter = new MusicPagerAdapter(view, getChildFragmentManager());
// mViewpager.setAdapter(mAdapter);
// mViewpager.addOnPageChangeListener(this);
// mTabLayout.setupWithViewPager(mViewpager);
//
// return view;
// }
//
// @Override
// public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
//
// }
//
// @Override
// public void onPageSelected(int position) {
// mCurrentPosition = position;
// mAdapter.getItem(mCurrentPosition).onResume();
// }
//
// @Override
// public void onPageScrollStateChanged(int state) {
//
// }
//
// /**
// * This interface must be implemented by activities that contain this
// * fragment to allow an interaction in this fragment to be communicated
// * to the activity and potentially other fragments contained in that
// * activity.
// * <p>
// * See the Android Training lesson <a href=
// * "http://developer.android.com/training/basics/fragments/communicating.html"
// * >Communicating with Other Fragments</a> for more information.
// */
// public interface OnFragmentInteractionListener {
// // TODO: Update argument type and name
// void onFragmentInteraction(Uri uri);
// }
// }
//
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/fragments/PlayListFragment.java
// public class PlayListFragment extends Fragment implements IPlaylistView, OnItemCLickListener {
//
// private PlaylistAdapter mAdapter;
// private PlaylistPresenter mPresenter;
//
// public PlayListFragment() {
// }
//
// @SuppressWarnings("unused")
// public static PlayListFragment newInstance() {
// return new PlayListFragment();
// }
//
// @Override
// public void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
//
// }
//
// @Override
// public void onResume() {
// super.onResume();
// mPresenter.requestList();
// }
//
// @Override
// public View onCreateView(LayoutInflater inflater, ViewGroup container,
// Bundle savedInstanceState) {
// View view = inflater.inflate(R.layout.fragment_play_list, container, false);
//
// // Set the adapter
// if (view instanceof RecyclerView) {
// Context context = view.getContext();
// RecyclerView recyclerView = (RecyclerView) view;
// recyclerView.setLayoutManager(new LinearLayoutManager(context));
// recyclerView.addItemDecoration(LineItemDecorator.getInstance());
// mAdapter = new PlaylistAdapter(getActivity().getLayoutInflater());
// mAdapter.setOnItemClickListener(this);
// mAdapter.addHeaderView(inflater.inflate(R.layout.play_list_header,null));
// recyclerView.setAdapter(mAdapter);
// mPresenter = new PlaylistPresenter(this);
// }
// return view;
// }
//
// @Override
// public void showItems(List<MusicBean> list) {
// if (null != mAdapter && null != list) {
// mAdapter.setDatas(list);
// mAdapter.notifyDataSetChanged();
// }
// }
//
// @Override
// public void onItemClick(View view, int position) {
// if (position>0) {
// MusicBean bean = mAdapter.getDataAtPosition(position);
// MusicListActivity.startMusicList(getContext(), bean.getName(),mPresenter.loadPlaylist((int) bean.getDuration()));
// }
// }
// }
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/adapters/MainAdapter.java
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import com.zsorg.neteasecloudmusic.fragments.MusicFragment;
import com.zsorg.neteasecloudmusic.fragments.PlayListFragment;
import java.util.ArrayList;
package com.zsorg.neteasecloudmusic.adapters;
/**
* Created by piyel_000 on 2017/1/2.
*/
public class MainAdapter extends FragmentPagerAdapter implements IFragmentAdapter {
private final ArrayList<Fragment> mList;
public MainAdapter(FragmentManager fm) {
super(fm);
mList = new ArrayList<>(); | mList.add(MusicFragment.newInstance()); |
piyell/NeteaseCloudMusic | app/src/main/java/com/zsorg/neteasecloudmusic/adapters/MainAdapter.java | // Path: app/src/main/java/com/zsorg/neteasecloudmusic/fragments/MusicFragment.java
// public class MusicFragment extends Fragment implements ViewPager.OnPageChangeListener {
//
// @BindView(R.id.music_tab)
// TabLayout mTabLayout;
// @BindView(R.id.music_viewpager)
// ViewPager mViewpager;
//
// private MusicPagerAdapter mAdapter;
// private int mCurrentPosition=0;
//
// public MusicFragment() {
// // Required empty public constructor
// }
//
// /**
// * Use this factory method to create a new instance of
// * this fragment using the provided parameters.
// *
// * @return A new instance of fragment MusicFragment.
// */
// public static MusicFragment newInstance() {
// return new MusicFragment();
// }
//
// @Override
// public void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// }
//
// @Override
// public void onResume() {
// super.onResume();
// Fragment fragment = null;
// if (null!=mAdapter) {
// fragment = mAdapter.getItem(mCurrentPosition);
// }
// if (null!=fragment) {
// fragment.onResume();
// }
// }
//
// @Override
// public View onCreateView(LayoutInflater inflater, ViewGroup container,
// Bundle savedInstanceState) {
// // Inflate the layout for this fragment
// View view = inflater.inflate(R.layout.fragment_music, container, false);
// ButterKnife.bind(this, view);
//
// Log.e("tag", "onCreateView");
// mAdapter = new MusicPagerAdapter(view, getChildFragmentManager());
// mViewpager.setAdapter(mAdapter);
// mViewpager.addOnPageChangeListener(this);
// mTabLayout.setupWithViewPager(mViewpager);
//
// return view;
// }
//
// @Override
// public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
//
// }
//
// @Override
// public void onPageSelected(int position) {
// mCurrentPosition = position;
// mAdapter.getItem(mCurrentPosition).onResume();
// }
//
// @Override
// public void onPageScrollStateChanged(int state) {
//
// }
//
// /**
// * This interface must be implemented by activities that contain this
// * fragment to allow an interaction in this fragment to be communicated
// * to the activity and potentially other fragments contained in that
// * activity.
// * <p>
// * See the Android Training lesson <a href=
// * "http://developer.android.com/training/basics/fragments/communicating.html"
// * >Communicating with Other Fragments</a> for more information.
// */
// public interface OnFragmentInteractionListener {
// // TODO: Update argument type and name
// void onFragmentInteraction(Uri uri);
// }
// }
//
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/fragments/PlayListFragment.java
// public class PlayListFragment extends Fragment implements IPlaylistView, OnItemCLickListener {
//
// private PlaylistAdapter mAdapter;
// private PlaylistPresenter mPresenter;
//
// public PlayListFragment() {
// }
//
// @SuppressWarnings("unused")
// public static PlayListFragment newInstance() {
// return new PlayListFragment();
// }
//
// @Override
// public void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
//
// }
//
// @Override
// public void onResume() {
// super.onResume();
// mPresenter.requestList();
// }
//
// @Override
// public View onCreateView(LayoutInflater inflater, ViewGroup container,
// Bundle savedInstanceState) {
// View view = inflater.inflate(R.layout.fragment_play_list, container, false);
//
// // Set the adapter
// if (view instanceof RecyclerView) {
// Context context = view.getContext();
// RecyclerView recyclerView = (RecyclerView) view;
// recyclerView.setLayoutManager(new LinearLayoutManager(context));
// recyclerView.addItemDecoration(LineItemDecorator.getInstance());
// mAdapter = new PlaylistAdapter(getActivity().getLayoutInflater());
// mAdapter.setOnItemClickListener(this);
// mAdapter.addHeaderView(inflater.inflate(R.layout.play_list_header,null));
// recyclerView.setAdapter(mAdapter);
// mPresenter = new PlaylistPresenter(this);
// }
// return view;
// }
//
// @Override
// public void showItems(List<MusicBean> list) {
// if (null != mAdapter && null != list) {
// mAdapter.setDatas(list);
// mAdapter.notifyDataSetChanged();
// }
// }
//
// @Override
// public void onItemClick(View view, int position) {
// if (position>0) {
// MusicBean bean = mAdapter.getDataAtPosition(position);
// MusicListActivity.startMusicList(getContext(), bean.getName(),mPresenter.loadPlaylist((int) bean.getDuration()));
// }
// }
// }
| import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import com.zsorg.neteasecloudmusic.fragments.MusicFragment;
import com.zsorg.neteasecloudmusic.fragments.PlayListFragment;
import java.util.ArrayList; | package com.zsorg.neteasecloudmusic.adapters;
/**
* Created by piyel_000 on 2017/1/2.
*/
public class MainAdapter extends FragmentPagerAdapter implements IFragmentAdapter {
private final ArrayList<Fragment> mList;
public MainAdapter(FragmentManager fm) {
super(fm);
mList = new ArrayList<>();
mList.add(MusicFragment.newInstance()); | // Path: app/src/main/java/com/zsorg/neteasecloudmusic/fragments/MusicFragment.java
// public class MusicFragment extends Fragment implements ViewPager.OnPageChangeListener {
//
// @BindView(R.id.music_tab)
// TabLayout mTabLayout;
// @BindView(R.id.music_viewpager)
// ViewPager mViewpager;
//
// private MusicPagerAdapter mAdapter;
// private int mCurrentPosition=0;
//
// public MusicFragment() {
// // Required empty public constructor
// }
//
// /**
// * Use this factory method to create a new instance of
// * this fragment using the provided parameters.
// *
// * @return A new instance of fragment MusicFragment.
// */
// public static MusicFragment newInstance() {
// return new MusicFragment();
// }
//
// @Override
// public void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// }
//
// @Override
// public void onResume() {
// super.onResume();
// Fragment fragment = null;
// if (null!=mAdapter) {
// fragment = mAdapter.getItem(mCurrentPosition);
// }
// if (null!=fragment) {
// fragment.onResume();
// }
// }
//
// @Override
// public View onCreateView(LayoutInflater inflater, ViewGroup container,
// Bundle savedInstanceState) {
// // Inflate the layout for this fragment
// View view = inflater.inflate(R.layout.fragment_music, container, false);
// ButterKnife.bind(this, view);
//
// Log.e("tag", "onCreateView");
// mAdapter = new MusicPagerAdapter(view, getChildFragmentManager());
// mViewpager.setAdapter(mAdapter);
// mViewpager.addOnPageChangeListener(this);
// mTabLayout.setupWithViewPager(mViewpager);
//
// return view;
// }
//
// @Override
// public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
//
// }
//
// @Override
// public void onPageSelected(int position) {
// mCurrentPosition = position;
// mAdapter.getItem(mCurrentPosition).onResume();
// }
//
// @Override
// public void onPageScrollStateChanged(int state) {
//
// }
//
// /**
// * This interface must be implemented by activities that contain this
// * fragment to allow an interaction in this fragment to be communicated
// * to the activity and potentially other fragments contained in that
// * activity.
// * <p>
// * See the Android Training lesson <a href=
// * "http://developer.android.com/training/basics/fragments/communicating.html"
// * >Communicating with Other Fragments</a> for more information.
// */
// public interface OnFragmentInteractionListener {
// // TODO: Update argument type and name
// void onFragmentInteraction(Uri uri);
// }
// }
//
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/fragments/PlayListFragment.java
// public class PlayListFragment extends Fragment implements IPlaylistView, OnItemCLickListener {
//
// private PlaylistAdapter mAdapter;
// private PlaylistPresenter mPresenter;
//
// public PlayListFragment() {
// }
//
// @SuppressWarnings("unused")
// public static PlayListFragment newInstance() {
// return new PlayListFragment();
// }
//
// @Override
// public void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
//
// }
//
// @Override
// public void onResume() {
// super.onResume();
// mPresenter.requestList();
// }
//
// @Override
// public View onCreateView(LayoutInflater inflater, ViewGroup container,
// Bundle savedInstanceState) {
// View view = inflater.inflate(R.layout.fragment_play_list, container, false);
//
// // Set the adapter
// if (view instanceof RecyclerView) {
// Context context = view.getContext();
// RecyclerView recyclerView = (RecyclerView) view;
// recyclerView.setLayoutManager(new LinearLayoutManager(context));
// recyclerView.addItemDecoration(LineItemDecorator.getInstance());
// mAdapter = new PlaylistAdapter(getActivity().getLayoutInflater());
// mAdapter.setOnItemClickListener(this);
// mAdapter.addHeaderView(inflater.inflate(R.layout.play_list_header,null));
// recyclerView.setAdapter(mAdapter);
// mPresenter = new PlaylistPresenter(this);
// }
// return view;
// }
//
// @Override
// public void showItems(List<MusicBean> list) {
// if (null != mAdapter && null != list) {
// mAdapter.setDatas(list);
// mAdapter.notifyDataSetChanged();
// }
// }
//
// @Override
// public void onItemClick(View view, int position) {
// if (position>0) {
// MusicBean bean = mAdapter.getDataAtPosition(position);
// MusicListActivity.startMusicList(getContext(), bean.getName(),mPresenter.loadPlaylist((int) bean.getDuration()));
// }
// }
// }
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/adapters/MainAdapter.java
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import com.zsorg.neteasecloudmusic.fragments.MusicFragment;
import com.zsorg.neteasecloudmusic.fragments.PlayListFragment;
import java.util.ArrayList;
package com.zsorg.neteasecloudmusic.adapters;
/**
* Created by piyel_000 on 2017/1/2.
*/
public class MainAdapter extends FragmentPagerAdapter implements IFragmentAdapter {
private final ArrayList<Fragment> mList;
public MainAdapter(FragmentManager fm) {
super(fm);
mList = new ArrayList<>();
mList.add(MusicFragment.newInstance()); | mList.add(PlayListFragment.newInstance()); |
piyell/NeteaseCloudMusic | app/src/main/java/com/zsorg/neteasecloudmusic/activities/ScanMusicActivity.java | // Path: app/src/main/java/com/zsorg/neteasecloudmusic/presenters/ScanMusicPresenter.java
// public class ScanMusicPresenter {
//
// private final IScanMusicView iScanMusicView;
// private final DiskMusicDao mScanMusicDao;
//
// public ScanMusicPresenter(IScanMusicView scanMusicView) {
// iScanMusicView = scanMusicView;
// mScanMusicDao = new DiskMusicDao(scanMusicView.getContext());
// }
//
// public void scanMusic() {
// // final PlaylistModel playlistModel = new PlaylistModel(iScanMusicView.getContext());
// ScanMusicModel scanMusicModel = new ScanMusicModel();
// scanMusicModel.setIsFilter60s(ConfigModel.getInstance(iScanMusicView.getContext()).isFilter60s());
// scanMusicModel.scanMusicFile().observeOn(AndroidSchedulers.mainThread()).subscribe(new Subscriber<MusicBean>() {
// @Override
// public void onSubscribe(Subscription s) {
// iScanMusicView.startScan();
// mScanMusicDao.clearAll();
// s.request(Integer.MAX_VALUE);
// }
//
// @Override
// public void onNext(MusicBean musicBean) {
// mScanMusicDao.addMusic(musicBean);
// // playlistModel.addToPlaylist(CONST.TEMP_PLAYLIST_ID,musicBean.getPath());
// }
//
// @Override
// public void onError(Throwable t) {
// iScanMusicView.onError(t);
// }
//
// @Override
// public void onComplete() {
// iScanMusicView.finishScan();
// }
// });
//
// }
//
// }
//
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/views/IScanMusicView.java
// public interface IScanMusicView {
// void startScan();
//
// void finishScan();
//
// void onError(Throwable throwable);
//
// Context getContext();
// }
| import android.Manifest;
import android.content.Context;
import android.os.Bundle;
import android.support.graphics.drawable.VectorDrawableCompat;
import android.support.v4.app.ActivityCompat;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.view.animation.LinearInterpolator;
import android.view.animation.TranslateAnimation;
import android.widget.ImageView;
import android.widget.TextView;
import com.nineoldandroids.animation.ValueAnimator;
import com.nineoldandroids.view.ViewHelper;
import com.zsorg.neteasecloudmusic.R;
import com.zsorg.neteasecloudmusic.presenters.ScanMusicPresenter;
import com.zsorg.neteasecloudmusic.views.IScanMusicView;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick; | package com.zsorg.neteasecloudmusic.activities;
public class ScanMusicActivity extends AppCompatActivity implements IScanMusicView{
private final int radius = 40;
@BindView(R.id.iv_search)
ImageView ivSearch;
@BindView(R.id.iv_scan_effect)
ImageView ivScanEffect;
@BindView(R.id.tv_back)
TextView tvBack;
@BindView(R.id.tv_scan_or_cancel)
TextView tvScanOrCancel;
@BindView(R.id.tv_scan)
TextView tvScan;
private ValueAnimator searchAnimation;
private TranslateAnimation scanAnimation; | // Path: app/src/main/java/com/zsorg/neteasecloudmusic/presenters/ScanMusicPresenter.java
// public class ScanMusicPresenter {
//
// private final IScanMusicView iScanMusicView;
// private final DiskMusicDao mScanMusicDao;
//
// public ScanMusicPresenter(IScanMusicView scanMusicView) {
// iScanMusicView = scanMusicView;
// mScanMusicDao = new DiskMusicDao(scanMusicView.getContext());
// }
//
// public void scanMusic() {
// // final PlaylistModel playlistModel = new PlaylistModel(iScanMusicView.getContext());
// ScanMusicModel scanMusicModel = new ScanMusicModel();
// scanMusicModel.setIsFilter60s(ConfigModel.getInstance(iScanMusicView.getContext()).isFilter60s());
// scanMusicModel.scanMusicFile().observeOn(AndroidSchedulers.mainThread()).subscribe(new Subscriber<MusicBean>() {
// @Override
// public void onSubscribe(Subscription s) {
// iScanMusicView.startScan();
// mScanMusicDao.clearAll();
// s.request(Integer.MAX_VALUE);
// }
//
// @Override
// public void onNext(MusicBean musicBean) {
// mScanMusicDao.addMusic(musicBean);
// // playlistModel.addToPlaylist(CONST.TEMP_PLAYLIST_ID,musicBean.getPath());
// }
//
// @Override
// public void onError(Throwable t) {
// iScanMusicView.onError(t);
// }
//
// @Override
// public void onComplete() {
// iScanMusicView.finishScan();
// }
// });
//
// }
//
// }
//
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/views/IScanMusicView.java
// public interface IScanMusicView {
// void startScan();
//
// void finishScan();
//
// void onError(Throwable throwable);
//
// Context getContext();
// }
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/activities/ScanMusicActivity.java
import android.Manifest;
import android.content.Context;
import android.os.Bundle;
import android.support.graphics.drawable.VectorDrawableCompat;
import android.support.v4.app.ActivityCompat;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.view.animation.LinearInterpolator;
import android.view.animation.TranslateAnimation;
import android.widget.ImageView;
import android.widget.TextView;
import com.nineoldandroids.animation.ValueAnimator;
import com.nineoldandroids.view.ViewHelper;
import com.zsorg.neteasecloudmusic.R;
import com.zsorg.neteasecloudmusic.presenters.ScanMusicPresenter;
import com.zsorg.neteasecloudmusic.views.IScanMusicView;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
package com.zsorg.neteasecloudmusic.activities;
public class ScanMusicActivity extends AppCompatActivity implements IScanMusicView{
private final int radius = 40;
@BindView(R.id.iv_search)
ImageView ivSearch;
@BindView(R.id.iv_scan_effect)
ImageView ivScanEffect;
@BindView(R.id.tv_back)
TextView tvBack;
@BindView(R.id.tv_scan_or_cancel)
TextView tvScanOrCancel;
@BindView(R.id.tv_scan)
TextView tvScan;
private ValueAnimator searchAnimation;
private TranslateAnimation scanAnimation; | private ScanMusicPresenter mPresenter; |
piyell/NeteaseCloudMusic | app/src/main/java/com/zsorg/neteasecloudmusic/ConfigHolder.java | // Path: app/src/main/java/com/zsorg/neteasecloudmusic/callbacks/OnItemCLickListener.java
// public interface OnItemCLickListener {
// void onItemClick(View view, int position);
// }
| import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.SwitchCompat;
import android.view.View;
import android.widget.TextView;
import com.zsorg.neteasecloudmusic.callbacks.OnItemCLickListener;
import butterknife.BindView;
import butterknife.ButterKnife; | package com.zsorg.neteasecloudmusic;
/**
* Project:NeteaseCloudMusic
*
* @Author: piyel_000
* Created on 2017/2/9.
* E-mail:piyell@qq.com
*/
public class ConfigHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
@BindView(R.id.tv_right)
public TextView tvRight;
@BindView(R.id.tv_group_title)
public TextView tvGroup;
@BindView(R.id.tv_content_title)
public TextView tvContent;
@BindView(R.id.tv_item_title)
public TextView tvTitle;
@BindView(R.id.sc_right)
public SwitchCompat scRight;
@BindView(R.id.view_bottom)
public View bottom;
@BindView(R.id.layout_item)
public View item;
| // Path: app/src/main/java/com/zsorg/neteasecloudmusic/callbacks/OnItemCLickListener.java
// public interface OnItemCLickListener {
// void onItemClick(View view, int position);
// }
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/ConfigHolder.java
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.SwitchCompat;
import android.view.View;
import android.widget.TextView;
import com.zsorg.neteasecloudmusic.callbacks.OnItemCLickListener;
import butterknife.BindView;
import butterknife.ButterKnife;
package com.zsorg.neteasecloudmusic;
/**
* Project:NeteaseCloudMusic
*
* @Author: piyel_000
* Created on 2017/2/9.
* E-mail:piyell@qq.com
*/
public class ConfigHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
@BindView(R.id.tv_right)
public TextView tvRight;
@BindView(R.id.tv_group_title)
public TextView tvGroup;
@BindView(R.id.tv_content_title)
public TextView tvContent;
@BindView(R.id.tv_item_title)
public TextView tvTitle;
@BindView(R.id.sc_right)
public SwitchCompat scRight;
@BindView(R.id.view_bottom)
public View bottom;
@BindView(R.id.layout_item)
public View item;
| private OnItemCLickListener onItemClickListener; |
piyell/NeteaseCloudMusic | app/src/main/java/com/zsorg/neteasecloudmusic/adapters/BaseAdapter.java | // Path: app/src/main/java/com/zsorg/neteasecloudmusic/BaseHolder.java
// public class BaseHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
//
// private OnItemCLickListener onItemClickListener;
//
// public BaseHolder(View itemView) {
// super(itemView);
// if (null != itemView) {
// itemView.setOnClickListener(this);
// }
// }
//
// public void setOnItemClickListener(OnItemCLickListener onItemClickListener) {
// this.onItemClickListener = onItemClickListener;
// }
//
// @Override
// public void onClick(View view) {
// if (null!=onItemClickListener) {
// onItemClickListener.onItemClick(view,getAdapterPosition());
// }
// }
// }
//
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/callbacks/OnItemCLickListener.java
// public interface OnItemCLickListener {
// void onItemClick(View view, int position);
// }
//
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/models/beans/MusicBean.java
// public class MusicBean implements Parcelable{
// private final String mSinger;
// private final String mAlbum;
// private String mPath;
// private String mName;
// private long mDuration;
//
// protected MusicBean(Parcel in) {
// mSinger = in.readString();
// mAlbum = in.readString();
// mPath = in.readString();
// mName = in.readString();
// mDuration = in.readLong();
// }
//
// public static final Creator<MusicBean> CREATOR = new Creator<MusicBean>() {
// @Override
// public MusicBean createFromParcel(Parcel in) {
// return new MusicBean(in);
// }
//
// @Override
// public MusicBean[] newArray(int size) {
// return new MusicBean[size];
// }
// };
//
// @Override
// public int describeContents() {
// return 0;
// }
//
// @Override
// public void writeToParcel(Parcel parcel, int i) {
//
// parcel.writeString(mSinger);
// parcel.writeString(mAlbum);
// parcel.writeString(mPath);
// parcel.writeString(mName);
// parcel.writeLong(mDuration);
// }
//
// @Override
// public int hashCode() {
// return mPath==null?0:mPath.hashCode();
// }
//
// @Override
// public boolean equals(Object obj) {
// return obj instanceof MusicBean && (((MusicBean) obj).hashCode()==hashCode());
// }
//
// public MusicBean(String name, String singer, String album, long duration, String path) {
// mPath = path;
// mName = name;
// mSinger = singer;
// mAlbum = album;
// mDuration = duration;
// }
//
// public String getSinger() {
// return mSinger;
// }
//
// public String getAlbum() {
// return mAlbum;
// }
//
// public String getPath() {
// return mPath;
// }
//
// public void setPath(String mPath) {
// this.mPath = mPath;
// }
//
// public String getName() {
// return mName;
// }
//
// public void setName(String mName) {
// this.mName = mName;
// }
//
// public long getDuration() {
// return mDuration;
// }
//
// public void setDuration(long mDuration) {
// this.mDuration = mDuration;
// }
// }
| import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.zsorg.neteasecloudmusic.BaseHolder;
import com.zsorg.neteasecloudmusic.callbacks.OnItemCLickListener;
import com.zsorg.neteasecloudmusic.models.beans.MusicBean;
import java.util.ArrayList;
import java.util.List; | package com.zsorg.neteasecloudmusic.adapters;
/**
* Created by piyel_000 on 2017/1/5.
*/
public abstract class BaseAdapter<T extends BaseHolder> extends RecyclerView.Adapter<BaseHolder> {
public static final int TYPE_HEADER = Integer.MAX_VALUE;
public static final int TYPE_FOOTER = Integer.MIN_VALUE;
public final LayoutInflater mInflater;
| // Path: app/src/main/java/com/zsorg/neteasecloudmusic/BaseHolder.java
// public class BaseHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
//
// private OnItemCLickListener onItemClickListener;
//
// public BaseHolder(View itemView) {
// super(itemView);
// if (null != itemView) {
// itemView.setOnClickListener(this);
// }
// }
//
// public void setOnItemClickListener(OnItemCLickListener onItemClickListener) {
// this.onItemClickListener = onItemClickListener;
// }
//
// @Override
// public void onClick(View view) {
// if (null!=onItemClickListener) {
// onItemClickListener.onItemClick(view,getAdapterPosition());
// }
// }
// }
//
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/callbacks/OnItemCLickListener.java
// public interface OnItemCLickListener {
// void onItemClick(View view, int position);
// }
//
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/models/beans/MusicBean.java
// public class MusicBean implements Parcelable{
// private final String mSinger;
// private final String mAlbum;
// private String mPath;
// private String mName;
// private long mDuration;
//
// protected MusicBean(Parcel in) {
// mSinger = in.readString();
// mAlbum = in.readString();
// mPath = in.readString();
// mName = in.readString();
// mDuration = in.readLong();
// }
//
// public static final Creator<MusicBean> CREATOR = new Creator<MusicBean>() {
// @Override
// public MusicBean createFromParcel(Parcel in) {
// return new MusicBean(in);
// }
//
// @Override
// public MusicBean[] newArray(int size) {
// return new MusicBean[size];
// }
// };
//
// @Override
// public int describeContents() {
// return 0;
// }
//
// @Override
// public void writeToParcel(Parcel parcel, int i) {
//
// parcel.writeString(mSinger);
// parcel.writeString(mAlbum);
// parcel.writeString(mPath);
// parcel.writeString(mName);
// parcel.writeLong(mDuration);
// }
//
// @Override
// public int hashCode() {
// return mPath==null?0:mPath.hashCode();
// }
//
// @Override
// public boolean equals(Object obj) {
// return obj instanceof MusicBean && (((MusicBean) obj).hashCode()==hashCode());
// }
//
// public MusicBean(String name, String singer, String album, long duration, String path) {
// mPath = path;
// mName = name;
// mSinger = singer;
// mAlbum = album;
// mDuration = duration;
// }
//
// public String getSinger() {
// return mSinger;
// }
//
// public String getAlbum() {
// return mAlbum;
// }
//
// public String getPath() {
// return mPath;
// }
//
// public void setPath(String mPath) {
// this.mPath = mPath;
// }
//
// public String getName() {
// return mName;
// }
//
// public void setName(String mName) {
// this.mName = mName;
// }
//
// public long getDuration() {
// return mDuration;
// }
//
// public void setDuration(long mDuration) {
// this.mDuration = mDuration;
// }
// }
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/adapters/BaseAdapter.java
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.zsorg.neteasecloudmusic.BaseHolder;
import com.zsorg.neteasecloudmusic.callbacks.OnItemCLickListener;
import com.zsorg.neteasecloudmusic.models.beans.MusicBean;
import java.util.ArrayList;
import java.util.List;
package com.zsorg.neteasecloudmusic.adapters;
/**
* Created by piyel_000 on 2017/1/5.
*/
public abstract class BaseAdapter<T extends BaseHolder> extends RecyclerView.Adapter<BaseHolder> {
public static final int TYPE_HEADER = Integer.MAX_VALUE;
public static final int TYPE_FOOTER = Integer.MIN_VALUE;
public final LayoutInflater mInflater;
| private OnItemCLickListener mListener; |
piyell/NeteaseCloudMusic | app/src/main/java/com/zsorg/neteasecloudmusic/adapters/BaseAdapter.java | // Path: app/src/main/java/com/zsorg/neteasecloudmusic/BaseHolder.java
// public class BaseHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
//
// private OnItemCLickListener onItemClickListener;
//
// public BaseHolder(View itemView) {
// super(itemView);
// if (null != itemView) {
// itemView.setOnClickListener(this);
// }
// }
//
// public void setOnItemClickListener(OnItemCLickListener onItemClickListener) {
// this.onItemClickListener = onItemClickListener;
// }
//
// @Override
// public void onClick(View view) {
// if (null!=onItemClickListener) {
// onItemClickListener.onItemClick(view,getAdapterPosition());
// }
// }
// }
//
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/callbacks/OnItemCLickListener.java
// public interface OnItemCLickListener {
// void onItemClick(View view, int position);
// }
//
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/models/beans/MusicBean.java
// public class MusicBean implements Parcelable{
// private final String mSinger;
// private final String mAlbum;
// private String mPath;
// private String mName;
// private long mDuration;
//
// protected MusicBean(Parcel in) {
// mSinger = in.readString();
// mAlbum = in.readString();
// mPath = in.readString();
// mName = in.readString();
// mDuration = in.readLong();
// }
//
// public static final Creator<MusicBean> CREATOR = new Creator<MusicBean>() {
// @Override
// public MusicBean createFromParcel(Parcel in) {
// return new MusicBean(in);
// }
//
// @Override
// public MusicBean[] newArray(int size) {
// return new MusicBean[size];
// }
// };
//
// @Override
// public int describeContents() {
// return 0;
// }
//
// @Override
// public void writeToParcel(Parcel parcel, int i) {
//
// parcel.writeString(mSinger);
// parcel.writeString(mAlbum);
// parcel.writeString(mPath);
// parcel.writeString(mName);
// parcel.writeLong(mDuration);
// }
//
// @Override
// public int hashCode() {
// return mPath==null?0:mPath.hashCode();
// }
//
// @Override
// public boolean equals(Object obj) {
// return obj instanceof MusicBean && (((MusicBean) obj).hashCode()==hashCode());
// }
//
// public MusicBean(String name, String singer, String album, long duration, String path) {
// mPath = path;
// mName = name;
// mSinger = singer;
// mAlbum = album;
// mDuration = duration;
// }
//
// public String getSinger() {
// return mSinger;
// }
//
// public String getAlbum() {
// return mAlbum;
// }
//
// public String getPath() {
// return mPath;
// }
//
// public void setPath(String mPath) {
// this.mPath = mPath;
// }
//
// public String getName() {
// return mName;
// }
//
// public void setName(String mName) {
// this.mName = mName;
// }
//
// public long getDuration() {
// return mDuration;
// }
//
// public void setDuration(long mDuration) {
// this.mDuration = mDuration;
// }
// }
| import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.zsorg.neteasecloudmusic.BaseHolder;
import com.zsorg.neteasecloudmusic.callbacks.OnItemCLickListener;
import com.zsorg.neteasecloudmusic.models.beans.MusicBean;
import java.util.ArrayList;
import java.util.List; | package com.zsorg.neteasecloudmusic.adapters;
/**
* Created by piyel_000 on 2017/1/5.
*/
public abstract class BaseAdapter<T extends BaseHolder> extends RecyclerView.Adapter<BaseHolder> {
public static final int TYPE_HEADER = Integer.MAX_VALUE;
public static final int TYPE_FOOTER = Integer.MIN_VALUE;
public final LayoutInflater mInflater;
private OnItemCLickListener mListener;
private View mHeaderView;
private View mFooterView;
public BaseAdapter(@NonNull LayoutInflater inflater) {
mInflater = inflater;
}
public abstract BaseHolder onCreateHolder(ViewGroup parent, int viewType);
public abstract void onBindHolder(T holder, int position);
public abstract int getDataCount();
| // Path: app/src/main/java/com/zsorg/neteasecloudmusic/BaseHolder.java
// public class BaseHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
//
// private OnItemCLickListener onItemClickListener;
//
// public BaseHolder(View itemView) {
// super(itemView);
// if (null != itemView) {
// itemView.setOnClickListener(this);
// }
// }
//
// public void setOnItemClickListener(OnItemCLickListener onItemClickListener) {
// this.onItemClickListener = onItemClickListener;
// }
//
// @Override
// public void onClick(View view) {
// if (null!=onItemClickListener) {
// onItemClickListener.onItemClick(view,getAdapterPosition());
// }
// }
// }
//
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/callbacks/OnItemCLickListener.java
// public interface OnItemCLickListener {
// void onItemClick(View view, int position);
// }
//
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/models/beans/MusicBean.java
// public class MusicBean implements Parcelable{
// private final String mSinger;
// private final String mAlbum;
// private String mPath;
// private String mName;
// private long mDuration;
//
// protected MusicBean(Parcel in) {
// mSinger = in.readString();
// mAlbum = in.readString();
// mPath = in.readString();
// mName = in.readString();
// mDuration = in.readLong();
// }
//
// public static final Creator<MusicBean> CREATOR = new Creator<MusicBean>() {
// @Override
// public MusicBean createFromParcel(Parcel in) {
// return new MusicBean(in);
// }
//
// @Override
// public MusicBean[] newArray(int size) {
// return new MusicBean[size];
// }
// };
//
// @Override
// public int describeContents() {
// return 0;
// }
//
// @Override
// public void writeToParcel(Parcel parcel, int i) {
//
// parcel.writeString(mSinger);
// parcel.writeString(mAlbum);
// parcel.writeString(mPath);
// parcel.writeString(mName);
// parcel.writeLong(mDuration);
// }
//
// @Override
// public int hashCode() {
// return mPath==null?0:mPath.hashCode();
// }
//
// @Override
// public boolean equals(Object obj) {
// return obj instanceof MusicBean && (((MusicBean) obj).hashCode()==hashCode());
// }
//
// public MusicBean(String name, String singer, String album, long duration, String path) {
// mPath = path;
// mName = name;
// mSinger = singer;
// mAlbum = album;
// mDuration = duration;
// }
//
// public String getSinger() {
// return mSinger;
// }
//
// public String getAlbum() {
// return mAlbum;
// }
//
// public String getPath() {
// return mPath;
// }
//
// public void setPath(String mPath) {
// this.mPath = mPath;
// }
//
// public String getName() {
// return mName;
// }
//
// public void setName(String mName) {
// this.mName = mName;
// }
//
// public long getDuration() {
// return mDuration;
// }
//
// public void setDuration(long mDuration) {
// this.mDuration = mDuration;
// }
// }
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/adapters/BaseAdapter.java
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.zsorg.neteasecloudmusic.BaseHolder;
import com.zsorg.neteasecloudmusic.callbacks.OnItemCLickListener;
import com.zsorg.neteasecloudmusic.models.beans.MusicBean;
import java.util.ArrayList;
import java.util.List;
package com.zsorg.neteasecloudmusic.adapters;
/**
* Created by piyel_000 on 2017/1/5.
*/
public abstract class BaseAdapter<T extends BaseHolder> extends RecyclerView.Adapter<BaseHolder> {
public static final int TYPE_HEADER = Integer.MAX_VALUE;
public static final int TYPE_FOOTER = Integer.MIN_VALUE;
public final LayoutInflater mInflater;
private OnItemCLickListener mListener;
private View mHeaderView;
private View mFooterView;
public BaseAdapter(@NonNull LayoutInflater inflater) {
mInflater = inflater;
}
public abstract BaseHolder onCreateHolder(ViewGroup parent, int viewType);
public abstract void onBindHolder(T holder, int position);
public abstract int getDataCount();
| public void setDatas(List<MusicBean> list){} |
piyell/NeteaseCloudMusic | app/src/main/java/com/zsorg/neteasecloudmusic/models/db/DiskMusicDao.java | // Path: app/src/main/java/com/zsorg/neteasecloudmusic/models/beans/MusicBean.java
// public class MusicBean implements Parcelable{
// private final String mSinger;
// private final String mAlbum;
// private String mPath;
// private String mName;
// private long mDuration;
//
// protected MusicBean(Parcel in) {
// mSinger = in.readString();
// mAlbum = in.readString();
// mPath = in.readString();
// mName = in.readString();
// mDuration = in.readLong();
// }
//
// public static final Creator<MusicBean> CREATOR = new Creator<MusicBean>() {
// @Override
// public MusicBean createFromParcel(Parcel in) {
// return new MusicBean(in);
// }
//
// @Override
// public MusicBean[] newArray(int size) {
// return new MusicBean[size];
// }
// };
//
// @Override
// public int describeContents() {
// return 0;
// }
//
// @Override
// public void writeToParcel(Parcel parcel, int i) {
//
// parcel.writeString(mSinger);
// parcel.writeString(mAlbum);
// parcel.writeString(mPath);
// parcel.writeString(mName);
// parcel.writeLong(mDuration);
// }
//
// @Override
// public int hashCode() {
// return mPath==null?0:mPath.hashCode();
// }
//
// @Override
// public boolean equals(Object obj) {
// return obj instanceof MusicBean && (((MusicBean) obj).hashCode()==hashCode());
// }
//
// public MusicBean(String name, String singer, String album, long duration, String path) {
// mPath = path;
// mName = name;
// mSinger = singer;
// mAlbum = album;
// mDuration = duration;
// }
//
// public String getSinger() {
// return mSinger;
// }
//
// public String getAlbum() {
// return mAlbum;
// }
//
// public String getPath() {
// return mPath;
// }
//
// public void setPath(String mPath) {
// this.mPath = mPath;
// }
//
// public String getName() {
// return mName;
// }
//
// public void setName(String mName) {
// this.mName = mName;
// }
//
// public long getDuration() {
// return mDuration;
// }
//
// public void setDuration(long mDuration) {
// this.mDuration = mDuration;
// }
// }
//
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/utils/MusicUtil.java
// public class MusicUtil {
//
// public static boolean isMusic(File file) {
// return null!=file && file.getName().toLowerCase().endsWith(".mp3");
// }
//
// public static String getAlbumArt(Context mContext, String album_id) {
// String[] projection = new String[]{MediaStore.Audio.Albums.ALBUM_ART};
// Cursor cur = mContext.getContentResolver().query(
// MediaStore.Audio.Albums.EXTERNAL_CONTENT_URI,
// projection, MediaStore.Audio.Albums._ID + "=?", new String[]{album_id}, null);
// String album_art = null;
// if (null!=cur && cur.moveToNext()) {
// album_art = cur.getString(0);
// cur.close();
// }
//
// return album_art;
// }
//
// public static String[] getParentAndFileName(String path) {
// if (null!=path) {
// int lastIndex = path.lastIndexOf(File.separatorChar);
// if (lastIndex == path.length() - 1 && lastIndex > 0) {
// String tmp = path.substring(0, lastIndex);
// lastIndex = tmp.lastIndexOf(File.separatorChar);
// }
// String parent = path.substring(0, lastIndex+1);
// String name = path.substring(lastIndex+1, path.length());
// return new String[]{parent,name};
// }
// return new String[]{path,path};
// }
// }
| import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import com.zsorg.neteasecloudmusic.models.beans.MusicBean;
import com.zsorg.neteasecloudmusic.utils.MusicUtil;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map; | package com.zsorg.neteasecloudmusic.models.db;
/**
* Project:NeteaseCloudMusic
*
* @Author: piyel_000
* Created on 2017/1/16.
* E-mail:piyell@qq.com
*/
public class DiskMusicDao {
private final DiskMusicHelper mDBHelper;
public DiskMusicDao(Context context) {
mDBHelper = new DiskMusicHelper(context, "diskMusic", 1);
}
@Override
protected void finalize() throws Throwable {
mDBHelper.close();
super.finalize();
}
| // Path: app/src/main/java/com/zsorg/neteasecloudmusic/models/beans/MusicBean.java
// public class MusicBean implements Parcelable{
// private final String mSinger;
// private final String mAlbum;
// private String mPath;
// private String mName;
// private long mDuration;
//
// protected MusicBean(Parcel in) {
// mSinger = in.readString();
// mAlbum = in.readString();
// mPath = in.readString();
// mName = in.readString();
// mDuration = in.readLong();
// }
//
// public static final Creator<MusicBean> CREATOR = new Creator<MusicBean>() {
// @Override
// public MusicBean createFromParcel(Parcel in) {
// return new MusicBean(in);
// }
//
// @Override
// public MusicBean[] newArray(int size) {
// return new MusicBean[size];
// }
// };
//
// @Override
// public int describeContents() {
// return 0;
// }
//
// @Override
// public void writeToParcel(Parcel parcel, int i) {
//
// parcel.writeString(mSinger);
// parcel.writeString(mAlbum);
// parcel.writeString(mPath);
// parcel.writeString(mName);
// parcel.writeLong(mDuration);
// }
//
// @Override
// public int hashCode() {
// return mPath==null?0:mPath.hashCode();
// }
//
// @Override
// public boolean equals(Object obj) {
// return obj instanceof MusicBean && (((MusicBean) obj).hashCode()==hashCode());
// }
//
// public MusicBean(String name, String singer, String album, long duration, String path) {
// mPath = path;
// mName = name;
// mSinger = singer;
// mAlbum = album;
// mDuration = duration;
// }
//
// public String getSinger() {
// return mSinger;
// }
//
// public String getAlbum() {
// return mAlbum;
// }
//
// public String getPath() {
// return mPath;
// }
//
// public void setPath(String mPath) {
// this.mPath = mPath;
// }
//
// public String getName() {
// return mName;
// }
//
// public void setName(String mName) {
// this.mName = mName;
// }
//
// public long getDuration() {
// return mDuration;
// }
//
// public void setDuration(long mDuration) {
// this.mDuration = mDuration;
// }
// }
//
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/utils/MusicUtil.java
// public class MusicUtil {
//
// public static boolean isMusic(File file) {
// return null!=file && file.getName().toLowerCase().endsWith(".mp3");
// }
//
// public static String getAlbumArt(Context mContext, String album_id) {
// String[] projection = new String[]{MediaStore.Audio.Albums.ALBUM_ART};
// Cursor cur = mContext.getContentResolver().query(
// MediaStore.Audio.Albums.EXTERNAL_CONTENT_URI,
// projection, MediaStore.Audio.Albums._ID + "=?", new String[]{album_id}, null);
// String album_art = null;
// if (null!=cur && cur.moveToNext()) {
// album_art = cur.getString(0);
// cur.close();
// }
//
// return album_art;
// }
//
// public static String[] getParentAndFileName(String path) {
// if (null!=path) {
// int lastIndex = path.lastIndexOf(File.separatorChar);
// if (lastIndex == path.length() - 1 && lastIndex > 0) {
// String tmp = path.substring(0, lastIndex);
// lastIndex = tmp.lastIndexOf(File.separatorChar);
// }
// String parent = path.substring(0, lastIndex+1);
// String name = path.substring(lastIndex+1, path.length());
// return new String[]{parent,name};
// }
// return new String[]{path,path};
// }
// }
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/models/db/DiskMusicDao.java
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import com.zsorg.neteasecloudmusic.models.beans.MusicBean;
import com.zsorg.neteasecloudmusic.utils.MusicUtil;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
package com.zsorg.neteasecloudmusic.models.db;
/**
* Project:NeteaseCloudMusic
*
* @Author: piyel_000
* Created on 2017/1/16.
* E-mail:piyell@qq.com
*/
public class DiskMusicDao {
private final DiskMusicHelper mDBHelper;
public DiskMusicDao(Context context) {
mDBHelper = new DiskMusicHelper(context, "diskMusic", 1);
}
@Override
protected void finalize() throws Throwable {
mDBHelper.close();
super.finalize();
}
| public void addMusic(MusicBean musicBean) { |
piyell/NeteaseCloudMusic | app/src/main/java/com/zsorg/neteasecloudmusic/models/db/DiskMusicDao.java | // Path: app/src/main/java/com/zsorg/neteasecloudmusic/models/beans/MusicBean.java
// public class MusicBean implements Parcelable{
// private final String mSinger;
// private final String mAlbum;
// private String mPath;
// private String mName;
// private long mDuration;
//
// protected MusicBean(Parcel in) {
// mSinger = in.readString();
// mAlbum = in.readString();
// mPath = in.readString();
// mName = in.readString();
// mDuration = in.readLong();
// }
//
// public static final Creator<MusicBean> CREATOR = new Creator<MusicBean>() {
// @Override
// public MusicBean createFromParcel(Parcel in) {
// return new MusicBean(in);
// }
//
// @Override
// public MusicBean[] newArray(int size) {
// return new MusicBean[size];
// }
// };
//
// @Override
// public int describeContents() {
// return 0;
// }
//
// @Override
// public void writeToParcel(Parcel parcel, int i) {
//
// parcel.writeString(mSinger);
// parcel.writeString(mAlbum);
// parcel.writeString(mPath);
// parcel.writeString(mName);
// parcel.writeLong(mDuration);
// }
//
// @Override
// public int hashCode() {
// return mPath==null?0:mPath.hashCode();
// }
//
// @Override
// public boolean equals(Object obj) {
// return obj instanceof MusicBean && (((MusicBean) obj).hashCode()==hashCode());
// }
//
// public MusicBean(String name, String singer, String album, long duration, String path) {
// mPath = path;
// mName = name;
// mSinger = singer;
// mAlbum = album;
// mDuration = duration;
// }
//
// public String getSinger() {
// return mSinger;
// }
//
// public String getAlbum() {
// return mAlbum;
// }
//
// public String getPath() {
// return mPath;
// }
//
// public void setPath(String mPath) {
// this.mPath = mPath;
// }
//
// public String getName() {
// return mName;
// }
//
// public void setName(String mName) {
// this.mName = mName;
// }
//
// public long getDuration() {
// return mDuration;
// }
//
// public void setDuration(long mDuration) {
// this.mDuration = mDuration;
// }
// }
//
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/utils/MusicUtil.java
// public class MusicUtil {
//
// public static boolean isMusic(File file) {
// return null!=file && file.getName().toLowerCase().endsWith(".mp3");
// }
//
// public static String getAlbumArt(Context mContext, String album_id) {
// String[] projection = new String[]{MediaStore.Audio.Albums.ALBUM_ART};
// Cursor cur = mContext.getContentResolver().query(
// MediaStore.Audio.Albums.EXTERNAL_CONTENT_URI,
// projection, MediaStore.Audio.Albums._ID + "=?", new String[]{album_id}, null);
// String album_art = null;
// if (null!=cur && cur.moveToNext()) {
// album_art = cur.getString(0);
// cur.close();
// }
//
// return album_art;
// }
//
// public static String[] getParentAndFileName(String path) {
// if (null!=path) {
// int lastIndex = path.lastIndexOf(File.separatorChar);
// if (lastIndex == path.length() - 1 && lastIndex > 0) {
// String tmp = path.substring(0, lastIndex);
// lastIndex = tmp.lastIndexOf(File.separatorChar);
// }
// String parent = path.substring(0, lastIndex+1);
// String name = path.substring(lastIndex+1, path.length());
// return new String[]{parent,name};
// }
// return new String[]{path,path};
// }
// }
| import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import com.zsorg.neteasecloudmusic.models.beans.MusicBean;
import com.zsorg.neteasecloudmusic.utils.MusicUtil;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map; | package com.zsorg.neteasecloudmusic.models.db;
/**
* Project:NeteaseCloudMusic
*
* @Author: piyel_000
* Created on 2017/1/16.
* E-mail:piyell@qq.com
*/
public class DiskMusicDao {
private final DiskMusicHelper mDBHelper;
public DiskMusicDao(Context context) {
mDBHelper = new DiskMusicHelper(context, "diskMusic", 1);
}
@Override
protected void finalize() throws Throwable {
mDBHelper.close();
super.finalize();
}
public void addMusic(MusicBean musicBean) {
addMusic(musicBean.getName(), musicBean.getSinger(), musicBean.getAlbum(),musicBean.getDuration(), musicBean.getPath());
}
public void clearAll() {
mDBHelper.getWritableDatabase().execSQL("delete from diskMusic;");
}
public void addMusic(String name, String singer, String album,long duration, String path) {
// ContentValues values = new ContentValues();
// values.put("name",name);
// values.put("singer",singer);
// values.put("album",album);
// values.put("path",path);
// values.put("parent",path.substring(0,path.lastIndexOf(File.separatorChar)));
// values.put("duration",duration);
// mDBHelper.getWritableDatabase().insert("diskMusic", null, values);
if (null == name) { | // Path: app/src/main/java/com/zsorg/neteasecloudmusic/models/beans/MusicBean.java
// public class MusicBean implements Parcelable{
// private final String mSinger;
// private final String mAlbum;
// private String mPath;
// private String mName;
// private long mDuration;
//
// protected MusicBean(Parcel in) {
// mSinger = in.readString();
// mAlbum = in.readString();
// mPath = in.readString();
// mName = in.readString();
// mDuration = in.readLong();
// }
//
// public static final Creator<MusicBean> CREATOR = new Creator<MusicBean>() {
// @Override
// public MusicBean createFromParcel(Parcel in) {
// return new MusicBean(in);
// }
//
// @Override
// public MusicBean[] newArray(int size) {
// return new MusicBean[size];
// }
// };
//
// @Override
// public int describeContents() {
// return 0;
// }
//
// @Override
// public void writeToParcel(Parcel parcel, int i) {
//
// parcel.writeString(mSinger);
// parcel.writeString(mAlbum);
// parcel.writeString(mPath);
// parcel.writeString(mName);
// parcel.writeLong(mDuration);
// }
//
// @Override
// public int hashCode() {
// return mPath==null?0:mPath.hashCode();
// }
//
// @Override
// public boolean equals(Object obj) {
// return obj instanceof MusicBean && (((MusicBean) obj).hashCode()==hashCode());
// }
//
// public MusicBean(String name, String singer, String album, long duration, String path) {
// mPath = path;
// mName = name;
// mSinger = singer;
// mAlbum = album;
// mDuration = duration;
// }
//
// public String getSinger() {
// return mSinger;
// }
//
// public String getAlbum() {
// return mAlbum;
// }
//
// public String getPath() {
// return mPath;
// }
//
// public void setPath(String mPath) {
// this.mPath = mPath;
// }
//
// public String getName() {
// return mName;
// }
//
// public void setName(String mName) {
// this.mName = mName;
// }
//
// public long getDuration() {
// return mDuration;
// }
//
// public void setDuration(long mDuration) {
// this.mDuration = mDuration;
// }
// }
//
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/utils/MusicUtil.java
// public class MusicUtil {
//
// public static boolean isMusic(File file) {
// return null!=file && file.getName().toLowerCase().endsWith(".mp3");
// }
//
// public static String getAlbumArt(Context mContext, String album_id) {
// String[] projection = new String[]{MediaStore.Audio.Albums.ALBUM_ART};
// Cursor cur = mContext.getContentResolver().query(
// MediaStore.Audio.Albums.EXTERNAL_CONTENT_URI,
// projection, MediaStore.Audio.Albums._ID + "=?", new String[]{album_id}, null);
// String album_art = null;
// if (null!=cur && cur.moveToNext()) {
// album_art = cur.getString(0);
// cur.close();
// }
//
// return album_art;
// }
//
// public static String[] getParentAndFileName(String path) {
// if (null!=path) {
// int lastIndex = path.lastIndexOf(File.separatorChar);
// if (lastIndex == path.length() - 1 && lastIndex > 0) {
// String tmp = path.substring(0, lastIndex);
// lastIndex = tmp.lastIndexOf(File.separatorChar);
// }
// String parent = path.substring(0, lastIndex+1);
// String name = path.substring(lastIndex+1, path.length());
// return new String[]{parent,name};
// }
// return new String[]{path,path};
// }
// }
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/models/db/DiskMusicDao.java
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import com.zsorg.neteasecloudmusic.models.beans.MusicBean;
import com.zsorg.neteasecloudmusic.utils.MusicUtil;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
package com.zsorg.neteasecloudmusic.models.db;
/**
* Project:NeteaseCloudMusic
*
* @Author: piyel_000
* Created on 2017/1/16.
* E-mail:piyell@qq.com
*/
public class DiskMusicDao {
private final DiskMusicHelper mDBHelper;
public DiskMusicDao(Context context) {
mDBHelper = new DiskMusicHelper(context, "diskMusic", 1);
}
@Override
protected void finalize() throws Throwable {
mDBHelper.close();
super.finalize();
}
public void addMusic(MusicBean musicBean) {
addMusic(musicBean.getName(), musicBean.getSinger(), musicBean.getAlbum(),musicBean.getDuration(), musicBean.getPath());
}
public void clearAll() {
mDBHelper.getWritableDatabase().execSQL("delete from diskMusic;");
}
public void addMusic(String name, String singer, String album,long duration, String path) {
// ContentValues values = new ContentValues();
// values.put("name",name);
// values.put("singer",singer);
// values.put("album",album);
// values.put("path",path);
// values.put("parent",path.substring(0,path.lastIndexOf(File.separatorChar)));
// values.put("duration",duration);
// mDBHelper.getWritableDatabase().insert("diskMusic", null, values);
if (null == name) { | name = MusicUtil.getParentAndFileName(path)[1]; |
piyell/NeteaseCloudMusic | app/src/androidTest/java/com/zsorg/neteasecloudmusic/ExampleInstrumentedTest.java | // Path: app/src/main/java/com/zsorg/neteasecloudmusic/models/ScanMusicModel.java
// public class ScanMusicModel implements IMusicModel {
//
// private boolean isFilter60s;
//
// @Override
// public Flowable<MusicBean> scanMusicFile() {
// return mScanMusicOnStorage(Environment.getExternalStorageDirectory())
// .observeOn(Schedulers.computation())
// .flatMap(new Function<File, Publisher<MusicBean>>() {
// @Override
// public Publisher<MusicBean> apply(File file) throws Exception {
// MusicBean bean = MP3Util.parseMP3File(file.getAbsolutePath());
// if (null!=bean && (bean.getDuration()>60000 || !isFilter60s)) {
// return Flowable.just(bean).subscribeOn(Schedulers.computation());
// }
// return Flowable.empty();
// }
// });
// }
//
// @Override
// public Flowable<MusicBean> loadMusicFile() {
// return null;
// }
//
// @Override
// public void setIsFilter60s(boolean isFilter60s) {
// this.isFilter60s = isFilter60s;
// }
//
// private Flowable<File> mScanMusicOnStorage(@NonNull final File file) {
// File[] items = file.listFiles();
// if (null != items) {
// return Flowable.fromArray(items).observeOn(Schedulers.computation()).flatMap(new Function<File, Publisher<File>>() {
// @Override
// public Publisher<File> apply(File file) throws Exception {
// if (file != null) {
// if (file.isDirectory()) {
// return mScanMusicOnStorage(file);
// } else {
// return Flowable.just(file).filter(new Predicate<File>() {
// @Override
// public boolean test(File file) throws Exception {
// return file.exists() && file.canRead() && MusicUtil.isMusic(file);
// }
// });
// }
//
// }
// //null is forbidden in RxJava2
// return Flowable.empty();
// }
// });
// } else {
// return Flowable.empty();
// }
// }
// }
| import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import com.zsorg.neteasecloudmusic.models.ScanMusicModel;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*; | package com.zsorg.neteasecloudmusic;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
| // Path: app/src/main/java/com/zsorg/neteasecloudmusic/models/ScanMusicModel.java
// public class ScanMusicModel implements IMusicModel {
//
// private boolean isFilter60s;
//
// @Override
// public Flowable<MusicBean> scanMusicFile() {
// return mScanMusicOnStorage(Environment.getExternalStorageDirectory())
// .observeOn(Schedulers.computation())
// .flatMap(new Function<File, Publisher<MusicBean>>() {
// @Override
// public Publisher<MusicBean> apply(File file) throws Exception {
// MusicBean bean = MP3Util.parseMP3File(file.getAbsolutePath());
// if (null!=bean && (bean.getDuration()>60000 || !isFilter60s)) {
// return Flowable.just(bean).subscribeOn(Schedulers.computation());
// }
// return Flowable.empty();
// }
// });
// }
//
// @Override
// public Flowable<MusicBean> loadMusicFile() {
// return null;
// }
//
// @Override
// public void setIsFilter60s(boolean isFilter60s) {
// this.isFilter60s = isFilter60s;
// }
//
// private Flowable<File> mScanMusicOnStorage(@NonNull final File file) {
// File[] items = file.listFiles();
// if (null != items) {
// return Flowable.fromArray(items).observeOn(Schedulers.computation()).flatMap(new Function<File, Publisher<File>>() {
// @Override
// public Publisher<File> apply(File file) throws Exception {
// if (file != null) {
// if (file.isDirectory()) {
// return mScanMusicOnStorage(file);
// } else {
// return Flowable.just(file).filter(new Predicate<File>() {
// @Override
// public boolean test(File file) throws Exception {
// return file.exists() && file.canRead() && MusicUtil.isMusic(file);
// }
// });
// }
//
// }
// //null is forbidden in RxJava2
// return Flowable.empty();
// }
// });
// } else {
// return Flowable.empty();
// }
// }
// }
// Path: app/src/androidTest/java/com/zsorg/neteasecloudmusic/ExampleInstrumentedTest.java
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import com.zsorg.neteasecloudmusic.models.ScanMusicModel;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
package com.zsorg.neteasecloudmusic;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
| new ScanMusicModel().scanMusicFile(); |
piyell/NeteaseCloudMusic | app/src/main/java/com/zsorg/neteasecloudmusic/models/GroupSongMenuModel.java | // Path: app/src/main/java/com/zsorg/neteasecloudmusic/models/beans/MenuBean.java
// public class MenuBean {
// private String mName;
// private int mIconID;
//
// public MenuBean() {
//
// }
//
// public MenuBean(String name, int iconID) {
// mName = name;
// mIconID = iconID;
// }
//
// public String getName() {
// return mName;
// }
//
// public void setName(String name) {
// this.mName = name;
// }
//
// public int getIconID() {
// return mIconID;
// }
//
// public void setIconID(int iconID) {
// this.mIconID = iconID;
// }
// }
| import android.content.Context;
import android.graphics.drawable.Drawable;
import android.support.annotation.NonNull;
import com.zsorg.neteasecloudmusic.R;
import com.zsorg.neteasecloudmusic.models.beans.MenuBean;
import java.util.ArrayList;
import java.util.List; | package com.zsorg.neteasecloudmusic.models;
/**
* Project:NeteaseCloudMusic
*
* @Author: piyel_000
* Created on 2017/1/31.
* E-mail:piyell@qq.com
*/
public class GroupSongMenuModel implements IMenuModel{
private static GroupSongMenuModel mModel;
| // Path: app/src/main/java/com/zsorg/neteasecloudmusic/models/beans/MenuBean.java
// public class MenuBean {
// private String mName;
// private int mIconID;
//
// public MenuBean() {
//
// }
//
// public MenuBean(String name, int iconID) {
// mName = name;
// mIconID = iconID;
// }
//
// public String getName() {
// return mName;
// }
//
// public void setName(String name) {
// this.mName = name;
// }
//
// public int getIconID() {
// return mIconID;
// }
//
// public void setIconID(int iconID) {
// this.mIconID = iconID;
// }
// }
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/models/GroupSongMenuModel.java
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.support.annotation.NonNull;
import com.zsorg.neteasecloudmusic.R;
import com.zsorg.neteasecloudmusic.models.beans.MenuBean;
import java.util.ArrayList;
import java.util.List;
package com.zsorg.neteasecloudmusic.models;
/**
* Project:NeteaseCloudMusic
*
* @Author: piyel_000
* Created on 2017/1/31.
* E-mail:piyell@qq.com
*/
public class GroupSongMenuModel implements IMenuModel{
private static GroupSongMenuModel mModel;
| List<MenuBean> mList; |
piyell/NeteaseCloudMusic | app/src/main/java/com/zsorg/neteasecloudmusic/views/ISearchView.java | // Path: app/src/main/java/com/zsorg/neteasecloudmusic/models/beans/MusicBean.java
// public class MusicBean implements Parcelable{
// private final String mSinger;
// private final String mAlbum;
// private String mPath;
// private String mName;
// private long mDuration;
//
// protected MusicBean(Parcel in) {
// mSinger = in.readString();
// mAlbum = in.readString();
// mPath = in.readString();
// mName = in.readString();
// mDuration = in.readLong();
// }
//
// public static final Creator<MusicBean> CREATOR = new Creator<MusicBean>() {
// @Override
// public MusicBean createFromParcel(Parcel in) {
// return new MusicBean(in);
// }
//
// @Override
// public MusicBean[] newArray(int size) {
// return new MusicBean[size];
// }
// };
//
// @Override
// public int describeContents() {
// return 0;
// }
//
// @Override
// public void writeToParcel(Parcel parcel, int i) {
//
// parcel.writeString(mSinger);
// parcel.writeString(mAlbum);
// parcel.writeString(mPath);
// parcel.writeString(mName);
// parcel.writeLong(mDuration);
// }
//
// @Override
// public int hashCode() {
// return mPath==null?0:mPath.hashCode();
// }
//
// @Override
// public boolean equals(Object obj) {
// return obj instanceof MusicBean && (((MusicBean) obj).hashCode()==hashCode());
// }
//
// public MusicBean(String name, String singer, String album, long duration, String path) {
// mPath = path;
// mName = name;
// mSinger = singer;
// mAlbum = album;
// mDuration = duration;
// }
//
// public String getSinger() {
// return mSinger;
// }
//
// public String getAlbum() {
// return mAlbum;
// }
//
// public String getPath() {
// return mPath;
// }
//
// public void setPath(String mPath) {
// this.mPath = mPath;
// }
//
// public String getName() {
// return mName;
// }
//
// public void setName(String mName) {
// this.mName = mName;
// }
//
// public long getDuration() {
// return mDuration;
// }
//
// public void setDuration(long mDuration) {
// this.mDuration = mDuration;
// }
// }
| import android.content.Context;
import com.zsorg.neteasecloudmusic.models.beans.MusicBean;
import java.util.List; | package com.zsorg.neteasecloudmusic.views;
/**
* Project:NeteaseCloudMusic
*
* @Author: piyel_000
* Created on 2017/2/8.
* E-mail:piyell@qq.com
*/
public interface ISearchView {
Context getContext();
| // Path: app/src/main/java/com/zsorg/neteasecloudmusic/models/beans/MusicBean.java
// public class MusicBean implements Parcelable{
// private final String mSinger;
// private final String mAlbum;
// private String mPath;
// private String mName;
// private long mDuration;
//
// protected MusicBean(Parcel in) {
// mSinger = in.readString();
// mAlbum = in.readString();
// mPath = in.readString();
// mName = in.readString();
// mDuration = in.readLong();
// }
//
// public static final Creator<MusicBean> CREATOR = new Creator<MusicBean>() {
// @Override
// public MusicBean createFromParcel(Parcel in) {
// return new MusicBean(in);
// }
//
// @Override
// public MusicBean[] newArray(int size) {
// return new MusicBean[size];
// }
// };
//
// @Override
// public int describeContents() {
// return 0;
// }
//
// @Override
// public void writeToParcel(Parcel parcel, int i) {
//
// parcel.writeString(mSinger);
// parcel.writeString(mAlbum);
// parcel.writeString(mPath);
// parcel.writeString(mName);
// parcel.writeLong(mDuration);
// }
//
// @Override
// public int hashCode() {
// return mPath==null?0:mPath.hashCode();
// }
//
// @Override
// public boolean equals(Object obj) {
// return obj instanceof MusicBean && (((MusicBean) obj).hashCode()==hashCode());
// }
//
// public MusicBean(String name, String singer, String album, long duration, String path) {
// mPath = path;
// mName = name;
// mSinger = singer;
// mAlbum = album;
// mDuration = duration;
// }
//
// public String getSinger() {
// return mSinger;
// }
//
// public String getAlbum() {
// return mAlbum;
// }
//
// public String getPath() {
// return mPath;
// }
//
// public void setPath(String mPath) {
// this.mPath = mPath;
// }
//
// public String getName() {
// return mName;
// }
//
// public void setName(String mName) {
// this.mName = mName;
// }
//
// public long getDuration() {
// return mDuration;
// }
//
// public void setDuration(long mDuration) {
// this.mDuration = mDuration;
// }
// }
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/views/ISearchView.java
import android.content.Context;
import com.zsorg.neteasecloudmusic.models.beans.MusicBean;
import java.util.List;
package com.zsorg.neteasecloudmusic.views;
/**
* Project:NeteaseCloudMusic
*
* @Author: piyel_000
* Created on 2017/2/8.
* E-mail:piyell@qq.com
*/
public interface ISearchView {
Context getContext();
| void updateSearchResult(List<MusicBean> results); |
tempofeng/lambda-local | lambda-local-example/src/main/java/com/zaoo/lambda/example/HelloStream.java | // Path: lambda-local/src/main/java/com/zaoo/lambda/LambdaStreamRequestDeserializer.java
// public interface LambdaStreamRequestDeserializer extends LambdaRequestDeserializer<byte[]> {
// }
//
// Path: lambda-local/src/main/java/com/zaoo/lambda/LambdaStreamResponseSerializer.java
// public interface LambdaStreamResponseSerializer extends LambdaResponseSerializer<byte[]> {
// }
| import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.RequestStreamHandler;
import com.zaoo.lambda.LambdaLocal;
import com.zaoo.lambda.LambdaStreamRequestDeserializer;
import com.zaoo.lambda.LambdaStreamResponseSerializer;
import org.apache.commons.io.IOUtils;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream; | package com.zaoo.lambda.example;
@SuppressWarnings("unused")
@LambdaLocal(value = "/lleHelloStream", serializer = HelloStream.Serializer.class, deserializer = HelloStream.Deserializer.class)
public class HelloStream implements RequestStreamHandler {
@Override
public void handleRequest(InputStream input, OutputStream output, Context context) throws IOException {
String content = IOUtils.toString(input, "UTF-8");
IOUtils.write(String.format("Hello %s!", content), output, "UTF-8");
}
| // Path: lambda-local/src/main/java/com/zaoo/lambda/LambdaStreamRequestDeserializer.java
// public interface LambdaStreamRequestDeserializer extends LambdaRequestDeserializer<byte[]> {
// }
//
// Path: lambda-local/src/main/java/com/zaoo/lambda/LambdaStreamResponseSerializer.java
// public interface LambdaStreamResponseSerializer extends LambdaResponseSerializer<byte[]> {
// }
// Path: lambda-local-example/src/main/java/com/zaoo/lambda/example/HelloStream.java
import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.RequestStreamHandler;
import com.zaoo.lambda.LambdaLocal;
import com.zaoo.lambda.LambdaStreamRequestDeserializer;
import com.zaoo.lambda.LambdaStreamResponseSerializer;
import org.apache.commons.io.IOUtils;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
package com.zaoo.lambda.example;
@SuppressWarnings("unused")
@LambdaLocal(value = "/lleHelloStream", serializer = HelloStream.Serializer.class, deserializer = HelloStream.Deserializer.class)
public class HelloStream implements RequestStreamHandler {
@Override
public void handleRequest(InputStream input, OutputStream output, Context context) throws IOException {
String content = IOUtils.toString(input, "UTF-8");
IOUtils.write(String.format("Hello %s!", content), output, "UTF-8");
}
| public static class Deserializer implements LambdaStreamRequestDeserializer { |
tempofeng/lambda-local | lambda-local-example/src/main/java/com/zaoo/lambda/example/HelloStream.java | // Path: lambda-local/src/main/java/com/zaoo/lambda/LambdaStreamRequestDeserializer.java
// public interface LambdaStreamRequestDeserializer extends LambdaRequestDeserializer<byte[]> {
// }
//
// Path: lambda-local/src/main/java/com/zaoo/lambda/LambdaStreamResponseSerializer.java
// public interface LambdaStreamResponseSerializer extends LambdaResponseSerializer<byte[]> {
// }
| import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.RequestStreamHandler;
import com.zaoo.lambda.LambdaLocal;
import com.zaoo.lambda.LambdaStreamRequestDeserializer;
import com.zaoo.lambda.LambdaStreamResponseSerializer;
import org.apache.commons.io.IOUtils;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream; | package com.zaoo.lambda.example;
@SuppressWarnings("unused")
@LambdaLocal(value = "/lleHelloStream", serializer = HelloStream.Serializer.class, deserializer = HelloStream.Deserializer.class)
public class HelloStream implements RequestStreamHandler {
@Override
public void handleRequest(InputStream input, OutputStream output, Context context) throws IOException {
String content = IOUtils.toString(input, "UTF-8");
IOUtils.write(String.format("Hello %s!", content), output, "UTF-8");
}
public static class Deserializer implements LambdaStreamRequestDeserializer {
@Override
public byte[] serialize(HttpServletRequest req) throws IOException {
return IOUtils.toByteArray(req.getInputStream());
}
}
| // Path: lambda-local/src/main/java/com/zaoo/lambda/LambdaStreamRequestDeserializer.java
// public interface LambdaStreamRequestDeserializer extends LambdaRequestDeserializer<byte[]> {
// }
//
// Path: lambda-local/src/main/java/com/zaoo/lambda/LambdaStreamResponseSerializer.java
// public interface LambdaStreamResponseSerializer extends LambdaResponseSerializer<byte[]> {
// }
// Path: lambda-local-example/src/main/java/com/zaoo/lambda/example/HelloStream.java
import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.RequestStreamHandler;
import com.zaoo.lambda.LambdaLocal;
import com.zaoo.lambda.LambdaStreamRequestDeserializer;
import com.zaoo.lambda.LambdaStreamResponseSerializer;
import org.apache.commons.io.IOUtils;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
package com.zaoo.lambda.example;
@SuppressWarnings("unused")
@LambdaLocal(value = "/lleHelloStream", serializer = HelloStream.Serializer.class, deserializer = HelloStream.Deserializer.class)
public class HelloStream implements RequestStreamHandler {
@Override
public void handleRequest(InputStream input, OutputStream output, Context context) throws IOException {
String content = IOUtils.toString(input, "UTF-8");
IOUtils.write(String.format("Hello %s!", content), output, "UTF-8");
}
public static class Deserializer implements LambdaStreamRequestDeserializer {
@Override
public byte[] serialize(HttpServletRequest req) throws IOException {
return IOUtils.toByteArray(req.getInputStream());
}
}
| public static class Serializer implements LambdaStreamResponseSerializer { |
tempofeng/lambda-local | lambda-local-example/src/main/java/com/zaoo/lambda/example/HelloPojo.java | // Path: lambda-local/src/main/java/com/zaoo/lambda/LambdaRequestDeserializer.java
// public interface LambdaRequestDeserializer<I> {
// I serialize(HttpServletRequest req) throws IOException;
// }
//
// Path: lambda-local/src/main/java/com/zaoo/lambda/LambdaResponseSerializer.java
// public interface LambdaResponseSerializer<O> {
// void deserialize(O output, HttpServletResponse resp) throws IOException;
// }
| import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.RequestHandler;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.zaoo.lambda.LambdaLocal;
import com.zaoo.lambda.LambdaRequestDeserializer;
import com.zaoo.lambda.LambdaResponseSerializer;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException; | }
public RequestClass(String firstName, String lastName) {
this.firstName = firstName;
this.lastName = lastName;
}
public RequestClass() {
}
}
public static class ResponseClass {
String greetings;
public String getGreetings() {
return greetings;
}
public void setGreetings(String greetings) {
this.greetings = greetings;
}
public ResponseClass(String greetings) {
this.greetings = greetings;
}
public ResponseClass() {
}
}
| // Path: lambda-local/src/main/java/com/zaoo/lambda/LambdaRequestDeserializer.java
// public interface LambdaRequestDeserializer<I> {
// I serialize(HttpServletRequest req) throws IOException;
// }
//
// Path: lambda-local/src/main/java/com/zaoo/lambda/LambdaResponseSerializer.java
// public interface LambdaResponseSerializer<O> {
// void deserialize(O output, HttpServletResponse resp) throws IOException;
// }
// Path: lambda-local-example/src/main/java/com/zaoo/lambda/example/HelloPojo.java
import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.RequestHandler;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.zaoo.lambda.LambdaLocal;
import com.zaoo.lambda.LambdaRequestDeserializer;
import com.zaoo.lambda.LambdaResponseSerializer;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
}
public RequestClass(String firstName, String lastName) {
this.firstName = firstName;
this.lastName = lastName;
}
public RequestClass() {
}
}
public static class ResponseClass {
String greetings;
public String getGreetings() {
return greetings;
}
public void setGreetings(String greetings) {
this.greetings = greetings;
}
public ResponseClass(String greetings) {
this.greetings = greetings;
}
public ResponseClass() {
}
}
| public static class Deserializer implements LambdaRequestDeserializer<RequestClass> { |
tempofeng/lambda-local | lambda-local-example/src/main/java/com/zaoo/lambda/example/HelloPojo.java | // Path: lambda-local/src/main/java/com/zaoo/lambda/LambdaRequestDeserializer.java
// public interface LambdaRequestDeserializer<I> {
// I serialize(HttpServletRequest req) throws IOException;
// }
//
// Path: lambda-local/src/main/java/com/zaoo/lambda/LambdaResponseSerializer.java
// public interface LambdaResponseSerializer<O> {
// void deserialize(O output, HttpServletResponse resp) throws IOException;
// }
| import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.RequestHandler;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.zaoo.lambda.LambdaLocal;
import com.zaoo.lambda.LambdaRequestDeserializer;
import com.zaoo.lambda.LambdaResponseSerializer;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException; | public RequestClass() {
}
}
public static class ResponseClass {
String greetings;
public String getGreetings() {
return greetings;
}
public void setGreetings(String greetings) {
this.greetings = greetings;
}
public ResponseClass(String greetings) {
this.greetings = greetings;
}
public ResponseClass() {
}
}
public static class Deserializer implements LambdaRequestDeserializer<RequestClass> {
@Override
public RequestClass serialize(HttpServletRequest req) throws IOException {
return new RequestClass(req.getParameter("firstName"), req.getParameter("lastName"));
}
}
| // Path: lambda-local/src/main/java/com/zaoo/lambda/LambdaRequestDeserializer.java
// public interface LambdaRequestDeserializer<I> {
// I serialize(HttpServletRequest req) throws IOException;
// }
//
// Path: lambda-local/src/main/java/com/zaoo/lambda/LambdaResponseSerializer.java
// public interface LambdaResponseSerializer<O> {
// void deserialize(O output, HttpServletResponse resp) throws IOException;
// }
// Path: lambda-local-example/src/main/java/com/zaoo/lambda/example/HelloPojo.java
import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.RequestHandler;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.zaoo.lambda.LambdaLocal;
import com.zaoo.lambda.LambdaRequestDeserializer;
import com.zaoo.lambda.LambdaResponseSerializer;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
public RequestClass() {
}
}
public static class ResponseClass {
String greetings;
public String getGreetings() {
return greetings;
}
public void setGreetings(String greetings) {
this.greetings = greetings;
}
public ResponseClass(String greetings) {
this.greetings = greetings;
}
public ResponseClass() {
}
}
public static class Deserializer implements LambdaRequestDeserializer<RequestClass> {
@Override
public RequestClass serialize(HttpServletRequest req) throws IOException {
return new RequestClass(req.getParameter("firstName"), req.getParameter("lastName"));
}
}
| public static class Serializer implements LambdaResponseSerializer<ResponseClass> { |
tempofeng/lambda-local | lambda-local/src/main/java/com/zaoo/lambda/rest/JsonRestParamDeserializer.java | // Path: lambda-local/src/main/java/com/zaoo/lambda/ObjectMappers.java
// public class ObjectMappers {
// private static ObjectMapper objectMapper;
// private static ObjectReader objectReader;
// private static ObjectWriter objectWriter;
//
// static {
// createInstance(ObjectMapper::new);
// }
//
// private static void createInstance(ObjectMapperFactory objectMapperFactory) {
// objectMapper = objectMapperFactory.createInstance();
// objectReader = objectMapper.reader();
// objectWriter = objectMapper.writer();
// }
//
// public static ObjectMapper getObjectMapper() {
// return objectMapper;
// }
//
// public static ObjectReader getReader() {
// return objectReader;
// }
//
// public static ObjectWriter getWriter() {
// return objectWriter;
// }
//
// public static void setObjectMapperFactory(ObjectMapperFactory objectMapperFactory) {
// createInstance(objectMapperFactory);
// }
//
// private ObjectMappers() {
// }
// }
| import com.fasterxml.jackson.databind.JavaType;
import com.zaoo.lambda.ObjectMappers;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException; | package com.zaoo.lambda.rest;
/**
* Support String, Integer, Long, Float, Double, Boolean, Enum, and JSON (Using jackson)
*/
public class JsonRestParamDeserializer implements RestParamDeserializer<Object> {
private static final Logger log = LoggerFactory.getLogger(JsonRestParamDeserializer.class);
@Override
public Object deserialize(String str, JavaType javaType) {
if (String.class.isAssignableFrom(javaType.getRawClass())) {
return str;
}
if (Integer.class.isAssignableFrom(javaType.getRawClass()) || int.class.isAssignableFrom(javaType.getRawClass())) {
return Integer.parseInt(str);
}
if (Long.class.isAssignableFrom(javaType.getRawClass()) || long.class.isAssignableFrom(javaType.getRawClass())) {
return Long.parseLong(str);
}
if (Float.class.isAssignableFrom(javaType.getRawClass()) || float.class.isAssignableFrom(javaType.getRawClass())) {
return Float.parseFloat(str);
}
if (Double.class.isAssignableFrom(javaType.getRawClass()) || double.class.isAssignableFrom(javaType.getRawClass())) {
return Double.parseDouble(str);
}
if (Boolean.class.isAssignableFrom(javaType.getRawClass()) || boolean.class.isAssignableFrom(javaType.getRawClass())) {
return Boolean.parseBoolean(str);
}
if (Enum.class.isAssignableFrom(javaType.getRawClass())) {
Class<?> rawClass = javaType.getRawClass();
return toEnum(str, rawClass);
}
try { | // Path: lambda-local/src/main/java/com/zaoo/lambda/ObjectMappers.java
// public class ObjectMappers {
// private static ObjectMapper objectMapper;
// private static ObjectReader objectReader;
// private static ObjectWriter objectWriter;
//
// static {
// createInstance(ObjectMapper::new);
// }
//
// private static void createInstance(ObjectMapperFactory objectMapperFactory) {
// objectMapper = objectMapperFactory.createInstance();
// objectReader = objectMapper.reader();
// objectWriter = objectMapper.writer();
// }
//
// public static ObjectMapper getObjectMapper() {
// return objectMapper;
// }
//
// public static ObjectReader getReader() {
// return objectReader;
// }
//
// public static ObjectWriter getWriter() {
// return objectWriter;
// }
//
// public static void setObjectMapperFactory(ObjectMapperFactory objectMapperFactory) {
// createInstance(objectMapperFactory);
// }
//
// private ObjectMappers() {
// }
// }
// Path: lambda-local/src/main/java/com/zaoo/lambda/rest/JsonRestParamDeserializer.java
import com.fasterxml.jackson.databind.JavaType;
import com.zaoo.lambda.ObjectMappers;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
package com.zaoo.lambda.rest;
/**
* Support String, Integer, Long, Float, Double, Boolean, Enum, and JSON (Using jackson)
*/
public class JsonRestParamDeserializer implements RestParamDeserializer<Object> {
private static final Logger log = LoggerFactory.getLogger(JsonRestParamDeserializer.class);
@Override
public Object deserialize(String str, JavaType javaType) {
if (String.class.isAssignableFrom(javaType.getRawClass())) {
return str;
}
if (Integer.class.isAssignableFrom(javaType.getRawClass()) || int.class.isAssignableFrom(javaType.getRawClass())) {
return Integer.parseInt(str);
}
if (Long.class.isAssignableFrom(javaType.getRawClass()) || long.class.isAssignableFrom(javaType.getRawClass())) {
return Long.parseLong(str);
}
if (Float.class.isAssignableFrom(javaType.getRawClass()) || float.class.isAssignableFrom(javaType.getRawClass())) {
return Float.parseFloat(str);
}
if (Double.class.isAssignableFrom(javaType.getRawClass()) || double.class.isAssignableFrom(javaType.getRawClass())) {
return Double.parseDouble(str);
}
if (Boolean.class.isAssignableFrom(javaType.getRawClass()) || boolean.class.isAssignableFrom(javaType.getRawClass())) {
return Boolean.parseBoolean(str);
}
if (Enum.class.isAssignableFrom(javaType.getRawClass())) {
Class<?> rawClass = javaType.getRawClass();
return toEnum(str, rawClass);
}
try { | return ObjectMappers.getReader().forType(javaType).readValue(str); |
tempofeng/lambda-local | lambda-local/src/test/java/com/zaoo/lambda/test/TestFunction2.java | // Path: lambda-local/src/main/java/com/zaoo/lambda/LambdaProxyRequestDeserializer.java
// public class LambdaProxyRequestDeserializer implements LambdaRequestDeserializer<LambdaProxyRequest> {
// private static final String USER_AGENT = "User-Agent";
//
// @Override
// public LambdaProxyRequest serialize(HttpServletRequest req) throws IOException {
// String requestPath = req.getRequestURI().substring(req.getContextPath().length());
//
// LambdaProxyRequest.Identity identity = new LambdaProxyRequest.Identity(req.getRemoteAddr(),
// req.getHeader(USER_AGENT));
//
// LambdaProxyRequest.RequestContext requestContext = new LambdaProxyRequest.RequestContext(identity,
// requestPath,
// req.getMethod());
//
// return new LambdaProxyRequest(requestPath,
// requestPath,
// req.getMethod(),
// toHeaders(req),
// toParameters(req),
// requestContext,
// readBody(req));
// }
//
// private String readBody(HttpServletRequest req) {
// try {
// return IOUtils.toString(req.getReader());
// } catch (IOException | IllegalStateException e) {
// return "";
// }
// }
//
// private Map<String, String> toHeaders(HttpServletRequest req) {
// Map<String, String> headers = new HashMap<>();
// for (Enumeration<String> e = req.getHeaderNames(); e.hasMoreElements(); ) {
// String name = e.nextElement();
// List<String> values = Collections.list(req.getHeaders(name));
// headers.put(name, values.get(values.size() - 1));
// }
// return headers;
// }
//
// private Map<String, String> toParameters(HttpServletRequest req) {
// return req.getParameterMap().entrySet().stream()
// .collect(Collectors.toMap(Map.Entry::getKey,
// entry -> {
// String[] values = entry.getValue();
// return values[values.length - 1];
// }));
// }
// }
//
// Path: lambda-local/src/main/java/com/zaoo/lambda/LambdaProxyResponseSerializer.java
// public class LambdaProxyResponseSerializer implements LambdaResponseSerializer<LambdaProxyResponse> {
// private static final String UTF_8 = "UTF-8";
//
// @Override
// public void deserialize(LambdaProxyResponse output, HttpServletResponse resp) throws IOException {
// IOUtils.write(output.getBody(), resp.getOutputStream(), UTF_8);
// }
// }
| import com.amazonaws.services.lambda.runtime.Context;
import com.zaoo.lambda.LambdaProxyRequestDeserializer;
import com.zaoo.lambda.LambdaProxyResponseSerializer;
import com.zaoo.lambda.LambdaLocal; | package com.zaoo.lambda.test;
@LambdaLocal(value = {"/testPath2.1", "/testPath2.2"},
handler = {"com.zaoo.lambda.test.TestFunction2::method1", "com.zaoo.lambda.test.TestFunction2::method2"}, | // Path: lambda-local/src/main/java/com/zaoo/lambda/LambdaProxyRequestDeserializer.java
// public class LambdaProxyRequestDeserializer implements LambdaRequestDeserializer<LambdaProxyRequest> {
// private static final String USER_AGENT = "User-Agent";
//
// @Override
// public LambdaProxyRequest serialize(HttpServletRequest req) throws IOException {
// String requestPath = req.getRequestURI().substring(req.getContextPath().length());
//
// LambdaProxyRequest.Identity identity = new LambdaProxyRequest.Identity(req.getRemoteAddr(),
// req.getHeader(USER_AGENT));
//
// LambdaProxyRequest.RequestContext requestContext = new LambdaProxyRequest.RequestContext(identity,
// requestPath,
// req.getMethod());
//
// return new LambdaProxyRequest(requestPath,
// requestPath,
// req.getMethod(),
// toHeaders(req),
// toParameters(req),
// requestContext,
// readBody(req));
// }
//
// private String readBody(HttpServletRequest req) {
// try {
// return IOUtils.toString(req.getReader());
// } catch (IOException | IllegalStateException e) {
// return "";
// }
// }
//
// private Map<String, String> toHeaders(HttpServletRequest req) {
// Map<String, String> headers = new HashMap<>();
// for (Enumeration<String> e = req.getHeaderNames(); e.hasMoreElements(); ) {
// String name = e.nextElement();
// List<String> values = Collections.list(req.getHeaders(name));
// headers.put(name, values.get(values.size() - 1));
// }
// return headers;
// }
//
// private Map<String, String> toParameters(HttpServletRequest req) {
// return req.getParameterMap().entrySet().stream()
// .collect(Collectors.toMap(Map.Entry::getKey,
// entry -> {
// String[] values = entry.getValue();
// return values[values.length - 1];
// }));
// }
// }
//
// Path: lambda-local/src/main/java/com/zaoo/lambda/LambdaProxyResponseSerializer.java
// public class LambdaProxyResponseSerializer implements LambdaResponseSerializer<LambdaProxyResponse> {
// private static final String UTF_8 = "UTF-8";
//
// @Override
// public void deserialize(LambdaProxyResponse output, HttpServletResponse resp) throws IOException {
// IOUtils.write(output.getBody(), resp.getOutputStream(), UTF_8);
// }
// }
// Path: lambda-local/src/test/java/com/zaoo/lambda/test/TestFunction2.java
import com.amazonaws.services.lambda.runtime.Context;
import com.zaoo.lambda.LambdaProxyRequestDeserializer;
import com.zaoo.lambda.LambdaProxyResponseSerializer;
import com.zaoo.lambda.LambdaLocal;
package com.zaoo.lambda.test;
@LambdaLocal(value = {"/testPath2.1", "/testPath2.2"},
handler = {"com.zaoo.lambda.test.TestFunction2::method1", "com.zaoo.lambda.test.TestFunction2::method2"}, | deserializer = {LambdaProxyRequestDeserializer.class, LambdaProxyRequestDeserializer.class}, |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.