Example usage for android.graphics Color BLACK

List of usage examples for android.graphics Color BLACK

Introduction

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

Prototype

int BLACK

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

Click Source Link

Usage

From source file:com.cypress.cysmart.BLEServiceFragments.HeartRateService.java

/**
 * Setting up the aChart Third party library
 * @param parent//from ww w .j  a  v  a 2s  .co m
 */
private void setupChart(View parent) {
    /**
     * Setting graph titles
     */
    String graphTitle = getResources().getString(R.string.hrm_graph_label);
    String graphXAxis = getResources().getString(R.string.health_temperature_time);
    String graphYAxis = getResources().getString(R.string.hrm_graph_label);

    // Creating an  XYSeries for temperature
    mDataSeries = new XYSeries(graphTitle);

    // Creating a dataset to hold each series
    XYMultipleSeriesDataset mDataset = new XYMultipleSeriesDataset();

    // Adding temperature Series to the dataset
    mDataset.addSeries(mDataSeries);

    // Creating XYSeriesRenderer to customize
    XYSeriesRenderer mRenderer = new XYSeriesRenderer();
    mRenderer.setColor(getResources().getColor(R.color.main_bg_color));
    mRenderer.setPointStyle(PointStyle.CIRCLE);
    mRenderer.setFillPoints(true);
    mRenderer.setLineWidth(3);

    // Creating a XYMultipleSeriesRenderer to customize the whole chart
    XYMultipleSeriesRenderer mMultiRenderer = new XYMultipleSeriesRenderer();
    int deviceDPi = getResources().getDisplayMetrics().densityDpi;
    switch (deviceDPi) {
    case DisplayMetrics.DENSITY_XHIGH:
        mMultiRenderer.setMargins(new int[] { 40, 90, 25, 10 });
        mMultiRenderer.setAxisTitleTextSize(Constants.TEXT_SIZE_XHDPI);
        mMultiRenderer.setChartTitleTextSize(Constants.TEXT_SIZE_XHDPI);
        mMultiRenderer.setLabelsTextSize(Constants.TEXT_SIZE_XHDPI);
        mMultiRenderer.setLegendTextSize(Constants.TEXT_SIZE_XHDPI);
        break;
    case DisplayMetrics.DENSITY_HIGH:
        mMultiRenderer.setMargins(new int[] { 30, 50, 25, 10 });
        mMultiRenderer.setAxisTitleTextSize(Constants.TEXT_SIZE_HDPI);
        mMultiRenderer.setChartTitleTextSize(Constants.TEXT_SIZE_HDPI);
        mMultiRenderer.setLabelsTextSize(Constants.TEXT_SIZE_HDPI);
        mMultiRenderer.setLegendTextSize(Constants.TEXT_SIZE_HDPI);
        break;
    case DisplayMetrics.DENSITY_XXHIGH:
        mMultiRenderer.setMargins(new int[] { 50, 100, 35, 20 });
        mMultiRenderer.setAxisTitleTextSize(Constants.TEXT_SIZE_XXHDPI);
        mMultiRenderer.setChartTitleTextSize(Constants.TEXT_SIZE_XXHDPI);
        mMultiRenderer.setLabelsTextSize(Constants.TEXT_SIZE_XXHDPI);
        mMultiRenderer.setLegendTextSize(Constants.TEXT_SIZE_XXHDPI);
        break;
    default:
        if (deviceDPi > DisplayMetrics.DENSITY_XXHIGH && deviceDPi < DisplayMetrics.DENSITY_XXXHIGH) {
            mMultiRenderer.setMargins(new int[] { 50, 100, 35, 20 });
            mMultiRenderer.setAxisTitleTextSize(Constants.TEXT_SIZE_XXHDPI);
            mMultiRenderer.setChartTitleTextSize(Constants.TEXT_SIZE_XXHDPI);
            mMultiRenderer.setLabelsTextSize(Constants.TEXT_SIZE_XXHDPI);
            mMultiRenderer.setLegendTextSize(Constants.TEXT_SIZE_XXHDPI);
        } else {
            mMultiRenderer.setMargins(new int[] { 30, 50, 25, 10 });
            mMultiRenderer.setAxisTitleTextSize(Constants.TEXT_SIZE_LDPI);
            mMultiRenderer.setChartTitleTextSize(Constants.TEXT_SIZE_LDPI);
            mMultiRenderer.setLabelsTextSize(Constants.TEXT_SIZE_LDPI);
            mMultiRenderer.setLegendTextSize(Constants.TEXT_SIZE_LDPI);
        }
        break;
    }
    mMultiRenderer.setXTitle(graphXAxis);
    mMultiRenderer.setLabelsColor(Color.BLACK);
    mMultiRenderer.setYTitle(graphYAxis);
    mMultiRenderer.setMarginsColor(Color.argb(0x00, 0xff, 0x00, 0x00));
    mMultiRenderer.setPanEnabled(true, true);
    mMultiRenderer.setYLabelsColor(0, Color.BLACK);
    mMultiRenderer.setXLabelsColor(Color.BLACK);
    mMultiRenderer.setApplyBackgroundColor(true);
    mMultiRenderer.setBackgroundColor(Color.WHITE);
    mMultiRenderer.setGridColor(Color.BLACK);
    mMultiRenderer.setShowGrid(true);
    mMultiRenderer.setShowLegend(false);

    // Adding mRenderer to multipleRenderer
    mMultiRenderer.addSeriesRenderer(mRenderer);

    // Getting a reference to LinearLayout of the MainActivity Layout
    mGraphLayoutParent = (LinearLayout) parent.findViewById(R.id.chart_container);

    mChart = ChartFactory.getLineChartView(getActivity(), mDataset, mMultiRenderer);

    // Adding the Line Chart to the LinearLayout
    mGraphLayoutParent.addView(mChart);

}

From source file:com.makotojava.android.debate.PolicySpeechFragment.java

private void createCrossExCountDownTimer(long durationInMillis) {
    _crossexTimer = new SpeechCountDownTimerWithAlarm(durationInMillis, getCountdownInterval(),
            new SpeechCountDownTimerCallback() {
                //private static final long serialVersionUID = 1L;
                @Override/*from w  w w  .jav a 2  s .c  o m*/
                public void update(long millisUntilFinished) {
                    updateTimerTextView(_crossexTimerTextView, millisUntilFinished);
                    // Animate the timer when < 1 minute to go
                    if (getSystemOptions().animateWhenTimerBelowThreshold()) {
                        if (millisUntilFinished < NUMBER_OF_MILLIS_IN_ONE_MINUTE) {
                            if (((millisUntilFinished / 1000) % 60 % 2) == 0)
                                _crossexTimerTextView.setTextColor(Color.RED);
                            else
                                _crossexTimerTextView.setTextColor(Color.BLACK);
                        }
                    }
                }

                @Override
                public void done() {
                    Log.i(TAG, "Speech Timer is done!");
                    // Beep or flash or something??
                    _crossexTimer.exhaust();
                    if (getSystemOptions().notifyAtTimerExpiration()) {
                        _crossexTimer.playNotification(getActivity());
                    }
                    _crossexTimerTextView.setTextColor(Color.RED);
                    manageState();
                }
            });
}

From source file:com.ibuildapp.romanblack.FanWallPlugin.FanWallPlugin.java

private void initializeUI() {
    setContentView(R.layout.romanblack_fanwall_main);

    mainlLayout = (LinearLayout) findViewById(R.id.romanblack_fanwall_main);
    mainlLayout.setBackgroundColor(Statics.color1);

    // less then android L
    if (android.os.Build.VERSION.SDK_INT <= 20) {
        InputMethodManager im = (InputMethodManager) getSystemService(Service.INPUT_METHOD_SERVICE);
        SoftKeyboard softKeyboard;//w  w  w . java2  s  .  c  o m
        softKeyboard = new SoftKeyboard(mainlLayout, im);
        softKeyboard.setSoftKeyboardCallback(new SoftKeyboard.SoftKeyboardChanged() {

            @Override
            public void onSoftKeyboardHide() {
                Message msg = handler.obtainMessage(HANDLE_TAP_BAR, 1, 0);
                handler.sendMessage(msg);
            }

            @Override
            public void onSoftKeyboardShow() {
                Message msg = handler.obtainMessage(HANDLE_TAP_BAR, 0, 0);
                handler.sendMessage(msg);
            }
        });
    }

    bottomBarHodler = (LinearLayout) findViewById(R.id.romanblack_fanwall_main_bottom_bar);

    TextView noMsgText = (TextView) findViewById(R.id.romanblack_fanwall_nomessages_text);

    // top bar
    setTopBarLeftButtonText(getResources().getString(R.string.common_home_upper), true,
            new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    finish();
                }
            });

    // set title
    if (TextUtils.isEmpty(widget.getTitle()))
        setTopBarTitle(getString(R.string.fanwall_talks));
    else
        setTopBarTitle(widget.getTitle());

    imageHolder = (LinearLayout) findViewById(R.id.fanwall_image_holder);
    userImage = (ImageView) findViewById(R.id.fanwall_user_image);
    closeBtn = (ImageView) findViewById(R.id.fanwall_close_image);
    closeBtn.setOnClickListener(this);

    chooserHolder = (LinearLayout) findViewById(R.id.fanwall_chooser_holder);
    openBottom = (LinearLayout) findViewById(R.id.romanblack_fanwall_open_bottom);
    openBottom.setOnClickListener(this);

    enableGpsCheckbox = (CheckBox) findViewById(R.id.romanblack_fanwall_enable_gps_checkbox);
    enableGpsCheckbox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
            if (b) {
                if (!locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
                    final AlertDialog.Builder builder = new AlertDialog.Builder(FanWallPlugin.this);
                    builder.setMessage(getString(R.string.enable_gps_msg)).setCancelable(false)
                            .setPositiveButton(getString(R.string.yes), new DialogInterface.OnClickListener() {
                                public void onClick(@SuppressWarnings("unused") final DialogInterface dialog,
                                        @SuppressWarnings("unused") final int id) {
                                    startActivityForResult(
                                            new Intent(
                                                    android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS),
                                            GPS_SETTINGS_ACTIVITY);
                                }
                            }).setNegativeButton(getString(R.string.no), new DialogInterface.OnClickListener() {
                                public void onClick(final DialogInterface dialog,
                                        @SuppressWarnings("unused") final int id) {
                                    enableGpsCheckbox.setChecked(false);
                                    dialog.dismiss();
                                }
                            });
                    final AlertDialog alert = builder.create();
                    alert.show();
                } else {
                    Prefs.with(FanWallPlugin.this).save(Prefs.KEY_GPS, true);
                }
            } else
                Prefs.with(FanWallPlugin.this).save(Prefs.KEY_GPS, false);

        }
    });
    enableGpsCheckbox.setChecked(Prefs.with(FanWallPlugin.this).getBoolean(Prefs.KEY_GPS, false));

    galleryChooser = (LinearLayout) findViewById(R.id.romanblack_fanwall_gallery);
    galleryChooser.setOnClickListener(this);
    photoChooser = (LinearLayout) findViewById(R.id.romanblack_fanwall_make_photo);
    photoChooser.setOnClickListener(this);

    postMsg = (LinearLayout) findViewById(R.id.romanblack_fanwall_send_post);
    postMsg.setOnClickListener(this);
    editMsg = (EditText) findViewById(R.id.romanblack_fanwall_edit_msg);
    editMsg.addTextChangedListener(FanWallPlugin.this);

    tabHolder = (LinearLayout) findViewById(R.id.romanblack_fanwall_tab_holder);
    tabHolder.setBackgroundColor(res.getColor(R.color.black_50_trans));
    LinearLayout separator = (LinearLayout) findViewById(R.id.romanblack_fanwall_tab_holder_separator);
    separator.setBackgroundColor(res.getColor(R.color.white_30_trans));
    LinearLayout separatorUp = (LinearLayout) findViewById(R.id.romanblack_fanwall_tab_holder_up);
    LinearLayout separatorDown = (LinearLayout) findViewById(R.id.romanblack_fanwall_tab_holder_down);

    tabMapLayout = (LinearLayout) findViewById(R.id.romanblack_fanwall_tab_map_layout);
    tabMapLayout.setOnClickListener(this);

    tabPhotosLayout = (LinearLayout) findViewById(R.id.romanblack_fanwall_tab_photos_layout);
    tabPhotosLayout.setOnClickListener(this);

    if (Statics.isSchemaDark) {
        separatorUp.setBackgroundColor(res.getColor(R.color.white_20_trans));
        separatorDown.setBackgroundColor(res.getColor(R.color.white_20_trans));
        int temp = Color.WHITE & 0x00ffffff;
        int result = temp | 0x80000000;
        noMsgText.setTextColor(result);
    } else {
        separatorUp.setBackgroundColor(res.getColor(R.color.black_20_trans));
        separatorDown.setBackgroundColor(res.getColor(R.color.black_20_trans));
        int temp = Color.BLACK & 0x00ffffff;
        int result = temp | 0x80000000;
        noMsgText.setTextColor(result);
    }

    noMessagesLayout = (LinearLayout) findViewById(R.id.romanblack_fanwall_main_nomessages_layout);

    messageListLayoutRoot = (FrameLayout) findViewById(R.id.romanblack_fanwall_messagelist_list_layout);
    messageList = (PullToRefreshListView) findViewById(R.id.romanblack_fanwall_messagelist_pulltorefresh);
    messageList.setDivider(null);
    messageList.setBackgroundColor(Color.TRANSPARENT);
    messageList.setDrawingCacheBackgroundColor(Color.TRANSPARENT);

    ILoadingLayout loadingLayout = messageList.getLoadingLayoutProxy();
    if (Statics.isSchemaDark) {
        loadingLayout.setHeaderColor(Color.WHITE);
    } else {
        loadingLayout.setHeaderColor(Color.BLACK);
    }

    //messageList.set
    adapter = new MainLayoutMessagesAdapter(FanWallPlugin.this, messageList, messages, widget);
    adapter.setInnerInterface(new MainLayoutMessagesAdapter.onEndReached() {
        @Override
        public void endReached() {
            if (!refreshingBottom)
                refreshBottom();
        }
    });

    messageList.setAdapter(adapter);
    messageList.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener<ListView>() {
        @Override
        public void onRefresh(PullToRefreshBase<ListView> refreshView) {
            refreshTop();
        }
    });

    if (Statics.canEdit.compareToIgnoreCase("all") == 0) {
        bottomBarHodler.setVisibility(View.VISIBLE);
    } else {
        bottomBarHodler.setVisibility(View.GONE);
    }

    // start downloading messages
    // exactly in create() method!!!
    handler.sendEmptyMessage(SHOW_PROGRESS_DIALOG);
    refreshMessages();
}

From source file:com.berniesanders.fieldthebern.MainActivity.java

/**
 * TODO: move this animation and toolbar code to it's own controller thing...
 *///from   www  .j a v a  2 s .c  o  m
@Override
public void setMainImage(String url) {

    animateShading(false);

    Picasso.with(getApplicationContext()).load(url).transform(PaletteTransformation.instance())
            .placeholder(backgroundImage.getDrawable()).into(backgroundImage, new Callback.EmptyCallback() {
                @Override
                public void onSuccess() {
                    Bitmap bitmap = ((BitmapDrawable) backgroundImage.getDrawable()).getBitmap(); // Ew!
                    Palette palette = PaletteTransformation.getPalette(bitmap);

                    if (isLollipopOrAbove()) {
                        setStatusBarColor(palette.getDarkVibrantColor(Color.BLACK));
                    }

                    animateShading(true);
                    animateBg(true);
                }
            });

    if (url == null) {
        backgroundImage.setImageDrawable(null);
    }

    if (url == null && isLollipopOrAbove()) {
        setStatusBarColor(bernieDarkBlue);
    }
}

From source file:com.skytree.epubtest.BookViewActivity.java

public void makeLayout() {
    // make fonts
    this.makeFonts();
    // clear the existing themes. 
    themes.clear();/*  w  ww. j  a  va 2s  .c  om*/
    // add themes 
    // String name,int foregroundColor,int backgroundColor,int controlColor,int controlHighlightColor,int seekBarColor,int seekThumbColor,int selectorColor,int selectionColor,String portraitName,String landscapeName,String doublePagedName,int bookmarkId
    themes.add(new Theme("white", Color.BLACK, 0xffffffff, Color.argb(240, 94, 61, 35), Color.LTGRAY,
            Color.argb(240, 94, 61, 35), Color.argb(120, 160, 124, 95), Color.DKGRAY, 0x22222222,
            "Phone-Portrait-White.png", "Phone-Landscape-White.png", "Phone-Landscape-Double-White.png",
            R.drawable.bookmark2x));
    themes.add(new Theme("brown", Color.BLACK, 0xffece3c7, Color.argb(240, 94, 61, 35),
            Color.argb(255, 255, 255, 255), Color.argb(240, 94, 61, 35), Color.argb(120, 160, 124, 95),
            Color.DKGRAY, 0x22222222, "Phone-Portrait-Brown.png", "Phone-Landscape-Brown.png",
            "Phone-Landscape-Double-Brown.png", R.drawable.bookmark2x));
    themes.add(new Theme("black", Color.LTGRAY, 0xff323230, Color.LTGRAY, Color.LTGRAY, Color.LTGRAY,
            Color.LTGRAY, Color.LTGRAY, 0x77777777, null, null, "Phone-Landscape-Double-Black.png",
            R.drawable.bookmarkgray2x));
    themes.add(new Theme("Leaf", 0xFF1F7F0E, 0xffF8F7EA, 0xFF186D08, Color.LTGRAY, 0xFF186D08, 0xFF186D08,
            Color.DKGRAY, 0x22222222, null, null, null, R.drawable.bookmarkgray2x));
    themes.add(new Theme("", 0xFFA13A0A, 0xFFF6DFD9, 0xFFA13A0A, 0xFFDC4F0E, 0xFFA13A0A, 0xFFA13A0A,
            Color.DKGRAY, 0x22222222, null, null, null, R.drawable.bookmarkgray2x));
    this.setBrightness((float) setting.brightness);
    // create highlights object to contains highlights of this book. 
    highlights = new Highlights();
    Bundle bundle = getIntent().getExtras();
    fileName = bundle.getString("BOOKNAME");
    author = bundle.getString("AUTHOR");
    title = bundle.getString("TITLE");
    bookCode = bundle.getInt("BOOKCODE");
    if (pagePositionInBook == -1)
        pagePositionInBook = bundle.getDouble("POSITION");
    themeIndex = setting.theme;
    this.isGlobalPagination = bundle.getBoolean("GLOBALPAGINATION");
    this.isRTL = bundle.getBoolean("RTL");
    this.isVerticalWriting = bundle.getBoolean("VERTICALWRITING");
    this.isDoublePagedForLandscape = bundle.getBoolean("DOUBLEPAGED");
    //      if (this.isRTL) this.isDoublePagedForLandscape = false; // In RTL mode, SDK does not support double paged. 

    ePubView = new RelativeLayout(this);

    RelativeLayout.LayoutParams rlp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.FILL_PARENT,
            RelativeLayout.LayoutParams.FILL_PARENT);
    ePubView.setLayoutParams(rlp);

    RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); // width,height
    if (this.getOSVersion() >= 11) {
        rv = new ReflowableControl(this); // in case that device supports transparent webkit, the background image under the content can be shown. in some devices, content may be overlapped.
    } else {
        rv = new ReflowableControl(this, getCurrentTheme().backgroundColor); // in case that device can not support transparent webkit, the background color will be set in one color.
    }

    // if false highlight will be drawed on the back of text - this is default. 
    // for the very old devices of which GPU does not support transparent webView background, set the value to true.  
    rv.setDrawingHighlightOnFront(false);

    // set the bookCode to identify the book file. 
    rv.bookCode = this.bookCode;

    // set bitmaps for engine. 
    rv.setPagesStackImage(this.getBitmap("PagesStack.png"));
    rv.setPagesCenterImage(this.getBitmap("PagesCenter.png"));
    // for epub3 which has page-progression-direction="rtl", rv.isRTL() will return true.
    // for old RTL epub which does not have <spine toc="ncx" page-progression-direction="rtl"> in opf file. 
    // you can enforce RTL mode.  

    /*      
          // delay times for proper operations. 
          // !! DO NOT SET these values if there's no issue on your epub reader. !!
          // !! if delayTime is decresed, performance will be increase
          // !! if delayTime is set to too low value, a lot of problem can be occurred. 
          // bringDelayTime(default 500 ms) is for curlView and mainView transition - if the value is too short, blink may happen.
          rv.setBringDelayTime(500);
          // reloadDelayTime(default 100) is used for delay before reload (eg. changeFont, loadChapter or etc) 
          rv.setReloadDelayTime(100);
          // reloadDelayTimeForRotation(default 1000) is used for delay before rotation
          rv.setReloadDelayTimeForRotation(1000);
          // retotaionDelayTime(default 1500) is used for delay after rotation.
          rv.setRotationDelayTime(1500);
          // finalDelayTime(default 500) is used for the delay after loading chapter. 
          rv.setFinalDelayTime(500);
          // rotationFactor affects the delayTime before Rotation. default value 1.0f
          rv.setRotationFactor(1.0f);      
          // If recalcDelayTime is too short, setContentBackground function failed to work properly.  
          rv.setRecalcDelayTime(2500);
    */

    // set the max width or height for background. 
    rv.setMaxSizeForBackground(1024);
    //      rv.setBaseDirectory(SkySetting.getStorageDirectory() + "/books");
    //      rv.setBookName(fileName);
    // set the file path of epub to open
    // Be sure that the file exists before setting.
    rv.setBookPath(SkySetting.getStorageDirectory() + "/books/" + fileName);
    // if true, double pages will be displayed on landscape mode. 
    rv.setDoublePagedForLandscape(this.isDoublePagedForLandscape);
    // set the initial font style for book. 
    rv.setFont(setting.fontName, this.getRealFontSize(setting.fontSize));
    // set the initial line space for book. 
    rv.setLineSpacing(this.getRealLineSpace(setting.lineSpacing)); // the value is supposed to be percent(%).
    // set the horizontal gap(margin) on both left and right side of each page.  
    rv.setHorizontalGapRatio(0.30);
    // set the vertical gap(margin) on both top and bottom side of each page. 
    rv.setVerticalGapRatio(0.22);
    // set the HighlightListener to handle text highlighting. 
    rv.setHighlightListener(new HighlightDelegate());
    // set the PageMovedListener which is called whenever page is moved. 
    rv.setPageMovedListener(new PageMovedDelegate());
    // set the SelectionListener to handle text selection. 
    rv.setSelectionListener(new SelectionDelegate());
    // set the pagingListener which is called when GlobalPagination is true. this enables the calculation for the total number of pages in book, not in chapter.   
    rv.setPagingListener(new PagingDelegate());
    // set the searchListener to search keyword.
    rv.setSearchListener(new SearchDelegate());
    // set the stateListener to monitor the state of sdk engine. 
    rv.setStateListener(new StateDelegate());
    // set the clickListener which is called when user clicks
    rv.setClickListener(new ClickDelegate());
    // set the bookmarkListener to toggle bookmark
    rv.setBookmarkListener(new BookmarkDelegate());
    // set the scriptListener to set custom javascript. 
    rv.setScriptListener(new ScriptDelegate());

    // enable/disable scroll mode
    rv.setScrollMode(false);

    // for some anroid device, when rendering issues are occurred, use "useSoftwareLayer"
    //      rv.useSoftwareLayer();
    // In search keyword, if true, sdk will return search result with the full information such as position, pageIndex. 
    rv.setFullSearch(true);
    // if true, sdk will return raw text for search result, highlight text or body text without character escaping.  
    rv.setRawTextRequired(false);

    // if true, sdk will read the content of book directry from file system, not via Internal server. 
    //      rv.setDirectRead(true);

    // If you want to make your own provider, please look into EpubProvider.java in Advanced demo.
    //      EpubProvider epubProvider = new EpubProvider();
    //      rv.setContentProvider(epubProvider);      

    // SkyProvider is the default ContentProvider which is presented with SDK. 
    // SkyProvider can read the content of epub file without unzipping. 
    // SkyProvider is also fully integrated with SkyDRM solution.  
    SkyProvider skyProvider = new SkyProvider();
    skyProvider.setKeyListener(new KeyDelegate());
    rv.setContentProvider(skyProvider);

    // set the start positon to open the book. 
    rv.setStartPositionInBook(pagePositionInBook);
    // DO NOT USE BELOW, if true , sdk will use DOM to highlight text.  
    //      rv.useDOMForHighlight(false);
    // if true, globalPagination will be activated. 
    // this enables the calculation of page number based on entire book ,not on each chapter.
    // this globalPagination consumes huge computing power. 
    // AVOID GLOBAL PAGINATION FOR LOW SPEC DEVICES.
    rv.setGlobalPagination(this.isGlobalPagination);
    // set the navigation area on both left and right side to go to the previous or next page when the area is clicked. 
    rv.setNavigationAreaWidthRatio(0.1f); // both left and right side.
    // set the device locked to prevent Rotation. 
    rv.setRotationLocked(setting.lockRotation);
    isRotationLocked = setting.lockRotation;
    // set the mediaOverlayListener for MediaOverlay.
    rv.setMediaOverlayListener(new MediaOverlayDelegate());
    // set the audio playing based on Sequence. 
    rv.setSequenceBasedForMediaOverlay(false);

    params.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE);
    params.addRule(RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.TRUE);
    params.width = LayoutParams.MATCH_PARENT;
    params.height = LayoutParams.MATCH_PARENT;

    rv.setLayoutParams(params);
    this.applyThemeToRV(themeIndex);

    if (this.isFullScreenForNexus && SkyUtility.isNexus() && Build.VERSION.SDK_INT >= 19) {
        rv.setImmersiveMode(true);
    }
    // If you want to get the license key for commercial use, please email us (skytree21@gmail.com). 
    // Without the license key, watermark message will be shown in background. 
    rv.setLicenseKey("a99b-3914-a63b-8ecb");

    // set PageTransition Effect 
    int transitionType = bundle.getInt("transitionType");
    if (transitionType == 0) {
        rv.setPageTransition(PageTransition.None);
    } else if (transitionType == 1) {
        rv.setPageTransition(PageTransition.Slide);
    } else if (transitionType == 2) {
        rv.setPageTransition(PageTransition.Curl);
    }

    // setCurlQuality effects the image quality when tuning page in Curl Transition Mode. 
    // If "Out of Memory" occurs in high resolution devices with big screen, 
    // this value should be decreased like 0.25f or below.
    if (this.getMaxSize() > 1280) {
        rv.setCurlQuality(0.5f);
    }

    // set the color of text selector. 
    rv.setSelectorColor(getCurrentTheme().selectorColor);
    // set the color of text selection area. 
    rv.setSelectionColor(getCurrentTheme().selectionColor);

    // setCustomDrawHighlight & setCustomDrawCaret work only if SDK >= 11
    // if true, sdk will ask you how to draw the highlighted text
    rv.setCustomDrawHighlight(true);
    // if true, sdk will require you to draw the custom selector.
    rv.setCustomDrawCaret(true);

    rv.setFontUnit("px");

    rv.setFingerTractionForSlide(true);
    rv.setVideoListener(new VideoDelegate());

    // make engine not to send any event to iframe
    // if iframe clicked, onIFrameClicked will be fired with source of iframe
    // By Using that source of iframe, you can load the content of iframe in your own webView or another browser. 
    rv.setSendingEventsToIFrameEnabled(false);

    // make engine send any event to video(tag) or not
    // if video tag is clicked, onVideoClicked will be fired with source of iframe
    // By Using that source of video, you can load the content of video in your own media controller or another browser. 
    rv.setSendingEventsToVideoEnabled(true);

    // make engine send any event to video(tag) or not
    // if video tag is clicked, onVideoClicked will be fired with source of iframe
    // By Using that source of video, you can load the content of video in your own media controller or another browser.
    rv.setSendingEventsToAudioEnabled(true);

    // if true, sdk will return the character offset from the chapter beginning , not from element index.
    // then startIndex, endIndex of highlight will be 0 (zero) 
    rv.setGlobalOffset(true);
    // if true, sdk will return the text of each page in the PageInformation object which is passed in onPageMoved event. 
    rv.setExtractText(true);

    ePubView.addView(rv);

    this.makeControls();
    this.makeBoxes();
    this.makeIndicator();
    this.recalcFrames();
    if (this.isRTL) {
        this.seekBar.setReversed(true);
    }
    setContentView(ePubView);
    this.isInitialized = true;
}

From source file:com.amaze.filemanager.fragments.ProcessViewer.java

void processCompressResults(DataPackage dataPackage) {
    final int id = dataPackage.getId();

    if (!CancelledZipIds.contains(id)) {
        if (ZipIds.contains(id)) {
            boolean completed = dataPackage.isCompleted();
            View process = rootView.findViewWithTag("zip" + id);
            if (completed) {
                rootView.removeViewInLayout(process);
                ZipIds.remove(ZipIds.indexOf(id));
            } else {
                String name = dataPackage.getName();
                int p1 = dataPackage.getP1();

                ProgressBar p = (ProgressBar) process.findViewById(R.id.progressBar1);
                if (p1 <= 100) {
                    ((TextView) process.findViewById(R.id.progressText)).setText(
                            utils.getString(getActivity(), R.string.zipping) + "\n" + name + "\n" + p1 + "%");

                    p.setProgress(p1);//from  w  ww  .  j a v  a  2 s.com
                }
            }
        } else {
            CardView root = (CardView) getActivity().getLayoutInflater().inflate(R.layout.processrow, null);
            root.setTag("zip" + id);

            ImageView progressImage = ((ImageView) root.findViewById(R.id.progressImage));
            ImageButton cancel = (ImageButton) root.findViewById(R.id.delete_button);
            TextView progressText = (TextView) root.findViewById(R.id.progressText);

            if (mainActivity.theme1 == 1) {

                root.setCardBackgroundColor(R.color.cardView_foreground);
                root.setCardElevation(0f);
                cancel.setImageResource(R.drawable.ic_action_cancel);
                progressText.setTextColor(Color.WHITE);
                progressImage.setImageResource(R.drawable.ic_doc_compressed);
            } else {

                // cancel has default src set for light theme
                progressText.setTextColor(Color.BLACK);
                progressImage.setImageResource(R.drawable.ic_doc_compressed_black);
            }

            cancel.setOnClickListener(new View.OnClickListener() {

                public void onClick(View p1) {
                    Toast.makeText(getActivity(), utils.getString(getActivity(), R.string.stopping),
                            Toast.LENGTH_LONG).show();
                    Intent i = new Intent("zipcancel");
                    i.putExtra("id", id);
                    getActivity().sendBroadcast(i);
                    rootView.removeView(rootView.findViewWithTag("zip" + id));

                    ZipIds.remove(ZipIds.indexOf(id));
                    CancelledZipIds.add(id);
                    // TODO: Implement this method
                }
            });

            String name = dataPackage.getName();
            int p1 = dataPackage.getP1();

            ((TextView) root.findViewById(R.id.progressText))
                    .setText(utils.getString(getActivity(), R.string.zipping) + "\n" + name);
            ProgressBar p = (ProgressBar) root.findViewById(R.id.progressBar1);
            p.setProgress(p1);

            ZipIds.add(id);
            rootView.addView(root);
        }
    }
}

From source file:com.lemon.lime.MainActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {

    final View coordinatorLayoutView = findViewById(R.id.snackbarPosition);
    switch (item.getItemId()) {

    case R.id.back:
        mWebView.goBack();/*from www.j  a v a2s  .c o m*/
        break;

    case R.id.forward:
        mWebView.goForward();
        break;

    case R.id.reload:
        mWebView.reload();
        break;

    case R.id.new_tab:
        Intent c = new Intent(this, MainActivity.class);
        startActivityForResult(c, RESULT_SETTINGS);
        break;

    case R.id.add_bookmark:
        Intent book = new Intent(this, BookMarkActivity.class);
        startActivityForResult(book, RESULT_SETTINGS);
        break;

    case R.id.share:
        String url = mWebView.getUrl().toString();
        ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
        clipboard.setText(url);
        Snackbar snackbar = Snackbar.make(coordinatorLayoutView, R.string.clipboard, Snackbar.LENGTH_LONG);
        snackbar.show();
        break;

    case R.id.menu_settings:
        Intent i = new Intent(this, UserSettingActivity.class);
        startActivityForResult(i, RESULT_SETTINGS);
        break;

    case R.id.invert:

        if (night == 0) {
            getSupportActionBar().setBackgroundDrawable(new ColorDrawable(Color.BLACK));
            mWebView.setBackgroundColor(Color.parseColor("#000000"));
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {

                window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
                window.setNavigationBarColor(Color.BLACK);
                window.setStatusBarColor(Color.BLACK);
            }

            night = 1;
        } else {
            getSupportActionBar().setBackgroundDrawable(new ColorDrawable(Color.parseColor("#7AB317")));
            mWebView.setBackgroundColor(Color.TRANSPARENT);
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {

                window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
                window.setNavigationBarColor(Color.parseColor("#7AB317"));
                window.setStatusBarColor(Color.parseColor("#7AB317"));
            }

            night = 0;
        }

        break;

    case R.id.hide:
        View decorView = window.getDecorView();
        int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
        decorView.setSystemUiVisibility(uiOptions);
        getSupportActionBar().hide();
        break;

    case R.id.easteregg:
        Toast.makeText(this, "(  Y  )", Toast.LENGTH_SHORT).show();
        mPlayer.start();
        addBarGraphRenderers();
        break;

    }

    return true;
}

From source file:terse.a1.TerseActivity.java

public void viewPath(String path, String queryStr, Bundle extras, Bundle savedInstanceState) {
    // Stop any running WorkThread before we continue.
    viewPath1prepare(path, queryStr);//  w  w  w  . j a v a 2  s  .  co m
    viewPath2parseQuery(queryStr, extras);

    final LayoutParams widgetParams = new LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
            ViewGroup.LayoutParams.FILL_PARENT, 1.0f);

    TextView splash = new TextView(TerseActivity.this);
    splash.setText("Launching\n\n" + taPath + "\n\n" + Static.hashMapToMultiLineString(taQuery));
    splash.setTextAppearance(this, R.style.teletype);
    splash.setBackgroundColor(Color.BLACK);
    splash.setTextColor(Color.DKGRAY);
    splash.setTextSize(24);

    Runnable bg = new Runnable() {
        @Override
        public void run() {
            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    };

    Runnable fg = new Runnable() {
        @Override
        public void run() {
            viewPath9display(taPath, widgetParams);
        }
    };

    setContentViewThenBgThenFg("viewPath8", splash, bg, fg);
}

From source file:com.sssemil.sonyirremote.ir.ir.java

public void onWrtClick(View view) {
    if (wrt) {/*from   w w  w.  j  a  va  2s  .  c  o m*/
        wrt = false;
        final Button btntxt = (Button) findViewById(R.id.button2);
        btntxt.setText(getResources().getString(R.string.Write_signal));
        btntxt.setTextColor(Color.BLACK);
    } else if (!wrt) {
        wrt = true;
        final Button btntxt = (Button) findViewById(R.id.button2);
        btntxt.setText(getResources().getString(R.string.Send_signal));
        btntxt.setTextColor(Color.RED);

        File f = new File(irpath + item);
        if (!f.isDirectory()) {
            f.mkdirs();
        }

        File f2 = new File(irpath + brand);
        if (!f2.isDirectory()) {
            f2.mkdirs();
        }
    }
}

From source file:co.ceryle.segmentedbutton.SegmentedButtonGroup.java

/**
 * Get attributes/*  www . ja  va 2 s  .co  m*/
 **/
private void getAttributes(AttributeSet attrs) {
    TypedArray typedArray = getContext().obtainStyledAttributes(attrs, R.styleable.SegmentedButtonGroup);

    hasDivider = typedArray.hasValue(R.styleable.SegmentedButtonGroup_sbg_dividerSize);
    dividerSize = typedArray.getDimensionPixelSize(R.styleable.SegmentedButtonGroup_sbg_dividerSize, 0);
    dividerColor = typedArray.getColor(R.styleable.SegmentedButtonGroup_sbg_dividerColor, Color.WHITE);
    dividerPadding = typedArray.getDimensionPixelSize(R.styleable.SegmentedButtonGroup_sbg_dividerPadding, 0);
    dividerRadius = typedArray.getDimensionPixelSize(R.styleable.SegmentedButtonGroup_sbg_dividerRadius, 0);

    textColorOnSelection = typedArray.getColor(R.styleable.SegmentedButtonGroup_sbg_selectorTextColor,
            Color.GRAY);
    hasTextColorOnSelection = typedArray.hasValue(R.styleable.SegmentedButtonGroup_sbg_selectorTextColor);
    drawableTintOnSelection = typedArray.getColor(R.styleable.SegmentedButtonGroup_sbg_selectorImageTint,
            Color.GRAY);
    hasDrawableTintOnSelection = typedArray.hasValue(R.styleable.SegmentedButtonGroup_sbg_selectorImageTint);
    selectorColor = typedArray.getColor(R.styleable.SegmentedButtonGroup_sbg_selectorColor, Color.GRAY);
    animateSelector = typedArray.getInt(R.styleable.SegmentedButtonGroup_sbg_animateSelector, 0);
    animateSelectorDuration = typedArray.getInt(R.styleable.SegmentedButtonGroup_sbg_animateSelectorDuration,
            500);

    shadow = typedArray.getBoolean(R.styleable.SegmentedButtonGroup_sbg_shadow, false);
    shadowElevation = typedArray.getDimension(R.styleable.SegmentedButtonGroup_sbg_shadowElevation, 0);
    shadowMargin = typedArray.getDimensionPixelSize(R.styleable.SegmentedButtonGroup_sbg_shadowMargin, -1);
    shadowMarginTop = typedArray.getDimensionPixelSize(R.styleable.SegmentedButtonGroup_sbg_shadowMarginTop, 0);
    shadowMarginBottom = typedArray
            .getDimensionPixelSize(R.styleable.SegmentedButtonGroup_sbg_shadowMarginBottom, 0);
    shadowMarginLeft = typedArray.getDimensionPixelSize(R.styleable.SegmentedButtonGroup_sbg_shadowMarginLeft,
            0);
    shadowMarginRight = typedArray.getDimensionPixelSize(R.styleable.SegmentedButtonGroup_sbg_shadowMarginRight,
            0);

    radius = typedArray.getDimension(R.styleable.SegmentedButtonGroup_sbg_radius, 0);
    position = typedArray.getInt(R.styleable.SegmentedButtonGroup_sbg_position, 0);
    backgroundColor = typedArray.getColor(R.styleable.SegmentedButtonGroup_sbg_backgroundColor, Color.WHITE);

    ripple = typedArray.getBoolean(R.styleable.SegmentedButtonGroup_sbg_ripple, false);
    hasRippleColor = typedArray.hasValue(R.styleable.SegmentedButtonGroup_sbg_rippleColor);
    rippleColor = typedArray.getColor(R.styleable.SegmentedButtonGroup_sbg_rippleColor, Color.GRAY);

    borderSize = typedArray.getDimensionPixelSize(R.styleable.SegmentedButtonGroup_sbg_borderSize, 0);
    borderColor = typedArray.getColor(R.styleable.SegmentedButtonGroup_sbg_borderColor, Color.BLACK);

    backgroundDrawable = typedArray.getDrawable(R.styleable.SegmentedButtonGroup_sbg_backgroundDrawable);
    selectorBackgroundDrawable = typedArray
            .getDrawable(R.styleable.SegmentedButtonGroup_sbg_selectorBackgroundDrawable);
    dividerBackgroundDrawable = typedArray
            .getDrawable(R.styleable.SegmentedButtonGroup_sbg_dividerBackgroundDrawable);

    enabled = typedArray.getBoolean(R.styleable.SegmentedButtonGroup_sbg_enabled, true);

    try {
        clickable = typedArray.getBoolean(R.styleable.SegmentedButtonGroup_android_clickable, true);
    } catch (Exception ex) {
        Log.d("SegmentedButtonGroup", ex.toString());
    }

    typedArray.recycle();
}