Home | History | Annotate | Download | only in musicservicedemo
      1 /* Copyright 2014 Google Inc. All Rights Reserved.
      2  *
      3  * Licensed under the Apache License, Version 2.0 (the "License");
      4  * you may not use this file except in compliance with the License.
      5  * You may obtain a copy of the License at
      6  *
      7  *     http://www.apache.org/licenses/LICENSE-2.0
      8  *
      9  * Unless required by applicable law or agreed to in writing, software
     10  * distributed under the License is distributed on an "AS IS" BASIS,
     11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     12  * See the License for the specific language governing permissions and
     13  * limitations under the License.
     14  */
     15 
     16 package com.example.android.musicservicedemo;
     17 
     18 import android.os.Bundle;
     19 import android.support.v4.app.Fragment;
     20 import android.support.v7.app.ActionBarActivity;
     21 import android.view.LayoutInflater;
     22 import android.view.Menu;
     23 import android.view.MenuItem;
     24 import android.view.View;
     25 import android.view.ViewGroup;
     26 
     27 import com.example.android.musicservicedemo.R;
     28 
     29 // TODO Local UI
     30 
     31 /**
     32  * Main activity of the app.
     33  */
     34 public class MainActivity extends ActionBarActivity {
     35 
     36     private static final String LOG = "MainActivity";
     37 
     38     @Override
     39     protected void onCreate(Bundle savedInstanceState) {
     40         super.onCreate(savedInstanceState);
     41         setContentView(R.layout.activity_main);
     42 
     43         if (savedInstanceState == null) {
     44             getSupportFragmentManager().beginTransaction()
     45                     .add(R.id.container, new PlaceholderFragment())
     46                     .commit();
     47         }
     48 
     49     }
     50 
     51     /*
     52      * (non-Javadoc)
     53      * @see android.app.Activity#onCreateOptionsMenu(android.view.Menu)
     54      */
     55     @Override
     56     public boolean onCreateOptionsMenu(Menu menu) {
     57 
     58         // Inflate the menu; this adds items to the action bar if it is present.
     59         //getMenuInflater().inflate(R.menu.main, menu);
     60         return true;
     61     }
     62 
     63     /*
     64      * (non-Javadoc)
     65      * @see android.app.Activity#onOptionsItemSelected(android.view.MenuItem)
     66      */
     67     @Override
     68     public boolean onOptionsItemSelected(MenuItem item) {
     69         // Handle action bar item clicks here. The action bar will
     70         // automatically handle clicks on the Home/Up button, so long
     71         // as you specify a parent activity in AndroidManifest.xml.
     72         int id = item.getItemId();
     73         // if (id == R.id.action_settings) {
     74         // return true;
     75         // }
     76         return super.onOptionsItemSelected(item);
     77     }
     78 
     79     /**
     80      * A placeholder fragment containing a simple view.
     81      */
     82     public static class PlaceholderFragment extends Fragment {
     83 
     84         public PlaceholderFragment() {
     85         }
     86 
     87         /*
     88          * (non-Javadoc)
     89          * @see
     90          * android.support.v4.app.Fragment#onCreateView(android.view.LayoutInflater
     91          * , android.view.ViewGroup, android.os.Bundle)
     92          */
     93         @Override
     94         public View onCreateView(LayoutInflater inflater, ViewGroup container,
     95                 Bundle savedInstanceState) {
     96             View rootView = inflater.inflate(R.layout.fragment_main, container, false);
     97             return rootView;
     98         }
     99     }
    100 
    101 }
    102