Advertisement
Guest User

Untitled

a guest
May 2nd, 2015
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 8.05 KB | None | 0 0
  1. package com.example.user.test;
  2.  
  3. import com.example.user.test.util.SystemUiHider;
  4.  
  5. import android.annotation.TargetApi;
  6. import android.app.Activity;
  7. import android.content.Context;
  8. import android.database.Cursor;
  9. import android.database.SQLException;
  10. import android.database.sqlite.SQLiteDatabase;
  11. import android.location.LocationListener;
  12. import android.os.Build;
  13. import android.os.Bundle;
  14. import android.os.Handler;
  15. import android.util.Log;
  16. import android.view.MotionEvent;
  17. import android.view.View;
  18. import android.widget.Button;
  19. import android.widget.TabHost;
  20. import android.widget.TextView;
  21. import android.widget.Toast;
  22.  
  23. import java.io.IOException;
  24.  
  25.  
  26. /**
  27.  * An example full-screen activity that shows and hides the system UI (i.e.
  28.  * status bar and navigation/system bar) with user interaction.
  29.  *
  30.  * @see SystemUiHider
  31.  */
  32. public class FullscreenActivity extends Activity {
  33.  
  34.  
  35.     Button lokacja;
  36.     GPSTracker gps;
  37.  
  38.  
  39. //    /**
  40. //     * Whether or not the system UI should be auto-hidden after
  41. //     * {@link #AUTO_HIDE_DELAY_MILLIS} milliseconds.
  42. //     */
  43. //    private static final boolean AUTO_HIDE = true;
  44. //
  45. //    /**
  46. //     * If {@link #AUTO_HIDE} is set, the number of milliseconds to wait after
  47. //     * user interaction before hiding the system UI.
  48. //     */
  49. //    private static final int AUTO_HIDE_DELAY_MILLIS = 3000;
  50. //
  51. //    /**
  52. //     * If set, will toggle the system UI visibility upon interaction. Otherwise,
  53. //     * will show the system UI visibility upon interaction.
  54. //     */
  55. //    private static final boolean TOGGLE_ON_CLICK = true;
  56. //
  57. //    /**
  58. //     * The flags to pass to {@link SystemUiHider#getInstance}.
  59. //     */
  60. //    private static final int HIDER_FLAGS = SystemUiHider.FLAG_HIDE_NAVIGATION;
  61. //
  62. //    /**
  63. //     * The instance of the {@link SystemUiHider} for this activity.
  64. //     */
  65. //    private SystemUiHider mSystemUiHider;
  66.  
  67.     @Override
  68.     protected void onCreate(Bundle savedInstanceState) {
  69.         super.onCreate(savedInstanceState);
  70.  
  71.         setContentView(R.layout.activity_fullscreen);
  72.  
  73.         final View controlsView = findViewById(R.id.fullscreen_content_controls);
  74.         final View contentView = findViewById(R.id.fullscreen_content);
  75.  
  76.  
  77.         TabHost tabHost = (TabHost) findViewById(R.id.tabHost);
  78.         tabHost.setup();
  79.  
  80.         TabHost.TabSpec tabSpec = tabHost.newTabSpec("lokalizator");
  81.         tabSpec.setContent(R.id.tab1);
  82.         tabSpec.setIndicator("Lokalizator");
  83.         tabHost.addTab(tabSpec);
  84.  
  85.         tabSpec = tabHost.newTabSpec("galeria");
  86.         tabSpec.setContent(R.id.tab2);
  87.         tabSpec.setIndicator("Galeria");
  88.         tabHost.addTab(tabSpec);
  89.  
  90.         tabSpec = tabHost.newTabSpec("ustawienia");
  91.         tabSpec.setContent(R.id.tab3);
  92.         tabSpec.setIndicator("Ustawienia");
  93.         tabHost.addTab(tabSpec);
  94.  
  95.  
  96. //        TextView tv = (TextView) findViewById(R.id.lokal2);
  97. //        LocationListener mlocListener = new GPSTracker(getApplicationContext(),tv);
  98.  
  99. //        lokacja = (Button) findViewById(R.id.show_location);
  100. //        final TextView lokal2 = (TextView) findViewById(R.id.lokal2);
  101. //        final TextView nazwaMiejsca2 = (TextView) findViewById(R.id.nazwaMiejsca2);
  102. //        lokacja.setOnClickListener(new View.OnClickListener() {
  103. //
  104. //            @Override
  105. //            public void onClick(View v) {
  106. //                gps = new GPSTracker(FullscreenActivity.this);
  107. //
  108. //                if (gps.canGetLocation()) {
  109. //                    double latitude = gps.getLatitude();
  110. //                    double longitude = gps.getLongitude();
  111. //
  112. //
  113. //
  114. //                } else {
  115. //                    gps.showSettingsAlert();
  116. //                }
  117. //            }
  118. //        });
  119.  
  120.        
  121.  
  122.  
  123.  
  124.     }
  125.  
  126.  
  127.  
  128.  
  129.  
  130.         // Set up an instance of SystemUiHider to control the system UI for
  131.         // this activity.
  132. //        mSystemUiHider = SystemUiHider.getInstance(this, contentView, HIDER_FLAGS);
  133. //        mSystemUiHider.setup();
  134. //        mSystemUiHider
  135. //                .setOnVisibilityChangeListener(new SystemUiHider.OnVisibilityChangeListener() {
  136. //                    // Cached values.
  137. //                    int mControlsHeight;
  138. //                    int mShortAnimTime;
  139. //
  140. //                    @Override
  141. //                    @TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
  142. //                    public void onVisibilityChange(boolean visible) {
  143. //                        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {
  144. //                            // If the ViewPropertyAnimator API is available
  145. //                            // (Honeycomb MR2 and later), use it to animate the
  146. //                            // in-layout UI controls at the bottom of the
  147. //                            // screen.
  148. //                            if (mControlsHeight == 0) {
  149. //                                mControlsHeight = controlsView.getHeight();
  150. //                            }
  151. //                            if (mShortAnimTime == 0) {
  152. //                                mShortAnimTime = getResources().getInteger(
  153. //                                        android.R.integer.config_shortAnimTime);
  154. //                            }
  155. //                            controlsView.animate()
  156. //                                    .translationY(visible ? 0 : mControlsHeight)
  157. //                                    .setDuration(mShortAnimTime);
  158. //                        } else {
  159. //                            // If the ViewPropertyAnimator APIs aren't
  160. //                            // available, simply show or hide the in-layout UI
  161. //                            // controls.
  162. //                            controlsView.setVisibility(visible ? View.VISIBLE : View.GONE);
  163. //                        }
  164. //
  165. //                        if (visible && AUTO_HIDE) {
  166. //                            // Schedule a hide().
  167. //                            delayedHide(AUTO_HIDE_DELAY_MILLIS);
  168. //                        }
  169. //                    }
  170. //                });
  171.  
  172.         // Set up the user interaction to manually show or hide the system UI.
  173. //        contentView.setOnClickListener(new View.OnClickListener() {
  174. //            @Override
  175. //            public void onClick(View view) {
  176. //                if (TOGGLE_ON_CLICK) {
  177. //                    mSystemUiHider.toggle();
  178. //                } else {
  179. //                    mSystemUiHider.show();
  180. //                }
  181. //            }
  182. //        });
  183.  
  184.         // Upon interacting with UI controls, delay any scheduled hide()
  185.         // operations to prevent the jarring behavior of controls going away
  186.         // while interacting with the UI.
  187.  
  188.  
  189.         @Override
  190.         protected void onPostCreate (Bundle savedInstanceState){
  191.             super.onPostCreate(savedInstanceState);
  192.  
  193.             // Trigger the initial hide() shortly after the activity has been
  194.             // created, to briefly hint to the user that UI controls
  195.             // are available.
  196. //        delayedHide(100);
  197.         }
  198.  
  199.  
  200.         /**
  201.          * Touch listener to use for in-layout UI controls to delay hiding the
  202.          * system UI. This is to prevent the jarring behavior of controls going away
  203.          * while interacting with activity UI.
  204.          */
  205. //    View.OnTouchListener mDelayHideTouchListener = new View.OnTouchListener() {
  206. //        @Override
  207. //        public boolean onTouch(View view, MotionEvent motionEvent) {
  208. //            if (AUTO_HIDE) {
  209. //                delayedHide(AUTO_HIDE_DELAY_MILLIS);
  210. //            }
  211. //            return false;
  212. //        }
  213. //    };
  214.  
  215. //    Handler mHideHandler = new Handler();
  216. //    Runnable mHideRunnable = new Runnable() {
  217. //        @Override
  218. //        public void run() {
  219. //            mSystemUiHider.hide();
  220. //        }
  221. //    };
  222.  
  223.         /**
  224.          * Schedules a call to hide() in [delay] milliseconds, canceling any
  225.          * previously scheduled calls.
  226.          */
  227. //    private void delayedHide(int delayMillis) {
  228. //        mHideHandler.removeCallbacks(mHideRunnable);
  229. //        mHideHandler.postDelayed(mHideRunnable, delayMillis);
  230. //    }
  231.  
  232.  
  233.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement