Giter VIP home page Giter VIP logo

liv_android's Introduction

LIV_Android

##Background LIV is a startup whose mission is to bring excitement and value to people’s daily experiences. We provide deal-of-the-day service that features discounted gift certificates usable at local or national companies. We combine Vine and Groupon to make shopping more interesting.
At present, there’re lots of deal apps like Groupon, LivingSocial, AmazonLocal and deal- aggregator Yipit. Normally, these Groupon-like apps use picture flow to show deals, in LIV, we use video flow (like in Vine, a short 6 second video clip), which is a fantastic way to attract attention and increase interaction between deal provider and consumer.

##Project Progress The app hasn't been finished yet.

  • Parts have been completed
    • sliding menu (Create a sliding menu using animation and drawables)
    • login-register module (json transfer between server and client, client-side local storage)
    • deal page (display a list of deals and automate the playback of video while the page is scrolled)
    • style the app using res/style and XML drawables

##Challenges:

  • Build the SlidingMenu
    • Mechanism:
      • slidingMenu is used to display user menus. It can be operated by clicking the thumb button on the home page or by gestures. When the slidingMenu is opened, it’s added to the rootView and slides right into the screen; when it is closed, it slides left and is removed from the rootView
    • Create the slidingMenu using animation(ObjectAnimator) and drawables. This also includes the manipulation of related views and creation of custom views. (HierarchyViewer)
    • Control the enabled state of layouts dynamically. When the slidingMenu is open, the home page should be disabled and touch on the home page will close the slidingMenu; when the slidingMenu is closed, all layouts in the rootView are enabled again.
  • Create the video flow for displaying deals
    • Mechanism:
      • video flow features the home page, where all deals are displayed here. Each deal consists of a video and deal description.
      • Clicking on the surface of the video can control the playback of the video.
      • Each video has a thumbnail( the first frame of the video), which is used to fill the blank before the video is completely downloaded and ready to play.
    • Create custom video view (combine TextureView and MediaPlayer). At first, I used the Android native VideoView, yet VideoView has rendering issues in the ListView. This is caused by the container of the VideoView -- SurfaceView. SurfaceView works by creating a new window placed behind the current window. It punches a hole through current window to reveal the new window. While this approach is very efficient, since the content of the new window can be refreshed without redrawing current window, it suffers in transformation(move, scale, rotate). This makes it difficult to use SurfaceView inside a ListView or ScrollView. The TextureView, introduced in Android 4.0, offers the same capabilities as SurfaceView, but behaves as a regular view. Therefore, I finally used TextureView as the video container and wrote a TextureViewListener to control the creation and destroy of the video container.
    • Download video in AsynTask
    • Manage MediaPlayer’s lifecycle. MediaPlayer is used to control playback of audio/videos. When the video is downloaded from the server, MediapLayer is created to play the video and when the video stops playing, MediaPlayer should be released clearly so as to save memory space.

##Others Android is known for various versions. In this app, we initially set the minSDK as API8, which will cover the 98% of Android phones on the market. Yet, the minSDK leveled up when I built the project. In order to create the slidingMenu, I used the ObjectAnimator (API11), then in creating custom video view, I used TextureView(API18). So, I generally placed the priority of function implementation before the backward compatibility.

liv_android's People

Contributors

walnutown avatar

Watchers

James Cloos avatar  avatar

liv_android's Issues

When scrolling fast, it crashes with DealView as Relativelayout instead of LinearLayout.

The crash happens from a media player being in an illegal state exception when trying to start a video. This happens when I try to scroll fast up and down.

I was wondering if you would know why does LinearLayout behaves better with TextureView & MediaPlayer in a ListView.

Thanks,

P.S. The crash message is as follows:
11-13 12:47:21.608: E/AndroidRuntime(19823): Process: com.example.liv, PID: 19823
11-13 12:47:21.608: E/AndroidRuntime(19823): java.lang.IllegalStateException
11-13 12:47:21.608: E/AndroidRuntime(19823): at android.media.MediaPlayer._start(Native Method)
11-13 12:47:21.608: E/AndroidRuntime(19823): at android.media.MediaPlayer.start(MediaPlayer.java:1495)
11-13 12:47:21.608: E/AndroidRuntime(19823): at com.example.liv.library.DealView$1.onCompletion(DealView.java:245)
11-13 12:47:21.608: E/AndroidRuntime(19823): at android.media.MediaPlayer$EventHandler.handleMessage(MediaPlayer.java:3240)
11-13 12:47:21.608: E/AndroidRuntime(19823): at android.os.Handler.dispatchMessage(Handler.java:102)
11-13 12:47:21.608: E/AndroidRuntime(19823): at android.os.Looper.loop(Looper.java:136)
11-13 12:47:21.608: E/AndroidRuntime(19823): at android.app.ActivityThread.main(ActivityThread.java:5579)
11-13 12:47:21.608: E/AndroidRuntime(19823): at java.lang.reflect.Method.invokeNative(Native Method)
11-13 12:47:21.608: E/AndroidRuntime(19823): at java.lang.reflect.Method.invoke(Method.java:515)
11-13 12:47:21.608: E/AndroidRuntime(19823): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1268)
11-13 12:47:21.608: E/AndroidRuntime(19823): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084)
11-13 12:47:21.608: E/AndroidRuntime(19823): at dalvik.system.NativeStart.main(Native Method)

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.