Example usage for android.view Window FEATURE_NO_TITLE

List of usage examples for android.view Window FEATURE_NO_TITLE

Introduction

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

Prototype

int FEATURE_NO_TITLE

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

Click Source Link

Document

Flag for the "no title" feature, turning off the title at the top of the screen.

Usage

From source file:com.b44t.ui.IntroActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    setTheme(R.style.Theme_MessengerProj);
    super.onCreate(savedInstanceState);
    Theme.loadRecources(this);
    requestWindowFeature(Window.FEATURE_NO_TITLE);

    if (AndroidUtilities.isTablet()) {
        setContentView(R.layout.intro_layout_tablet);
    } else {/*from  w  ww  .  j  ava 2 s . co  m*/
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        setContentView(R.layout.intro_layout);
    }

    if (LocaleController.isRTL) {
        icons = new int[] { R.drawable.intro7, R.drawable.intro6, R.drawable.intro5, R.drawable.intro4,
                R.drawable.intro3, R.drawable.intro2, R.drawable.intro1 };
        titles = new int[] { R.string.Intro7Headline, R.string.Intro6Headline, R.string.Intro5Headline,
                R.string.Intro4Headline, R.string.Intro3Headline, R.string.Intro2Headline,
                R.string.Intro1Headline };
        messages = new int[] { R.string.Intro7Message, R.string.Intro6Message, R.string.Intro5Message,
                R.string.Intro4Message, R.string.Intro3Message, R.string.Intro2Message,
                R.string.Intro1Message };
    } else {
        icons = new int[] { R.drawable.intro1, R.drawable.intro2, R.drawable.intro3, R.drawable.intro4,
                R.drawable.intro5, R.drawable.intro6, R.drawable.intro7 };
        titles = new int[] { R.string.Intro1Headline, R.string.Intro2Headline, R.string.Intro3Headline,
                R.string.Intro4Headline, R.string.Intro5Headline, R.string.Intro6Headline,
                R.string.Intro7Headline };
        messages = new int[] { R.string.Intro1Message, R.string.Intro2Message, R.string.Intro3Message,
                R.string.Intro4Message, R.string.Intro5Message, R.string.Intro6Message,
                R.string.Intro7Message };
    }
    viewPager = (ViewPager) findViewById(R.id.intro_view_pager);
    TextView startMessagingButton = (TextView) findViewById(R.id.start_messaging_button);
    startMessagingButton.setText(ApplicationLoader.applicationContext.getString(R.string.IntroStartMessaging)
            .toUpperCase(Locale.getDefault()));
    if (Build.VERSION.SDK_INT >= 21) {
        StateListAnimator animator = new StateListAnimator();
        animator.addState(new int[] { android.R.attr.state_pressed }, ObjectAnimator
                .ofFloat(startMessagingButton, "translationZ", AndroidUtilities.dp(2), AndroidUtilities.dp(4))
                .setDuration(200));
        animator.addState(new int[] {}, ObjectAnimator
                .ofFloat(startMessagingButton, "translationZ", AndroidUtilities.dp(4), AndroidUtilities.dp(2))
                .setDuration(200));
        startMessagingButton.setStateListAnimator(animator);
    }
    topImage1 = (ImageView) findViewById(R.id.icon_image1);
    topImage2 = (ImageView) findViewById(R.id.icon_image2);
    bottomPages = (ViewGroup) findViewById(R.id.bottom_pages);
    topImage2.setVisibility(View.GONE);
    viewPager.setAdapter(new IntroAdapter());
    viewPager.setPageMargin(0);
    viewPager.setOffscreenPageLimit(1);
    viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
        @Override
        public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {

        }

        @Override
        public void onPageSelected(int i) {

        }

        @Override
        public void onPageScrollStateChanged(int i) {
            if (i == ViewPager.SCROLL_STATE_IDLE || i == ViewPager.SCROLL_STATE_SETTLING) {
                if (lastPage != viewPager.getCurrentItem()) {
                    lastPage = viewPager.getCurrentItem();

                    final ImageView fadeoutImage;
                    final ImageView fadeinImage;
                    if (topImage1.getVisibility() == View.VISIBLE) {
                        fadeoutImage = topImage1;
                        fadeinImage = topImage2;

                    } else {
                        fadeoutImage = topImage2;
                        fadeinImage = topImage1;
                    }

                    fadeinImage.bringToFront();
                    fadeinImage.setImageResource(icons[lastPage]);
                    fadeinImage.clearAnimation();
                    fadeoutImage.clearAnimation();

                    Animation outAnimation = AnimationUtils.loadAnimation(IntroActivity.this,
                            R.anim.icon_anim_fade_out);
                    outAnimation.setAnimationListener(new Animation.AnimationListener() {
                        @Override
                        public void onAnimationStart(Animation animation) {
                        }

                        @Override
                        public void onAnimationEnd(Animation animation) {
                            fadeoutImage.setVisibility(View.GONE);
                        }

                        @Override
                        public void onAnimationRepeat(Animation animation) {

                        }
                    });

                    Animation inAnimation = AnimationUtils.loadAnimation(IntroActivity.this,
                            R.anim.icon_anim_fade_in);
                    inAnimation.setAnimationListener(new Animation.AnimationListener() {
                        @Override
                        public void onAnimationStart(Animation animation) {
                            fadeinImage.setVisibility(View.VISIBLE);
                        }

                        @Override
                        public void onAnimationEnd(Animation animation) {
                        }

                        @Override
                        public void onAnimationRepeat(Animation animation) {

                        }
                    });

                    fadeoutImage.startAnimation(outAnimation);
                    fadeinImage.startAnimation(inAnimation);
                }
            }
        }
    });

    startMessagingButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (startPressed) {
                return;
            }
            startPressed = true;
            Intent intent2 = new Intent(IntroActivity.this, LaunchActivity.class);
            intent2.putExtra("fromIntro", true);
            startActivity(intent2);
            finish();
        }
    });

    justCreated = true;
}

From source file:com.ubiLive.GameCloud.payment.GoogleBillingActivity.java

/** Called when the activity is first created. */
@Override//from ww w. j a v a2s  .  c  o  m
public void onCreate(Bundle savedInstanceState) {
    /*refer to
     * Webview client google play in-app purchase spec
     * http://wiki.ubitus.net/pages/viewpage.action?pageId=32640257
     * {
     *   "id": "zkvkjxklrwekrejw"
     *   "type": "set",
     *   "google": {
     *       "packageName": "devils",
     *       "productId": "product_id",
     *       "purchaseType": "inapp",
     *       "developerPayload": "bGoa+V7g/yqDXvKRqq+JTFn4uQZbPiQJo4pf9RzJ"
     *   }
     * }
     */
    String base64EncodedPublicKey = "DUMMY_BILLING_PUBLICKEY";
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    Bundle bundleData = getIntent().getExtras();
    if (CloudGamePlayer.sWebBrowser.getBillingStatus() == Constants.BILLING_STATUS_START) {
        DebugLog.d(TAG, "GoogleBillingActivity.onCreate() line50");
        //finish();
        return;
    }

    mJsonData = bundleData.getString("jsonData");
    DebugLog.d(TAG, "BillingActivity.onCreate() mJsonData=" + mJsonData);
    // compute your public key and store it in base64EncodedPublicKey
    mHelper = new IabHelper(this, base64EncodedPublicKey);

    JSONObject json;
    try {
        json = new JSONObject(mJsonData);
        mStrId = json.getString("id");
        GooglePurchaseInfo googlePurchaseInfo = new GooglePurchaseInfo();
        googlePurchaseInfo.idStr = json.optString("id");
        googlePurchaseInfo.packageNameStr = json.optString("packageName");
        googlePurchaseInfo.productIdStr = json.optString("productId");
        googlePurchaseInfo.developerPayloadStr = json.optString("developerPayload");
        mGooglePurchaseMap.put(googlePurchaseInfo.productIdStr, googlePurchaseInfo);

        mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() {
            public void onIabSetupFinished(final IabResult result) {
                DebugLog.d(TAG, "Setup finished.");

                if (!result.isSuccess()) {
                    // Oh noes, there was a problem.
                    //                             complain("Problem setting up in-app billing: " + result);
                    return;
                }

                // Have we been disposed of in the meantime? If so, quit.
                if (mHelper == null)
                    return;

                // IAB is fully set up. Now, let's get an inventory of stuff we own.
                DebugLog.d(TAG, "Setup successful. Querying inventory.");
                mHelper.queryInventoryAsync(mGotInventoryListener);
            }
        });

        processGooglePurchase(googlePurchaseInfo.productIdStr);
    } catch (JSONException e) {
        // TODO Auto-generated catch block
        DebugLog.d(TAG, "exception = " + e.getMessage());
        finish();
    }
    CloudGamePlayer.sWebBrowser.setBillingStatus(Constants.BILLING_STATUS_START);
    DebugLog.d(TAG, "GoogleBillingActivity() leave ");
}

From source file:de.teambluebaer.patientix.activities.LoginActivity.java

/**
 * In this method is defined what happens on create of the Activity:
 * Set Layout and remove titlebar// w  w  w . j  a va  2 s .  co m
 *
 * @param savedInstanceState Standard parameter
 */
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);

    setContentView(R.layout.activity_login);
    Constants.CURRENTACTIVITY = this;
    Constants.LISTOFACTIVITIES.add(this);

    getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
    Constants.TORESTART = false;
    PrefUtils.setKioskModeActive(true, this);
    buttonLogin = (Button) findViewById(R.id.buttonLogin);
    editTextPassword = (EditText) findViewById(R.id.editTextPassword);
    editTextPassword.setOnEditorActionListener(new EditText.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (actionId == EditorInfo.IME_ACTION_DONE) {
                onClickLoginButton(v);
            }
            return true;
        }
    });
    InsertConfig.getConfig();
}

From source file:fr.pronoschallenge.afreechart.AFreeChartAnnotationActivity.java

/**
 * Called when the activity is starting.
 * @param savedInstanceState// w  ww . j av  a2 s. c  o  m
 */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Bundle objetbunble = this.getIntent().getExtras();
    setItemName((String) objetbunble.get("item"));
    setMode((Integer) objetbunble.get("mode"));

    new EvolutionTask(this).execute(getItemName());
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setTitle(getString(R.string.title_evolution));

}

From source file:com.groupme.sdk.activity.PinEntryActivity.java

@Override
protected Dialog onCreateDialog(int id, Bundle args) {
    switch (id) {
    case DIALOG_LOADING:
        ProgressDialog dialog = new ProgressDialog(this);
        dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
        dialog.setMessage(getString(R.string.validation_waiting_message));
        return dialog;
    default://from  w w w .j a va2s.  co m
        throw new IllegalArgumentException("Unknown dialog id: " + id);
    }
}

From source file:com.fbbackup.ImageDetailActivity.java

@TargetApi(11)
@Override/*w ww.  j ava2s  .c  o m*/
public void onCreate(Bundle savedInstanceState) {
    if (BuildConfig.DEBUG) {
        Utils.enableStrictMode();
    }
    super.onCreate(savedInstanceState);

    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.image_detail_pager);

    extStorageDirectory = Environment.getExternalStorageDirectory().toString();

    // Fetch screen height and width, to use as our max size when loading
    // images as this
    // activity runs full screen
    final DisplayMetrics displayMetrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
    final int height = displayMetrics.heightPixels;
    final int width = displayMetrics.widthPixels;

    photoArray = getIntent().getExtras().getStringArray("photo");
    albumName = getIntent().getExtras().getString("albumName");
    img_pos = getIntent().getExtras().getInt("albumPosition");
    name = getIntent().getExtras().getString("userName");

    setView();
    setListener();

    // For this sample we'll use half of the longest width to resize our
    // images. As the
    // image scaling ensures the image is larger than this, we should be
    // left with a
    // resolution that is appropriate for both portrait and landscape. For
    // best image quality
    // we shouldn't divide by 2, but this will use more memory and require a
    // larger memory
    // cache.
    final int longest = (height > width ? height : width) / 2;

    Log.w("testSize", "longest:" + longest);

    ImageCache.ImageCacheParams cacheParams = new ImageCache.ImageCacheParams(this, IMAGE_CACHE_DIR);
    cacheParams.setMemCacheSizePercent(0.25f); // Set memory cache to 25% of
    // app memory

    // The ImageFetcher takes care of loading images into our ImageView
    // children asynchronously
    mImageFetcher = new ImageFetcher(this, longest);
    mImageFetcher.addImageCache(getSupportFragmentManager(), cacheParams);
    mImageFetcher.setImageFadeIn(false);

    // Set up ViewPager and backing adapter
    mAdapter = new ImagePagerAdapter(getSupportFragmentManager(), photoArray.length);
    mPager = (ViewPager) findViewById(R.id.pager);
    mPager.setAdapter(mAdapter);
    mPager.setPageMargin((int) getResources().getDimension(R.dimen.image_detail_pager_margin));
    mPager.setOffscreenPageLimit(2);
    mPager.setOnPageChangeListener(new MyOnPageChangeListener());

    // Set up activity to go full screen
    // getWindow().addFlags(LayoutParams.FLAG_FULLSCREEN);

    // Enable some additional newer visibility and ActionBar features to
    // create a more
    // immersive photo viewing experience
    //      if (Utils.hasHoneycomb()) {
    //         final ActionBar actionBar = getActionBar();
    //
    //         // Hide title text and set home as up
    //         actionBar.setDisplayShowTitleEnabled(false);
    //         actionBar.setDisplayHomeAsUpEnabled(true);
    //
    //         // Hide and show the ActionBar as the visibility changes
    //         mPager.setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener() {
    //            @Override
    //            public void onSystemUiVisibilityChange(int vis) {
    //               if ((vis & View.SYSTEM_UI_FLAG_LOW_PROFILE) != 0) {
    //                  actionBar.hide();
    //               } else {
    //                  actionBar.show();
    //               }
    //            }
    //         });
    //
    //         // Start low profile mode and hide ActionBar
    //         mPager.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
    //         actionBar.hide();
    //      }

    // Set the current item based on the extra passed in to this activity
    final int extraCurrentItem = getIntent().getIntExtra(EXTRA_IMAGE, -1);
    if (extraCurrentItem != -1) {
        mPager.setCurrentItem(extraCurrentItem);
    }
}

From source file:ax.ha.it.smsalarm.activity.Splash.java

/**
 * Perform initialization of <code>Layout</code>'s, fetching {@link SharedPreferences}, setting up {@link View}'s, setting different
 * <code>Listener</code>'s and other things that's needed by this {@link Activity} in order for it to work.
 *///from  w  ww .  j a  v  a  2  s .  co  m
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Remove title on activity
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.splash);

    // Report that the application was opened through the widget
    if (getIntent() != null && ACTION_REPORT_OPENED_THROUGH_WIDGET.equals(getIntent().getAction())) {
        GoogleAnalyticsHandler.sendEvent(EventCategory.USER_INTERFACE, EventAction.WIDGET_INTERACTION,
                WidgetProvider.OPEN_SMS_ALARM_LABEL);
    }

    // Text with correct version number
    versionTextView = (TextView) findViewById(R.id.splashVersion_tv);
    versionTextView.setText(
            String.format(getString(R.string.SPLASH_VERSION), getString(R.string.APPLICATION_VERSION)));

    // Fetch value from shared preferences, this is to decide if user has agreed user the user license before or not and to figure out if splash
    // screen should be shown or not
    endUserLicenseAgreed = (Boolean) prefHandler.fetchPrefs(PrefKey.SHARED_PREF,
            PrefKey.END_USER_LICENSE_AGREED, DataType.BOOLEAN, this, false);
    showSplashScreen = (Boolean) prefHandler.fetchPrefs(PrefKey.SHARED_PREF, PrefKey.SHOW_SPLASH_SCREEN_KEY,
            DataType.BOOLEAN, this, true);

    // Only set up onClickListener and start Runnable if user has agreed the end user license agreement
    if (endUserLicenseAgreed) {
        // Skip splash screen switch activity directly
        if (!showSplashScreen) {
            switchActivity();
        }

        // Get a handle to the layout by finding it's id
        RelativeLayout splashRelativeLayout = (RelativeLayout) findViewById(R.id.splash_rl);

        // Create object that acts as listener to the sbStartView
        splashRelativeLayout.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                switchActivity();
            }
        });

        // Initialize a handler object, used to put a thread to sleep, activity will be switched after thread has been a sleep for a given
        // time
        handler = new Handler();
        handler.postDelayed(new Runnable() {
            @Override
            public void run() {
                switchActivity();
            }
        }, delay);
    } else { // Else show dialog requesting for user to agree the license
        EulaDialog dialog = new EulaDialog();
        dialog.show(getSupportFragmentManager(), EulaDialog.EULA_DIALOG_TAG);
    }
}

From source file:com.appnexus.opensdkapp.MainActivity.java

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

    Clog.v(Constants.BASE_LOG_TAG, "App created");

    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.activity_main);

    initTabHost();/*from  w w w . j a v a 2  s  .  co m*/
    initViewPager();

    tabHost.setOnTabChangedListener(this);

    // Default to Preview tab
    new Handler() {
        @Override
        public void handleMessage(Message msg) {
            onPageSelected(TABS.PREVIEW.ordinal());
        }
    }.sendEmptyMessage(0);

    btnMore = findViewById(R.id.btn_log);
    btnLog = findViewById(R.id.log_extension);

    btnMore.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (btnLog.getVisibility() == View.VISIBLE)
                btnLog.setVisibility(View.GONE);
            else
                btnLog.setVisibility(View.VISIBLE);
        }
    });

    btnLog.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            view.setVisibility(View.GONE);
            showLogDialog();
        }
    });

    contentView = getWindow().findViewById(Window.ID_ANDROID_CONTENT);

    Clog.registerListener(logTabClogListener);
}

From source file:com.example.de.taomi2.mediachooser.activity.HomeFragmentActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.activity_home_media_chooser);

    headerBarTitle = (TextView) findViewById(R.id.titleTextViewFromMediaChooserHeaderBar);
    headerBarCamera = (ImageView) findViewById(R.id.cameraImageViewFromMediaChooserHeaderBar);
    headerBarBack = (ImageView) findViewById(R.id.backArrowImageViewFromMediaChooserHeaderView);
    headerBarDone = (TextView) findViewById(R.id.doneTextViewViewFromMediaChooserHeaderView);
    mTabHost = (FragmentTabHost) findViewById(android.R.id.tabhost);

    mTabHost.setup(this, getSupportFragmentManager(), R.id.realTabcontent);
    headerBarBack.setOnClickListener(clickListener);
    headerBarCamera.setOnClickListener(clickListener);
    headerBarDone.setOnClickListener(clickListener);

    if (!MediaChooserConstants.showCameraVideo) {
        headerBarCamera.setVisibility(View.GONE);
    }//from  w  w w . j av a  2  s .  co m

    if (getIntent() != null && (getIntent().getBooleanExtra("isFromBucket", false))) {

        if (getIntent().getBooleanExtra("image", false)) {
            headerBarTitle.setText(getResources().getString(R.string.image));
            setHeaderBarCameraBackground(getResources().getDrawable(R.drawable.selector_camera_button));

            headerBarCamera.setTag(getResources().getString(R.string.image));

            Bundle bundle = new Bundle();
            bundle.putString("name", getIntent().getStringExtra("name"));
            mTabHost.addTab(
                    mTabHost.newTabSpec("tab1")
                            .setIndicator(getResources().getString(R.string.images_tab) + "     "),
                    ImageFragment.class, bundle);

        } else {
            headerBarTitle.setText(getResources().getString(R.string.video));
            setHeaderBarCameraBackground(getResources().getDrawable(R.drawable.selector_video_button));
            headerBarCamera.setTag(getResources().getString(R.string.video));

            Bundle bundle = new Bundle();
            bundle.putString("name", getIntent().getStringExtra("name"));
            mTabHost.addTab(
                    mTabHost.newTabSpec("tab2")
                            .setIndicator(getResources().getString(R.string.videos_tab) + "      "),
                    VideoFragment.class, bundle);
        }
    } else {

        if (MediaChooserConstants.showVideo) {
            mTabHost.addTab(
                    mTabHost.newTabSpec("tab2")
                            .setIndicator(getResources().getString(R.string.videos_tab) + "      "),
                    VideoFragment.class, null);
        }

        if (MediaChooserConstants.showImage) {
            headerBarTitle.setText(getResources().getString(R.string.image));
            setHeaderBarCameraBackground(getResources().getDrawable(R.drawable.selector_camera_button));
            headerBarCamera.setTag(getResources().getString(R.string.image));

            mTabHost.addTab(
                    mTabHost.newTabSpec("tab1")
                            .setIndicator(getResources().getString(R.string.images_tab) + "      "),
                    ImageFragment.class, null);
        }

        if (MediaChooserConstants.showVideo) {
            headerBarTitle.setText(getResources().getString(R.string.video));
            setHeaderBarCameraBackground(getResources().getDrawable(R.drawable.selector_video_button));
            headerBarCamera.setTag(getResources().getString(R.string.video));
        }
    }

    for (int i = 0; i < mTabHost.getTabWidget().getChildCount(); i++) {

        TextView textView = (TextView) mTabHost.getTabWidget().getChildAt(i).findViewById(android.R.id.title);
        if (textView.getLayoutParams() instanceof RelativeLayout.LayoutParams) {

            RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) textView.getLayoutParams();
            params.addRule(RelativeLayout.CENTER_HORIZONTAL);
            params.addRule(RelativeLayout.CENTER_VERTICAL);
            params.height = RelativeLayout.LayoutParams.MATCH_PARENT;
            params.width = RelativeLayout.LayoutParams.WRAP_CONTENT;
            textView.setLayoutParams(params);

        } else if (textView.getLayoutParams() instanceof LinearLayout.LayoutParams) {
            LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) textView.getLayoutParams();
            params.gravity = Gravity.CENTER;
            textView.setLayoutParams(params);
        }
        textView.setTextColor(getResources().getColor(R.color.tabs_title_color));
        textView.setTextSize(convertDipToPixels(10));

    }

    if ((mTabHost.getTabWidget().getChildAt(0) != null)) {
        ((TextView) (mTabHost.getTabWidget().getChildAt(0).findViewById(android.R.id.title)))
                .setTextColor(Color.WHITE);
    }

    if ((mTabHost.getTabWidget().getChildAt(1) != null)) {
        ((TextView) (mTabHost.getTabWidget().getChildAt(1).findViewById(android.R.id.title)))
                .setTextColor(getResources().getColor(R.color.headerbar_selected_tab_color));
    }

    mTabHost.setOnTabChangedListener(new OnTabChangeListener() {

        @Override
        public void onTabChanged(String tabId) {

            android.support.v4.app.FragmentManager fragmentManager = getSupportFragmentManager();
            ImageFragment imageFragment = (ImageFragment) fragmentManager.findFragmentByTag("tab1");
            VideoFragment videoFragment = (VideoFragment) fragmentManager.findFragmentByTag("tab2");
            android.support.v4.app.FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();

            if (tabId.equalsIgnoreCase("tab1")) {

                headerBarTitle.setText(getResources().getString(R.string.image));
                setHeaderBarCameraBackground(getResources().getDrawable(R.drawable.selector_camera_button));
                headerBarCamera.setTag(getResources().getString(R.string.image));

                if (imageFragment != null) {

                    if (videoFragment != null) {
                        fragmentTransaction.hide(videoFragment);
                    }
                    fragmentTransaction.show(imageFragment);
                }
                ((TextView) (mTabHost.getTabWidget().getChildAt(0).findViewById(android.R.id.title)))
                        .setTextColor(getResources().getColor(R.color.headerbar_selected_tab_color));
                ((TextView) (mTabHost.getTabWidget().getChildAt(1).findViewById(android.R.id.title)))
                        .setTextColor(Color.WHITE);

            } else {
                headerBarTitle.setText(getResources().getString(R.string.video));
                setHeaderBarCameraBackground(getResources().getDrawable(R.drawable.selector_video_button));
                headerBarCamera.setTag(getResources().getString(R.string.video));

                if (videoFragment != null) {

                    if (imageFragment != null) {
                        fragmentTransaction.hide(imageFragment);
                    }

                    fragmentTransaction.show(videoFragment);
                    if (videoFragment.getAdapter() != null) {
                        videoFragment.getAdapter().notifyDataSetChanged();
                    }
                }
                ((TextView) (mTabHost.getTabWidget().getChildAt(0).findViewById(android.R.id.title)))
                        .setTextColor(Color.WHITE);
                ((TextView) (mTabHost.getTabWidget().getChildAt(1).findViewById(android.R.id.title)))
                        .setTextColor(getResources().getColor(R.color.headerbar_selected_tab_color));
            }

            fragmentTransaction.commit();
        }
    });

    RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) headerBarCamera.getLayoutParams();
    params.height = convertDipToPixels(40);
    params.width = convertDipToPixels(40);
    headerBarCamera.setLayoutParams(params);
    headerBarCamera.setScaleType(ScaleType.CENTER_INSIDE);
    headerBarCamera.setPadding(convertDipToPixels(15), convertDipToPixels(15), convertDipToPixels(15),
            convertDipToPixels(15));

}

From source file:net.dian1.player.activity.ArtistActivity.java

/** Called when the activity is first created. */
@Override/*from ww w  .  java  2  s. com*/
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.artist);

    mArtistBar = (ArtistBar) findViewById(R.id.ArtistBar);
    mAlbumGridView = (GridView) findViewById(R.id.AlbumGridView);

    mArtistBar.setDescription(R.string.discography);

    mArtist = (Artist) getIntent().getSerializableExtra("artist");
    mAlbumGridAdapter = new AlbumGridAdapter(this);
    mArtistBar.setArtist(mArtist);

    loadAlbums();

    mAlbumGridView.setOnItemClickListener(mOnItemClickListener);
    mAlbumGridView.setOnItemLongClickListener(mOnItemLongClickListener);

    mDonateButton = (Button) findViewById(R.id.DonateButton);
    mDonateButton.setOnClickListener(mDonateClick);
    mWebpageButton = (Button) findViewById(R.id.WebpageButton);
    mWebpageButton.setOnClickListener(mWebpageClick);

    Toast.makeText(ArtistActivity.this, R.string.long_press_playlist, Toast.LENGTH_SHORT).show();

    mGestureOverlayView = (GestureOverlayView) findViewById(R.id.gestures);
    mGestureOverlayView.addOnGesturePerformedListener(Dian1Application.getInstance().getPlayerGestureHandler());
}