Example usage for android.view Window FEATURE_INDETERMINATE_PROGRESS

List of usage examples for android.view Window FEATURE_INDETERMINATE_PROGRESS

Introduction

In this page you can find the example usage for android.view Window FEATURE_INDETERMINATE_PROGRESS.

Prototype

int FEATURE_INDETERMINATE_PROGRESS

To view the source code for android.view Window FEATURE_INDETERMINATE_PROGRESS.

Click Source Link

Document

Flag for indeterminate progress.

Usage

From source file:com.android.gpstest.GpsTestActivity.java

/** Called when the activity is first created. */
@Override/*  w w w  . j  a  va2 s  . c  om*/
public void onCreate(Bundle savedInstanceState) {
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    super.onCreate(savedInstanceState);
    sInstance = this;

    // Set the default values from the XML file if this is the first
    // execution of the app
    PreferenceManager.setDefaultValues(this, R.xml.preferences, false);

    mService = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
    if (ActivityCompat.checkSelfPermission(this,
            android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED
            && ActivityCompat.checkSelfPermission(this,
                    android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
        // Permission Denied
        Toast.makeText(this, getString(R.string.permission_denied), Toast.LENGTH_SHORT).show();
        finish();
        return;
    } else {
        mProvider = mService.getProvider(LocationManager.GPS_PROVIDER);
        if (mProvider == null) {
            Log.e(TAG, "Unable to get GPS_PROVIDER");
            Toast.makeText(this, getString(R.string.gps_not_supported), Toast.LENGTH_SHORT).show();
            finish();
            return;
        }
    }
    mService.addGpsStatusListener(this);

    mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);

    // If we have a large screen, show all the fragments in one layout
    if (GpsTestUtil.isLargeScreen(this)) {
        setContentView(R.layout.activity_main_large_screen);
        mIsLargeScreen = true;
    } else {
        setContentView(R.layout.activity_main);
    }

    initActionBar(savedInstanceState);

    SharedPreferences settings = Application.getPrefs();

    double tempMinTime = Double.valueOf(settings.getString(getString(R.string.pref_key_gps_min_time),
            getString(R.string.pref_gps_min_time_default_sec)));
    minTime = (long) (tempMinTime * SECONDS_TO_MILLISECONDS);
    minDistance = Float.valueOf(settings.getString(getString(R.string.pref_key_gps_min_distance),
            getString(R.string.pref_gps_min_distance_default_meters)));

    if (settings.getBoolean(getString(R.string.pref_key_auto_start_gps), true)) {
        gpsStart();
    }
}

From source file:joshuatee.wx.USWXOGLRadarActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    preferences = PreferenceManager.getDefaultSharedPreferences(this);
    //editor = preferences.edit();
    theme_blue_current = preferences.getString("THEME_BLUE", "");
    setTheme(Utility.Theme(theme_blue_current));

    //setContentView(R.layout.activity_uswxoglradar);

    if (!DataStore.loaded)
        DataStore.Init(this);

    space = Pattern.compile(" ");
    comma = Pattern.compile(",");
    colon = Pattern.compile(":");

    //mImageMap = (ImageMap) findViewById(R.id.map);
    //mImageMap.setVisibility(View.GONE);

    cod_warnings_default = preferences.getString("COD_WARNINGS_DEFAULT", "");
    cod_cities_default = preferences.getString("COD_CITIES_DEFAULT", "");
    cod_hw_default = preferences.getString("COD_HW_DEFAULT", "true");
    cod_locdot_default = preferences.getString("COD_LOCDOT_DEFAULT", "true");
    cod_lakes_default = preferences.getString("COD_LAKES_DEFAULT", "true");

    //delay = UtilityImg.GetAnimInterval(preferences);

    img = new TouchImageView2(getApplicationContext());
    img.setMaxZoom(max_zoom);/*from w  w  w  .j ava 2 s  .c o m*/
    img.setZoom(init_zoom);

    dm = new DisplayMetrics();
    this.getWindowManager().getDefaultDisplay().getMetrics(dm);

    boolean isActionBarSplitted = ((dm.widthPixels / dm.density) < 400.00f);
    if (isActionBarSplitted) {
        ab_split = true;
    }

    int resourceId = getResources().getIdentifier("status_bar_height", "dimen", "android");
    statusBarHeight = getResources().getDimensionPixelSize(resourceId);

    TypedValue tv = new TypedValue();
    getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true);
    actionBarHeight = getResources().getDimensionPixelSize(tv.resourceId);
    actionBarHeight *= dm.density;

    screen_width = dm.widthPixels;
    screen_height = dm.heightPixels - statusBarHeight - actionBarHeight;

    turl = getIntent().getStringArrayExtra(RID);

    prod = "N0Q";

    view = new GLSurfaceView(this);
    view.setEGLContextClientVersion(2);
    mScaleDetector = new ScaleGestureDetector(this, new ScaleListener());
    mGestureDetector = new GestureDetectorCompat(this, this);

    OGLR = new OpenGLRenderRadar2Dv4(this);
    view.setRenderer(OGLR);
    view.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);

    density = (float) (OGLR.ort_int * 2) / dm.widthPixels;

    setContentView(view);
    ogl_in_view = true;

    rid1 = turl[0];
    state = turl[1];
    if (turl.length > 2) {
        prod = turl[2];
        if (prod.equals("N0R")) {
            prod = "N0Q";
        }
    }

    //rid_fav = preferences.getString(pref_token," : : :");
    //sector = preferences.getString("COD_SECTOR_"+state,"");
    //state = preferences.getString("STATE_CODE_"+state,"");
    //onek = preferences.getString("COD_1KM_"+rid1,"");

    setTitle(prod);

    rid_fav = preferences.getString(pref_token, " : : :");
    rid_arr_loc = UtilityFavorites.SetupFavMenu(preferences, rid_fav, turl[0], pref_token_location, colon);
    adapter = new ArrayAdapter<String>(getBaseContext(), android.R.layout.simple_spinner_dropdown_item,
            rid_arr_loc);
    getActionBar().setListNavigationCallbacks(adapter, navigationListener);
    getActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);

    navigationListener = new OnNavigationListener() {

        @Override
        public boolean onNavigationItemSelected(int itemPosition, long itemId) {

            if (itemPosition == 0 || itemPosition > 2) {
                rid1 = space.split(rid_arr_loc[itemPosition])[0];

                //rid_loc = preferences.getString("RID_LOC_"+rid1,"");
                //editor.putString("NEXRAD_LAST", rid1); 
                //editor.commit();

                old_state = state;
                old_sector = sector;
                old_onek = onek;
                state = comma.split(preferences.getString("RID_LOC_" + rid1, ""))[0];
                sector = preferences.getString("COD_SECTOR_" + state, "");
                state = preferences.getString("STATE_CODE_" + state, "");
                onek = preferences.getString("COD_1KM_" + rid1, "");

                if (prod.equals("2k")) {
                    img_url = img_url.replace(old_sector, sector);
                    img_url = img_url.replace(old_state, state);
                    img_url = img_url.replace(old_onek, onek);
                }
                if (!restarted) {
                    img.resetZoom();
                    img.setZoom(init_zoom);
                    OGLR.setZoom(1.0f);
                    mScaleFactor = 1.0f;
                    OGLR.mPositionX = 0.0f;
                    OGLR.mPositionY = 0.0f;
                }
                restarted = false;
                new GetContent().execute();
            } else if (itemPosition == 1) {
                Intent dtx_srm = new Intent(getApplicationContext(), RIDAddFavActivity.class);
                startActivity(dtx_srm);
            } else if (itemPosition == 2) {
                Intent dtx_srm2 = new Intent(getApplicationContext(), RIDRemoveFavActivity.class);
                startActivity(dtx_srm2);
            }

            return false;
        }
    };
    getActionBar().setListNavigationCallbacks(adapter, navigationListener);

}

From source file:com.adnanbal.fxdedektifi.forex.presentation.view.activity.SignalsActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    //    final Inventory.Request request = Inventory.Request.create();
    //    request.loadPurchases(ProductTypes.IN_APP);
    //    request.loadPurchases(ProductTypes.SUBSCRIPTION);
    ////from  w w  w.  j ava 2s .  co m
    //    request.loadSkus(SUBSCRIPTION, SKUS);
    //    request.loadSkus(ProductTypes.IN_APP, SKUS);
    prefs = getSharedPreferences("com.adnanbal.fxdedektifi.forex.presentation", MODE_PRIVATE);

    if (prefs.getBoolean("firstrun", true)) {
        this.navigator.navigateToMainIntroActivity(this);
        prefs.edit().putBoolean("firstrun", false).apply();
    }

    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    setContentView(com.adnanbal.fxdedektifi.forex.presentation.R.layout.activity_layout);

    unbinder = ButterKnife.bind(this);

    setUpToolbar_();
    setUpMaterialDialog();
    setupDrawerContent(navigationViewDrawer);

    this.initializeInjector();

    db = new DatabaseHandler(this);

}

From source file:com.andrewshu.android.reddit.threads.ThreadsListActivity.java

/**
 * Called when the activity starts up. Do activity initialization
 * here, not in a constructor.//from ww  w  . ja  va 2 s.c om
 * 
 * @see Activity#onCreate
 */
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    CookieSyncManager.createInstance(getApplicationContext());

    mSettings.loadRedditPreferences(getApplicationContext(), mClient);
    setRequestedOrientation(mSettings.getRotation());
    setTheme(mSettings.getTheme());
    requestWindowFeature(Window.FEATURE_PROGRESS);
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);

    setContentView(R.layout.threads_list_content);
    registerForContextMenu(getListView());

    if (savedInstanceState != null) {
        if (Constants.LOGGING)
            Log.d(TAG, "using savedInstanceState");
        mSubreddit = savedInstanceState.getString(Constants.SUBREDDIT_KEY);
        if (mSubreddit == null)
            mSubreddit = mSettings.getHomepage();
        mAfter = savedInstanceState.getString(Constants.AFTER_KEY);
        mBefore = savedInstanceState.getString(Constants.BEFORE_KEY);
        mCount = savedInstanceState.getInt(Constants.THREAD_COUNT_KEY);
        mLastAfter = savedInstanceState.getString(Constants.LAST_AFTER_KEY);
        mLastBefore = savedInstanceState.getString(Constants.LAST_BEFORE_KEY);
        mLastCount = savedInstanceState.getInt(Constants.THREAD_LAST_COUNT_KEY);
        mSortByUrl = savedInstanceState.getString(Constants.ThreadsSort.SORT_BY_KEY);
        mJumpToThreadId = savedInstanceState.getString(Constants.JUMP_TO_THREAD_ID_KEY);
        mVoteTargetThing = savedInstanceState.getParcelable(Constants.VOTE_TARGET_THING_INFO_KEY);

        // try to restore mThreadsList using getLastNonConfigurationInstance()
        // (separate function to avoid a compiler warning casting ArrayList<ThingInfo>
        restoreLastNonConfigurationInstance();
        if (mThreadsList == null) {
            // Load previous view of threads
            if (mLastAfter != null) {
                new MyDownloadThreadsTask(mSubreddit, mLastAfter, null, mLastCount).execute();
            } else if (mLastBefore != null) {
                new MyDownloadThreadsTask(mSubreddit, null, mLastBefore, mLastCount).execute();
            } else {
                new MyDownloadThreadsTask(mSubreddit).execute();
            }
        } else {
            // Orientation change. Use prior instance.
            resetUI(new ThreadsListAdapter(this, mThreadsList));
            if (Constants.FRONTPAGE_STRING.equals(mSubreddit))
                setTitle("reddit.com: what's new online!");
            else
                setTitle("/r/" + mSubreddit.trim());
        }
    }
    // Handle subreddit Uri passed via Intent
    else if (getIntent().getData() != null) {
        Matcher redditContextMatcher = REDDIT_PATH_PATTERN.matcher(getIntent().getData().getPath());
        if (redditContextMatcher.matches()) {
            new MyDownloadThreadsTask(redditContextMatcher.group(1)).execute();
        } else {
            new MyDownloadThreadsTask(mSettings.getHomepage()).execute();
        }
    }
    // No subreddit specified by Intent, so load the user's home reddit
    else {
        new MyDownloadThreadsTask(mSettings.getHomepage()).execute();
    }
}

From source file:com.shinymetal.gradereport.AbstractActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    BugSenseHandler.initAndStartSession(AbstractActivity.this, getString(R.string.bugsense_id));

    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    instance = this;

    mGshisLoader = DataLoader.getInstance(getApplicationContext());
    Database.setContext(this.getApplicationContext());

    // this is required to get proper list of pupils in fragments
    mGshisLoader.setLogin(PreferenceManager.getDefaultSharedPreferences(this)
            .getString(getString(R.string.pref_login_key), ""));

    mLicValidator = LicenseValidatorHelper.getInstance(this.getApplicationContext());
}

From source file:com.andrewshu.android.reddit.user.ProfileActivity.java

/**
 * Called when the activity starts up. Do activity initialization
 * here, not in a constructor.//from   w w  w. jav a2s.  c om
 * 
 * @see Activity#onCreate
 */
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    CookieSyncManager.createInstance(getApplicationContext());

    mSettings.loadRedditPreferences(this, mClient);
    setRequestedOrientation(mSettings.getRotation());
    setTheme(mSettings.getTheme());
    requestWindowFeature(Window.FEATURE_PROGRESS);
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);

    setContentView(R.layout.profile_list_content);
    registerForContextMenu(getListView());

    if (savedInstanceState != null) {
        if (Constants.LOGGING)
            Log.d(TAG, "using savedInstanceState");
        mUsername = savedInstanceState.getString(Constants.USERNAME_KEY);
        mAfter = savedInstanceState.getString(Constants.AFTER_KEY);
        mBefore = savedInstanceState.getString(Constants.BEFORE_KEY);
        mCount = savedInstanceState.getInt(Constants.THREAD_COUNT_KEY);
        mLastAfter = savedInstanceState.getString(Constants.LAST_AFTER_KEY);
        mLastBefore = savedInstanceState.getString(Constants.LAST_BEFORE_KEY);
        mLastCount = savedInstanceState.getInt(Constants.THREAD_LAST_COUNT_KEY);
        mKarma = savedInstanceState.getIntArray(Constants.KARMA_KEY);
        mSortByUrl = savedInstanceState.getString(Constants.CommentsSort.SORT_BY_KEY);
        mJumpToThreadId = savedInstanceState.getString(Constants.JUMP_TO_THREAD_ID_KEY);
        mVoteTargetThingInfo = savedInstanceState.getParcelable(Constants.VOTE_TARGET_THING_INFO_KEY);

        // try to restore mThingsList using getLastNonConfigurationInstance()
        // (separate function to avoid a compiler warning casting ArrayList<ThingInfo>
        restoreLastNonConfigurationInstance();
        if (mThingsList == null) {
            // Load previous page of profile items
            if (mLastAfter != null) {
                new DownloadProfileTask(mUsername, mLastAfter, null, mLastCount).execute();
            } else if (mLastBefore != null) {
                new DownloadProfileTask(mUsername, null, mLastBefore, mLastCount).execute();
            } else {
                new DownloadProfileTask(mUsername).execute();
            }
        } else {
            // Orientation change. Use prior instance.
            resetUI(new ThingsListAdapter(this, mThingsList));
            setTitle(mUsername + "'s profile");
        }
        return;
    }
    // Handle subreddit Uri passed via Intent
    else if (getIntent().getData() != null) {
        Matcher userPathMatcher = USER_PATH_PATTERN.matcher(getIntent().getData().getPath());
        if (userPathMatcher.matches()) {
            mUsername = userPathMatcher.group(1);
            new DownloadProfileTask(mUsername).execute();
            return;
        }
    }

    // No username specified by Intent, so load the logged in user's profile
    if (mSettings.isLoggedIn()) {
        mUsername = mSettings.getUsername();
        new DownloadProfileTask(mUsername).execute();
        return;
    }

    // Can't find a username to use. Quit.
    if (Constants.LOGGING)
        Log.e(TAG, "Could not find a username to use for ProfileActivity");
    finish();
}

From source file:com.andrewshu.android.reddit.profile.ProfileActivity.java

/**
 * Called when the activity starts up. Do activity initialization
 * here, not in a constructor./*from   w ww  .ja  v a 2 s . co m*/
 * 
 * @see Activity#onCreate
 */
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    CookieSyncManager.createInstance(getApplicationContext());

    mSettings.loadRedditPreferences(this, mClient);
    setRequestedOrientation(mSettings.getRotation());
    setTheme(mSettings.getTheme());
    requestWindowFeature(Window.FEATURE_PROGRESS);
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);

    setContentView(R.layout.profile_list_content);

    if (savedInstanceState != null) {
        if (Constants.LOGGING)
            Log.d(TAG, "using savedInstanceState");
        mUsername = savedInstanceState.getString(Constants.USERNAME_KEY);
        mAfter = savedInstanceState.getString(Constants.AFTER_KEY);
        mBefore = savedInstanceState.getString(Constants.BEFORE_KEY);
        mCount = savedInstanceState.getInt(Constants.THREAD_COUNT_KEY);
        mLastAfter = savedInstanceState.getString(Constants.LAST_AFTER_KEY);
        mLastBefore = savedInstanceState.getString(Constants.LAST_BEFORE_KEY);
        mLastCount = savedInstanceState.getInt(Constants.THREAD_LAST_COUNT_KEY);
        mKarma = savedInstanceState.getStringArray(Constants.KARMA_KEY);
        mSortByUrl = savedInstanceState.getString(Constants.CommentsSort.SORT_BY_KEY);
        mJumpToThreadId = savedInstanceState.getString(Constants.JUMP_TO_THREAD_ID_KEY);
        mVoteTargetThingInfo = savedInstanceState.getParcelable(Constants.VOTE_TARGET_THING_INFO_KEY);

        // try to restore mThingsList using getLastNonConfigurationInstance()
        // (separate function to avoid a compiler warning casting ArrayList<ThingInfo>
        restoreLastNonConfigurationInstance();
        if (mThingsList == null) {
            // Load previous page of profile items
            if (mLastAfter != null) {
                new DownloadProfileTask(mUsername, mLastAfter, null, mLastCount).execute();
            } else if (mLastBefore != null) {
                new DownloadProfileTask(mUsername, null, mLastBefore, mLastCount).execute();
            } else {
                new DownloadProfileTask(mUsername).execute();
            }
        } else {
            // Orientation change. Use prior instance.
            resetUI(new ThingsListAdapter(this, mThingsList));
            setTitle(mUsername + "'s profile");
        }
        return;
    }
    // Handle subreddit Uri passed via Intent
    else if (getIntent().getData() != null) {
        Matcher userPathMatcher = USER_PATH_PATTERN.matcher(getIntent().getData().getPath());
        if (userPathMatcher.matches()) {
            mUsername = userPathMatcher.group(1);
            new DownloadProfileTask(mUsername).execute();
            return;
        }
    }

    // No username specified by Intent, so load the logged in user's profile
    if (mSettings.isLoggedIn()) {
        mUsername = mSettings.getUsername();
        new DownloadProfileTask(mUsername).execute();
        return;
    }

    // Can't find a username to use. Quit.
    if (Constants.LOGGING)
        Log.e(TAG, "Could not find a username to use for ProfileActivity");
    finish();
}

From source file:org.videolan.vlc2.gui.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    if (!LibVlcUtil.hasCompatibleCPU(this)) {
        Log.e(TAG, LibVlcUtil.getErrorMsg());
        Intent i = new Intent(this, CompatErrorActivity.class);
        startActivity(i);/* w  ww.  ja  v  a2  s .  c o  m*/
        finish();
        super.onCreate(savedInstanceState);
        return;
    }

    /* Get the current version from package */
    PackageInfo pinfo = null;
    try {
        pinfo = getPackageManager().getPackageInfo(getPackageName(), 0);
    } catch (NameNotFoundException e) {
        Log.e(TAG, "package info not found.");
    }
    if (pinfo != null)
        mVersionNumber = pinfo.versionCode;

    /* Get settings */
    mSettings = PreferenceManager.getDefaultSharedPreferences(this);

    /* Check if it's the first run */
    mFirstRun = mSettings.getInt(PREF_FIRST_RUN, -1) != mVersionNumber;
    if (mFirstRun) {
        Editor editor = mSettings.edit();
        editor.putInt(PREF_FIRST_RUN, mVersionNumber);
        editor.commit();
    }

    try {
        // Start LibVLC
        VLCInstance.getLibVlcInstance();
    } catch (LibVlcException e) {
        e.printStackTrace();
        Intent i = new Intent(this, CompatErrorActivity.class);
        i.putExtra("runtimeError", true);
        i.putExtra("message", "LibVLC failed to initialize (LibVlcException)");
        startActivity(i);
        finish();
        super.onCreate(savedInstanceState);
        return;
    }

    super.onCreate(savedInstanceState);

    /*** Start initializing the UI ***/

    /* Enable the indeterminate progress feature */
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);

    // Set up the sliding menu
    mMenu = (SlidingMenu) LayoutInflater.from(this).inflate(R.layout.sliding_menu, null);
    changeMenuOffset();

    SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(this);
    boolean enableBlackTheme = pref.getBoolean("enable_black_theme", false);
    if (enableBlackTheme)
        setTheme(R.style.Theme_VLC_Black);

    View v_main = LayoutInflater.from(this).inflate(R.layout.main, null);
    setContentView(v_main);

    mSlidingPane = (SlidingPaneLayout) v_main.findViewById(R.id.pane);
    mSlidingPane.setPanelSlideListener(mPanelSlideListener);

    View sidebar = LayoutInflater.from(this).inflate(R.layout.sidebar, null);
    final ListView listView = (ListView) sidebar.findViewById(android.R.id.list);
    listView.setFooterDividersEnabled(true);
    mSidebarAdapter = new SidebarAdapter(this);
    listView.setAdapter(mSidebarAdapter);
    mMenu.setMenu(sidebar);
    mMenu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT, true);

    /* Initialize UI variables */
    mInfoLayout = v_main.findViewById(R.id.info_layout);
    mInfoProgress = (ProgressBar) v_main.findViewById(R.id.info_progress);
    mInfoText = (TextView) v_main.findViewById(R.id.info_text);
    mAudioPlayerFilling = v_main.findViewById(R.id.audio_player_filling);
    mRootContainer = (RelativeLayout) v_main.findViewById(R.id.root_container);

    /* Set up the action bar */
    prepareActionBar();

    /* Set up the sidebar click listener */
    listView.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            SidebarAdapter.SidebarEntry entry = (SidebarEntry) listView.getItemAtPosition(position);
            Fragment current = getSupportFragmentManager().findFragmentById(R.id.fragment_placeholder);

            if (current == null
                    || (entry != null && current.getTag().equals(entry.id))) { /* Already selected */
                mMenu.showContent();
                return;
            }

            // This should not happen
            if (entry == null || entry.id == null)
                return;

            /*
             * Clear any backstack before switching tabs. This avoids
             * activating an old backstack, when a user hits the back button
             * to quit
             */
            getSupportFragmentManager().popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE);

            /* Slide down the audio player */
            slideDownAudioPlayer();

            /* Switch the fragment */
            FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
            ft.replace(R.id.fragment_placeholder, getFragment(entry.id), entry.id);
            ft.commit();
            mCurrentFragment = entry.id;

            /*
             * Set user visibility hints to work around weird Android
             * behaviour of duplicate context menu events.
             */
            current.setUserVisibleHint(false);
            getFragment(mCurrentFragment).setUserVisibleHint(true);
            // HACK ALERT: Set underlying audio browser to be invisible too.
            if (current.getTag().equals("tracks"))
                getFragment("audio").setUserVisibleHint(false);

            mMenu.showContent();
        }
    });

    /* Set up the audio player */
    mAudioPlayer = new AudioPlayer();
    mAudioController = AudioServiceController.getInstance();

    getSupportFragmentManager().beginTransaction().replace(R.id.audio_player, mAudioPlayer).commit();

    if (mFirstRun) {
        /*
         * The sliding menu is automatically opened when the user closes
         * the info dialog. If (for any reason) the dialog is not shown,
         * open the menu after a short delay.
         */
        mHandler.postDelayed(new Runnable() {
            @Override
            public void run() {
                mMenu.showMenu();
            }
        }, 500);
    }

    /* Prepare the progressBar */
    IntentFilter filter = new IntentFilter();
    filter.addAction(ACTION_SHOW_PROGRESSBAR);
    filter.addAction(ACTION_HIDE_PROGRESSBAR);
    filter.addAction(ACTION_SHOW_TEXTINFO);
    filter.addAction(ACTION_SHOW_PLAYER);
    registerReceiver(messageReceiver, filter);

    /* Reload the latest preferences */
    reloadPreferences();
}

From source file:com.arantius.tivocommander.Search.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    setContentView(R.layout.search);/* w  ww. j av  a2 s .  c om*/
    setTitle("Search");

    final EditText searchBox = (EditText) findViewById(R.id.search_box);
    getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);

    mAdapter = new SearchAdapter(this, R.layout.item_show, mResults);

    setListAdapter(mAdapter);
    searchBox.addTextChangedListener(mTextWatcher);

    final ListView lv = getListView();
    lv.setOnItemClickListener(mOnClickListener);

    mEmptyView = findViewById(android.R.id.empty);
    mEmptyView.setVisibility(View.INVISIBLE);
}

From source file:com.myapps.playnation.main.MainActivity.java

@SuppressLint("NewApi")
private void miniSetup() {
    if (android.os.Build.VERSION.SDK_INT > 10) {
        StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
        StrictMode.setThreadPolicy(policy);
    }//from  w  w  w .  j  av a2  s  . c  om
    // requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);

    supportRequestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    getSupportActionBar().setTitle("Playnation Mobile");
    getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.color.background_gradient));
    con = DataConnector.getInst();
    Log.i("MainActiv", "intent.getInt() = " + getIntent().getExtras().getInt(Keys.AppState));
    isTablet = Configurations.getConfigs().isTablet();
    if (!isTablet)
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    setSupportProgressBarIndeterminateVisibility(true);
}