Search in sources :

Example 1 with BookDetailDataSource

use of com.shizhefei.test.models.datasource.BookDetailDataSource in project MVCHelper by LuckyJayce.

the class TestCaseFragment method getTestCaseDatas.

@Override
protected List<TestCaseData> getTestCaseDatas() {
    List<TestCaseData> datas = new ArrayList<TestCaseData>();
    TestCaseData caseData = new TestCaseData("测试登录", new LoginAsyncTask("LuckyJayce", "111"));
    caseData.addParamGet(new String[] { "name", "password" }, new IAsyncTask<Map<String, String>>() {

        @Override
        public RequestHandle execute(ResponseSender<Map<String, String>> sender) throws Exception {
            Map<String, String> map = new ArrayListMap<String, String>();
            map.put("name", "nnnnn");
            map.put("password", "ppppp");
            sender.sendData(map);
            return null;
        }
    });
    datas.add(caseData);
    datas.add(new TestCaseData("测试详情页", new BookDetailDataSource()));
    datas.add(new TestCaseData("测试搜索文章", new SearchBookDataSource("Java")));
    datas.add(new TestCaseData("测试文章列表", new BooksOkHttpNormal_DataSource()));
    return datas;
}
Also used : RequestHandle(com.shizhefei.mvc.RequestHandle) ArrayList(java.util.ArrayList) BooksOkHttpNormal_DataSource(com.shizhefei.test.models.datasource.okhttp.BooksOkHttpNormal_DataSource) BookDetailDataSource(com.shizhefei.test.models.datasource.BookDetailDataSource) TestCaseData(com.shizhefei.mvchelper.testcase.TestCaseData) SearchBookDataSource(com.shizhefei.test.models.datasource.SearchBookDataSource) ArrayListMap(com.shizhefei.utils.ArrayListMap) Map(java.util.Map) LoginAsyncTask(com.shizhefei.test.models.task.LoginAsyncTask)

Example 2 with BookDetailDataSource

use of com.shizhefei.test.models.datasource.BookDetailDataSource in project MVCHelper by LuckyJayce.

the class BookDetailActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_bookdetail);
    nameTextView = (TextView) findViewById(R.id.name_textView);
    authorTextView = (TextView) findViewById(R.id.author_textView);
    descriptionTextView = (TextView) findViewById(R.id.description_textView);
    contentTextView = (TextView) findViewById(R.id.content_textView);
    PtrClassicFrameLayout contentLayout = (PtrClassicFrameLayout) findViewById(R.id.rotate_header_list_view_frame);
    mvcHelper = new MVCUltraHelper<Book>(contentLayout);
    // 设置数据源
    mvcHelper.setDataSource(new BookDetailDataSource());
    // 设置适配器
    mvcHelper.setAdapter(dataAdapter);
    // 加载数据
    mvcHelper.refresh();
}
Also used : PtrClassicFrameLayout(in.srain.cube.views.ptr.PtrClassicFrameLayout) Book(com.shizhefei.test.models.enties.Book) BookDetailDataSource(com.shizhefei.test.models.datasource.BookDetailDataSource)

Example 3 with BookDetailDataSource

use of com.shizhefei.test.models.datasource.BookDetailDataSource in project MVCHelper by LuckyJayce.

the class NormalActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_normal);
    View contentLayout = findViewById(R.id.content_layout);
    nameTextView = (TextView) findViewById(R.id.name_textView);
    authorTextView = (TextView) findViewById(R.id.author_textView);
    descriptionTextView = (TextView) findViewById(R.id.description_textView);
    contentTextView = (TextView) findViewById(R.id.content_textView);
    mvcHelper = new MVCNormalHelper<>(contentLayout);
    // 设置数据源
    mvcHelper.setDataSource(new BookDetailDataSource());
    // 设置适配器
    mvcHelper.setAdapter(dataAdapter);
    // 加载数据
    mvcHelper.refresh();
}
Also used : TextView(android.widget.TextView) View(android.view.View) BookDetailDataSource(com.shizhefei.test.models.datasource.BookDetailDataSource)

Aggregations

BookDetailDataSource (com.shizhefei.test.models.datasource.BookDetailDataSource)3 View (android.view.View)1 TextView (android.widget.TextView)1 RequestHandle (com.shizhefei.mvc.RequestHandle)1 TestCaseData (com.shizhefei.mvchelper.testcase.TestCaseData)1 SearchBookDataSource (com.shizhefei.test.models.datasource.SearchBookDataSource)1 BooksOkHttpNormal_DataSource (com.shizhefei.test.models.datasource.okhttp.BooksOkHttpNormal_DataSource)1 Book (com.shizhefei.test.models.enties.Book)1 LoginAsyncTask (com.shizhefei.test.models.task.LoginAsyncTask)1 ArrayListMap (com.shizhefei.utils.ArrayListMap)1 PtrClassicFrameLayout (in.srain.cube.views.ptr.PtrClassicFrameLayout)1 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1