Imitation Storm video Android client application source

Source: Internet
Author: User
Tags gety

This project is a simulation of the Storm video UI project source code, modeled after the interface has a menu page, home page, category pages, etc., all the data in the project using local analog data, the size of the general on the large-resolution device layout display will be problematic, 480x800 resolution should be appropriate, The default compiled version 4.2.2 encoded GBK, the comment is not many, the need friend can download to look.

public class Mainactivity extends Tabactivity {private Slidemenu slidemenu;    Private Tabhost Tabhost;    Private Layoutinflater Inflater;     Private Intent Intent1, Intent2, Intent3, Intent4, INTENT5, intent6;         Private long exittime = 0;      private static final int swipe_min_distance = 120;      private static final int swipe_max_off_path = 250;      private static final int swipe_threshold_velocity = 200;      Private Gesturedetector Gesturedetector;         View.ontouchlistener Gesturelistener;      int currentview = 0;       private static int maxtabindex = 5;                @Override public boolean onKeyDown (int keycode, keyevent event) {if (keycode = = Keyevent.keycode_back && event.getaction () = = Keyevent.action_down) {if (System.currenttimemillis ()-Exittime) >                {Toast.maketext (Mainactivity.this, "Press Exit program again", Toast.length_short). Show (); Exittime = System.currenttimemilLis ();                } else {finish ();            System.exit (0);        } return true;    } return Super.onkeydown (KeyCode, event);        } @Override protected void OnCreate (Bundle savedinstancestate) {super.oncreate (savedinstancestate);                          Setcontentview (R.layout.main);          Gesturedetector = new Gesturedetector (new Mygesturedetector ());                  Gesturelistener = new View.ontouchlistener () {public boolean OnTouch (View V, motionevent event) {                  if (Gesturedetector.ontouchevent (event)) {return true;              } return false;                   }          };        Drawer effect Slidemenu = (Slidemenu) Findviewbyid (R.id.slide_menu);        ImageView menuimg = (ImageView) Findviewbyid (R.id.slide_firstmenu); Menuimg.setonclicklistener (New Onclicklistener () {@Override public void OnClick (View arg0) {               TODO auto-generated Method Stub if (slidemenu.ismainscreenshowing ()) {                Slidemenu.openmenu ();                } else {slidemenu.closemenu ();         }            }        });        Intent1 = new Intent (mainactivity.this, Firstactivity.class);        Intent2 = new Intent (mainactivity.this, Secondactivity.class);        Intent3 = new Intent (mainactivity.this, Secondactivity.class);        Intent4 = new Intent (mainactivity.this, Secondactivity.class);        INTENT5 = new Intent (mainactivity.this, Secondactivity.class);         INTENT6 = new Intent (mainactivity.this, Moreinformationactivity.class);        Layoutinflater inflater = Layoutinflater.from (mainactivity.this);        View view1 = inflater.inflate (r.layout.tabitem_1, NULL);        View view2 = inflater.inflate (r.layout.tabitem_2, NULL);        View view3 = inflater.inflate (r.layout.tabitem_3, NULL); View view4 = inflater.inflate (r.layout.tabitem_4, NULL);        View view5 = inflater.inflate (r.layout.tabitem_5, NULL);         View view6 = inflater.inflate (r.layout.tabitem_6, NULL);        Create Tabhost//Tabhost = (tabhost) Findviewbyid (r.id.tabhost);        Tabhost.setup ();        Tabhost = Gettabhost ();        Tabspec TABSPEC1 = Tabhost.newtabspec ("Tab1"). Setindicator (View1). SetContent (INTENT1);        Tabhost.addtab (TABSPEC1);        Tabspec tabSpec2 = Tabhost.newtabspec ("TaB2"). Setindicator (View2). SetContent (Intent2);        Tabhost.addtab (TABSPEC2);        Tabspec TABSPEC3 = Tabhost.newtabspec ("Tab3"). Setindicator (VIEW3). SetContent (INTENT3);        Tabhost.addtab (TABSPEC3);        Tabspec TABSPEC4 = Tabhost.newtabspec ("Tab4"). Setindicator (VIEW4). SetContent (INTENT4);        Tabhost.addtab (TABSPEC4);        Tabspec tabSpec5 = Tabhost.newtabspec ("Tab5"). Setindicator (VIEW5). SetContent (INTENT5);        Tabhost.addtab (TABSPEC5); TaBspec tabSpec6 = Tabhost.newtabspec ("Tab6"). Setindicator (VIEW6). SetContent (INTENT6);         Tabhost.addtab (TABSPEC6);        Button ImageButton1 = (button) Findviewbyid (R.id.imagebutton1);                Imagebutton1.setonclicklistener (New Onclicklistener () {@Override public void OnClick (View arg0) { TODO auto-generated Method Stub//Toast.maketext (Mainactivity.this, "123", Toast.length_                Short)//. Show ();                Intent newintent = new Intent (mainactivity.this, Localactivity.class);            StartActivity (newintent);         }        });        ImageView slide_menu_history = (ImageView) Findviewbyid (r.id.slide_menu_history); Slide_menu_history.setonclicklistener (New Onclicklistener () {@Override public void OnClick (View ar G0) {//TODO auto-generated method stub Intent newintent = new Intent (mainactivity.this, Historyactivity.class);            StartActivity (newintent);         }        });        ImageView Slide_menu_search = (ImageView) Findviewbyid (R.id.slide_menu_search); Slide_menu_search.setonclicklistener (New Onclicklistener () {@Override public void OnClick (View v)                        {//TODO auto-generated method stub Intent newintent = new Intent (Mainactivity.this,                Searchactivity.class);            StartActivity (newintent);     }        });         }//Swipe right or left the page also has a sliding effect class Mygesturedetector extends Simpleongesturelistener {@Override              public boolean onfling (Motionevent E1, motionevent E2, float Velocityx, float velocityy) {              Tabhost tabhost = Gettabhost ();              System.out.println ("************");               try {if (Math.Abs (E1.gety ()-e2.gety ()) > Swipe_max_off_path)       return false; Right to left swipe if (E1.getx ()-E2.getx () > Swipe_min_distance &&A mp                      Math.Abs (Velocityx) > Swipe_threshold_velocity) {log.i ("test", "right");                      if (CurrentView = = maxtabindex) {currentview = 0;                      } else {currentview++;                  } tabhost.setcurrenttab (CurrentView); } else if (E2.getx ()-E1.getx () > Swipe_min_distance && math.abs (Velocityx) > Swip                      e_threshold_velocity) {log.i ("test", "left");                      if (CurrentView = = 0) {CurrentView = Maxtabindex;                      } else {currentview--;                  } tabhost.setcurrenttab (CurrentView); }} CatCH (Exception e) {} return false; }} @Override public boolean dispatchtouchevent (Motionevent event) {if (Gesturedetector.ontouch          Event) {event.setaction (motionevent.action_cancel);      } return Super.dispatchtouchevent (event); } @Override public boolean ontouchevent (Motionevent event) {//TODO auto-generated method stub R    Eturn gesturedetector.ontouchevent (event); }//@Override//Public boolean Oncreateoptionsmenu (Menu menu) {//Getmenuinflater (). Inflate (R.menu.activi  Ty_main, menu);  return true; //    }   }

  

    • <ignore_js_op> run the recommended interface
    • <ignore_js_op> Navigation Plate
    • <ignore_js_op> Search Box
    • <ignore_js_op> Detailed Description: http://android.662p.com/thread-5865-1-1.html

Imitation Storm video Android client application source

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.