Example usage for android.widget TextView setVisibility

List of usage examples for android.widget TextView setVisibility

Introduction

In this page you can find the example usage for android.widget TextView setVisibility.

Prototype

@RemotableViewMethod
public void setVisibility(@Visibility int visibility) 

Source Link

Document

Set the visibility state of this view.

Usage

From source file:com.example.reabar.wimc.Fragments.CarScreenFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View view = inflater.inflate(R.layout.fragment_car_screen, container, false);

    TextView text = (TextView) view.findViewById(R.id.deleteTextView);
    Button addUserButton = (Button) view.findViewById(R.id.addUserButton);

    Typeface english = Typeface.createFromAsset(getActivity().getAssets(), "KOMIKAX_.ttf"); // create a typeface from the raw ttf
    Typeface hebrew = Typeface.createFromAsset(getActivity().getAssets(), "OpenSansHebrew-Bold.ttf"); // create a typeface from the raw ttf
    if (Locale.getDefault().getDisplayLanguage().equals("")) {
        addUserButton.setTypeface(hebrew);
        text.setTypeface(hebrew);//  ww w .  j av a 2s .  co  m
    } else {
        addUserButton.setTypeface(english);
        text.setTypeface(english);
    }

    if (sharedUsersList == null) {
        sharedUsersList = new ArrayList<>();
    }

    if (sharedUsersList.isEmpty()) {
        text.setVisibility(View.GONE);
    }

    TextView licenseTextView = (TextView) view.findViewById(R.id.cars_list_row_car_license);
    licenseTextView.setText(carLicense);
    TextView modelCompanyTextView = (TextView) view.findViewById(R.id.cars_list_row_car_model_company);
    modelCompanyTextView.setText(modelCompany);

    list = (ListView) view.findViewById(R.id.listSharedUsersID);
    adapter = new MyUsersCarAdapter();
    list.setAdapter(adapter);
    list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            car.removeCarUser(sharedUsersList.get(position));
            adapter.notifyDataSetChanged();
            Toast.makeText(MyApplication.getAppActivity(), "User removed successfully", Toast.LENGTH_SHORT)
                    .show();
        }
    });

    emailSharedInput = (EditText) view.findViewById(R.id.emailSharedinput);
    addUserButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

            //hide keyboard after click
            InputMethodManager inputManager = (InputMethodManager) getContext()
                    .getSystemService(Context.INPUT_METHOD_SERVICE);
            inputManager.hideSoftInputFromWindow(getActivity().getCurrentFocus().getWindowToken(),
                    InputMethodManager.HIDE_NOT_ALWAYS);

            if (emailSharedInput.getText().toString().matches("")) {
                Toast.makeText(MyApplication.getAppActivity(), "You must enter email of the shared user",
                        Toast.LENGTH_SHORT).show();
            } else {
                //addUser user to car by email
                final String userEmail = emailSharedInput.getText().toString();
                //car.setCarUser(userEmail, true);
                //car.setNewCarUser(userEmail);
                Model.getInstance().setCarUser(car, userEmail);
                emailSharedInput.setText("");
                adapter.notifyDataSetChanged();
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                //sharedUsersList.add(userEmail);
                Object[] data = new Object[] { car };
                fragmentCommunicator.passData(data, "CarScreenFragment");
            }
        }
    });

    return view;
}

From source file:com.facebook.widget.GraphObjectAdapter.java

protected void populateGraphObjectView(View view, T graphObject) {
    String id = getIdOfGraphObject(graphObject);
    view.setTag(id);//from w  ww . j a va 2  s. com

    CharSequence title = getTitleOfGraphObject(graphObject);
    TextView titleView = (TextView) view.findViewById(R.id.com_facebook_picker_title);
    if (titleView != null) {
        titleView.setText(title, TextView.BufferType.SPANNABLE);
    }

    CharSequence subtitle = getSubTitleOfGraphObject(graphObject);
    TextView subtitleView = (TextView) view.findViewById(R.id.picker_subtitle);
    if (subtitleView != null) {
        if (subtitle != null) {
            subtitleView.setText(subtitle, TextView.BufferType.SPANNABLE);
            subtitleView.setVisibility(View.VISIBLE);
        } else {
            subtitleView.setVisibility(View.GONE);
        }
    }

    if (getShowCheckbox()) {
        CheckBox checkBox = (CheckBox) view.findViewById(R.id.com_facebook_picker_checkbox);
        updateCheckboxState(checkBox, isGraphObjectSelected(id));
    }

    if (getShowPicture()) {
        URI pictureURI = getPictureUriOfGraphObject(graphObject);

        if (pictureURI != null) {
            ImageView profilePic = (ImageView) view.findViewById(R.id.com_facebook_picker_image);

            // See if we have already pre-fetched this; if not, download it.
            if (prefetchedPictureCache.containsKey(id)) {
                ImageResponse response = prefetchedPictureCache.get(id);
                profilePic.setImageBitmap(response.getBitmap());
                profilePic.setTag(response.getRequest().getImageUri());
            } else {
                downloadProfilePicture(id, pictureURI, profilePic);
            }
        }
    }
}

From source file:com.google.samples.apps.iosched.myschedule.MyScheduleActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_my_schedule);

    // Pre-process the intent received to open this activity to determine if it was a deep
    // link to a SessionDetail. Typically you wouldn't use this type of logic, but we need to
    // because of the path of session details page on the website is only /schedule and session
    // ids are part of the query parameters (sid).
    Intent intent = getIntent();/*from   w  w w  .  j  a  v a 2s . c om*/
    if (intent != null && !TextUtils.isEmpty(intent.getDataString())) {
        // Check format against website format.
        String intentDataString = intent.getDataString();
        try {
            Uri dataUri = Uri.parse(intentDataString);
            String sessionId = dataUri.getQueryParameter("sid");
            if (!TextUtils.isEmpty(sessionId)) {
                Uri data = ScheduleContract.Sessions.buildSessionUri(sessionId);
                Intent sessionDetailIntent = new Intent(MyScheduleActivity.this, SessionDetailActivity.class);
                sessionDetailIntent.setData(data);
                startActivity(sessionDetailIntent);
                finish();
            }
            LOGD(TAG, "SessionId: " + sessionId);
        } catch (Exception exception) {
            LOGE(TAG, "Data uri existing but wasn't parsable for a session detail deep link");
        }
    }

    // ANALYTICS SCREEN: View the My Schedule screen
    // Contains: Nothing (Page name is a constant)
    AnalyticsHelper.sendScreenView(SCREEN_LABEL);

    mViewPager = (ViewPager) findViewById(R.id.view_pager);
    mScrollViewWide = (ScrollView) findViewById(R.id.main_content_wide);
    mWideMode = findViewById(R.id.my_schedule_first_day) != null;

    if (SettingsUtils.isAttendeeAtVenue(this)) {
        mDayZeroAdapter = new MyScheduleAdapter(this, getLUtils());
        prepareDayZeroAdapter();
    }

    for (int i = 0; i < Config.CONFERENCE_DAYS.length; i++) {
        mScheduleAdapters[i] = new MyScheduleAdapter(this, getLUtils());
    }

    mViewPagerAdapter = new OurViewPagerAdapter(getFragmentManager());
    mViewPager.setAdapter(mViewPagerAdapter);

    if (mWideMode) {
        mMyScheduleViewWide[0] = (MyScheduleView) findViewById(R.id.my_schedule_first_day);
        mMyScheduleViewWide[0].setAdapter(mScheduleAdapters[0]);
        mMyScheduleViewWide[1] = (MyScheduleView) findViewById(R.id.my_schedule_second_day);
        mMyScheduleViewWide[1].setAdapter(mScheduleAdapters[1]);

        TextView firstDayHeaderView = (TextView) findViewById(R.id.day_label_first_day);
        TextView secondDayHeaderView = (TextView) findViewById(R.id.day_label_second_day);
        if (firstDayHeaderView != null) {
            firstDayHeaderView.setText(getDayName(0));
        }
        if (secondDayHeaderView != null) {
            secondDayHeaderView.setText(getDayName(1));
        }

        TextView zerothDayHeaderView = (TextView) findViewById(R.id.day_label_zeroth_day);
        MyScheduleView dayZeroView = (MyScheduleView) findViewById(R.id.my_schedule_zeroth_day);
        if (mDayZeroAdapter != null) {
            dayZeroView.setAdapter(mDayZeroAdapter);
            dayZeroView.setVisibility(View.VISIBLE);
            zerothDayHeaderView.setText(getDayName(-1));
            zerothDayHeaderView.setVisibility(View.VISIBLE);
        } else {
            dayZeroView.setVisibility(View.GONE);
            zerothDayHeaderView.setVisibility(View.GONE);
        }
    } else {
        // it's PagerAdapter set.
        mTabLayout = (TabLayout) findViewById(R.id.sliding_tabs);

        mTabLayout.setTabsFromPagerAdapter(mViewPagerAdapter);

        mTabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
            @Override
            public void onTabSelected(TabLayout.Tab tab) {
                mViewPager.setCurrentItem(tab.getPosition(), true);
                TextView view = (TextView) findViewById(baseTabViewId + tab.getPosition());
                view.setContentDescription(
                        getString(R.string.talkback_selected, getString(R.string.a11y_button, tab.getText())));
            }

            @Override
            public void onTabUnselected(TabLayout.Tab tab) {
                TextView view = (TextView) findViewById(baseTabViewId + tab.getPosition());
                view.setContentDescription(getString(R.string.a11y_button, tab.getText()));
            }

            @Override
            public void onTabReselected(TabLayout.Tab tab) {
                // Do nothing
            }
        });
        mViewPager.setPageMargin(getResources().getDimensionPixelSize(R.dimen.my_schedule_page_margin));
        mViewPager.setPageMarginDrawable(R.drawable.page_margin);

        setTabLayoutContentDescriptions();
    }

    mButterBar = findViewById(R.id.butter_bar);
    removeLoginFailed();

    overridePendingTransition(0, 0);
    addDataObservers();
}

From source file:com.android.mail.photo.MailPhotoViewController.java

/**
 * Updates the empty views of the fragment based upon the current
 * state of the attachment.//from  w ww. j  a va  2  s. co m
 * @param fragment the current fragment
 */
private void updateProgressAndEmptyViews(final PhotoViewFragment fragment, final Attachment attachment) {
    final ProgressBarWrapper progressBar = fragment.getPhotoProgressBar();
    final TextView emptyText = fragment.getEmptyText();
    final ImageView retryButton = fragment.getRetryButton();

    // update the progress
    if (attachment.shouldShowProgress()) {
        progressBar.setMax(attachment.size);
        progressBar.setProgress(attachment.downloadedSize);
        progressBar.setIndeterminate(false);
    } else if (fragment.isProgressBarNeeded()) {
        progressBar.setIndeterminate(true);
    }

    // If the download failed, show the empty text and retry button
    if (attachment.isDownloadFailed()) {
        emptyText.setText(R.string.photo_load_failed);
        emptyText.setVisibility(View.VISIBLE);
        retryButton.setVisibility(View.VISIBLE);
        retryButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                redownloadAttachment();
                emptyText.setVisibility(View.GONE);
                retryButton.setVisibility(View.GONE);
            }
        });
        progressBar.setVisibility(View.GONE);
    }
}

From source file:com.dvn.vindecoder.ui.user.GetAllVehicalDetails.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    //  setContentView(R.layout.activity_get_all_vehical_details);
    // Watch for button clicks.
    /* Button button = (Button)findViewById(R.id.new_fragment);
            /*from w  w  w. java 2s .  co m*/
     button.setOnClickListener(new OnClickListener() {
    public void onClick(View v) {
        addFragmentToStack();
    }
     });*/
    setTitle("Vehical details");
    Bundle bundle = getIntent().getExtras();
    if (bundle != null) {
        CommonURL.V_ID = bundle.getString("v_id");
        v_id = bundle.getString("v_id");
        CommonURL.PK_ID = v_id;
        if (bundle.containsKey("user_type")) {
            CommonURL.USER_TYPE = bundle.getInt("user_type");
            ;
        }
    }
    drawChildLayout();
    if (savedInstanceState == null) {
        // Do first time initialization -- add initial fragment.
        /*  newFragment = GetNewVehicalFragment.newInstance(GetAllVehicalDetails.this);
         FragmentTransaction ft = getFragmentManager().beginTransaction();
         ft.add(R.id.fragment1, newFragment).commit();*/

        addVehicalFragment_new_for_user = AddVehicalFragment_New_For_User
                .newInstance(GetAllVehicalDetails.this);
        FragmentTransaction ft = getFragmentManager().beginTransaction();
        ft.add(R.id.fragment1, addVehicalFragment_new_for_user).commit();
    } else {
        mStackLevel = savedInstanceState.getInt("level");
    }

    fab = (FloatingActionButton) findViewById(R.id.fab);
    TextView fab_txt = (TextView) findViewById(R.id.textView12);
    if (CommonURL.USER_TYPE == 1) {

        fab.setVisibility(View.GONE);
        fab_txt.setVisibility(View.GONE);
    }
    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            //handleCameraForPickingPhoto();
            openDialog();
        }
    });

}

From source file:org.npr.android.news.NewsListAdapter.java

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    if (convertView == null) {
        convertView = inflater.inflate(R.layout.news_item, parent, false);
    }//from  ww  w  .  ja  v  a 2 s.c  o m

    Story story = getItem(position);

    ImageView image = (ImageView) convertView.findViewById(R.id.NewsItemImage);
    TextView teaser = (TextView) convertView.findViewById(R.id.NewsItemTeaserText);
    TextView name = (TextView) convertView.findViewById(R.id.NewsItemNameText);

    if (story != null) {
        image.setImageDrawable(getContext().getResources()
                .getDrawable(isPlayable(story) ? R.drawable.icon_listen_main : R.drawable.bullet));
        image.setVisibility(View.VISIBLE);
        name.setTypeface(headlineTypeface, Typeface.NORMAL);
        name.setText(story.toString());
        String teaserText = story.getMiniTeaser();
        if (teaserText == null) {
            teaserText = story.getTeaser();
        }
        if (teaserText != null && teaserText.length() > 0) {
            // Disable for now.
            //        teaser.setText(story.getTeaser());
            //        teaser.setVisibility(View.VISIBLE);
        } else {
            teaser.setVisibility(View.INVISIBLE);
        }
        teaser.setVisibility(View.GONE);
    } else {
        // null marker means it's the end of the list.
        image.setVisibility(View.INVISIBLE);
        teaser.setVisibility(View.INVISIBLE);
        name.setTypeface(Typeface.SANS_SERIF, Typeface.ITALIC);
        name.setText(R.string.msg_load_more);
    }
    return convertView;
}

From source file:com.dmbstream.android.adapter.ConcertListAdapter.java

@Override
public View getView(final int position, View convertView, final ViewGroup parent) {

    if (convertView == null) {
        convertView = inflater.inflate(R.layout.partial_concert_list_item, parent, false);
    }/*from  w w w. j a va2s.  co m*/

    Concert concert = getItem(position);

    TextView date = (TextView) convertView.findViewById(R.id.ConcertItemDate);
    TextView artist = (TextView) convertView.findViewById(R.id.ConcertItemArtist);
    TextView name = (TextView) convertView.findViewById(R.id.ConcertItemName);

    if (concert != null) {

        Date d = new Date(concert.date.getTimeInMillis());
        DateFormat shortDateFormat = new SimpleDateFormat("yyyy-MM-dd");

        date.setText(shortDateFormat.format(d));
        artist.setText(concert.artistAbbreviation);
        name.setText(concert.name);

        // Need to (re)set this because the views are reused. If we don't
        // then
        // while scrolling, some items will replace the old
        // "Load more concerts"
        // view and will be in italics
        name.setTypeface(name.getTypeface(), Typeface.BOLD);
        date.setVisibility(View.VISIBLE);
        artist.setVisibility(View.VISIBLE);
    } else {
        // null marker means it's the end of the list.
        name.setTypeface(name.getTypeface(), Typeface.ITALIC);
        name.setText(R.string.msg_load_more_concerts);
        date.setVisibility(View.GONE);
        artist.setVisibility(View.GONE);
    }

    return convertView;
}

From source file:com.android.calendar.selectcalendars.SelectCalendarsSimpleAdapter.java

@Override
public View getView(final int position, View convertView, ViewGroup parent) {
    if (position >= mRowCount) {
        return null;
    }//from  w w w. j  a v a 2 s  .c  o  m
    String name = mData[position].displayName;
    boolean selected = mData[position].selected;

    int color = Utils.getDisplayColorFromColor(mData[position].color);
    View view;
    if (convertView == null) {
        view = mInflater.inflate(mLayout, parent, false);
        final View delegate = view.findViewById(R.id.color);
        final View delegateParent = (View) delegate.getParent();
        delegateParent.post(new Runnable() {

            @Override
            public void run() {
                final Rect r = new Rect();
                delegate.getHitRect(r);
                r.top -= mColorViewTouchAreaIncrease;
                r.bottom += mColorViewTouchAreaIncrease;
                r.left -= mColorViewTouchAreaIncrease;
                r.right += mColorViewTouchAreaIncrease;
                delegateParent.setTouchDelegate(new TouchDelegate(r, delegate));
            }
        });
    } else {
        view = convertView;
    }

    TextView calendarName = (TextView) view.findViewById(R.id.calendar);
    calendarName.setText(name);

    View colorView = view.findViewById(R.id.color);
    colorView.setBackgroundColor(color);
    colorView.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            // Purely for sanity check--view should be disabled if account has no more colors
            if (!hasMoreColors(position)) {
                return;
            }

            if (mColorPickerDialog == null) {
                mColorPickerDialog = CalendarColorPickerDialog.newInstance(mData[position].id, mIsTablet);
            } else {
                mColorPickerDialog.setCalendarId(mData[position].id);
            }
            mFragmentManager.executePendingTransactions();
            if (!mColorPickerDialog.isAdded()) {
                mColorPickerDialog.show(mFragmentManager, COLOR_PICKER_DIALOG_TAG);
            }
        }
    });

    int textColor;
    if (selected) {
        textColor = mColorCalendarVisible;
    } else {
        textColor = mColorCalendarHidden;
    }
    calendarName.setTextColor(textColor);

    CheckBox syncCheckBox = (CheckBox) view.findViewById(R.id.sync);
    if (syncCheckBox != null) {

        // Full screen layout
        syncCheckBox.setChecked(selected);

        colorView.setEnabled(hasMoreColors(position));
        LayoutParams layoutParam = calendarName.getLayoutParams();
        TextView secondaryText = (TextView) view.findViewById(R.id.status);
        if (!TextUtils.isEmpty(mData[position].ownerAccount) && !mData[position].ownerAccount.equals(name)
                && !mData[position].ownerAccount.endsWith("calendar.google.com")) {
            int secondaryColor;
            if (selected) {
                secondaryColor = mColorCalendarSecondaryVisible;
            } else {
                secondaryColor = mColorCalendarSecondaryHidden;
            }
            secondaryText.setText(mData[position].ownerAccount);
            secondaryText.setTextColor(secondaryColor);
            secondaryText.setVisibility(View.VISIBLE);
            layoutParam.height = LayoutParams.WRAP_CONTENT;
        } else {
            secondaryText.setVisibility(View.GONE);
            layoutParam.height = LayoutParams.MATCH_PARENT;
        }

        calendarName.setLayoutParams(layoutParam);

    } else {
        // Tablet layout
        view.findViewById(R.id.color).setEnabled(selected && hasMoreColors(position));
        view.setBackgroundDrawable(getBackground(position, selected));
        ViewGroup.LayoutParams newParams = view.getLayoutParams();
        if (position == mData.length - 1) {
            newParams.height = BOTTOM_ITEM_HEIGHT;
        } else {
            newParams.height = NORMAL_ITEM_HEIGHT;
        }
        view.setLayoutParams(newParams);
        CheckBox visibleCheckBox = (CheckBox) view.findViewById(R.id.visible_check_box);
        if (visibleCheckBox != null) {
            visibleCheckBox.setChecked(selected);
        }
    }
    view.invalidate();
    return view;
}

From source file:com.freeme.filemanager.FileExplorerTabActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    //*/ add by xueweili for after Switch the language, file manager  stop running on 20160518
    if (savedInstanceState != null) {
        savedInstanceState.remove("android:fragments");
    }// ww w.j a  va  2  s. co m
    //*/
    Log.i("liuhaoran", "oncreate");
    super.onCreate(savedInstanceState);

    mContext = this;

    MobclickAgent.setDebugMode(true);
    MobclickAgent.openActivityDurationTrack(false);
    MobclickAgent.startWithConfigure(new UMAnalyticsConfig(mContext, "57dfa18e67e58e7d2b003625", "hwdroi",
            EScenarioType.E_UM_ANALYTICS_OEM, false));

    getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN);
    StorageHelper.getInstance(this).setCurrentMountPoint(Environment.getExternalStorageDirectory().getPath());
    setContentView(R.layout.fragment_pager);
    mViewPager = (ViewPager) findViewById(R.id.pager);
    mViewPager.setOffscreenPageLimit(DEFAULT_OFFSCREEN_PAGES);

    //*/ test
    if (FileManagerApplication.mIsTest.equals("true")) {
        final TextView test = (TextView) findViewById(R.id.tv_test);
        test.setVisibility(View.VISIBLE);
        test.getBackground().setAlpha(100);
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                test.setVisibility(View.GONE);
            }
        }, 3000);
    }
    //*/

    mTabsAdapter = new TabsAdapter(this, mViewPager);
    mTabsAdapter.addTab(null, FileCategoryContainerFragment.class, null);
    mTabsAdapter.addTab(null, FileViewFragment.class, null);
    mTabsAdapter.addTab(null, ServerControlFragment.class, null);
    mViewPager.setAdapter(mTabsAdapter);
    //*/ modified by tyd wulianghuan 2013-07-15 for: make the second tab be selected when usbStorge mounted
    //*/add by droi mingjun for updateself on 20151221
    mSharedPref = PreferenceManager.getDefaultSharedPreferences(this);
    editor = mSharedPref.edit();

    //*/end
    mTabHost = (RadioGroup) findViewById(R.id.home_group);
    mTabBtnOne = (RadioButton) findViewById(R.id.home_radio_one);
    mTabBtnTwo = (RadioButton) findViewById(R.id.home_radio_two);
    mTabBtnThree = (RadioButton) findViewById(R.id.home_radio_three);

    if (FileManagerApplication.mIsHideFTP.equals("false")) {
        mTabBtnThree.setVisibility(View.GONE);
    }

    mTabHost.setOnCheckedChangeListener(new OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(RadioGroup arg0, int arg1) {
            // TODO Auto-generated method stub
            switch (arg0.getCheckedRadioButtonId()) {
            case R.id.home_radio_one:
                Log.i("home_radio_one", "home_radio_one");
                // hometype = 1;
                if ((FileViewFragment) mTabsAdapter.getItem(1) != null
                        && ((FileViewFragment) mTabsAdapter.getItem(1)).mFileViewInteractionHub != null) {
                    ((FileViewFragment) mTabsAdapter.getItem(1)).mFileViewInteractionHub.exitActionMode();
                    //((FileCategoryContainerFragment)mTabsAdapter.getItem(0)).setStorageDeviceInfo();
                }
                mViewPager.setCurrentItem(0, false);
                break;

            case R.id.home_radio_two:
                // hometype = 2;
                if ((FileCategoryContainerFragment) mTabsAdapter.getItem(0) != null
                        && ((FileCategoryContainerFragment) mTabsAdapter
                                .getItem(0)).mFileViewInteractionHub != null) {

                    ((FileCategoryContainerFragment) mTabsAdapter.getItem(0)).mFileViewInteractionHub
                            .exitActionMode();
                }
                mViewPager.setCurrentItem(1, false);
                break;

            case R.id.home_radio_three:
                // hometype = 3;
                if ((FileViewFragment) mTabsAdapter.getItem(1) != null
                        && ((FileViewFragment) mTabsAdapter.getItem(1)).mFileViewInteractionHub != null) {
                    ((FileViewFragment) mTabsAdapter.getItem(1)).mFileViewInteractionHub.exitActionMode();
                }
                mViewPager.setCurrentItem(2, false);
                break;
            default:
                break;
            }
        }
    });
    int tabindex = getIntent().getIntExtra("TAB", Util.CATEGORY_TAB_INDEX);
    if (tabindex != 2) {
        int index = getIntent().getIntExtra("tab_index", Util.CATEGORY_TAB_INDEX);
    }
    //*/ modify end

    initButtonReceiver();

    UpdateMonitor.Builder
            //*/ init UpdateMonitor
            .getInstance(this)
            //*/ register you Application to obsever
            .registerApplication(getApplication())
            //*/ register you Application is Service or hasEnrtyActivity
            .setApplicationIsServices(true)
            //*/ default notify small icon, ifnot set use updateself_ic_notify_small
            .setDefaultNotifyIcon(R.drawable.updateself_ic_notify_small).complete();

    checkSecurityPermissions();
    //        requestPermissionsMonery();
}

From source file:net.oschina.app.v2.activity.zxing.CaptureActivity.java

private void handleDecodeInternally(Result rawResult, ResultHandler resultHandler, Bitmap barcode) {
    //- ------------------------------------------------------- //
    String text = rawResult.getText();
    if (text != null && StringUtils.isUrl(text)) {
        if (text.contains("scan_login")) {
            statusView.setVisibility(View.GONE);
            viewfinderView.setVisibility(View.GONE);
            showConfirmLogin(text);//from   w w w . j  a  v  a2  s . c om
            return;
        }
        if (text.contains("oschina.net")) {
            UIHelper.showUrlRedirect(CaptureActivity.this, text);
            finish();
            return;
        }
    }
    try {
        BarCode2 bc = BarCode2.parse(text);
        int type = bc.getType();
        switch (type) {
        case BarCode2.SIGN_IN:// 
            handleSignIn(bc);
            return;
        default:
            break;
        }
    } catch (JSONException e) {
        e.printStackTrace();
    }
    //- ------------------------------------------------------- //
    CharSequence displayContents = resultHandler.getDisplayContents();

    if (copyToClipboard && !resultHandler.areContentsSecure()) {
        ClipboardInterface.setText(displayContents, this);
    }

    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);

    if (resultHandler.getDefaultButtonID() != null
            && prefs.getBoolean(PreferencesActivity.KEY_AUTO_OPEN_WEB, false)) {
        resultHandler.handleButtonPress(resultHandler.getDefaultButtonID());
        return;
    }

    statusView.setVisibility(View.GONE);
    viewfinderView.setVisibility(View.GONE);
    resultView.setVisibility(View.VISIBLE);

    ImageView barcodeImageView = (ImageView) findViewById(R.id.barcode_image_view);
    if (barcode == null) {
        barcodeImageView.setImageBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.app_icon));
    } else {
        barcodeImageView.setImageBitmap(barcode);
    }

    TextView formatTextView = (TextView) findViewById(R.id.format_text_view);
    formatTextView.setText(rawResult.getBarcodeFormat().toString());

    TextView typeTextView = (TextView) findViewById(R.id.type_text_view);
    typeTextView.setText(resultHandler.getType().toString());

    DateFormat formatter = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);
    TextView timeTextView = (TextView) findViewById(R.id.time_text_view);
    timeTextView.setText(formatter.format(new Date(rawResult.getTimestamp())));

    TextView metaTextView = (TextView) findViewById(R.id.meta_text_view);
    View metaTextViewLabel = findViewById(R.id.meta_text_view_label);
    metaTextView.setVisibility(View.GONE);
    metaTextViewLabel.setVisibility(View.GONE);
    Map<ResultMetadataType, Object> metadata = rawResult.getResultMetadata();
    if (metadata != null) {
        StringBuilder metadataText = new StringBuilder(20);
        for (Map.Entry<ResultMetadataType, Object> entry : metadata.entrySet()) {
            if (DISPLAYABLE_METADATA_TYPES.contains(entry.getKey())) {
                metadataText.append(entry.getValue()).append('\n');
            }
        }
        if (metadataText.length() > 0) {
            metadataText.setLength(metadataText.length() - 1);
            metaTextView.setText(metadataText);
            metaTextView.setVisibility(View.VISIBLE);
            metaTextViewLabel.setVisibility(View.VISIBLE);
        }
    }

    TextView contentsTextView = (TextView) findViewById(R.id.contents_text_view);
    contentsTextView.setText(displayContents);
    int scaledSize = Math.max(22, 32 - displayContents.length() / 4);
    contentsTextView.setTextSize(TypedValue.COMPLEX_UNIT_SP, scaledSize);

    TextView supplementTextView = (TextView) findViewById(R.id.contents_supplement_text_view);
    supplementTextView.setText("");
    supplementTextView.setOnClickListener(null);
    if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean(PreferencesActivity.KEY_SUPPLEMENTAL,
            true)) {
        //SupplementalInfoRetriever.maybeInvokeRetrieval(supplementTextView,
        //        resultHandler.getResult(),
        //        historyManager,
        //        this);
    }

    int buttonCount = resultHandler.getButtonCount();
    ViewGroup buttonView = (ViewGroup) findViewById(R.id.result_button_view);
    buttonView.requestFocus();
    for (int x = 0; x < ResultHandler.MAX_BUTTON_COUNT; x++) {
        TextView button = (TextView) buttonView.getChildAt(x);
        if (x < buttonCount) {
            button.setVisibility(View.VISIBLE);
            button.setText(resultHandler.getButtonText(x));
            button.setOnClickListener(new ResultButtonListener(resultHandler, x));
        } else {
            button.setVisibility(View.GONE);
        }
    }
}