Day7


Time : October 28th,2015 / Author : xiaomeixw

library

1.UI:

  • RoundedImageView --- (From vinc3m1) : A fast ImageView that supports rounded corners, ovals, and circles. [各种自定义形状图片].
<img src="https://camo.githubusercontent.com/ed1e075be6ed97fa9091d3702e9b96d3e85b7a35/68747470733a2f2f7261772e6769746875622e636f6d2f6d616b6572616d656e2f526f756e646564496d616765566965772f6d61737465722f73637265656e73686f742e706e67" width="35%"><img src="https://camo.githubusercontent.com/d4970a90842c50a708f94b7bd996657c41ab62fb/68747470733a2f2f7261772e6769746875622e636f6d2f6d616b6572616d656e2f526f756e646564496d616765566965772f6d61737465722f73637265656e73686f742d6f76616c2e706e67" width="35%">
  • android-crop --- (From jdamcd) : Android library project for cropping images. [裁剪图片].

  • cropper --- (From edmodo) : Android widget for cropping and rotating an image. [裁剪图片].

  • SimpleCropView --- (From IsseiAoki) : A simple image cropping library for Android. [裁剪图片].

  • CropImageView --- (From cesards) : Widget allows you crop from whatever side in an ImageView. Currently Android only supports centerCrop type of cropping. [各种不同的角度中间centerCrop截取图片].

  • Masaccio --- (From Subito-it) : An Android library providing a useful widget class which automatically detects the presence of faces in the source image and crop it accordingly so to achieve the best visual result. [自动识别图片中人脸并截取出来].

2.Logic:

  • android-priority-jobqueue --- (From path & Tag is AsyncTask) : A Job Queue specifically written for Android to easily schedule jobs (tasks) that run in the background, improving UX and application stability. [后台异步线程调度,Path出品,必属精品].

      // A job to send a tweet
      public class PostTweetJob extends Job {
          public static final int PRIORITY = 1;
          private String text;
          public PostTweetJob(String text) {
              // This job requires network connectivity,
              // and should be persisted in case the application exits before job is completed.
              super(new Params(PRIORITY).requireNetwork().persist());
          }
          @Override
          public void onAdded() {
              // Job has been saved to disk.
              // This is a good place to dispatch a UI event to indicate the job will eventually run.
              // In this example, it would be good to update the UI with the newly posted tweet.
          }
          @Override
          public void onRun() throws Throwable {
              // Job logic goes here. In this example, the network call to post to Twitter is done here.
              webservice.postTweet(text);
          }
          @Override
          protected boolean shouldReRunOnThrowable(Throwable throwable) {
              // An error occurred in onRun.
              // Return value determines whether this job should retry running (true) or abort (false).
          }
          @Override
          protected void onCancel() {
              // Job has exceeded retry attempts or shouldReRunOnThrowable() has returned false.
          }
      }
    

3.Architecture:

  • mv2m --- (From fabioCollini) : Android MVVM lightweight library based on Android Data Binding. [基于google的Android Data Binding基础的MVVM架构探索].

    Model:

    A Model class contains the data used to populate the user interface using Data Binding library. It's saved automatically in Actvity/Fragment state, for this reason it must implement Parcelable interface.

    View:

    The View is an Activity or a Fragment, the user interface is managed using Android Data Binding. You need to extend ViewModelActivity or ViewModelFragment class and implement createViewModel method returning a new ViewModel object.

    ViewModel:

    The ViewModel is a subclass of ViewModel class, it is automatically saved in a retained fragment to avoid the creation of a new object on every configuration change. The ViewModel is usually the object bound to the layout using the Data Binding framework. It manages the background tasks and all the business logic of the application.

App-Demo

  • GEM --- (From Substance-Project A Organization from United States) : A music player for Android, in stunning Material Design. [带Material Design设计风格的音乐App-Demo].

    Check the Source in Github.Want to know more about the App-Demo see http://substanceproject.net

  • StickerCamera --- (From Skykai521 A Developer from China) : This is an Android application with camera,picture cropping,collage sticking and tagging. [图片裁剪图片标签App-Demo].

    Check the Source in Github.

article

  • JOE'S GREAT ADAPTER HELL ESCAPE --- (From Author sockeqwe blog http://hannesdorfmann.com) --- [Source in Github]

    Favor composition over inheritance!

    Let me tell you a story about Joe Somebody an android developer at MyLittleZoo Inc. and how he walked through the hell while trying to create reusable RecyclerView Adapters with different view types and how he finally managed to implement reusable Adapters painlessly. [Translation:组合优于继承,逃离Adapter-Type的地狱].

      public class AdapterDelegatesManager<T> {
    
          SparseArrayCompat<AdapterDelegate<T>> delegates = new SparseArrayCompat();
    
          public AdapterDelegatesManager<T> addDelegate(@NonNull AdapterDelegate<T> delegate) {
              return addDelegate(delegate, false);
          }
    
        public AdapterDelegatesManager<T> addDelegate(@NonNull AdapterDelegate<T> delegate,boolean allowReplacingDelegate) {
            return this;
        }


        public AdapterDelegatesManager<T> removeDelegate(@NonNull AdapterDelegate<T> delegate) {
            return this;
        }


        public AdapterDelegatesManager<T> removeDelegate(int viewType) {
            delegates.remove(viewType);
            return this;
        }


        public int getItemViewType(@NonNull T items, int position) {
            for (int i = 0; i < delegatesCount; i++) {
                AdapterDelegate<T> delegate = delegates.valueAt(i);
                if (delegate.isForViewType(items, position)) {
                    return delegate.getItemViewType();
                }
            }

        }


        @NonNull public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
            AdapterDelegate<T> delegate = delegates.get(viewType);
            RecyclerView.ViewHolder vh = delegate.onCreateViewHolder(parent);
            return vh;
        }


        public void onBindViewHolder(@NonNull T items, int position, @NonNull RecyclerView.ViewHolder viewHolder) {
            AdapterDelegate<T> delegate = delegates.get(viewHolder.getItemViewType());
            delegate.onBindViewHolder(items, position, viewHolder);
        }
    }

website

  • jsonschema2pojo --- (Build By joelittlejohn) :Generates Java types from JSON Schema (or example JSON) and annotates those types for data-binding with Jackson 1.x or 2.x, Gson, etc. [自动将json转成pojo对象,简化JavaBean对象书写].

results matching ""

    No results matching ""