Example usage for android.graphics Color WHITE

List of usage examples for android.graphics Color WHITE

Introduction

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

Prototype

int WHITE

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

Click Source Link

Usage

From source file:com.donsen.svg.ui.common.AnimatedSvgView.java

private void rebuildGlyphData() {
    SvgPathParser parser = new SvgPathParser() {
        @Override// ww w  .  j a v  a  2 s  .c o m
        protected float transformX(float x) {
            return x * mWidth / mViewport.x;
        }

        @Override
        protected float transformY(float y) {
            return y * mHeight / mViewport.y;
        }
    };

    mGlyphData = new GlyphData[mGlyphStrings.length];
    for (int i = 0; i < mGlyphStrings.length; i++) {
        mGlyphData[i] = new GlyphData();
        try {
            mGlyphData[i].path = parser.parsePath(mGlyphStrings[i]);
        } catch (ParseException e) {
            mGlyphData[i].path = new Path();
            Log.e(TAG, "Couldn't parse path", e);
        }
        PathMeasure pm = new PathMeasure(mGlyphData[i].path, true);
        while (true) {
            mGlyphData[i].length = Math.max(mGlyphData[i].length, pm.getLength());
            if (!pm.nextContour()) {
                break;
            }
        }
        mGlyphData[i].paint = new Paint();
        mGlyphData[i].paint.setStyle(Paint.Style.STROKE);
        mGlyphData[i].paint.setAntiAlias(true);
        mGlyphData[i].paint.setColor(Color.WHITE);
        mGlyphData[i].paint.setStrokeWidth(
                TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 1, getResources().getDisplayMetrics()));
    }
}

From source file:app.learning.fantaster.nhatkyhoctiengnhat.util.slidingtab.SlidingTabLayout.java

private void populateTabStrip() {
    final PagerAdapter adapter = mViewPager.getAdapter();
    final View.OnClickListener tabClickListener = new TabClickListener();

    for (int i = 0; i < adapter.getCount(); i++) {
        View tabView = null;/*from   www  .  j a  v  a2s  .c o  m*/
        TextView tabTitleView = null;

        if (mTabViewLayoutId != 0) {
            // If there is a custom tab view layout id set, try and inflate it
            tabView = LayoutInflater.from(getContext()).inflate(mTabViewLayoutId, mTabStrip, false);
            tabTitleView = (TextView) tabView.findViewById(mTabViewTextViewId);
        }

        if (tabView == null) {
            tabView = createDefaultTabView(getContext());
        }

        if (tabTitleView == null && TextView.class.isInstance(tabView)) {
            tabTitleView = (TextView) tabView;
        }

        CharSequence title = adapter.getPageTitle(i);
        tabTitleView.setText(title);
        tabTitleView.setGravity(Gravity.CENTER_HORIZONTAL);
        tabTitleView.setTextColor(Color.WHITE);
        tabView.setOnClickListener(tabClickListener);

        if (mDistributeEvenly) {
            tabView.setLayoutParams(layoutParams);
        }

        mTabStrip.addView(tabView);
    }
}

From source file:com.busticket.amedora.busticketsrl.TicketingHomeActivity.java

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

    setContentView(R.layout.layout_ticket_home);
    myToolbar = (Toolbar) findViewById(R.id.my_toolbar);
    setSupportActionBar(myToolbar);//www.jav  a2s.c  o m
    //synchTrips();
    assert getSupportActionBar() != null;
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setHomeButtonEnabled(true);
    spBoard = (Spinner) findViewById(R.id.spBoard);
    spBuses = (Spinner) findViewById(R.id.spBusNo);
    spTrips = (Spinner) findViewById(R.id.spTripType);
    spHighlight = (Spinner) findViewById(R.id.spHighlight);
    mAccount = CreateSyncAccount(this);
    mQueue = Volley.newRequestQueue(getApplicationContext());
    rQSyncTicket = Volley.newRequestQueue(getApplicationContext());
    rQSyncTicketSynch = Volley.newRequestQueue(getApplicationContext());
    rQSyncBalance = Volley.newRequestQueue(getApplicationContext());
    rqTrip = Volley.newRequestQueue(getApplicationContext());
    rQSyncTicketing = Volley.newRequestQueue(getApplicationContext());
    rQSyncTicketingSynch = Volley.newRequestQueue(getApplicationContext());
    //Key methods needed to be sent to server on activity created
    syncTicketing();
    syncTickets();

    apps = db.getApp(Installation.appId(getApplicationContext()));
    EMAIL = apps.getRoute_name();
    NAME = "CODE: " + apps.getAgent_code().toUpperCase() + " Trip: " + apps.getTripCount();
    // Get the content resolver for your app
    mResolver = getContentResolver();
    /*
     * Turn on periodic syncing
     */

    mTitle = mDrawerTitle = getTitle();
    ContentResolver.addPeriodicSync(CreateSyncAccount(this), AUTHORITY, Bundle.EMPTY, SYNC_INTERVAL);

    String[] tdata = populateTerminals();
    String[] bdata = populateBuses();
    ArrayAdapter adapter = new ArrayAdapter(this, android.R.layout.simple_spinner_item, tdata);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    spBoard.setAdapter(adapter);/**/

    ArrayAdapter Hadapter = new ArrayAdapter(this, android.R.layout.simple_spinner_item, tdata);
    Hadapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    spHighlight.setAdapter(Hadapter);

    ArrayAdapter gadapter = new ArrayAdapter(this, android.R.layout.simple_spinner_item, bdata);
    gadapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    spBuses.setAdapter(gadapter);

    ArrayAdapter<CharSequence> tadapter = ArrayAdapter.createFromResource(this, R.array.tripTypes,
            android.R.layout.simple_spinner_item);
    tadapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    /*ArrayAdapter badapter =new ArrayAdapter(this,android.R.layout.simple_spinner_item,bdata);
    badapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);*/
    spTrips.setAdapter(tadapter);

    spBuses.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            ((TextView) parent.getChildAt(0)).setTextColor(Color.WHITE);
            //((TextView) parent.getChildAt(0)).setTextSize(25);
            bus = parent.getItemAtPosition(position).toString();
        }

        @Override
        public void onNothingSelected(AdapterView<?> parent) {

        }
    });

    spBoard.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            ((TextView) parent.getChildAt(0)).setTextColor(Color.WHITE);
            //((TextView) parent.getChildAt(0)).setTextSize(25);
            board = parent.getItemAtPosition(position).toString();
        }

        @Override
        public void onNothingSelected(AdapterView<?> parent) {

        }
    });

    spHighlight.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            ((TextView) parent.getChildAt(0)).setTextColor(Color.WHITE);
            //((TextView) parent.getChildAt(0)).setTextSize(25);
            highlight = parent.getItemAtPosition(position).toString();
        }

        @Override
        public void onNothingSelected(AdapterView<?> parent) {

        }
    });

    spTrips.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            ((TextView) parent.getChildAt(0)).setTextColor(Color.WHITE);
            //((TextView) parent.getChildAt(0)).setTextSize(25);
            trip = parent.getItemAtPosition(position).toString();

        }

        @Override
        public void onNothingSelected(AdapterView<?> parent) {

        }
    });

    btnGenerate = (Button) findViewById(R.id.btnGenerate);

    btnGenerate.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            // get a new activity to show invoice preview
            sendData();
        }
    });
    mRecyclerView = (RecyclerView) findViewById(R.id.RecyclerView); // Assigning the RecyclerView Object to the xml View

    mRecyclerView.setHasFixedSize(true); // Letting the system know that the list objects are of fixed size

    mAdapter = new DrawerAdapter(TITLES, ICONS, NAME, EMAIL, PROFILE); // Creating the Adapter of MyAdapter class(which we are going to see in a bit)
    // And passing the titles,icons,header view name, header view email,
    // and header view profile picture

    // Setting the adapter to RecyclerView
    //mRecyclerView.setLayoutManager(mLayoutManager);                 // Setting the layout Manager
    LinearLayoutManager layoutManager = new LinearLayoutManager(getApplicationContext());
    mRecyclerView.setLayoutManager(layoutManager);
    mRecyclerView.setAdapter(mAdapter);
    Drawer = (DrawerLayout) findViewById(R.id.DrawerLayout);
    // Drawer object Assigned to the view

    mDrawerToggle = new ActionBarDrawerToggle(this, Drawer, toolbar, R.string.openDrawer,
            R.string.closeDrawer) {
        @Override
        public void onDrawerOpened(View drawerView) {
            super.onDrawerOpened(drawerView);
            // code here will execute once the drawer is opened( As I dont want anything happened whe drawer is
            // open I am not going to put anything here)
            invalidateOptionsMenu();
        }

        @Override
        public void onDrawerClosed(View drawerView) {
            super.onDrawerClosed(drawerView);
            // Code here will execute once drawer is closed
            invalidateOptionsMenu();
        }
    }; // Drawer Toggle Object Made
    Drawer.setDrawerListener(mDrawerToggle); // Drawer Listener set to the Drawer toggle
    mDrawerToggle.syncState(); // Finally we set the drawer toggle sync State

    final GestureDetector mGestureDetector = new GestureDetector(TicketingHomeActivity.this,
            new GestureDetector.SimpleOnGestureListener() {

                @Override
                public boolean onSingleTapUp(MotionEvent e) {
                    return true;
                }

            });

    mRecyclerView.addOnItemTouchListener(new RecyclerView.OnItemTouchListener() {
        @Override
        public boolean onInterceptTouchEvent(RecyclerView recyclerView, MotionEvent motionEvent) {
            View child = recyclerView.findChildViewUnder(motionEvent.getX(), motionEvent.getY());
            if (child != null && mGestureDetector.onTouchEvent(motionEvent)) {
                Drawer.closeDrawers();
                if (recyclerView.getChildPosition(child) == 1) {

                } else if (recyclerView.getChildPosition(child) == 2) {
                    Intent intent = new Intent(TicketingHomeActivity.this, AccountActivity.class);
                    startActivity(intent);
                } else if (recyclerView.getChildPosition(child) == 3) {
                    Intent intent = new Intent(TicketingHomeActivity.this, TicketListActivity.class);
                    startActivity(intent);
                } else if (recyclerView.getChildPosition(child) == 4) {

                    syncTicketingSynchronize();
                    syncTicketsSynchronize();
                    synchAccount();
                    insertBuses();
                    //insertTerminals();

                    //syncTickets();

                    //dialog = ProgressDialog.show(TicketingHomeActivity.this, "", "Synchronizing App Data. Please wait...", true);
                    /*new Thread(new Runnable() {
                    @Override
                    public void run() {
                            
                        Looper.prepare();
                            
                        final Handler handler = new Handler();
                        handler.postDelayed(new Runnable() {
                            @Override
                            public void run() {*/

                    // insertTerminals();

                    // insertBuses();
                    //getTickets();

                    //Toast.makeText(TicketingHomeActivity.this, "Looper startes ", Toast.LENGTH_SHORT).show();
                    /*handler.removeCallbacks(this);
                            
                    Looper.myLooper().quit();
                    }
                    }, 30000);
                            
                    Looper.loop();
                    }
                    }).start();*/

                } else if (recyclerView.getChildPosition(child) == 5) {
                    if (apps.getLicenceNo() != null) {
                        Intent intent = new Intent(TicketingHomeActivity.this, TripHomeActivity.class);
                        startActivity(intent);

                    } else {
                        //Intent intent = new Intent(TicketingHomeActivity.this,TestPrintActivity.class);
                        //startActivity(intent);
                        Toast.makeText(TicketingHomeActivity.this,
                                "Application is in default mode you cannot use this menu", Toast.LENGTH_SHORT)
                                .show();
                    }

                } else if (recyclerView.getChildPosition(child) == 6) {
                    Intent intent = new Intent(TicketingHomeActivity.this, LogoutActivity.class);
                    startActivity(intent);
                    // Toast.makeText(TicketingHomeActivity.this, "The Item Clicked is: " + recyclerView.getChildPosition(child), Toast.LENGTH_SHORT).show();
                }
                return true;
            }
            return false;
        }

        @Override
        public void onTouchEvent(RecyclerView recyclerView, MotionEvent motionEvent) {

        }
    });
    List<Ticket> issuedTickets = db.getIssuedTickets();
    Log.e("SYNC LOG", issuedTickets.toString());
}

From source file:com.infthink.demo.webrtc.MainActivity.java

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

    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
            | View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);

    setContentView(R.layout.activity_fullscreen);

    // init flint related
    String APPLICATION_ID = "~flint_android_webrtc_demo";
    Flint.FlintApi.setApplicationId(APPLICATION_ID);

    mWebrtcChannel = new MyWebrtcChannel();

    mMediaRouter = MediaRouter.getInstance(getApplicationContext());
    mMediaRouteSelector = new MediaRouteSelector.Builder()
            .addControlCategory(FlintMediaControlIntent.categoryForFlint(APPLICATION_ID)).build();

    mMediaRouterCallback = new MediaRouterCallback();
    mFlingListener = new FlingListener();
    mConnectionCallbacks = new ConnectionCallbacks();

    mIceConnected = false;/*from ww  w.j  a v  a 2 s. c o m*/

    // init views
    mRootView = findViewById(android.R.id.content);
    mEncoderStatView = (TextView) findViewById(R.id.encoder_stat);
    mMenuBar = findViewById(R.id.menubar_fragment);
    mRoomName = (TextView) findViewById(R.id.room_name);
    mVideoView = (GLSurfaceView) findViewById(R.id.glview);

    mMediaRouteButton = (MediaRouteButton) mMenuBar.findViewById(R.id.media_route_button);
    mMediaRouteButton.setRouteSelector(mMediaRouteSelector);

    VideoRendererGui.setView(mVideoView);

    mScalingType = ScalingType.SCALE_ASPECT_FILL;
    mRemoteRender = VideoRendererGui.create(0, 0, 100, 100, mScalingType, false);
    mLocalRender = VideoRendererGui.create(0, 0, 100, 100, mScalingType, true);

    mVideoView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            int visibility = mMenuBar.getVisibility() == View.VISIBLE ? View.INVISIBLE : View.VISIBLE;
            mEncoderStatView.setVisibility(visibility);
            mMenuBar.setVisibility(visibility);
            mRoomName.setVisibility(visibility);
            if (visibility == View.VISIBLE) {
                mEncoderStatView.bringToFront();
                mMenuBar.bringToFront();
                mRoomName.bringToFront();
                mRootView.invalidate();
            }
        }
    });

    ((ImageButton) findViewById(R.id.button_disconnect)).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            logAndToast("Disconnecting call.");
            disconnect();
        }
    });

    ((ImageButton) findViewById(R.id.button_switch_camera)).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (mPeerConn != null) {
                mPeerConn.switchCamera();
            }
        }
    });

    ((ImageButton) findViewById(R.id.button_toggle_debug)).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            int visibility = mHudView.getVisibility() == View.VISIBLE ? View.INVISIBLE : View.VISIBLE;
            mHudView.setVisibility(visibility);

            // use this to send view switch
            if (mApiClient != null && mApiClient.isConnected()) {
                mWebrtcChannel.sendSwitchView(mApiClient);
            }
        }
    });

    mVideoScalingButton = (ImageButton) findViewById(R.id.button_scaling_mode);
    mVideoScalingButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (mScalingType == ScalingType.SCALE_ASPECT_FILL) {
                mVideoScalingButton.setBackgroundResource(R.drawable.ic_action_full_screen);
                mScalingType = ScalingType.SCALE_ASPECT_FIT;
            } else {
                mVideoScalingButton.setBackgroundResource(R.drawable.ic_action_return_from_full_screen);
                mScalingType = ScalingType.SCALE_ASPECT_FILL;
            }
            updateVideoView();
        }
    });

    mHudView = new TextView(this);
    mHudView.setTextColor(Color.BLACK);
    mHudView.setBackgroundColor(Color.WHITE);
    mHudView.setAlpha(0.4f);
    mHudView.setTextSize(TypedValue.COMPLEX_UNIT_PT, 5);
    mHudView.setVisibility(View.INVISIBLE);
    addContentView(mHudView, mHudLayout);

    // Create and audio manager that will take care of audio routing,
    // audio modes, audio device enumeration etc.
    mAudioManager = AppRTCAudioManager.create(this);

    // ready to init webrtc params
    mWebrtcHelper = new WebRtcHelper(this);
    mWebrtcHelper.initParams();
}

From source file:net.nightwhistler.pageturner.Configuration.java

@Inject
public Configuration(Context context) {
    this.settings = PreferenceManager.getDefaultSharedPreferences(context);
    this.context = context;

    if (IS_NOOK_TOUCH) {
        defaultSerifFont = "serif";
        defaultSansFont = "sans";
    } else {//w  ww  .ja  v  a  2  s.c  om
        defaultSerifFont = "gen_book_bas";
        defaultSansFont = "sans";
    }

    // On Nook Touch, preset some different defaults on first load
    // (these values work better w/ e-ink)
    if (IS_NOOK_TOUCH && this.settings.getString(KEY_DEVICE_NAME, null) == null) {
        SharedPreferences.Editor editor = this.settings.edit();
        editor.putString(KEY_FONT_FACE, "sans");
        editor.putString(KEY_SERIF_FONT, "serif");

        editor.putInt(KEY_TEXT_SIZE, 32);
        editor.putString(KEY_SCROLL_STYLE, "timer"); // enum is ScrollStyle.PAGE_TIMER
        final String no_animation = AnimationStyle.NONE.name().toLowerCase(Locale.US);
        editor.putString(KEY_H_ANIMATION, no_animation);
        editor.putString(KEY_V_ANIMATION, no_animation);
        editor.putInt(PREFIX_DAY + "_" + KEY_LINK, Color.rgb(0x40, 0x40, 0x40));
        editor.putInt(PREFIX_NIGHT + "_" + KEY_TEXT, Color.WHITE);
        editor.putInt(PREFIX_NIGHT + "_" + KEY_LINK, Color.rgb(0xb0, 0xb0, 0xb0));
        editor.commit();
    }
}

From source file:com.raspi.chatapp.util.Notification.java

private Bitmap getLargeIcon(int bgColor, char letter, float width, boolean round) {
    Bitmap b = Bitmap.createBitmap((int) width, (int) width, Bitmap.Config.ARGB_8888);
    Canvas c = new Canvas(b);

    RectF mInnerRectF = new RectF();
    mInnerRectF.set(0, 0, width, width);
    mInnerRectF.offset(0, 0);//w ww.ja v  a2 s  . c  o  m

    Paint mBgPaint = new Paint();
    mBgPaint.setFlags(Paint.ANTI_ALIAS_FLAG);
    mBgPaint.setStyle(Paint.Style.FILL);
    mBgPaint.setColor(bgColor);

    TextPaint mTitleTextPaint = new TextPaint();
    mTitleTextPaint.setFlags(Paint.ANTI_ALIAS_FLAG);
    mTitleTextPaint.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
    mTitleTextPaint.setTextAlign(Paint.Align.CENTER);
    mTitleTextPaint.setLinearText(true);
    mTitleTextPaint.setColor(Color.WHITE);
    mTitleTextPaint.setTextSize(width * 0.8f);

    float centerX = mInnerRectF.centerX();
    float centerY = mInnerRectF.centerY();

    int xPos = (int) centerX;
    int yPos = (int) (centerY - (mTitleTextPaint.descent() + mTitleTextPaint.ascent()) / 2);

    if (round)
        c.drawOval(mInnerRectF, mBgPaint);
    else
        c.drawRect(mInnerRectF, mBgPaint);
    c.drawText(String.valueOf(letter), xPos, yPos, mTitleTextPaint);

    return b;
}

From source file:com.cecs492a_group4.sp.SingleEvent.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_single_event);
    listView = (ListView) findViewById(R.id.listView);
    buildGoogleApiClient();/* ww  w  .  ja  v a  2 s  . c o  m*/
    autocompleteFragment = (PlaceAutocompleteFragment) getFragmentManager()
            .findFragmentById(R.id.autocomplete_fragment);
    autocompleteFragment.getView().setBackgroundColor(Color.WHITE);

    shareDialog = new ShareDialog(this);
    callbackManager = CallbackManager.Factory.create();

    locationSwitch = (Switch) findViewById(R.id.locationSwitch);
    // Register a listener to receive callbacks when a place has been selected or an error has
    // occurred.
    if (staticAddress != null) {

        finalAddress = staticAddress;
        autocompleteFragment.setHint(staticAddress);

        Toast.makeText(this, "Using GSM location", Toast.LENGTH_SHORT).show();

    } else {
        locationSwitch.toggle();
        Toast.makeText(this, ("Please enter a location"), Toast.LENGTH_SHORT).show();

    }

    locationSwitch.setOnCheckedChangeListener(this);
    yelp.setLimit(limit);
    autocompleteFragment.setOnPlaceSelectedListener(this);

    fullButton = (Button) findViewById(R.id.fulldaybtn);
    singleButton = (Button) findViewById(R.id.singleDayBtn);
    Typeface buttonfont = Typeface.createFromAsset(getAssets(), "PoisonedApples.ttf");
    fullButton.setTypeface(buttonfont);
    singleButton.setTypeface(buttonfont);

    //String htmlexample = "<body><h2>The Result<br></h2>";
    //tv.setText(Html.fromHtml(htmlexample, null, null));
    arrayAdapter = new MyDayListAdapter();
    listView.setAdapter(arrayAdapter);
    fullButton.setOnClickListener(this);
    singleButton.setOnClickListener(this);

    listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            DayEvent clickedevent = dayevent.get(position);
            try {
                Intent myIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(clickedevent.url));
                startActivity(myIntent);
            } catch (Exception e) {
                System.out.println("Been in on click method");
            }
        }
    });

    // ATTENTION: This was auto-generated to implement the App Indexing API.
    // See https://g.co/AppIndexing/AndroidStudio for more information
    // ATTENTION: This was auto-generated to implement the App Indexing API.
    // See https://g.co/AppIndexing/AndroidStudio for more information.
    client = new GoogleApiClient.Builder(this).addApi(AppIndex.API).build();
}

From source file:com.aujur.ebookreader.Configuration.java

@Inject
public Configuration(Context context) {
    this.settings = PreferenceManager.getDefaultSharedPreferences(context);
    this.context = context;

    if (IS_NOOK_TOUCH) {
        defaultSerifFont = "serif";
        defaultSansFont = "sans";
    } else {/*from www.java  2  s .  c  om*/
        defaultSerifFont = "gen_book_bas";
        defaultSansFont = "sans";
    }

    // On Nook Touch, preset some different defaults on first load
    // (these values work better w/ e-ink)
    if (IS_NOOK_TOUCH && this.settings.getString(KEY_DEVICE_NAME, null) == null) {
        SharedPreferences.Editor editor = this.settings.edit();
        editor.putString(KEY_FONT_FACE, "sans");
        editor.putString(KEY_SERIF_FONT, "serif");

        editor.putInt(KEY_TEXT_SIZE, 32);
        editor.putString(KEY_SCROLL_STYLE, "timer"); // enum is
        // ScrollStyle.PAGE_TIMER
        final String no_animation = AnimationStyle.NONE.name().toLowerCase(Locale.US);
        editor.putString(KEY_H_ANIMATION, no_animation);
        editor.putString(KEY_V_ANIMATION, no_animation);
        editor.putInt(PREFIX_DAY + "_" + KEY_LINK, Color.rgb(0x40, 0x40, 0x40));
        editor.putInt(PREFIX_NIGHT + "_" + KEY_TEXT, Color.WHITE);
        editor.putInt(PREFIX_NIGHT + "_" + KEY_LINK, Color.rgb(0xb0, 0xb0, 0xb0));
        editor.commit();
    }
}

From source file:com.TakeTaxi.jy.OnrouteScreen.java

public void pingpicked(JSONObject json) {

    try {/*from   w  w w  .  j av a  2  s .  c  o  m*/

        int driverpicked = json.getInt("picked");
        int drivercancelled = json.getInt("dcancel");
        int starttime = json.getInt("datetime");

        // /////////////////////////////// DRIVER CANCEL ////////
        if (drivercancelled == 1) {

            // //// DRIVER CANCEL LATE /////

            if (starttime + 300 <= Query.getServerTime()) {
                handlerboolean = false;
                handler.removeCallbacks(r);

                AlertDialog dcancelbuilder = new AlertDialog.Builder(OnrouteScreen.this).create();
                dcancelbuilder
                        .setMessage("Job has been cancelled.\nWould you like to report a late cancellation?.");

                // //// DRIVER CANCEL LATE - NO REPORT LATE/////
                button_cancelJob_noquery(dcancelbuilder);
                // //// DRIVER CANCEL LATE - REPORT LATE /////
                button_drivercancel_reportlate(dcancelbuilder);

                dcancelbuilder.show();

            } else {
                // /////////////////////////////// DRIVER CANCEL NO ALERTS -
                // WITHIN TIME LIMIT///////////////
                handlerboolean = false;
                handler.removeCallbacks(r);

                alertdialog_drivercancelintime();

            }
        }
        if (driverpicked == 1) {
            // /////////////////////////////// CONFIRM PICK UP
            // ///////////////////////////////////////////

            handlerboolean = false;
            handler.removeCallbacks(r);
            AlertDialog.Builder alert = new AlertDialog.Builder(OnrouteScreen.this);
            final Drawable thumbsup = getResources().getDrawable(R.drawable.thumbsup);
            final Drawable thumbsupwhite = getResources().getDrawable(R.drawable.thumbsupwhite);
            final Drawable thumbsdown = getResources().getDrawable(R.drawable.thumbsdown);
            final Drawable thumbsdownwhite = getResources().getDrawable(R.drawable.thumbsdownwhite);
            LinearLayout layout = new LinearLayout(OnrouteScreen.this);
            layout.setOrientation(1);
            layout.setGravity(17);

            TextView tx1 = new TextView(OnrouteScreen.this);
            tx1.setText("Driver says you have been picked up");
            tx1.setGravity(17);
            tx1.setTextSize(20);
            tx1.setTextColor(Color.WHITE);
            tx1.setPadding(10, 10, 10, 10);

            TextView tx2 = new TextView(OnrouteScreen.this);
            tx2.setText("Please rate your driver");
            tx2.setGravity(17);
            tx2.setTextSize(16);

            LinearLayout imglayout = new LinearLayout(OnrouteScreen.this);
            imglayout.setOrientation(0);
            imglayout.setGravity(17);

            final ImageView ivup = new ImageView(OnrouteScreen.this);
            ivup.setImageDrawable(thumbsupwhite);
            ivup.setClickable(true);
            ivup.setPadding(0, 5, 30, 5);
            final ImageView ivdown = new ImageView(OnrouteScreen.this);
            ivdown.setImageDrawable(thumbsdownwhite);
            ivdown.setClickable(true);
            ivup.setPadding(30, 5, 0, 5);
            imglayout.addView(ivup);
            imglayout.addView(ivdown);

            layout.addView(tx1);
            layout.addView(tx2);

            layout.addView(imglayout);
            // /////////////////////////////// CONFIRM PICK UP - RATINGS
            // ///////////////////////////////////////////

            ivup.setOnClickListener(new View.OnClickListener() {
                public void onClick(View v) {
                    if (thumbsupboolean == false) {
                        thumbsupboolean = true;
                        thumbsdownboolean = false;
                        ivup.setImageDrawable(thumbsup);
                        ivdown.setImageDrawable(thumbsdownwhite);
                        rating = 1;
                    } else {
                        thumbsupboolean = false;
                        ivup.setImageDrawable(thumbsupwhite);
                        rating = 0;
                    }

                }
            });

            ivdown.setOnClickListener(new View.OnClickListener() {
                public void onClick(View v) {
                    if (thumbsdownboolean == false) {
                        thumbsdownboolean = true;
                        thumbsupboolean = false;
                        ivdown.setImageDrawable(thumbsdown);
                        ivup.setImageDrawable(thumbsupwhite);

                        AlertDialog alert = new AlertDialog.Builder(OnrouteScreen.this).create();

                        alert.setMessage("Please pick one");
                        alert.setButton("No show", new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog, int which) {
                                rating = -1;
                            }
                        });
                        alert.setButton2("Driver late", new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog, int which) {
                                rating = -2;
                            }
                        });
                        alert.setButton3("Poor service", new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog, int which) {
                                rating = -3;
                            }
                        });
                        alert.show();

                    } else {
                        thumbsupboolean = false;
                        ivdown.setImageDrawable(thumbsdownwhite);
                        rating = 0;
                    }

                }
            });

            button_completed_finish(alert);

            alert.setView(layout);
            alert.create();
            alert.show();
        } else {
        }

    } catch (JSONException e) {
    }
}

From source file:com.dhayanand.apps.stockhawkk.StockDetailFragment.java

private void updateChart(Cursor data) {

    List<AxisValue> axisValuesX = new ArrayList<>();
    List<PointValue> pointValues = new ArrayList<>();

    int counter = -1;
    do {//from  w  w  w.  j a va 2  s. c  om
        counter++;

        String date = data.getString(data.getColumnIndex(QuoteHistoricalDataColumns.DATE));
        String bidPrice = data.getString(data.getColumnIndex(QuoteHistoricalDataColumns.BIDPRICE));

        // We have to show chart in right order.
        int x = data.getCount() - 1 - counter;

        // Point for line chart (date, price).
        PointValue pointValue = new PointValue(x, Float.valueOf(bidPrice));
        pointValue.setLabel(date);
        pointValues.add(pointValue);

        // Set labels for x-axis (we have to reduce its number to avoid overlapping text).
        if (counter != 0 && counter % (data.getCount() / 3) == 0) {
            AxisValue axisValueX = new AxisValue(x);
            axisValueX.setLabel(date);
            axisValuesX.add(axisValueX);
        }

    } while (data.moveToNext());

    // Prepare data for chart
    Line line = new Line(pointValues).setColor(Color.WHITE).setCubic(false);
    List<Line> lines = new ArrayList<>();
    lines.add(line);
    LineChartData lineChartData = new LineChartData();
    lineChartData.setLines(lines);

    // Init x-axis
    Axis axisX = new Axis(axisValuesX);
    axisX.setHasLines(true);
    axisX.setMaxLabelChars(4);
    lineChartData.setAxisXBottom(axisX);

    // Init y-axis
    Axis axisY = new Axis();
    axisY.setAutoGenerated(true);
    axisY.setHasLines(true);
    axisY.setMaxLabelChars(4);
    lineChartData.setAxisYLeft(axisY);

    // Update chart with new data.
    mChart.setInteractive(false);
    mChart.setLineChartData(lineChartData);

    // Show chart
    mChart.setVisibility(View.VISIBLE);
    mTabContent.setVisibility(View.VISIBLE);
}