Example usage for android.widget LinearLayout setVisibility

List of usage examples for android.widget LinearLayout setVisibility

Introduction

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

Prototype

@RemotableViewMethod
public void setVisibility(@Visibility int visibility) 

Source Link

Document

Set the visibility state of this view.

Usage

From source file:com.androguide.honamicontrol.kernel.cpucontrol.CPUActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    //noinspection ConstantConditions
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setIcon(getResources().getDrawable(R.drawable.ic_tools_cpu_control));
    setContentView(R.layout.card_cpu_control);
    bootPrefs = getSharedPreferences("BOOT_PREFS", 0);

    graph = (LineGraph) findViewById(R.id.graph);
    line = new Line();
    LinePoint point = new LinePoint();
    point.setX(currX);/*from w  w  w . jav a 2  s  . c o  m*/
    point.setY(1);
    line.addPoint(point);
    line.setColor(Color.parseColor("#FFBB33"));
    graph.addLine(line);
    graph.setLineToFill(0);

    availableFrequencies = new String[0];
    String availableFrequenciesLine;

    mCoresOnline = (TextView) findViewById(R.id.cores_online);
    mGeneralGovernor = (Spinner) findViewById(R.id.general_governor);
    mGovernor = (Spinner) findViewById(R.id.governor);
    mGovernor2 = (Spinner) findViewById(R.id.governor2);
    mGovernor3 = (Spinner) findViewById(R.id.governor3);
    mGovernor4 = (Spinner) findViewById(R.id.governor4);

    Button customizeGov = (Button) findViewById(R.id.governor_customize_btn);
    customizeGov.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            FragmentManager fm = getSupportFragmentManager();
            GovernorDialog editNameDialog = new GovernorDialog();
            editNameDialog.show(fm, "governor_fragment");
        }
    });

    if (Helpers.doesFileExist(STEPS)) {
        availableFrequenciesLine = CPUHelper.readOneLineNotRoot(STEPS);

        if (availableFrequenciesLine != null) {
            availableFrequencies = availableFrequenciesLine.split(" ");
            Arrays.sort(availableFrequencies, new Comparator<String>() {
                @Override
                public int compare(String object1, String object2) {
                    return Integer.valueOf(object1).compareTo(Integer.valueOf(object2));
                }
            });
        }
    }

    Switch snakeCharmer = (Switch) findViewById(R.id.snake_charmer_switch);
    if (!Helpers.doesFileExist(SNAKE_CHARMER_MAX_FREQ)) {
        LinearLayout cardSnakeCharmer = (LinearLayout) findViewById(R.id.card_snake_charmer);
        cardSnakeCharmer.setVisibility(View.GONE);
    } else {
        if (Helpers.doesFileExist(SNAKE_CHARMER_VERSION)) {
            TextView snakeTitle = (TextView) findViewById(R.id.snake_charmer);
            String snakeVersion = CPUHelper.readOneLineNotRoot(SNAKE_CHARMER_VERSION);
            snakeVersion = snakeVersion.replaceAll("version: ", "v");
            snakeTitle.setText(snakeTitle.getText() + " " + snakeVersion);
            if (snakeVersion.equals("v1.2")) {
                TextView snakeDesc = (TextView) findViewById(R.id.snake_charmer_text);
                snakeDesc.setText(snakeDesc.getText() + "\n" + getString(R.string.snake_charmer_built_in));
                snakeCharmer.setEnabled(false);
            }
        }

        if (bootPrefs.getBoolean("SNAKE_CHARMER", true)) {
            snakeCharmer.setChecked(true);
            snakeCharmerEnabled = true;
        }

        snakeCharmer.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton compoundButton, boolean isOn) {
                snakeCharmerEnabled = isOn;
            }
        });
    }

    int frequenciesNum = availableFrequencies.length - 1;

    Switch thermalControl = (Switch) findViewById(R.id.msm_thermal_switch);
    if (Helpers.doesFileExist(MSM_THERMAL)) {
        String thermal = CPUHelper.readOneLineNotRoot(MSM_THERMAL);
        if (thermal.equals("Y"))
            thermalControl.setChecked(true);
        else
            thermalControl.setChecked(false);

        thermalControl.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) {
                if (isChecked)
                    Helpers.CMDProcessorWrapper.runSuCommand("echo Y > " + MSM_THERMAL);
                else
                    Helpers.CMDProcessorWrapper.runSuCommand("echo N > " + MSM_THERMAL);

                bootPrefs.edit().putBoolean("MSM_THERMAL", isChecked).commit();
            }
        });
    }
    thermalControl.setChecked(bootPrefs.getBoolean("MSM_THERMAL", true));

    perCoreGovernor = (Switch) findViewById(R.id.per_core_governors_switch);
    perCoreGovernor.setChecked(bootPrefs.getBoolean("PER_CORE_GOV", true));

    if (perCoreGovernor.isChecked()) {
        findViewById(R.id.card_general_governor).setVisibility(View.GONE);
        findViewById(R.id.card_per_core_governors).setVisibility(View.VISIBLE);
    } else {
        findViewById(R.id.card_per_core_governors).setVisibility(View.GONE);
        findViewById(R.id.card_general_governor).setVisibility(View.VISIBLE);
    }

    perCoreGovernor.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) {
            if (isChecked) {
                findViewById(R.id.card_general_governor).setVisibility(View.GONE);
                findViewById(R.id.card_per_core_governors).setVisibility(View.VISIBLE);
                handleGovernors();
            } else {
                findViewById(R.id.card_per_core_governors).setVisibility(View.GONE);
                findViewById(R.id.card_general_governor).setVisibility(View.VISIBLE);
                handleGovernors();
            }

            bootPrefs.edit().putBoolean("PER_CORE_GOV", isChecked).commit();
        }
    });

    String currentIo = "";
    if (Helpers.doesFileExist(IO_SCHEDULER))
        currentIo = CPUHelper.getIOScheduler();

    String currentTcp = "";
    if (Helpers.doesFileExist(CURR_TCP_ALGORITHM))
        currentTcp = Helpers.getCurrentTcpAlgorithm();

    String curMaxSpeed = "NaN";
    if (Helpers.doesFileExist(MAX_FREQ_ALL_CORES))
        curMaxSpeed = CPUHelper.readOneLineNotRoot(MAX_FREQ_ALL_CORES);
    else if (Helpers.doesFileExist(MAX_FREQ))
        curMaxSpeed = CPUHelper.readOneLineNotRoot(MAX_FREQ);

    String curMinSpeed = "NaN";
    if (Helpers.doesFileExist(MIN_FREQ_ALL_CORES))
        curMinSpeed = CPUHelper.readOneLineNotRoot(MIN_FREQ_ALL_CORES);
    else if (Helpers.doesFileExist(MIN_FREQ))
        curMinSpeed = CPUHelper.readOneLineNotRoot(MIN_FREQ);

    if (mIsTegra3) {
        String curTegraMaxSpeed = "NaN";
        if (Helpers.doesFileExist(TEGRA_MAX_FREQ)) {
            curTegraMaxSpeed = CPUHelper.readOneLineNotRoot(TEGRA_MAX_FREQ);
            int curTegraMax = 0;
            try {
                curTegraMax = Integer.parseInt(curTegraMaxSpeed);
                if (curTegraMax > 0) {
                    curMaxSpeed = Integer.toString(curTegraMax);
                }
            } catch (NumberFormatException ex) {
                curTegraMax = 0;
            }
        }
    }

    if (Helpers.doesFileExist(NUM_OF_CPUS))
        mNumOfCpus = Helpers.getNumOfCpus();

    mCurFreq = (TextView) findViewById(R.id.currspeed);

    mMaxSlider = (SeekBar) findViewById(R.id.max_slider);
    mMaxSlider.setMax(frequenciesNum);
    mMaxSpeedText = (TextView) findViewById(R.id.max_speed_text);
    mMaxSpeedText.setText(toMHz(curMaxSpeed));
    mMaxSlider.setProgress(Arrays.asList(availableFrequencies).indexOf(curMaxSpeed));
    mMaxSlider.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            if (fromUser)
                setMaxSpeed(seekBar, progress);
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {

        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
            startSupportActionMode(new ActionMode.Callback() {
                @Override
                public boolean onCreateActionMode(ActionMode actionMode, Menu menu) {
                    MenuInflater inflater = actionMode.getMenuInflater();
                    inflater.inflate(R.menu.contextual_menu, menu);
                    return true;
                }

                @Override
                public boolean onPrepareActionMode(ActionMode actionMode, Menu menu) {
                    return false;
                }

                @Override
                public boolean onActionItemClicked(ActionMode actionMode, MenuItem menuItem) {
                    switch (menuItem.getItemId()) {
                    case R.id.apply:
                        if (mMaxFreqSetting != null && !mMaxFreqSetting.isEmpty()) {
                            bootPrefs.edit().putString("CPU_MAX_FREQ", mMaxFreqSetting).commit();
                            for (int i = 0; i < mNumOfCpus; i++)
                                Helpers.CMDProcessorWrapper.runSuCommand("busybox echo " + mMaxFreqSetting
                                        + " > " + MAX_FREQ.replace("cpu0", "cpu" + i));

                            if (snakeCharmerEnabled)
                                Helpers.CMDProcessorWrapper.runSuCommand(
                                        "busybox echo " + mMaxFreqSetting + " > " + SNAKE_CHARMER_MAX_FREQ);
                        }

                        if (mIsTegra3) {
                            if (mMaxFreqSetting != null && !mMaxFreqSetting.isEmpty())
                                Helpers.CMDProcessorWrapper.runSuCommand(
                                        "busybox echo " + mMaxFreqSetting + " > " + TEGRA_MAX_FREQ);

                            if (snakeCharmerEnabled)
                                Helpers.CMDProcessorWrapper.runSuCommand(
                                        "busybox echo " + mMaxFreqSetting + " > " + SNAKE_CHARMER_MAX_FREQ);
                        }
                        actionMode.finish();
                        return true;
                    default:
                        return false;
                    }
                }

                @Override
                public void onDestroyActionMode(ActionMode actionMode) {

                }
            });
        }
    });

    mMinSlider = (SeekBar) findViewById(R.id.min_slider);
    mMinSlider.setMax(frequenciesNum);
    mMinSpeedText = (TextView) findViewById(R.id.min_speed_text);
    mMinSpeedText.setText(toMHz(curMinSpeed));
    mMinSlider.setProgress(Arrays.asList(availableFrequencies).indexOf(curMinSpeed));
    mMinSlider.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            if (fromUser)
                setMinSpeed(seekBar, progress);
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {

        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
            startSupportActionMode(new ActionMode.Callback() {
                @Override
                public boolean onCreateActionMode(ActionMode actionMode, Menu menu) {
                    MenuInflater inflater = actionMode.getMenuInflater();
                    inflater.inflate(R.menu.contextual_menu, menu);
                    return true;
                }

                @Override
                public boolean onPrepareActionMode(ActionMode actionMode, Menu menu) {
                    return false;
                }

                @Override
                public boolean onActionItemClicked(ActionMode actionMode, MenuItem menuItem) {
                    switch (menuItem.getItemId()) {
                    case R.id.apply:
                        if (mMinFreqSetting != null && !mMinFreqSetting.isEmpty()) {
                            bootPrefs.edit().putString("CPU_MIN_FREQ", mMinFreqSetting).commit();
                            for (int i = 0; i < mNumOfCpus; i++)
                                Helpers.CMDProcessorWrapper.runSuCommand("busybox echo " + mMinFreqSetting
                                        + " > " + MIN_FREQ.replace("cpu0", "cpu" + i));
                        }
                        actionMode.finish();
                        return true;
                    default:
                        return false;
                    }
                }

                @Override
                public void onDestroyActionMode(ActionMode actionMode) {

                }
            });
        }
    });

    handleGovernors();

    /** TCP Congestion Spinner */
    Spinner mTcp = (Spinner) findViewById(R.id.tcp);
    ArrayAdapter<CharSequence> tcpAdapter = new ArrayAdapter<CharSequence>(this, R.layout.spinner_row);
    tcpAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    ArrayList<String> algorithms = Helpers.getTcpAlgorithms();
    for (String algorithm : algorithms)
        tcpAdapter.add(algorithm);
    mTcp.setAdapter(tcpAdapter);
    mTcp.setSelection(algorithms.indexOf(currentTcp));
    mTcp.setOnItemSelectedListener(new TCPListener());

    onlineCoresPolling();
}

From source file:com.zhengde163.netguard.ActivityMain.java

@Override
public void onSharedPreferenceChanged(SharedPreferences prefs, String name) {
    Log.i(TAG, "Preference " + name + "=" + prefs.getAll().get(name));
    if ("enabled".equals(name)) {
        // Get enabled
        boolean enabled = prefs.getBoolean(name, false);

        // Display disabled warning
        //            TextView tvDisabled = (TextView) findViewById(R.id.tvDisabled);
        //            tvDisabled.setVisibility(enabled ? View.GONE : View.VISIBLE);
        LinearLayout ly = (LinearLayout) findViewById(R.id.lldisable);
        ly.setVisibility(enabled ? View.GONE : View.VISIBLE);
        // Check switch state
        ImageView ivEnabled = (ImageView) findViewById(R.id.ivEnabled);
        if (ivEnabled != null) {
            if (enabled) {
                ivEnabled.setImageResource(R.drawable.on);
            } else {
                ivEnabled.setImageResource(R.drawable.off);
            }/*from www. ja v  a 2  s  .c om*/
        }

    } else if ("whitelist_wifi".equals(name) || "screen_wifi".equals(name) || "whitelist_other".equals(name)
            || "screen_other".equals(name) || "whitelist_roaming".equals(name) || "show_user".equals(name)
            || "show_system".equals(name) || "show_nointernet".equals(name) || "show_disabled".equals(name)
            || "sort".equals(name) || "imported".equals(name))
        updateApplicationList(null);
    else if ("theme".equals(name) || "dark_theme".equals(name))
        recreate();
}

From source file:cz.muni.fi.japanesedictionary.fragments.DisplayTranslation.java

/**
 * Displays map of characters to user. Called from CharacterLoader after loading has been done.
 *///from  www  .  j  av  a2 s  . c om
public void displayCharacters() {
    if (mCharacters == null || mCharacters.size() < 1 || getView() == null) {
        Log.w(LOG_TAG, "displayCharacters called - null");
        return;
    }
    LinearLayout outerContainer = ((LinearLayout) getView().findViewById(R.id.translation_kanji_container));
    if (outerContainer == null) {
        Log.w(LOG_TAG, "displayCharacters called - outerContainer null");
        return;
    }
    Log.i(LOG_TAG, "displayCharacters called - display");
    outerContainer.setVisibility(View.VISIBLE);
    String writeCharacters = mTranslation.getJapaneseKeb().get(0);
    LinearLayout container = (LinearLayout) getView().findViewById(R.id.translation_kanji_meanings_container);
    container.removeAllViews();
    for (int i = 0; i < writeCharacters.length(); i++) {
        String character = String.valueOf(writeCharacters.charAt(i));
        JapaneseCharacter japCharacter = mCharacters.get(character);
        if (japCharacter != null) {
            View translationKanji = mInflater.inflate(R.layout.kanji_line, container, false);
            TextView kanjiView = (TextView) translationKanji.findViewById(R.id.translation_kanji);
            kanjiView.setText(character);
            TextView meaningView = (TextView) translationKanji.findViewById(R.id.translation_kanji_meaning);
            if (mEnglish && japCharacter.getMeaningEnglish() != null) {
                int meaningSize = japCharacter.getMeaningEnglish().size();
                if (meaningSize > 0) {
                    int j = 0;
                    StringBuilder strBuilder = new StringBuilder();
                    for (String str : japCharacter.getMeaningEnglish()) {
                        strBuilder.append(str);
                        j++;
                        if (j < meaningSize) {
                            strBuilder.append(", ");
                        }
                    }
                    meaningView.setText(strBuilder);

                }
            } else if (mFrench && japCharacter.getMeaningFrench() != null) {
                int meaningSize = japCharacter.getMeaningFrench().size();
                if (meaningSize > 0) {
                    int j = 0;
                    StringBuilder strBuilder = new StringBuilder();
                    for (String str : japCharacter.getMeaningFrench()) {
                        strBuilder.append(str);
                        j++;
                        if (j < meaningSize) {
                            strBuilder.append(", ");
                        }
                    }
                    meaningView.setText(strBuilder);
                }
            } else if (mDutch && japCharacter.getMeaningDutch() != null) {
                int meaningSize = japCharacter.getMeaningDutch().size();
                if (meaningSize > 0) {
                    int j = 0;
                    StringBuilder strBuilder = new StringBuilder();
                    for (String str : japCharacter.getMeaningDutch()) {
                        strBuilder.append(str);
                        j++;
                        if (j < meaningSize) {
                            strBuilder.append(", ");
                        }
                    }
                    meaningView.setText(strBuilder);
                }
            } else if (mGerman && japCharacter.getMeaningGerman() != null) {
                int meaningSize = japCharacter.getMeaningGerman().size();
                if (meaningSize > 0) {
                    int j = 0;
                    StringBuilder strBuilder = new StringBuilder();
                    for (String str : japCharacter.getMeaningGerman()) {
                        strBuilder.append(str);
                        j++;
                        if (j < meaningSize) {
                            strBuilder.append(", ");
                        }
                    }
                    meaningView.setText(strBuilder);
                }
            } else if (mRussian && japCharacter.getMeaningRussian() != null) {
                int meaningSize = japCharacter.getMeaningRussian().size();
                if (meaningSize > 0) {
                    int j = 0;
                    StringBuilder strBuilder = new StringBuilder();
                    for (String str : japCharacter.getMeaningRussian()) {
                        strBuilder.append(str);
                        j++;
                        if (j < meaningSize) {
                            strBuilder.append(", ");
                        }
                    }
                    meaningView.setText(strBuilder);
                }
            } else {
                meaningView.setText(getString(R.string.translation_kanji_no_meaning));
            }

            translationKanji.findViewById(R.id.kanji_line_id).setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(View v) {
                    TextView textView = (TextView) v.findViewById(R.id.translation_kanji);
                    mCallbackTranslation.showKanjiDetail(mCharacters.get(textView.getText().toString()));
                }
            });

            container.addView(translationKanji);
        }
    }

}

From source file:org.medcada.android.activity.MainActivity.java

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

    GlucosioApplication application = (GlucosioApplication) getApplication();
    //startActivity(new Intent(this,PinCodeActivity.class));
    initPresenters(application);/*from   w  w  w .  j  a  v  a  2  s  .c  o m*/
    setContentView(R.layout.activity_main);
    showDebugDBAddressLogToast();
    Toolbar toolbar = (Toolbar) findViewById(R.id.activity_main_toolbar);
    tabLayout = (TabLayout) findViewById(R.id.activity_main_tab_layout);
    viewPager = (ViewPager) findViewById(R.id.activity_main_pager);

    if (toolbar != null) {
        setSupportActionBar(toolbar);
        getSupportActionBar().setDisplayHomeAsUpEnabled(false);
        getSupportActionBar().setElevation(0);
        getSupportActionBar().setTitle("assistBUD");
        getSupportActionBar().setLogo(R.drawable.ic_logo);
    }

    homePagerAdapter = new HomePagerAdapter(getSupportFragmentManager(), getApplicationContext());

    viewPager.setAdapter(homePagerAdapter);
    tabLayout.setupWithViewPager(viewPager);
    tabLayout.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(viewPager) {
        @Override
        public void onTabSelected(TabLayout.Tab tab) {
            super.onTabSelected(tab);
        }
    });

    viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
        @Override
        public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
        }

        @Override
        public void onPageSelected(int position) {
            if (position == 2) {
                hideFabAnimation();
                LinearLayout emptyLayout = (LinearLayout) findViewById(R.id.activity_main_empty_layout);
                ViewPager pager = (ViewPager) findViewById(R.id.activity_main_pager);
                if (pager.getVisibility() == View.GONE) {
                    pager.setVisibility(View.VISIBLE);
                    emptyLayout.setVisibility(View.INVISIBLE);
                }
            } else {
                showFabAnimation();
                checkIfEmptyLayout();
            }
        }

        @Override
        public void onPageScrollStateChanged(int state) {

        }
    });

    FloatingActionButton fabAddReading = (FloatingActionButton) findViewById(
            R.id.activity_main_fab_add_reading);
    fabAddReading.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            bottomSheetAddDialog.show();
            bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
        }
    });

    bottomSheetAddDialog = new BottomSheetDialog(this);

    // Add Nav Drawer
    final PrimaryDrawerItem itemSettings = new PrimaryDrawerItem().withName(R.string.action_settings)
            .withIcon(VectorDrawableCompat.create(getResources(), R.drawable.ic_settings_grey_24dp, null))
            .withSelectable(false).withTypeface(Typeface.DEFAULT_BOLD);
    final PrimaryDrawerItem itemExport = new PrimaryDrawerItem().withName(R.string.sidebar_backup_export)
            .withIcon(VectorDrawableCompat.create(getResources(), R.drawable.ic_backup_grey_24dp, null))
            .withSelectable(false).withTypeface(Typeface.DEFAULT_BOLD);
    final PrimaryDrawerItem itemFeedback = new PrimaryDrawerItem().withName(R.string.menu_support)
            .withIcon(VectorDrawableCompat.create(getResources(), R.drawable.ic_announcement_grey_24dp, null))
            .withSelectable(false).withTypeface(Typeface.DEFAULT_BOLD);
    final PrimaryDrawerItem itemAbout = new PrimaryDrawerItem().withName(R.string.preferences_about_glucosio)
            .withIcon(VectorDrawableCompat.create(getResources(), R.drawable.ic_info_grey_24dp, null))
            .withSelectable(false).withTypeface(Typeface.DEFAULT_BOLD);
    final PrimaryDrawerItem itemInvite = new PrimaryDrawerItem().withName(R.string.action_invite)
            .withIcon(VectorDrawableCompat.create(getResources(), R.drawable.ic_face_grey_24dp, null))
            .withSelectable(false).withTypeface(Typeface.DEFAULT_BOLD);
    //final PrimaryDrawerItem itemDonate = new PrimaryDrawerItem().withName(R.string.about_donate).withIcon(VectorDrawableCompat.create(getResources(), R.drawable.ic_favorite_grey_24dp, null)).withSelectable(false).withTypeface(Typeface.DEFAULT_BOLD);
    final PrimaryDrawerItem itemA1C = new PrimaryDrawerItem().withName("Profile")
            .withIcon(VectorDrawableCompat.create(getResources(), R.drawable.ic_person_black_24dp, null))
            .withSelectable(false).withTypeface(Typeface.DEFAULT_BOLD);
    final PrimaryDrawerItem itememergency = new PrimaryDrawerItem().withName("Emergency")
            .withIcon(VectorDrawableCompat.create(getResources(), R.drawable.ic_add_alert_black_24dp, null))
            .withSelectable(false).withTypeface(Typeface.DEFAULT_BOLD);
    final PrimaryDrawerItem itemmedications = new PrimaryDrawerItem().withName("Medications")
            .withIcon(VectorDrawableCompat.create(getResources(), R.drawable.ic_calculator_a1c_grey_24dp, null))
            .withSelectable(false).withTypeface(Typeface.DEFAULT_BOLD);
    final PrimaryDrawerItem itemReminders = new PrimaryDrawerItem().withName(R.string.activity_reminders_title)
            .withIcon(VectorDrawableCompat.create(getResources(), R.drawable.ic_alarm_grey_24dp, null))
            .withSelectable(false).withTypeface(Typeface.DEFAULT_BOLD);

    DrawerBuilder drawerBuilder = new DrawerBuilder().withActivity(this).withTranslucentStatusBar(false)
            .withToolbar(toolbar).withActionBarDrawerToggle(true)
            .withAccountHeader(new AccountHeaderBuilder().withActivity(this)

                    .withHeaderBackground(R.drawable.drawer_header).build())
            .withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {
                @Override
                public boolean onItemClick(View view, int position, IDrawerItem drawerItem) {
                    if (drawerItem.equals(itemSettings)) {
                        // Settings
                        openPreferences();
                    } else if (drawerItem.equals(itemAbout)) {
                        // About
                        startAboutActivity();
                    } else if (drawerItem.equals(itemFeedback)) {
                        // Feedback
                        openSupportDialog();
                    } else if (drawerItem.equals(itemInvite)) {
                        // Invite
                        showInviteDialog();
                    } else if (drawerItem.equals(itemExport)) {
                        // Export
                        startExportActivity();
                    }
                    //                        else if (drawerItem.equals(itemDonate)) {
                    //                            // Donate
                    //                            openDonateIntent();
                    //                        }

                    else if (drawerItem.equals(itemA1C)) {
                        startProfileActivity();
                    }

            else if (drawerItem.equals(itemmedications)) {
                        startMedicationActivity();
                    } else if (drawerItem.equals(itemReminders)) {
                        openRemindersActivity();
                    }
                    return false;
                }
            });

    if (isPlayServicesAvailable()) {
        drawerBuilder.addDrawerItems(itemA1C, itememergency, itemmedications, itemReminders, itemExport,
                itemSettings, itemFeedback, itemAbout,
                //itemDonate,
                itemInvite).withSelectedItem(-1).build();
    } else {
        drawerBuilder.addDrawerItems(itemA1C, itememergency, itemmedications, itemReminders, itemExport,
                itemSettings, itemFeedback, itemAbout
        // itemDonate
        ).withSelectedItem(-1).build();
    }

    // Restore pager position
    Bundle b = getIntent().getExtras();
    if (b != null) {
        viewPager.setCurrentItem(b.getInt("pager"));
    }

    checkIfEmptyLayout();
    bottomSheetAddDialog.setContentView(bottomSheetAddDialogView);
    bottomSheetBehavior = BottomSheetBehavior.from((View) bottomSheetAddDialogView.getParent());
    bottomSheetBehavior.setHideable(false);

    Analytics analytics = application.getAnalytics();
    Log.i("MainActivity", "Setting screen name: " + "main");
    analytics.reportScreen("Main Activity");
}

From source file:com.vexigon.libraries.onboarding.ui.fragments.SelfSelectFragment.java

@SuppressWarnings("ConstantConditions")
@Override/*w w  w .  jav  a 2s  .c  o  m*/
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    // Fragment view containers
    LinearLayout userView = getView().findViewById(R.id.userScreenView);
    LinearLayout selectionView = getView().findViewById(R.id.selectionScreenView);

    // Fragment 1 views
    ImageView userScreenImage = getView().findViewById(R.id.userScreenImage);
    final Spinner userDropdown = getView().findViewById(R.id.userScreenDropdown);
    final Button confirmButton = getView().findViewById(R.id.userScreenConfirmButton);

    // Fragment 2 views
    TextView selectionViewTitle = getView().findViewById(R.id.selectionScreenTitle);
    TextView selectionViewSubtitle = getView().findViewById(R.id.selectionScreenSubtitle);
    selfSelectItems = getView().findViewById(R.id.selectionScreenItems);
    selfSelectGridItems = getView().findViewById(R.id.selectionScreenGridItems);

    switch (position) {
    case 0:
        userView.setVisibility(View.VISIBLE);

        Glide.with(getActivity()).load(getUserScreenImage(position)).dontAnimate().into(userScreenImage);

        userDropdown.setAdapter(new CustomUserAdapter(getLoggedInUsers()));
        userDropdown.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
            @Override
            public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
                confirmButton.setText("Continue as " + ((User) userDropdown.getSelectedItem()).getName());
            }

            @Override
            public void onNothingSelected(AdapterView<?> parent) {
                confirmButton.setText("Continue as " + ((User) userDropdown.getSelectedItem()).getName());
            }
        });

        confirmButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ((SelfSelectActivity) getActivity()).viewPager.setCurrentItem(1, true);
            }
        });
        break;
    case 1:
        selectionView.setVisibility(View.VISIBLE);

        selectionViewTitle.setText(getSelfSelectTitle());
        selectionViewSubtitle.setText(getSelfSelectSubtitle());

        configureSelfSelectionList();
        break;
    }
}

From source file:com.nexes.manager.EventHandler.java

/**
 * This method, handles the button presses of the top buttons found in the
 * Main activity./*  w ww  . j a va2s. c o  m*/
 */
@Override
public void onClick(View v) {

    switch (v.getId()) {

    case R.id.back_button:
        if (mFileMang.getCurrentDir() != "/") {
            if (multi_select_flag) {
                mDelegate.killMultiSelect(true);
                Toast.makeText(mContext, "Multi-select is now off", Toast.LENGTH_SHORT).show();
            }

            stopThumbnailThread();
            updateDirectory(mFileMang.getPreviousDir());
            if (mPathLabel != null)
                mPathLabel.setText(mFileMang.getCurrentDir());
        }
        break;

    case R.id.home_button:
        if (multi_select_flag) {
            mDelegate.killMultiSelect(true);
            Toast.makeText(mContext, "Multi-select is now off", Toast.LENGTH_SHORT).show();
        }

        stopThumbnailThread();
        updateDirectory(mFileMang.setHomeDir("/sdcard"));
        if (mPathLabel != null)
            mPathLabel.setText(mFileMang.getCurrentDir());
        break;

    case R.id.info_button:
        Intent info = new Intent(mContext, DirectoryInfo.class);
        info.putExtra("PATH_NAME", mFileMang.getCurrentDir());
        mContext.startActivity(info);
        break;

    case R.id.help_button:
        Intent help = new Intent(mContext, HelpManager.class);
        mContext.startActivity(help);
        break;

    case R.id.manage_button:
        display_dialog(MANAGE_DIALOG);
        break;

    case R.id.multiselect_button:
        if (multi_select_flag) {
            mDelegate.killMultiSelect(true);

        } else {
            LinearLayout hidden_lay = (LinearLayout) ((Activity) mContext).findViewById(R.id.hidden_buttons);

            multi_select_flag = true;
            hidden_lay.setVisibility(LinearLayout.VISIBLE);
        }
        break;

    /*
     * three hidden buttons for multiselect
     */
    case R.id.hidden_attach:
        /* check if user selected objects before going further */
        if (mMultiSelectData == null || mMultiSelectData.isEmpty()) {
            mDelegate.killMultiSelect(true);
            break;
        }

        ArrayList<Uri> uris = new ArrayList<Uri>();
        int length = mMultiSelectData.size();
        Intent mail_int = new Intent();

        mail_int.setAction(android.content.Intent.ACTION_SEND_MULTIPLE);
        mail_int.setType("application/mail");
        mail_int.putExtra(Intent.EXTRA_BCC, "");
        mail_int.putExtra(Intent.EXTRA_SUBJECT, " ");

        for (int i = 0; i < length; i++) {
            File file = new File(mMultiSelectData.get(i));
            uris.add(Uri.fromFile(file));
        }

        mail_int.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);
        mContext.startActivity(Intent.createChooser(mail_int, "Email using..."));

        mDelegate.killMultiSelect(true);
        break;

    case R.id.hidden_move:
    case R.id.hidden_copy:
        /* check if user selected objects before going further */
        if (mMultiSelectData == null || mMultiSelectData.isEmpty()) {
            mDelegate.killMultiSelect(true);
            break;
        }

        if (v.getId() == R.id.hidden_move)
            delete_after_copy = true;

        mInfoLabel.setText("Holding " + mMultiSelectData.size() + " file(s)");

        mDelegate.killMultiSelect(false);
        break;

    case R.id.hidden_delete:
        /* check if user selected objects before going further */
        if (mMultiSelectData == null || mMultiSelectData.isEmpty()) {
            mDelegate.killMultiSelect(true);
            break;
        }

        final String[] data = new String[mMultiSelectData.size()];
        int at = 0;

        for (String string : mMultiSelectData)
            data[at++] = string;

        AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
        builder.setMessage(
                "Are you sure you want to delete " + data.length + " files? This cannot be " + "undone.");
        builder.setCancelable(false);
        builder.setPositiveButton("Delete", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                new BackgroundWork(DELETE_TYPE).execute(data);
                mDelegate.killMultiSelect(true);
            }
        });
        builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                mDelegate.killMultiSelect(true);
                dialog.cancel();
            }
        });

        builder.create().show();
        break;
    }
}

From source file:com.sentaroh.android.BluetoothWidget.Log.LogFileListDialogFragment.java

private void setContextButtonNormalMode(LogFileListAdapter lfm_adapter) {
    final TextView dlg_title = (TextView) mDialog.findViewById(R.id.log_file_list_dlg_title);
    dlg_title.setText(mDialogTitle);//from  w w  w .  j ava2 s . com

    final ImageButton dlg_done = (ImageButton) mDialog.findViewById(R.id.log_file_list_dlg_done);
    dlg_done.setVisibility(ImageButton.GONE);

    LinearLayout ll_prof = (LinearLayout) mDialog.findViewById(R.id.log_context_view);
    LinearLayout ll_delete = (LinearLayout) ll_prof.findViewById(R.id.log_context_button_delete_view);
    LinearLayout ll_share = (LinearLayout) ll_prof.findViewById(R.id.log_context_button_share_view);
    LinearLayout ll_rotate_log = (LinearLayout) ll_prof.findViewById(R.id.log_context_button_rotate_log_view);
    LinearLayout ll_select_all = (LinearLayout) ll_prof.findViewById(R.id.log_context_button_select_all_view);
    LinearLayout ll_unselect_all = (LinearLayout) ll_prof
            .findViewById(R.id.log_context_button_unselect_all_view);

    ll_delete.setVisibility(LinearLayout.GONE);
    ll_share.setVisibility(LinearLayout.GONE);

    ll_rotate_log.setVisibility(LinearLayout.VISIBLE);

    if (lfm_adapter.isEmptyAdapter()) {
        ll_select_all.setVisibility(LinearLayout.GONE);
        ll_unselect_all.setVisibility(LinearLayout.GONE);
    } else {
        ll_select_all.setVisibility(LinearLayout.VISIBLE);
        ll_unselect_all.setVisibility(LinearLayout.GONE);
    }
}

From source file:com.dm.wallpaper.board.activities.WallpaperBoardActivity.java

@Override
public void onWallpapersChecked(@Nullable Intent intent) {
    if (intent != null) {
        String packageName = intent.getStringExtra("packageName");
        LogUtil.d("Broadcast received from service with packageName: " + packageName);

        if (packageName == null)
            return;

        if (!packageName.equals(getPackageName())) {
            LogUtil.d("Received broadcast from different packageName, expected: " + getPackageName());
            return;
        }/*from  w w  w .  ja v  a 2 s. c o  m*/

        int size = intent.getIntExtra(Extras.EXTRA_SIZE, 0);
        int offlineSize = Database.get(this).getWallpapersCount();
        Preferences.get(this).setAvailableWallpapersCount(size);

        if (size > offlineSize) {
            int accent = ColorHelper.getAttributeColor(this, R.attr.colorAccent);
            LinearLayout container = (LinearLayout) mNavigationView.getMenu().getItem(0).getActionView();
            if (container != null) {
                TextView counter = (TextView) container.findViewById(R.id.counter);
                if (counter == null)
                    return;

                ViewCompat.setBackground(counter,
                        DrawableHelper.getTintedDrawable(this, R.drawable.ic_toolbar_circle, accent));
                counter.setTextColor(ColorHelper.getTitleTextColor(accent));
                int newItem = (size - offlineSize);
                counter.setText(String.valueOf(newItem > 99 ? "99+" : newItem));
                container.setVisibility(View.VISIBLE);

                if (mFragmentTag.equals(Extras.TAG_WALLPAPERS)) {
                    WallpapersFragment fragment = (WallpapersFragment) mFragManager
                            .findFragmentByTag(Extras.TAG_WALLPAPERS);
                    if (fragment != null)
                        fragment.showPopupBubble();
                }
                return;
            }
        }
    }

    LinearLayout container = (LinearLayout) mNavigationView.getMenu().getItem(0).getActionView();
    if (container != null)
        container.setVisibility(View.GONE);
}

From source file:com.mobicage.rogerthat.GroupDetailActivity.java

private void updateGroupForEdit() {
    T.UI();//from   w  w w.  jav  a 2 s  .  co m
    final Button saveBtn = (Button) findViewById(R.id.save_group);
    final ImageView editBtn = (ImageView) findViewById(R.id.edit_group);
    final RelativeLayout updateGroupName = ((RelativeLayout) findViewById(R.id.update_group_name));
    final LinearLayout updateGroupAvatar = ((LinearLayout) findViewById(R.id.update_group_avatar));
    final ImageView newGroupAvatar = ((ImageView) findViewById(R.id.update_group_avatar_img));
    final Button updateAvatarBtn = (Button) findViewById(R.id.update_avatar);
    final Button cancelBtn = (Button) findViewById(R.id.cancel);

    final ImageView friendAvatar = (ImageView) findViewById(R.id.friend_avatar);
    final TextView friendName = (TextView) findViewById(R.id.friend_name);

    if (mEditing) {
        updateGroupName.setVisibility(View.VISIBLE);
        updateGroupAvatar.setVisibility(View.VISIBLE);
        updateGroupName.setBackgroundResource(android.R.drawable.edit_text);
        cancelBtn.setVisibility(View.VISIBLE);
        saveBtn.setVisibility(View.VISIBLE);
        editBtn.setVisibility(View.GONE);

        friendAvatar.setVisibility(View.GONE);
        friendName.setVisibility(View.GONE);

        updateGroupName.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (mUpdateGroupName.requestFocus()) {
                    int pos = mUpdateGroupName.getText().length();
                    mUpdateGroupName.setSelection(pos);
                    UIUtils.showKeyboard(getApplicationContext());
                }
            }
        });

        OnClickListener newAvatarListener = new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                getNewAvatar(true);
                UIUtils.hideKeyboard(getApplicationContext(), mUpdateGroupName);
            }
        };

        updateAvatarBtn.setOnClickListener(newAvatarListener);
        newGroupAvatar.setOnClickListener(newAvatarListener);

    } else {
        updateGroupName.setVisibility(View.GONE);
        updateGroupAvatar.setVisibility(View.GONE);
        updateGroupName.setBackgroundResource(0);
        cancelBtn.setVisibility(View.GONE);
        saveBtn.setVisibility(View.GONE);
        editBtn.setVisibility(View.VISIBLE);

        friendAvatar.setVisibility(View.VISIBLE);
        friendName.setVisibility(View.VISIBLE);

        final byte[] byteArray;
        if (mPhotoSelected) {
            Bitmap bm = BitmapFactory.decodeFile(mUriSavedImage.getPath(), null);
            bm = ImageHelper.rotateBitmap(bm, mPhoneExifRotation);

            ByteArrayOutputStream stream = new ByteArrayOutputStream();
            bm.compress(Bitmap.CompressFormat.PNG, 100, stream);
            byteArray = stream.toByteArray();
            File image;
            try {
                image = getTmpUploadPhotoLocation();
            } catch (IOException e) {
                L.d(e.getMessage());
                UIUtils.showLongToast(getApplicationContext(), e.getMessage());
                return;
            }
            image.delete();
            mPhotoSelected = false;
            mGroup.avatar = byteArray;
        }
        mGroup.name = mUpdateGroupName.getText().toString();
        mFriendsPlugin.getStore().updateGroup(mGroup.guid, mGroup.name, mGroup.avatar, null);
        mFriendsPlugin.putGroup(mGroup);

        mBackupMembers = new ArrayList<String>(mGroup.members);

        Intent intent = new Intent(mIsNewGroup ? FriendsPlugin.GROUP_ADDED : FriendsPlugin.GROUP_MODIFIED);
        intent.putExtra("guid", mGroup.guid);
        mService.sendBroadcast(intent);
    }
}

From source file:cz.muni.fi.japanesedictionary.fragments.DisplayTranslation.java

/**
 * Updates Fragment view acording to saved translation.
 *//* w  ww  .java2 s  .  co  m*/
public void updateTranslation(View view) {
    Log.i(LOG_TAG, " Update translation");
    if (getActivity() == null || view == null) {
        return;
    }

    TextView layoutSelect = (TextView) view.findViewById(R.id.translation_select);
    LinearLayout layoutTranslation = (LinearLayout) view.findViewById(R.id.translation_container);
    if (mTranslation == null) {
        layoutSelect.setVisibility(View.VISIBLE);
        layoutTranslation.setVisibility(View.GONE);
        return;
    }
    Log.i(LOG_TAG, " Ruby: " + mTranslation.getRuby());
    layoutSelect.setVisibility(View.GONE);
    layoutTranslation.setVisibility(View.VISIBLE);

    updateLanguages();

    LinearLayout readWriteContainer = (LinearLayout) view
            .findViewById(R.id.translation_reading_writing_container);
    readWriteContainer.removeAllViews();
    //Ruby: ,?;?;?;,??;

    String writeCharacters = null;

    StringBuilder alternativeStrBuilder = new StringBuilder();
    if (mTranslation.getRuby() != null) {
        String ruby = mTranslation.getRuby();
        String[] pairs = ruby.split(";");
        for (String pair : pairs) {
            View viewReading = mInflater.inflate(R.layout.display_translation_reading_group, readWriteContainer,
                    false);
            String[] parts = pair.split(",");
            TextView writing = (TextView) viewReading.findViewById(R.id.translation_write);
            writing.setText(parts[0]);
            if (parts.length == 2) {
                TextView reading = (TextView) viewReading.findViewById(R.id.translation_read);
                reading.setText(parts[1]);
            }
            readWriteContainer.addView(viewReading);
        }
    } else {
        View viewReading = mInflater.inflate(R.layout.display_translation_reading_group, readWriteContainer,
                false);
        TextView write = (TextView) viewReading.findViewById(R.id.translation_write);
        TextView read = (TextView) viewReading.findViewById(R.id.translation_read);
        if (mTranslation.getJapaneseKeb() != null && mTranslation.getJapaneseKeb().size() > 0) {
            writeCharacters = mTranslation.getJapaneseKeb().get(0);
            write.setText(writeCharacters);
        } else {
            write.setVisibility(View.GONE);
        }

        if (mTranslation.getJapaneseReb() != null) {
            String reading = mTranslation.getJapaneseReb().get(0);
            read.setText(reading);
            ((ActionBarActivity) getActivity()).getSupportActionBar().setTitle(reading);
        } else {
            read.setVisibility(View.GONE);
        }
        readWriteContainer.addView(viewReading);
    }

    if (mTranslation.getJapaneseReb() != null) {
        String reading = mTranslation.getJapaneseReb().get(0);
        ((ActionBarActivity) getActivity()).getSupportActionBar().setTitle(reading);
        DBAsyncTask saveTranslation = new DBAsyncTask(mCallbackTranslation.getDatabase());
        saveTranslation.execute(mTranslation);

        TextView romaji = (TextView) view.findViewById(R.id.translation_romaji);
        romaji.setText(RomanizationEnum.Hepburn.toRomaji(reading));

        int sizeReb = mTranslation.getJapaneseReb().size();
        if (sizeReb > 1) {
            for (int i = 1; i < sizeReb; i++) {
                alternativeStrBuilder.append(mTranslation.getJapaneseReb().get(i));
                if (i + 1 < sizeReb) {
                    alternativeStrBuilder.append(", ");
                }
            }
        }
    }
    if (mTranslation.getJapaneseKeb() != null) {
        writeCharacters = mTranslation.getJapaneseKeb().get(0);
        int size_keb = mTranslation.getJapaneseKeb().size();
        if (size_keb > 1) {
            if (alternativeStrBuilder.length() > 0) {
                alternativeStrBuilder.append(", ");
            }
            for (int i = 1; i < size_keb; i++) {
                alternativeStrBuilder.append(mTranslation.getJapaneseKeb().get(i));
                if (i + 1 < size_keb) {
                    alternativeStrBuilder.append(", ");
                }
            }
        }
    }

    TextView alternative = (TextView) view.findViewById(R.id.translation_alternative);
    if (alternativeStrBuilder.length() > 0) {
        alternative.setText(alternativeStrBuilder);
        view.findViewById(R.id.translation_alternative_container).setVisibility(View.VISIBLE);
    } else {
        view.findViewById(R.id.translation_alternative_container).setVisibility(View.GONE);
    }

    if (mInflater != null) {
        LinearLayout translationsContainer = (LinearLayout) getView()
                .findViewById(R.id.translation_translation_container);
        translationsContainer.removeAllViews();
        if ((mEnglish || (!mFrench && !mDutch && !mGerman && !mRussian))
                && mTranslation.getEnglishSense() != null && mTranslation.getEnglishSense().size() > 0) {
            View translationLanguage = mInflater.inflate(R.layout.translation_language, translationsContainer,
                    false);
            TextView textView = (TextView) translationLanguage.findViewById(R.id.translation_language);
            if (!mFrench && !mDutch && !mGerman && !mRussian) {
                textView.setVisibility(View.GONE);
            }
            textView.setText(getString(R.string.language_english));
            translationsContainer.addView(translationLanguage);
            for (List<String> tran : mTranslation.getEnglishSense()) {
                int tran_size = tran.size();
                if (tran_size > 0) {
                    int i = 0;
                    StringBuilder strBuilder = new StringBuilder();
                    for (String str : tran) {
                        strBuilder.append(str);
                        i++;
                        if (i < tran_size) {
                            strBuilder.append(", ");
                        }
                    }
                    View translation_ll = mInflater.inflate(R.layout.translation_line, translationsContainer,
                            false);
                    TextView tView = (TextView) translation_ll.findViewById(R.id.translation_translation);
                    tView.setText(strBuilder.toString());
                    translationsContainer.addView(translation_ll);
                }

            }
        }
        if (mFrench && mTranslation.getFrenchSense() != null && mTranslation.getFrenchSense().size() > 0) {
            View translation_language = mInflater.inflate(R.layout.translation_language, translationsContainer,
                    false);
            TextView textView = (TextView) translation_language.findViewById(R.id.translation_language);
            if (!mEnglish && !mDutch && !mGerman && !mRussian) {
                textView.setVisibility(View.GONE);
            }
            textView.setText(getString(R.string.language_french));
            translationsContainer.addView(translation_language);
            for (List<String> tran : mTranslation.getFrenchSense()) {
                int tran_size = tran.size();
                if (tran_size > 0) {
                    int i = 0;
                    StringBuilder strBuilder = new StringBuilder();
                    for (String str : tran) {
                        strBuilder.append(str);
                        i++;
                        if (i < tran_size) {
                            strBuilder.append(", ");
                        }
                    }
                    View translation_ll = mInflater.inflate(R.layout.translation_line, translationsContainer,
                            false);
                    TextView tView = (TextView) translation_ll.findViewById(R.id.translation_translation);
                    tView.setText(strBuilder.toString());
                    translationsContainer.addView(translation_ll);
                }
            }
        }
        if (mDutch && mTranslation.getDutchSense() != null && mTranslation.getDutchSense().size() > 0) {
            View translation_language = mInflater.inflate(R.layout.translation_language, translationsContainer,
                    false);
            TextView textView = (TextView) translation_language.findViewById(R.id.translation_language);
            if (!mFrench && !mEnglish && !mGerman && !mRussian) {
                textView.setVisibility(View.GONE);
            }
            textView.setText(getString(R.string.language_dutch));
            translationsContainer.addView(translation_language);
            for (List<String> tran : mTranslation.getDutchSense()) {
                int tran_size = tran.size();
                if (tran_size > 0) {
                    int i = 0;
                    StringBuilder strBuilder = new StringBuilder();
                    for (String str : tran) {
                        strBuilder.append(str);
                        i++;
                        if (i < tran_size) {
                            strBuilder.append(", ");
                        }
                    }
                    View translation_ll = mInflater.inflate(R.layout.translation_line, translationsContainer,
                            false);
                    TextView tView = (TextView) translation_ll.findViewById(R.id.translation_translation);
                    tView.setText(strBuilder.toString());
                    translationsContainer.addView(translation_ll);
                }
            }
        }
        if (mGerman && mTranslation.getGermanSense() != null && mTranslation.getGermanSense().size() > 0) {
            View translation_language = mInflater.inflate(R.layout.translation_language, translationsContainer,
                    false);
            TextView textView = (TextView) translation_language.findViewById(R.id.translation_language);
            if (!mFrench && !mDutch && !mEnglish && !mRussian) {
                textView.setVisibility(View.GONE);
            }
            textView.setText(getString(R.string.language_german));
            translationsContainer.addView(translation_language);
            for (List<String> tran : mTranslation.getGermanSense()) {
                int tran_size = tran.size();
                if (tran_size > 0) {
                    int i = 0;
                    StringBuilder strBuilder = new StringBuilder();
                    for (String str : tran) {
                        strBuilder.append(str);
                        i++;
                        if (i < tran_size) {
                            strBuilder.append(", ");
                        }
                    }
                    View translation_ll = mInflater.inflate(R.layout.translation_line, translationsContainer,
                            false);
                    TextView tView = (TextView) translation_ll.findViewById(R.id.translation_translation);
                    tView.setText(strBuilder.toString());
                    translationsContainer.addView(translation_ll);
                }
            }
        }
        if (mRussian && mTranslation.getRussianSense() != null && mTranslation.getRussianSense().size() > 0) {
            View translation_language = mInflater.inflate(R.layout.translation_language, translationsContainer,
                    false);
            TextView textView = (TextView) translation_language.findViewById(R.id.translation_language);
            if (!mFrench && !mDutch && !mEnglish && !mGerman) {
                textView.setVisibility(View.GONE);
            }
            textView.setText(getString(R.string.language_russian));
            translationsContainer.addView(translation_language);
            for (List<String> tran : mTranslation.getRussianSense()) {
                int tran_size = tran.size();
                if (tran_size > 0) {
                    int i = 0;
                    StringBuilder strBuilder = new StringBuilder();
                    for (String str : tran) {
                        strBuilder.append(str);
                        i++;
                        if (i < tran_size) {
                            strBuilder.append(", ");
                        }
                    }
                    View translation_ll = mInflater.inflate(R.layout.translation_line, translationsContainer,
                            false);
                    TextView tView = (TextView) translation_ll.findViewById(R.id.translation_translation);
                    tView.setText(strBuilder.toString());
                    translationsContainer.addView(translation_ll);
                }
            }
        }

        view.findViewById(R.id.translation_kanji_container).setVisibility(View.GONE);
        mCharacters = null;
        if (writeCharacters != null) {
            // write single characters
            if (writeCharacters.length() > 0) {
                CharacterLoader charLoader = new CharacterLoader(getActivity().getApplicationContext(), this);
                charLoader.execute(writeCharacters);
            }
        }
        view.findViewById(R.id.detail_example_sentences_progress_bar).setVisibility(View.VISIBLE);
        view.findViewById(R.id.translation_tatoeba_container).setVisibility(View.VISIBLE);
        ViewGroup tatoebaContainer = (ViewGroup) view.findViewById(R.id.detail_example_sentences_container);
        tatoebaContainer.removeAllViews();

        List<String> kebRebList = kebRebToList(mTranslation);
        if (kebRebList != null && kebRebList.size() > 0) {
            TatoebaSentenceLoader sentenceLoader = new TatoebaSentenceLoader(
                    this.getActivity().getApplicationContext(), this);
            sentenceLoader.execute(kebRebList);
        }
    } else {
        Log.e(LOG_TAG, "inflater null");
    }
}