GithubHelp home page GithubHelp logo

dmvpr's Introduction

DMVPR

Dagger2+MVP+Retrofit Demo

用到的知识点

Retrofit相关知识

  • get请求
    • RESTful 格式的请求
     @GET("/cook/list/{page}")
     Call<List<MenuList>> getMenuList(@Path("issue") int page);
     // 最终请求的URL http://api.baidu.com/tngou/cook/list/1
    • 普通的以&符拼接的请求
    @GET("/cook/list")
    Call<List<MenuList>> getMenuList(@Query("page") int page);
    // 最终请求的URL http://api.baidu.com/tngou/cook/list?page=1

gradle 脚本中常量的定义

  • resValue
     //build.gradle
     resValue 'string', 'BASE_HOST', 'http://192.168.1.150:8080/test/service/'
     //java 代码中获取
     context.getResources().getString(R.string.BASE_HOST);
  • buildConfigField
     //build.gradle
     buildConfigField "long", "BUILD_TIME", System.currentTimeMillis()+"L"
     //java 代码中获取
     public Date getAppBuildDate() {
         return new Date(BuildConfig.BUILD_TIME);
     }
     /**
      * buildConfigField 定义时需要拼完整串
      * buildConfigField "类型","常量名称","常量值"
      */

其他点

  • 全屏
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         //全屏
         requestWindowFeature(Window.FEATURE_NO_TITLE);
         getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                 WindowManager.LayoutParams.FLAG_FULLSCREEN);
    
         setContentView(R.layout.activity_splash);
         ...
     }
  • WebView loadData 中文乱码问题
     webView.getSettings().setDefaultTextEncodingName("UTF-8");
     webView.loadData(htmlStr, "text/html; charset=UTF-8", null);

参考项目

dmvpr's People

Contributors

liaodongxiaoxiao avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.