Example usage for android.graphics Color TRANSPARENT

List of usage examples for android.graphics Color TRANSPARENT

Introduction

In this page you can find the example usage for android.graphics Color TRANSPARENT.

Prototype

int TRANSPARENT

To view the source code for android.graphics Color TRANSPARENT.

Click Source Link

Usage

From source file:com.gosuncn.core.util.view.StatusBarUtils.java

/**
 * DrawerLayout ???/*  ww  w  .j  a va2 s  . co m*/
 *
 * @param activity       ?activity
 * @param drawerLayout   DrawerLayout
 * @param color          ??
 * @param statusBarAlpha ???
 */
public static void setColorForDrawerLayout(Activity activity, DrawerLayout drawerLayout, int color,
        int statusBarAlpha) {
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
        return;
    }
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
        activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        activity.getWindow().setStatusBarColor(Color.TRANSPARENT);
    } else {
        activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
    }
    // ????
    //  statusBarView 
    ViewGroup contentLayout = (ViewGroup) drawerLayout.getChildAt(0);
    if (contentLayout.getChildCount() > 0 && contentLayout.getChildAt(0) instanceof StatusBarView) {
        contentLayout.getChildAt(0).setBackgroundColor(calculateStatusColor(color, statusBarAlpha));
    } else {
        StatusBarView statusBarView = createStatusBarView(activity, color);
        contentLayout.addView(statusBarView, 0);
    }
    // ? LinearLayout ,padding top
    if (!(contentLayout instanceof LinearLayout) && contentLayout.getChildAt(1) != null) {
        contentLayout.getChildAt(1).setPadding(contentLayout.getPaddingLeft(),
                getStatusBarHeight(activity) + contentLayout.getPaddingTop(), contentLayout.getPaddingRight(),
                contentLayout.getPaddingBottom());
    }
    // 
    ViewGroup drawer = (ViewGroup) drawerLayout.getChildAt(1);
    drawerLayout.setFitsSystemWindows(false);
    contentLayout.setFitsSystemWindows(false);
    contentLayout.setClipToPadding(true);
    drawer.setFitsSystemWindows(false);

    addTranslucentView(activity, statusBarAlpha);
}

From source file:com.alburivan.slickform.tooltip.SimpleTooltip.java

private void configPopupWindow() {
    mPopupWindow = new AppCompatPopupWindow(mContext, null, mDefaultPopupWindowStyleRes);
    mPopupWindow.setOnDismissListener(this);
    mPopupWindow.setWidth(ViewGroup.LayoutParams.WRAP_CONTENT);
    mPopupWindow.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
    mPopupWindow.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
    mPopupWindow.setClippingEnabled(false);
    if (mDismissOnInsideTouch || mDismissOnOutsideTouch)
        mPopupWindow.setTouchInterceptor(mPopupWindowsTouchListener);
}

From source file:com.nghianh.giaitriviet.activity.MainActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    MobileAds.initialize(getApplicationContext(), "ca-app-pub-8092675209428225~8500010598");

    // Create an auto-managed GoogleApiClient with access to App Invites.
    mGoogleApiClient = new GoogleApiClient.Builder(this).addApi(AppInvite.API).enableAutoManage(this, this)
            .build();//from  ww w . j  a  va2  s . c  om
    // Check for App Invite invitations and launch deep-link activity if possible.
    // Requires that an Activity is registered in AndroidManifest.xml to handle
    // deep-link URLs.
    boolean autoLaunchDeepLink = true;
    AppInvite.AppInviteApi.getInvitation(mGoogleApiClient, this, autoLaunchDeepLink)
            .setResultCallback(new ResultCallback<AppInviteInvitationResult>() {
                @Override
                public void onResult(AppInviteInvitationResult result) {
                    Log.d(TAG, "getInvitation:onResult:" + result.getStatus());
                    if (result.getStatus().isSuccess()) {
                        // Extract information from the intent
                        Intent intent = result.getInvitationIntent();
                        String deepLink = AppInviteReferral.getDeepLink(intent);
                        String invitationId = AppInviteReferral.getInvitationId(intent);

                        // Because autoLaunchDeepLink = true we don't have to do anything
                        // here, but we could set that to false and manually choose
                        // an Activity to launch to handle the deep link here.
                        // ...
                    }
                }
            });

    if (useTabletMenu()) {
        setContentView(R.layout.activity_main_tablet);
        Helper.setStatusBarColor(MainActivity.this, ContextCompat.getColor(this, R.color.myPrimaryDarkColor));
    } else if (Config.USE_NEW_DRAWER) {
        setContentView(R.layout.activity_main_alternate);
    } else {
        setContentView(R.layout.activity_main);
        Helper.setStatusBarColor(MainActivity.this, ContextCompat.getColor(this, R.color.myPrimaryDarkColor));
    }

    mToolbar = (Toolbar) findViewById(R.id.toolbar_actionbar);
    setSupportActionBar(mToolbar);

    if (!useTabletMenu())
        getSupportActionBar().setDisplayShowHomeEnabled(true);
    else {
        getSupportActionBar().setDisplayShowHomeEnabled(false);
    }

    mNavigationDrawerFragment = (NavDrawerFragment) getSupportFragmentManager()
            .findFragmentById(R.id.fragment_drawer);

    if (Config.USE_NEW_DRAWER && !useTabletMenu()) {
        mNavigationDrawerFragment.setup(R.id.scrimInsetsFrameLayout, (DrawerLayout) findViewById(R.id.drawer),
                mToolbar);
        mNavigationDrawerFragment.getDrawerLayout()
                .setStatusBarBackgroundColor(ContextCompat.getColor(this, R.color.myPrimaryDarkColor));

        findViewById(R.id.scrimInsetsFrameLayout).getLayoutParams().width = getDrawerWidth();
    } else {
        mNavigationDrawerFragment.setup(R.id.fragment_drawer, (DrawerLayout) findViewById(R.id.drawer),
                mToolbar);

        DrawerLayout.LayoutParams params = (android.support.v4.widget.DrawerLayout.LayoutParams) mNavigationDrawerFragment
                .getView().getLayoutParams();
        params.width = getDrawerWidth();
        mNavigationDrawerFragment.getView().setLayoutParams(params);
    }

    if (useTabletMenu()) {
        mNavigationDrawerFragment.getDrawerLayout().setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_OPEN);
        mNavigationDrawerFragment.getDrawerLayout().setScrimColor(Color.TRANSPARENT);
    } else {
        mNavigationDrawerFragment.getDrawerLayout().setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);
    }

    Helper.admobLoader(this, getResources(), findViewById(R.id.adView));

    prefs = PreferenceManager.getDefaultSharedPreferences(getBaseContext());

    Helper.updateAndroidSecurityProvider(this);

    // setting push enabled
    String push = getString(R.string.rss_push_url);
    if (null != push && !push.equals("")) {
        // Create object of SharedPreferences.
        boolean firstStart = prefs.getBoolean("firstStart", true);

        if (firstStart) {
            Intent intent = new Intent(this, SplashIntroActivity.class);
            startActivityForResult(intent, REQUEST_CODE_INTRO);

            final ServiceStarter alarm = new ServiceStarter();

            SharedPreferences.Editor editor = prefs.edit();

            alarm.setAlarm(this);
            // now, just to be sure, where going to set a value to check if
            // notifications is really enabled
            editor.putBoolean("firstStart", false);
            // commits your edits
            editor.commit();
        }

    }

    // Check if we should open a fragment based on the arguments we have
    boolean loadedFragment = false;
    if (getIntent().getExtras() != null && getIntent().getExtras().containsKey(FRAGMENT_CLASS)) {
        try {
            Class<? extends Fragment> fragmentClass = (Class<? extends Fragment>) getIntent().getExtras()
                    .getSerializable(FRAGMENT_CLASS);
            if (fragmentClass != null) {
                String[] extra = getIntent().getExtras().getStringArray(FRAGMENT_DATA);

                Fragment fragment = fragmentClass.newInstance();
                showFragment(fragment, extra, getTitle().toString());
                loadedFragment = true;
            }
        } catch (Exception e) {
            //If we come across any errors, just continue and open the default fragment
            Log.printStackTrace(e);
        }
    }

    //If we haven't already loaded an item (or came from rotation and there was already an item)
    //Load the first item
    if (savedInstanceState == null && !loadedFragment) {
        mNavigationDrawerFragment.loadInitialItem();
    }

    // Checking if the user would prefer to show the menu on start
    boolean checkBox = prefs.getBoolean("menuOpenOnStart", false);
    if (checkBox && !useTabletMenu()) {
        mNavigationDrawerFragment.openDrawer();
    }

    AppRate.with(this).setInstallDays(0) // default 10, 0 means install day.
            .setLaunchTimes(3) // default 10
            .setRemindInterval(2) // default 1
            .setShowLaterButton(true) // default true
            .setDebug(false) // default false
            .setOnClickButtonListener(new OnClickButtonListener() { // callback listener.
                @Override
                public void onClickButton(int which) {
                    Log.d(MainActivity.class.getName(), Integer.toString(which));
                }
            }).monitor();

    // Show a dialog if meets conditions
    AppRate.showRateDialogIfMeetsConditions(this);
}

From source file:com.gumgoose.app.quakebuddy.EarthquakeActivity.java

private void showWhatsNewDialog() {
    // Display the change log for QuakeBuddy on-screen
    Dialog dialog = new Dialog(this, android.R.style.Theme_Dialog);
    dialog.setCanceledOnTouchOutside(true);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
    dialog.setContentView(R.layout.dialog_change_log);
    dialog.show();/*from   www.ja  va2s.c o  m*/
}

From source file:com.gmail.at.faint545.fragments.QueueFragment.java

private void setupListView() {
    getListView().setCacheColorHint(Color.TRANSPARENT); // Optimization for ListView

    // Attach a footer view
    View footer = getActivity().getLayoutInflater().inflate(R.layout.remote_queue_footer, null);
    getListView().addFooterView(footer);

    mAdapter = new RemoteQueueAdapter(getActivity(), R.layout.remote_queue_row, mJobs);
    setListAdapter(mAdapter);/* w ww. j a va2 s .c o m*/
}

From source file:com.facebook.litho.ComponentsStethoManagerImpl.java

private static int parseColor(String color) {
    if (color == null || color.length() == 0) {
        return Color.TRANSPARENT;
    }//w  ww  .  j a  v  a  2 s.  c o m

    // Color.parse does not handle hax code with 3 ints e.g. #123
    if (color.length() == 4) {
        final char r = color.charAt(1);
        final char g = color.charAt(2);
        final char b = color.charAt(3);
        color = "#" + r + r + g + g + b + b;
    }

    return Color.parseColor(color);
}

From source file:com.experiments.whereapp.application.home.activities.HomeActivity.java

@TargetApi(Build.VERSION_CODES.KITKAT)
@Override/*from  w  ww  .  ja v a2s  . c  o m*/
public void makeStatusBarTransparent() {
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT)
        return;
    Window window = getWindow();
    window.getDecorView()
            .setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        window.setStatusBarColor(Color.TRANSPARENT);
    } else {
        window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
    }
}

From source file:com.grepsound.activities.MainActivity.java

private void setupNavigationDrawer(boolean locked) {
    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);

    mDrawerToggle = new ActionBarDrawerToggle(this, /* host Activity */
            mDrawerLayout, /* DrawerLayout object */
            mToolbar, /* nav drawer image to replace 'Up' caret */
            R.string.drawer_open, /* "open drawer" description for accessibility */
            R.string.drawer_close /* "close drawer" description for accessibility */) {

        public ColorDrawable toolbarDrawable;
        public int toolbarColor = getResources().getColor(R.color.holo_orange_light);

        public void onDrawerClosed(View view) {
            invalidateOptionsMenu(); // creates call to
            // onPrepareOptionsMenu()
            Log.i(TAG, "CLOSED");
        }//w  w w.  java  2s .co m

        @Override
        public void onDrawerSlide(View drawerView, float slideOffset) {
            super.onDrawerSlide(drawerView, slideOffset);
            int ratioRed = Math.round(Color.red(toolbarColor) - Color.red(toolbarColor) * slideOffset);
            int ratioGreen = Math.round(Color.green(toolbarColor) - Color.green(toolbarColor) * slideOffset);
            int ratioBlue = Math.round(Color.blue(toolbarColor) - Color.blue(toolbarColor) * slideOffset);

            toolbarDrawable = new ColorDrawable(Math.round(0xFFFFFFFF * slideOffset));
            toolbarDrawable.setColor(Color.argb(255, ratioRed, ratioGreen, ratioBlue));

            getSupportActionBar().setBackgroundDrawable(toolbarDrawable);
        }

        public void onDrawerOpened(View drawerView) {
            invalidateOptionsMenu(); // creates call to
            Log.i(TAG, "OPEN");
            // onPrepareOptionsMenu()
        }

    };

    mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Log.i(TAG, "GOOD");
            if (getFragmentManager().getBackStackEntryCount() > 0)
                getFragmentManager().popBackStack();
            else {
                if (mDrawerLayout.isDrawerOpen(GravityCompat.START))
                    mDrawerLayout.closeDrawer(GravityCompat.START);
                else
                    mDrawerLayout.openDrawer(GravityCompat.START);
            }
        }
    });

    if (locked) {
        mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_OPEN);
        mDrawerLayout.setScrimColor(Color.TRANSPARENT);
    } else {
        mDrawerLayout.setDrawerListener(mDrawerToggle);
        mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);
        mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);
    }

    mDrawerToggle.setDrawerIndicatorEnabled(!locked);
    getSupportActionBar().setHomeButtonEnabled(!locked);
}

From source file:com.nicolas.coding.third.WechatTab.java

private void setTabsValue() {
    DisplayMetrics dm = getResources().getDisplayMetrics();
    // Tab?//  ww w  . j  a v a 2s  .  co m
    setShouldExpand(true);
    // Tab?
    setDividerColor(Color.TRANSPARENT);
    // Tab
    setUnderlineHeight((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 1, dm));
    // Tab Indicator
    setIndicatorHeight((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 3, dm));
    // Tab?
    setTextSize((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 16, dm));
    // Tab Indicator
    setIndicatorColor(Color.parseColor("#3bbd79"));
    // Tab ()
    setSelectedTextColor(Color.parseColor("#3bbd79"));
    // ?Tab
    setTabBackground(0);
}

From source file:com.facebook.react.views.scroll.ReactHorizontalScrollViewManager.java

/**
 * When set, fills the rest of the scrollview with a color to avoid setting a background and
 * creating unnecessary overdraw.//from  ww w. j a va  2 s .  c  o  m
 * @param view
 * @param color
 */
@ReactProp(name = "endFillColor", defaultInt = Color.TRANSPARENT, customType = "Color")
public void setBottomFillColor(ReactHorizontalScrollView view, int color) {
    view.setEndFillColor(color);
}