Example usage for android.content Context CLIPBOARD_SERVICE

List of usage examples for android.content Context CLIPBOARD_SERVICE

Introduction

In this page you can find the example usage for android.content Context CLIPBOARD_SERVICE.

Prototype

String CLIPBOARD_SERVICE

To view the source code for android.content Context CLIPBOARD_SERVICE.

Click Source Link

Document

Use with #getSystemService(String) to retrieve a android.content.ClipboardManager for accessing and modifying the contents of the global clipboard.

Usage

From source file:org.uguess.android.sysinfo.ApplicationManager.java

void sendContent(final boolean[] items, final List<AppInfoHolder> apps, final boolean isCopy) {
    if (progress != null) {
        progress.dismiss();//from   w  w w. j  a  v a  2s. co  m
    }
    progress = new ProgressDialog(getActivity());
    progress.setMessage(getResources().getText(R.string.loading));
    progress.setIndeterminate(true);
    progress.show();

    // move this out of the thread code to avoid exception under honeycomb
    final ClipboardManager cm = (ClipboardManager) getActivity().getSystemService(Context.CLIPBOARD_SERVICE);

    new Thread(new Runnable() {

        public void run() {
            String content = collectTextContent(items, apps);

            if (isCopy) {
                if (cm != null && content != null) {
                    cm.setText(content);
                }

                handler.sendEmptyMessage(MSG_DISMISS_PROGRESS);

                handler.sendMessage(handler.obtainMessage(MSG_TOAST, getString(R.string.copied_hint)));

                return;
            }

            if (aborted) {
                return;
            }

            if (content != null) {
                handler.sendMessage(handler.obtainMessage(MSG_CHECK_FORCE_COMPRESSION, SiragonManager.PLAINTEXT,
                        0, content));
            } else {
                handler.sendMessage(
                        handler.obtainMessage(MSG_CONTENT_READY, SiragonManager.PLAINTEXT, 0, content));
            }
        }
    }).start();
}

From source file:com.intel.xdk.device.Device.java

public void copyToClipboard(String text) {
    ClipboardManager clipboard = (ClipboardManager) activity.getSystemService(Context.CLIPBOARD_SERVICE);
    clipboard.setText(text);
}

From source file:com.ichi2.anki.Info.java

/**
 * Copy debug information about the device to the clipboard
 * @return debugInfo/*from  ww w. jav  a 2 s.c o  m*/
 */
public String copyDebugInfo() {
    StringBuilder sb = new StringBuilder();
    // AnkiDroid Version
    sb.append("AnkiDroid Version = ").append(AnkiDroidApp.getPkgVersionName()).append("\n\n");
    // Android SDK
    sb.append("Android Version = " + Build.VERSION.RELEASE).append("\n\n");
    // ACRA install ID
    sb.append("ACRA UUID = ").append(Installation.id(this)).append("\n");
    String debugInfo = sb.toString();
    ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
    clipboard.setText(debugInfo);
    return debugInfo;
}

From source file:org.telegram.ui.ProfileActivity.java

private boolean processOnClickOrPress(final int position) {
    if (position == usernameRow) {
        final TLRPC.User user = MessagesController.getInstance().getUser(user_id);
        if (user == null || user.username == null) {
            return false;
        }/*  w  ww .j av  a2 s .  c  o m*/
        AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
        builder.setItems(new CharSequence[] { LocaleController.getString("Copy", R.string.Copy) },
                new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int i) {
                        if (i == 0) {
                            try {
                                android.content.ClipboardManager clipboard = (android.content.ClipboardManager) ApplicationLoader.applicationContext
                                        .getSystemService(Context.CLIPBOARD_SERVICE);
                                android.content.ClipData clip = android.content.ClipData.newPlainText("label",
                                        "@" + user.username);
                                clipboard.setPrimaryClip(clip);
                            } catch (Exception e) {
                                FileLog.e("tmessages", e);
                            }
                        }
                    }
                });
        showDialog(builder.create());
        return true;
    } else if (position == phoneRow) {
        final TLRPC.User user = MessagesController.getInstance().getUser(user_id);
        if (user == null || user.phone == null || user.phone.length() == 0 || getParentActivity() == null) {
            return false;
        }

        AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
        builder.setItems(
                new CharSequence[] { LocaleController.getString("Call", R.string.Call),
                        LocaleController.getString("Copy", R.string.Copy) },
                new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int i) {
                        if (i == 0) {
                            try {
                                Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:+" + user.phone));
                                intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                                getParentActivity().startActivityForResult(intent, 500);
                            } catch (Exception e) {
                                FileLog.e("tmessages", e);
                            }
                        } else if (i == 1) {
                            try {
                                android.content.ClipboardManager clipboard = (android.content.ClipboardManager) ApplicationLoader.applicationContext
                                        .getSystemService(Context.CLIPBOARD_SERVICE);
                                android.content.ClipData clip = android.content.ClipData.newPlainText("label",
                                        "+" + user.phone);
                                clipboard.setPrimaryClip(clip);
                            } catch (Exception e) {
                                FileLog.e("tmessages", e);
                            }
                        }
                    }
                });
        showDialog(builder.create());
        return true;
    } else if (position == channelInfoRow || position == userInfoRow) {
        AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
        builder.setItems(new CharSequence[] { LocaleController.getString("Copy", R.string.Copy) },
                new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int i) {
                        try {
                            String about;
                            if (position == channelInfoRow) {
                                about = info.about;
                            } else {
                                about = MessagesController.getInstance().getUserAbout(botInfo.user_id);
                            }
                            if (about == null) {
                                return;
                            }
                            android.content.ClipboardManager clipboard = (android.content.ClipboardManager) ApplicationLoader.applicationContext
                                    .getSystemService(Context.CLIPBOARD_SERVICE);
                            android.content.ClipData clip = android.content.ClipData.newPlainText("label",
                                    about);
                            clipboard.setPrimaryClip(clip);
                        } catch (Exception e) {
                            FileLog.e("tmessages", e);
                        }
                    }
                });
        showDialog(builder.create());
        return true;
    }
    return false;
}

From source file:org.totschnig.myexpenses.activity.MyExpenses.java

public void copyToClipBoard(View view) {
    ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
    clipboard.setText(mCurrentBalance);/* w  w w .  j  a va2s  . c  o m*/
    Toast.makeText(this, R.string.copied_to_clipboard, Toast.LENGTH_LONG).show();
}

From source file:com.android.mms.ui.ComposeMessageActivity.java

private void copyToClipboard(String str) {
    ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
    clipboard.setPrimaryClip(ClipData.newPlainText(null, str));
}

From source file:com.ichi2.anki2.Reviewer.java

private void initLayout(Integer layout) {
    setContentView(layout);/*from   www . j  a  v  a  2s . co m*/

    mMainLayout = findViewById(R.id.main_layout);
    Themes.setContentStyle(mMainLayout, Themes.CALLER_REVIEWER);

    mCardContainer = (FrameLayout) findViewById(R.id.flashcard_frame);
    setInAnimation(false);

    findViewById(R.id.top_bar).setOnClickListener(mCardStatisticsListener);

    mCardFrame = (FrameLayout) findViewById(R.id.flashcard);
    mTouchLayer = (FrameLayout) findViewById(R.id.touch_layer);
    mTouchLayer.setOnTouchListener(mGestureListener);
    if (mPrefTextSelection && mLongClickWorkaround) {
        mTouchLayer.setOnLongClickListener(mLongClickListener);
    }
    if (mPrefTextSelection) {
        mClipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
    }
    mCardFrame.removeAllViews();
    if (!mChangeBorderStyle) {
        ((View) findViewById(R.id.flashcard_border)).setVisibility(View.VISIBLE);
    }
    // hunt for input issue 720, like android issue 3341
    if (AnkiDroidApp.SDK_VERSION <= 7 && (mCard != null)) {
        mCard.setFocusableInTouchMode(true);
    }

    // Initialize swipe
    gestureDetector = new GestureDetector(new MyGestureDetector());

    mProgressBar = (ProgressBar) findViewById(R.id.flashcard_progressbar);

    // initialise shake detection
    if (mShakeEnabled) {
        mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
        mSensorManager.registerListener(mSensorListener,
                mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER), SensorManager.SENSOR_DELAY_NORMAL);
        mAccel = 0.00f;
        mAccelCurrent = SensorManager.GRAVITY_EARTH;
        mAccelLast = SensorManager.GRAVITY_EARTH;
    }

    Resources res = getResources();

    mEase1 = (Button) findViewById(R.id.ease1);
    mEase1.setTextColor(res.getColor(R.color.next_time_failed_color));
    mEase1Layout = (LinearLayout) findViewById(R.id.flashcard_layout_ease1);
    mEase1Layout.setOnClickListener(mSelectEaseHandler);

    mEase2 = (Button) findViewById(R.id.ease2);
    mEase2.setTextColor(res.getColor(R.color.next_time_usual_color));
    mEase2Layout = (LinearLayout) findViewById(R.id.flashcard_layout_ease2);
    mEase2Layout.setOnClickListener(mSelectEaseHandler);

    mEase3 = (Button) findViewById(R.id.ease3);
    mEase3Layout = (LinearLayout) findViewById(R.id.flashcard_layout_ease3);
    mEase3Layout.setOnClickListener(mSelectEaseHandler);

    mEase4 = (Button) findViewById(R.id.ease4);
    mEase4Layout = (LinearLayout) findViewById(R.id.flashcard_layout_ease4);
    mEase4Layout.setOnClickListener(mSelectEaseHandler);

    mNext1 = (TextView) findViewById(R.id.nextTime1);
    mNext2 = (TextView) findViewById(R.id.nextTime2);
    mNext3 = (TextView) findViewById(R.id.nextTime3);
    mNext4 = (TextView) findViewById(R.id.nextTime4);

    mNext1.setTextColor(res.getColor(R.color.next_time_failed_color));
    mNext2.setTextColor(res.getColor(R.color.next_time_usual_color));

    if (!mshowNextReviewTime) {
        ((TextView) findViewById(R.id.nextTimeflip)).setVisibility(View.GONE);
        mNext1.setVisibility(View.GONE);
        mNext2.setVisibility(View.GONE);
        mNext3.setVisibility(View.GONE);
        mNext4.setVisibility(View.GONE);
    }

    mFlipCard = (Button) findViewById(R.id.flip_card);
    mFlipCardLayout = (LinearLayout) findViewById(R.id.flashcard_layout_flip);
    mFlipCardLayout.setOnClickListener(mFlipCardListener);

    mTextBarRed = (TextView) findViewById(R.id.red_number);
    mTextBarBlack = (TextView) findViewById(R.id.black_number);
    mTextBarBlue = (TextView) findViewById(R.id.blue_number);

    if (mShowProgressBars) {
        mSessionProgressTotalBar = (View) findViewById(R.id.daily_bar);
        mSessionProgressBar = (View) findViewById(R.id.session_progress);
        mProgressBars = (LinearLayout) findViewById(R.id.progress_bars);
    }

    mCardTimer = (Chronometer) findViewById(R.id.card_time);
    if (mShowProgressBars && mProgressBars.getVisibility() != View.VISIBLE) {
        switchVisibility(mProgressBars, View.VISIBLE);
    }

    mChosenAnswer = (TextView) findViewById(R.id.choosen_answer);

    if (mPrefWhiteboard) {
        mWhiteboard = new Whiteboard(this, mInvertedColors, mBlackWhiteboard);
        FrameLayout.LayoutParams lp2 = new FrameLayout.LayoutParams(LayoutParams.FILL_PARENT,
                LayoutParams.FILL_PARENT);
        mWhiteboard.setLayoutParams(lp2);
        FrameLayout fl = (FrameLayout) findViewById(R.id.whiteboard);
        fl.addView(mWhiteboard);

        mWhiteboard.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                if (mShowWhiteboard) {
                    return false;
                }
                if (gestureDetector.onTouchEvent(event)) {
                    return true;
                }
                return false;
            }
        });
    }
    mAnswerField = (EditText) findViewById(R.id.answer_field);

    mNextTimeTextColor = getResources().getColor(R.color.next_time_usual_color);
    mNextTimeTextRecomColor = getResources().getColor(R.color.next_time_recommended_color);
    mForegroundColor = getResources().getColor(R.color.next_time_usual_color);
    if (mInvertedColors) {
        invertColors(true);
    }

    mLookUpIcon = findViewById(R.id.lookup_button);
    mLookUpIcon.setVisibility(View.GONE);
    mLookUpIcon.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View arg0) {
            if (clipboardHasText()) {
                lookUp();
            }
        }

    });
    initControls();
}

From source file:com.nit.vicky.Reviewer.java

private void initLayout(Integer layout) {
    setContentView(layout);//  ww  w.ja va  2 s. c  om

    mMainLayout = findViewById(R.id.main_layout);
    Themes.setContentStyle(mMainLayout, Themes.CALLER_REVIEWER);

    mCardContainer = (FrameLayout) findViewById(R.id.flashcard_frame);
    setInAnimation(false);

    findViewById(R.id.top_bar).setOnClickListener(mCardStatisticsListener);

    mCardFrame = (FrameLayout) findViewById(R.id.flashcard);
    mTouchLayer = (FrameLayout) findViewById(R.id.touch_layer);
    mTouchLayer.setOnTouchListener(mGestureListener);
    if (mPrefTextSelection && mLongClickWorkaround) {
        mTouchLayer.setOnLongClickListener(mLongClickListener);
    }
    if (mPrefTextSelection) {
        mClipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
    }
    mCardFrame.removeAllViews();
    if (!mChangeBorderStyle) {
        ((View) findViewById(R.id.flashcard_border)).setVisibility(View.VISIBLE);
    }
    // hunt for input issue 720, like android issue 3341
    if (AnkiDroidApp.SDK_VERSION <= 7 && (mCard != null)) {
        mCard.setFocusableInTouchMode(true);
    }

    // Initialize swipe
    gestureDetector = new GestureDetector(new MyGestureDetector());

    mProgressBar = (ProgressBar) findViewById(R.id.flashcard_progressbar);

    // initialise shake detection
    if (mShakeEnabled) {
        mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
        mSensorManager.registerListener(mSensorListener,
                mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER), SensorManager.SENSOR_DELAY_NORMAL);
        mAccel = 0.00f;
        mAccelCurrent = SensorManager.GRAVITY_EARTH;
        mAccelLast = SensorManager.GRAVITY_EARTH;
    }

    Resources res = getResources();

    mEase1 = (Button) findViewById(R.id.ease1);
    mEase1.setTextColor(res.getColor(R.color.next_time_failed_color));
    mEase1Layout = (LinearLayout) findViewById(R.id.flashcard_layout_ease1);
    mEase1Layout.setOnClickListener(mSelectEaseHandler);

    mEase2 = (Button) findViewById(R.id.ease2);
    mEase2.setTextColor(res.getColor(R.color.next_time_usual_color));
    mEase2Layout = (LinearLayout) findViewById(R.id.flashcard_layout_ease2);
    mEase2Layout.setOnClickListener(mSelectEaseHandler);

    mEase3 = (Button) findViewById(R.id.ease3);
    mEase3Layout = (LinearLayout) findViewById(R.id.flashcard_layout_ease3);
    mEase3Layout.setOnClickListener(mSelectEaseHandler);

    mEase4 = (Button) findViewById(R.id.ease4);
    mEase4Layout = (LinearLayout) findViewById(R.id.flashcard_layout_ease4);
    mEase4Layout.setOnClickListener(mSelectEaseHandler);

    mNext1 = (TextView) findViewById(R.id.nextTime1);
    mNext2 = (TextView) findViewById(R.id.nextTime2);
    mNext3 = (TextView) findViewById(R.id.nextTime3);
    mNext4 = (TextView) findViewById(R.id.nextTime4);

    mNext1.setTextColor(res.getColor(R.color.next_time_failed_color));
    mNext2.setTextColor(res.getColor(R.color.next_time_usual_color));

    if (!mShowNextReviewTime) {
        ((TextView) findViewById(R.id.nextTimeflip)).setVisibility(View.GONE);
        mNext1.setVisibility(View.GONE);
        mNext2.setVisibility(View.GONE);
        mNext3.setVisibility(View.GONE);
        mNext4.setVisibility(View.GONE);
    }

    mFlipCard = (Button) findViewById(R.id.flip_card);
    mFlipCardLayout = (LinearLayout) findViewById(R.id.flashcard_layout_flip);
    mFlipCardLayout.setOnClickListener(mFlipCardListener);

    mTextBarRed = (TextView) findViewById(R.id.red_number);
    mTextBarBlack = (TextView) findViewById(R.id.black_number);
    mTextBarBlue = (TextView) findViewById(R.id.blue_number);

    if (!mShowRemainingCardCount) {
        mTextBarRed.setVisibility(View.GONE);
        mTextBarBlack.setVisibility(View.GONE);
        mTextBarBlue.setVisibility(View.GONE);
    }

    if (mShowProgressBars) {
        mSessionProgressTotalBar = (View) findViewById(R.id.daily_bar);
        mSessionProgressBar = (View) findViewById(R.id.session_progress);
        mProgressBars = (LinearLayout) findViewById(R.id.progress_bars);
    }

    mCardTimer = (Chronometer) findViewById(R.id.card_time);
    if (mShowProgressBars && mProgressBars.getVisibility() != View.VISIBLE) {
        switchVisibility(mProgressBars, View.VISIBLE);
    }

    mChosenAnswer = (TextView) findViewById(R.id.choosen_answer);

    if (mPrefWhiteboard) {
        mWhiteboard = new Whiteboard(this, mInvertedColors, mBlackWhiteboard);
        FrameLayout.LayoutParams lp2 = new FrameLayout.LayoutParams(LayoutParams.FILL_PARENT,
                LayoutParams.FILL_PARENT);
        mWhiteboard.setLayoutParams(lp2);
        FrameLayout fl = (FrameLayout) findViewById(R.id.whiteboard);
        fl.addView(mWhiteboard);

        mWhiteboard.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                if (mShowWhiteboard) {
                    return false;
                }
                if (gestureDetector.onTouchEvent(event)) {
                    return true;
                }
                return false;
            }
        });
    }
    mAnswerField = (EditText) findViewById(R.id.answer_field);

    mNextTimeTextColor = getResources().getColor(R.color.next_time_usual_color);
    mNextTimeTextRecomColor = getResources().getColor(R.color.next_time_recommended_color);
    mForegroundColor = getResources().getColor(R.color.next_time_usual_color);
    if (mInvertedColors) {
        invertColors(true);
    }

    mLookUpIcon = findViewById(R.id.lookup_button);
    mLookUpIcon.setVisibility(View.GONE);
    mLookUpIcon.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View arg0) {
            if (clipboardHasText()) {
                lookUp();
            }
        }

    });
    initControls();
}

From source file:com.hichinaschool.flashcards.anki.Reviewer.java

private void initLayout(Integer layout) {
    setContentView(layout);//from  w ww .  ja v  a 2s  .c  o  m

    mMainLayout = findViewById(R.id.main_layout);
    Themes.setContentStyle(mMainLayout, Themes.CALLER_REVIEWER);

    mCardContainer = (FrameLayout) findViewById(R.id.flashcard_frame);
    setInAnimation(false);

    findViewById(R.id.top_bar).setOnClickListener(mCardStatisticsListener);

    mCardFrame = (FrameLayout) findViewById(R.id.flashcard);
    mTouchLayer = (FrameLayout) findViewById(R.id.touch_layer);
    mTouchLayer.setOnTouchListener(mGestureListener);
    if (mPrefTextSelection && mLongClickWorkaround) {
        mTouchLayer.setOnLongClickListener(mLongClickListener);
    }
    if (mPrefTextSelection) {
        mClipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
    }
    mCardFrame.removeAllViews();
    if (!mChangeBorderStyle) {
        ((View) findViewById(R.id.flashcard_border)).setVisibility(View.VISIBLE);
    }
    // hunt for input issue 720, like android issue 3341
    if (AnkiDroidApp.SDK_VERSION <= 7 && (mCard != null)) {
        mCard.setFocusableInTouchMode(true);
    }

    // Initialize swipe
    gestureDetector = new GestureDetector(new MyGestureDetector());

    mProgressBar = (ProgressBar) findViewById(R.id.flashcard_progressbar);

    // initialise shake detection
    if (mShakeEnabled) {
        mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
        mSensorManager.registerListener(mSensorListener,
                mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER), SensorManager.SENSOR_DELAY_NORMAL);
        mAccel = 0.00f;
        mAccelCurrent = SensorManager.GRAVITY_EARTH;
        mAccelLast = SensorManager.GRAVITY_EARTH;
    }

    Resources res = getResources();

    mEase1 = (Button) findViewById(R.id.ease1);
    mEase1.setTextColor(res.getColor(R.color.next_time_failed_color));
    mEase1Layout = (LinearLayout) findViewById(R.id.flashcard_layout_ease1);
    mEase1Layout.setOnClickListener(mSelectEaseHandler);

    mEase2 = (Button) findViewById(R.id.ease2);
    mEase2.setTextColor(res.getColor(R.color.next_time_usual_color));
    mEase2Layout = (LinearLayout) findViewById(R.id.flashcard_layout_ease2);
    mEase2Layout.setOnClickListener(mSelectEaseHandler);

    mEase3 = (Button) findViewById(R.id.ease3);
    mEase3Layout = (LinearLayout) findViewById(R.id.flashcard_layout_ease3);
    mEase3Layout.setOnClickListener(mSelectEaseHandler);

    mEase4 = (Button) findViewById(R.id.ease4);
    mEase4Layout = (LinearLayout) findViewById(R.id.flashcard_layout_ease4);
    mEase4Layout.setOnClickListener(mSelectEaseHandler);

    mNext1 = (TextView) findViewById(R.id.nextTime1);
    mNext2 = (TextView) findViewById(R.id.nextTime2);
    mNext3 = (TextView) findViewById(R.id.nextTime3);
    mNext4 = (TextView) findViewById(R.id.nextTime4);

    mNext1.setTextColor(res.getColor(R.color.next_time_failed_color));
    mNext2.setTextColor(res.getColor(R.color.next_time_usual_color));

    if (!mShowNextReviewTime) {
        ((TextView) findViewById(R.id.nextTimeflip)).setVisibility(View.GONE);
        mNext1.setVisibility(View.GONE);
        mNext2.setVisibility(View.GONE);
        mNext3.setVisibility(View.GONE);
        mNext4.setVisibility(View.GONE);
    }

    mFlipCard = (Button) findViewById(R.id.flip_card);
    mFlipCardLayout = (LinearLayout) findViewById(R.id.flashcard_layout_flip);
    mFlipCardLayout.setOnClickListener(mFlipCardListener);

    mTextBarRed = (TextView) findViewById(R.id.red_number);
    mTextBarBlack = (TextView) findViewById(R.id.black_number);
    mTextBarBlue = (TextView) findViewById(R.id.blue_number);

    if (!mShowRemainingCardCount) {
        mTextBarRed.setVisibility(View.GONE);
        mTextBarBlack.setVisibility(View.GONE);
        mTextBarBlue.setVisibility(View.GONE);
    }

    if (mShowProgressBars) {
        mSessionProgressTotalBar = (View) findViewById(R.id.daily_bar);
        mSessionProgressBar = (View) findViewById(R.id.session_progress);
        mProgressBars = (LinearLayout) findViewById(R.id.progress_bars);
    }

    mCardTimer = (Chronometer) findViewById(R.id.card_time);
    if (mShowProgressBars && mProgressBars.getVisibility() != View.VISIBLE) {
        //            switchVisibility(mProgressBars, View.VISIBLE);
    }

    mChosenAnswer = (TextView) findViewById(R.id.choosen_answer);

    if (mPrefWhiteboard) {
        mWhiteboard = new Whiteboard(this, mInvertedColors, mBlackWhiteboard);
        FrameLayout.LayoutParams lp2 = new FrameLayout.LayoutParams(LayoutParams.FILL_PARENT,
                LayoutParams.FILL_PARENT);
        mWhiteboard.setLayoutParams(lp2);
        FrameLayout fl = (FrameLayout) findViewById(R.id.whiteboard);
        fl.addView(mWhiteboard);

        mWhiteboard.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                if (mShowWhiteboard) {
                    return false;
                }
                if (gestureDetector.onTouchEvent(event)) {
                    return true;
                }
                return false;
            }
        });
    }
    mAnswerField = (EditText) findViewById(R.id.answer_field);

    mNextTimeTextColor = getResources().getColor(R.color.next_time_usual_color);
    mNextTimeTextRecomColor = getResources().getColor(R.color.next_time_recommended_color);
    mForegroundColor = getResources().getColor(R.color.next_time_usual_color);
    if (mInvertedColors) {
        invertColors(true);
    }

    mLookUpIcon = findViewById(R.id.lookup_button);
    mLookUpIcon.setVisibility(View.GONE);
    mLookUpIcon.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View arg0) {
            if (clipboardHasText()) {
                lookUp();
            }
        }

    });
    initControls();
}