Android Open Source - innovativeproject-meetingdataexchange System Ui Hider






From Project

Back to project page innovativeproject-meetingdataexchange.

License

The source code is released under:

MIT License

If you think the Android project innovativeproject-meetingdataexchange listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.TrololoCompany.meetingdataexchange.util;
/*w w  w.  j av a  2  s  .  c  o m*/
import android.app.Activity;
import android.os.Build;
import android.view.View;

/**
 * A utility class that helps with showing and hiding system UI such as the
 * status bar and navigation/system bar. This class uses backward-compatibility
 * techniques described in <a href=
 * "http://developer.android.com/training/backward-compatible-ui/index.html">
 * Creating Backward-Compatible UIs</a> to ensure that devices running any
 * version of ndroid OS are supported. More specifically, there are separate
 * implementations of this abstract class: for newer devices,
 * {@link #getInstance} will return a {@link SystemUiHiderHoneycomb} instance,
 * while on older devices {@link #getInstance} will return a
 * {@link SystemUiHiderBase} instance.
 * <p>
 * For more on system bars, see <a href=
 * "http://developer.android.com/design/get-started/ui-overview.html#system-bars"
 * > System Bars</a>.
 * 
 * @see android.view.View#setSystemUiVisibility(int)
 * @see android.view.WindowManager.LayoutParams#FLAG_FULLSCREEN
 */
public abstract class SystemUiHider {
  /**
   * When this flag is set, the
   * {@link android.view.WindowManager.LayoutParams#FLAG_LAYOUT_IN_SCREEN}
   * flag will be set on older devices, making the status bar "float" on top
   * of the activity layout. This is most useful when there are no controls at
   * the top of the activity layout.
   * <p>
   * This flag isn't used on newer devices because the <a
   * href="http://developer.android.com/design/patterns/actionbar.html">action
   * bar</a>, the most important structural element of an Android app, should
   * be visible and not obscured by the system UI.
   */
  public static final int FLAG_LAYOUT_IN_SCREEN_OLDER_DEVICES = 0x1;

  /**
   * When this flag is set, {@link #show()} and {@link #hide()} will toggle
   * the visibility of the status bar. If there is a navigation bar, show and
   * hide will toggle low profile mode.
   */
  public static final int FLAG_FULLSCREEN = 0x2;

  /**
   * When this flag is set, {@link #show()} and {@link #hide()} will toggle
   * the visibility of the navigation bar, if it's present on the device and
   * the device allows hiding it. In cases where the navigation bar is present
   * but cannot be hidden, show and hide will toggle low profile mode.
   */
  public static final int FLAG_HIDE_NAVIGATION = FLAG_FULLSCREEN | 0x4;

  /**
   * The activity associated with this UI hider object.
   */
  protected Activity mActivity;

  /**
   * The view on which {@link View#setSystemUiVisibility(int)} will be called.
   */
  protected View mAnchorView;

  /**
   * The current UI hider flags.
   * 
   * @see #FLAG_FULLSCREEN
   * @see #FLAG_HIDE_NAVIGATION
   * @see #FLAG_LAYOUT_IN_SCREEN_OLDER_DEVICES
   */
  protected int mFlags;

  /**
   * The current visibility callback.
   */
  protected OnVisibilityChangeListener mOnVisibilityChangeListener = sDummyListener;

  /**
   * Creates and returns an instance of {@link SystemUiHider} that is
   * appropriate for this device. The object will be either a
   * {@link SystemUiHiderBase} or {@link SystemUiHiderHoneycomb} depending on
   * the device.
   * 
   * @param activity
   *            The activity whose window's system UI should be controlled by
   *            this class.
   * @param anchorView
   *            The view on which {@link View#setSystemUiVisibility(int)} will
   *            be called.
   * @param flags
   *            Either 0 or any combination of {@link #FLAG_FULLSCREEN},
   *            {@link #FLAG_HIDE_NAVIGATION}, and
   *            {@link #FLAG_LAYOUT_IN_SCREEN_OLDER_DEVICES}.
   */
  public static SystemUiHider getInstance(Activity activity, View anchorView,
      int flags) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
      return new SystemUiHiderHoneycomb(activity, anchorView, flags);
    } else {
      return new SystemUiHiderBase(activity, anchorView, flags);
    }
  }

  protected SystemUiHider(Activity activity, View anchorView, int flags) {
    mActivity = activity;
    mAnchorView = anchorView;
    mFlags = flags;
  }

  /**
   * Sets up the system UI hider. Should be called from
   * {@link Activity#onCreate}.
   */
  public abstract void setup();

  /**
   * Returns whether or not the system UI is visible.
   */
  public abstract boolean isVisible();

  /**
   * Hide the system UI.
   */
  public abstract void hide();

  /**
   * Show the system UI.
   */
  public abstract void show();

  /**
   * Toggle the visibility of the system UI.
   */
  public void toggle() {
    if (isVisible()) {
      hide();
    } else {
      show();
    }
  }

  /**
   * Registers a callback, to be triggered when the system UI visibility
   * changes.
   */
  public void setOnVisibilityChangeListener(
      OnVisibilityChangeListener listener) {
    if (listener == null) {
      listener = sDummyListener;
    }

    mOnVisibilityChangeListener = listener;
  }

  /**
   * A dummy no-op callback for use when there is no other listener set.
   */
  private static OnVisibilityChangeListener sDummyListener = new OnVisibilityChangeListener() {
    @Override
    public void onVisibilityChange(boolean visible) {
    }
  };

  /**
   * A callback interface used to listen for system UI visibility changes.
   */
  public interface OnVisibilityChangeListener {
    /**
     * Called when the system UI visibility has changed.
     * 
     * @param visible
     *            True if the system UI is visible.
     */
    public void onVisibilityChange(boolean visible);
  }
}




Java Source Code List

Dialogs.ServerOptionsLoggedIn.java
Dialogs.ServerOptionsLoggedOut.java
asynctasks.HttpGetListMeetings.java
asynctasks.HttpGetPersonalData.java
asynctasks.HttpGetServerName.java
asynctasks.HttpPostNewMeeting.java
asynctasks.HttpPostRequestLogInAlreadyExistsUser.java
asynctasks.HttpPostRequestLogInFirstTime.java
asynctasks.HttpPostRequestLogIn.java
asynctasks.HttpPostSignUp.java
asynctasks.HttpPutSendFile.java
asynctasks.RefreshMeetingProgress.java
com.TrololoCompany.meetingdataexchangeAdapters.FileAdapter.java
com.TrololoCompany.meetingdataexchangeAdapters.MeetingAdapter.java
com.TrololoCompany.meetingdataexchangeAdapters.ServerAdapter.java
com.TrololoCompany.meetingdataexchange.AddNewMeetingActivity.java
com.TrololoCompany.meetingdataexchange.AddServerActivityFail.java
com.TrololoCompany.meetingdataexchange.AddServerActivitySuccess.java
com.TrololoCompany.meetingdataexchange.AddServerActivity.java
com.TrololoCompany.meetingdataexchange.DisplayQR.java
com.TrololoCompany.meetingdataexchange.LogInActivity.java
com.TrololoCompany.meetingdataexchange.MainActivity.java
com.TrololoCompany.meetingdataexchange.MeetingDetails.java
com.TrololoCompany.meetingdataexchange.ServerList.java
com.TrololoCompany.meetingdataexchange.ServerManageActivity.java
com.TrololoCompany.meetingdataexchangeServices.MeetingDetailsRefresh.java
com.TrololoCompany.meetingdataexchangeServices.MeetingServerCommunication.java
com.TrololoCompany.meetingdataexchangeServices.ServiceHandlers.java
com.TrololoCompany.meetingdataexchange.SignUpActivity.java
com.TrololoCompany.meetingdataexchange.util.SystemUiHiderBase.java
com.TrololoCompany.meetingdataexchange.util.SystemUiHiderHoneycomb.java
com.TrololoCompany.meetingdataexchange.util.SystemUiHider.java
com.TrololoCompany.meetingdataexchangedataBase.CommentEntity.java
com.TrololoCompany.meetingdataexchangedataBase.DataBaseHelper.java
com.TrololoCompany.meetingdataexchangedataBase.FileEntity.java
com.TrololoCompany.meetingdataexchangedataBase.MeetingEntity.java
com.TrololoCompany.meetingdataexchangedataBase.ServerEntity.java
controllers.Accounts.java
controllers.FilesManagement.java
controllers.GeneralStuff.java
controllers.Mailing.java
controllers.Meetings.java
dataBase.CommentEntity.java
dataBase.DataBaseHelper.java
dataBase.FileEntity.java
dataBase.MeetingEntity.java
dataBase.MettingEntity.java
dataBase.ServerEntity.java
dataBase.Server.java
fileMaintenance.FileMaintenance.java
lists.MeetingList.java
lists.ServerList.java
meeting_options.FireMissilesDialogFragment.java
meeting_options.MeetDetOnPageListener.java
meeting_options.MeetDetTabListener.java
meeting_options.MeetingAddItems.java
meeting_options.MeetingDescription.java
meeting_options.MeetingProgressUIRefresh.java
meeting_options.MeetingProgress.java
meeting_options.MeetingTabPagerAdapter.java
meeting_options.MyOnPageChangeListener.java
meeting_options.MyTabListener.java
meeting_options.RefreshMeetingProgressListView.java
meeting_options.TabsPagerAdapter.java
models.DbSingleton.java
models.DefaultSchema.java
models.Keys.java
models.Tables.java
models.tables.Comment.java
models.tables.File.java
models.tables.Meeting.java
models.tables.Meetinguser.java
models.tables.Session.java
models.tables.SqliteSequence.java
models.tables.User.java
models.tables.records.CommentRecord.java
models.tables.records.FileRecord.java
models.tables.records.MeetingRecord.java
models.tables.records.MeetinguserRecord.java
models.tables.records.SessionRecord.java
models.tables.records.SqliteSequenceRecord.java
models.tables.records.UserRecord.java
serverCommunicator.CheckIsServerExists.java
serverCommunicator.CommentsHelper.java
serverCommunicator.CommunicationHelper.java
serverCommunicator.Communication.java
serverCommunicator.FileHelper.java
serverCommunicator.FileListRefreshService.java
serverCommunicator.GetMeetingListHelper.java
serverCommunicator.GetPersonalDataHelper.java
serverCommunicator.HttpGetRequest.java
serverCommunicator.HttpPostRequest.java
serverCommunicator.LogInHelper.java
serverCommunicator.MeetingHelper.java
serverCommunicator.NewMeetingHelper.java
serverCommunicator.RegistrationHelper.java
tools.MD5Checksum.java