Search in sources :

Example 71 with TextView

use of android.widget.TextView in project boilerplate by koush.

the class SimpleListTwoLineCheckboxItem method bindView.

@Override
protected void bindView(View v) {
    super.bindView(v);
    TextView tv = (TextView) v.findViewById(R.id.icon_list_fragment_subtitle);
    tv.setText(subtitle);
    tv.setVisibility(subtitle != null ? TextView.VISIBLE : TextView.GONE);
}
Also used : TextView(android.widget.TextView)

Example 72 with TextView

use of android.widget.TextView in project boilerplate by koush.

the class SimpleListTwoLineItem method bindView.

@Override
protected void bindView(View v) {
    super.bindView(v);
    TextView tv = (TextView) v.findViewById(R.id.icon_list_fragment_subtitle);
    tv.setText(subtitle);
    tv.setVisibility(subtitle != null ? TextView.VISIBLE : TextView.GONE);
}
Also used : TextView(android.widget.TextView)

Example 73 with TextView

use of android.widget.TextView in project ion by koush.

the class ProgressBarDownload method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // Enable global Ion logging
    Ion.getDefault(this).configure().setLogging("ion-sample", Log.DEBUG);
    setContentView(R.layout.progress);
    download = (Button) findViewById(R.id.download);
    downloadCount = (TextView) findViewById(R.id.download_count);
    progressBar = (ProgressBar) findViewById(R.id.progress);
    download.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            if (downloading != null && !downloading.isCancelled()) {
                resetDownload();
                return;
            }
            download.setText("Cancel");
            // this is a 180MB zip file to test with
            downloading = Ion.with(ProgressBarDownload.this).load("http://developer.clockworkmod.com/downloads/51/4883/cm-10.1-20130512-CPUFREQ-m7.zip").progressBar(progressBar).progressHandler(new ProgressCallback() {

                @Override
                public void onProgress(long downloaded, long total) {
                    downloadCount.setText("" + downloaded + " / " + total);
                }
            }).write(getFileStreamPath("zip-" + System.currentTimeMillis() + ".zip")).setCallback(new FutureCallback<File>() {

                @Override
                public void onCompleted(Exception e, File result) {
                    resetDownload();
                    if (e != null) {
                        Toast.makeText(ProgressBarDownload.this, "Error downloading file", Toast.LENGTH_LONG).show();
                        return;
                    }
                    Toast.makeText(ProgressBarDownload.this, "File upload complete", Toast.LENGTH_LONG).show();
                }
            });
        }
    });
}
Also used : ProgressCallback(com.koushikdutta.ion.ProgressCallback) TextView(android.widget.TextView) View(android.view.View) File(java.io.File)

Example 74 with TextView

use of android.widget.TextView in project ion by koush.

the class TwitterGson method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // Enable global Ion logging
    Ion.getDefault(this).configure().setLogging("ion-sample", Log.DEBUG);
    // create a tweet adapter for our list view
    tweetAdapter = new ArrayAdapter<Tweet>(this, 0) {

        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            if (convertView == null)
                convertView = getLayoutInflater().inflate(R.layout.tweet, null);
            // we're near the end of the list adapter, so load more items
            if (position >= getCount() - 3)
                load();
            // grab the tweet (or retweet)
            Tweet tweet = getItem(position);
            Tweet retweet = tweet.retweetedStatus;
            if (retweet != null)
                tweet = retweet;
            ImageView imageView = (ImageView) convertView.findViewById(R.id.image);
            // Use Ion's builder set the google_image on an ImageView from a URL
            // start with the ImageView
            Ion.with(imageView).placeholder(R.drawable.twitter).load(tweet.user.imageUrl);
            // and finally, set the name and text
            TextView handle = (TextView) convertView.findViewById(R.id.handle);
            handle.setText(tweet.user.screenName);
            TextView text = (TextView) convertView.findViewById(R.id.tweet);
            text.setText(tweet.text);
            return convertView;
        }
    };
    // basic setup of the ListView and adapter
    setContentView(R.layout.twitter);
    ListView listView = (ListView) findViewById(R.id.list);
    listView.setAdapter(tweetAdapter);
    // authenticate and do the first load
    getCredentials();
}
Also used : ListView(android.widget.ListView) ViewGroup(android.view.ViewGroup) TextView(android.widget.TextView) ImageView(android.widget.ImageView) ImageView(android.widget.ImageView) TextView(android.widget.TextView) View(android.view.View) ListView(android.widget.ListView)

Example 75 with TextView

use of android.widget.TextView in project Shuttle by timusus.

the class EqualizerActivity method onCreate.

@SuppressLint("InlinedApi")
@TargetApi(Build.VERSION_CODES.GINGERBREAD)
@Override
public void onCreate(Bundle savedInstanceState) {
    mPrefs = PreferenceManager.getDefaultSharedPreferences(this);
    ThemeUtils.setTheme(this);
    if (!ShuttleUtils.hasLollipop() && ShuttleUtils.hasKitKat()) {
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        mTintManager = new SystemBarTintManager(this);
    }
    if (!ShuttleUtils.hasKitKat()) {
        getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
    }
    if (SettingsManager.getInstance().canTintNavBar()) {
        getWindow().setNavigationBarColor(ColorUtils.getPrimaryColorDark(this));
    }
    super.onCreate(savedInstanceState);
    overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
    setContentView(R.layout.activity_equalizer);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    ThemeUtils.themeActionBar(this);
    ThemeUtils.themeStatusBar(this, mTintManager);
    ActionBar actionBar = getSupportActionBar();
    actionBar.setTitle(getResources().getString(R.string.equalizer));
    try {
        //Query available effects
        final AudioEffect.Descriptor[] effects = AudioEffect.queryEffects();
        //Determine available/supported effects
        if (effects != null && effects.length != 0) {
            for (final AudioEffect.Descriptor effect : effects) {
                //Equalizer
                if (effect.type.equals(UUID.fromString(EFFECT_TYPE_EQUALIZER))) {
                    mEqualizerSupported = true;
                } else if (effect.type.equals(UUID.fromString(EFFECT_TYPE_BASS_BOOST))) {
                    mBassBoostSupported = true;
                } else if (effect.type.equals(UUID.fromString(EFFECT_TYPE_VIRTUALIZER))) {
                    mVirtualizerSupported = true;
                }
            }
        }
    } catch (NoClassDefFoundError ignored) {
    //The user doesn't have the AudioEffect/AudioEffect.Descriptor class. How sad.
    }
    mSpinner = (Spinner) findViewById(R.id.eqSpinner);
    mSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {

        @Override
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            mEqPreset = position;
            equalizerSetPreset(position);
        }

        @Override
        public void onNothingSelected(AdapterView<?> parent) {
        }
    });
    setupPresets();
    if (mSpinnerAdapter != null && mSpinnerAdapter.getCount() > mEqPreset) {
        mSpinner.setSelection(mEqPreset);
    }
    //Initialize the equalizer elements
    View eqContainer = findViewById(R.id.eqContainer);
    mNumberEqualizerBands = Integer.parseInt(mPrefs.getString("equalizer.number_of_bands", "5"));
    final int[] centerFreqs = getCenterFreqs();
    final int[] bandLevelRange = getBandLevelRange();
    for (int band = 0; band < mNumberEqualizerBands; band++) {
        //Unit conversion from mHz to Hz and use k prefix if necessary to display
        float centerFreqHz = centerFreqs[band] / 1000;
        String unitPrefix = "";
        if (centerFreqHz >= 1000) {
            centerFreqHz = centerFreqHz / 1000;
            unitPrefix = "k";
        }
        (eqContainer.findViewById(eqViewElementIds[band][0])).setVisibility(View.VISIBLE);
        (eqContainer.findViewById(eqViewTextElementIds[band][0])).setVisibility(View.VISIBLE);
        (eqContainer.findViewById(eqViewElementIds[band][1])).setVisibility(View.VISIBLE);
        (eqContainer.findViewById(eqViewTextElementIds[band][1])).setVisibility(View.VISIBLE);
        ((TextView) eqContainer.findViewById(eqViewElementIds[band][0])).setText(format("%.0f ", centerFreqHz) + unitPrefix + "Hz");
        mEqualizerSeekBar[band] = (SizableSeekBar) eqContainer.findViewById(eqViewElementIds[band][1]);
        ThemeUtils.themeSeekBar(this, mEqualizerSeekBar[band]);
        mEqualizerSeekBar[band].setMax((bandLevelRange[1] / 100) - (bandLevelRange[0] / 100));
        mEqualizerSeekBar[band].setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {

            @Override
            public void onProgressChanged(final SeekBar seekBar, final int progress, final boolean fromUser) {
                if (fromUser) {
                    //Determine which band changed
                    int seekbarId = seekBar.getId();
                    int band = 0;
                    for (int i = 0; i < eqViewElementIds.length; i++) {
                        if (eqViewElementIds[i][1] == seekbarId) {
                            band = i;
                        }
                    }
                    if (mEqPreset != mEqCustomPresetPosition) {
                        equalizerCopyToCustom();
                        if (mSpinnerAdapter != null && mSpinnerAdapter.getCount() > mEqCustomPresetPosition) {
                            mSpinner.setSelection(mEqCustomPresetPosition);
                        }
                    } else {
                        int level = getBandLevelRange()[0] + (progress * 100);
                        equalizerBandUpdate(band, level);
                    }
                }
            }

            @Override
            public void onStartTrackingTouch(SeekBar seekBar) {
            }

            @Override
            public void onStopTrackingTouch(SeekBar seekBar) {
                mHandler.sendEmptyMessage(MSG_UPDATE_SERVICE);
            }
        });
    }
    // Set the SeekBar listener.
    if (mBassBoostSupported) {
        final SizableSeekBar seekbar = (SizableSeekBar) findViewById(R.id.bb_strength);
        ThemeUtils.themeSeekBar(this, seekbar);
        seekbar.setMax(OpenSLESConstants.BASSBOOST_MAX_STRENGTH - OpenSLESConstants.BASSBOOST_MIN_STRENGTH);
        seekbar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {

            @Override
            public void onProgressChanged(final SeekBar seekBar, final int progress, final boolean fromUser) {
                // set parameter and state
                if (fromUser) {
                    mPrefs.edit().putBoolean("audiofx.bass.enable", true).apply();
                    mPrefs.edit().putString("audiofx.bass.strength", String.valueOf(progress)).apply();
                    mHandler.sendEmptyMessage(MSG_UPDATE_SERVICE);
                }
            }

            // If slider pos was 0 when starting re-enable effect
            @Override
            public void onStartTrackingTouch(final SeekBar seekBar) {
                if (seekBar.getProgress() == 0) {
                    mPrefs.edit().putBoolean("audiofx.bass.enable", true).apply();
                    mHandler.sendEmptyMessage(MSG_UPDATE_SERVICE);
                }
            }

            // If slider pos = 0 when stopping disable effect
            @Override
            public void onStopTrackingTouch(final SeekBar seekBar) {
                if (seekBar.getProgress() == 0) {
                    // disable
                    mPrefs.edit().putBoolean("audiofx.bass.enable", false).apply();
                    mHandler.sendEmptyMessage(MSG_UPDATE_SERVICE);
                }
            }
        });
    }
    // Set the SeekBar listener.
    if (mVirtualizerSupported) {
        final SizableSeekBar seekbar = (SizableSeekBar) findViewById(R.id.virtualizer_strength);
        ThemeUtils.themeSeekBar(this, seekbar);
        seekbar.setMax(OpenSLESConstants.VIRTUALIZER_MAX_STRENGTH - OpenSLESConstants.VIRTUALIZER_MIN_STRENGTH);
        seekbar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {

            @Override
            public void onProgressChanged(final SeekBar seekBar, final int progress, final boolean fromUser) {
                // set parameter and state
                if (fromUser) {
                    mPrefs.edit().putBoolean("audiofx.virtualizer.enable", true).apply();
                    mPrefs.edit().putString("audiofx.virtualizer.strength", String.valueOf(progress)).apply();
                    mHandler.sendEmptyMessage(MSG_UPDATE_SERVICE);
                }
            }

            // If slider pos was 0 when starting re-enable effect
            @Override
            public void onStartTrackingTouch(final SeekBar seekBar) {
                if (seekBar.getProgress() == 0) {
                    mPrefs.edit().putBoolean("audiofx.virtualizer.enable", true).apply();
                    mHandler.sendEmptyMessage(MSG_UPDATE_SERVICE);
                }
            }

            // If slider pos = 0 when stopping disable effect
            @Override
            public void onStopTrackingTouch(final SeekBar seekBar) {
                if (seekBar.getProgress() == 0) {
                    // disable
                    mPrefs.edit().putBoolean("audiofx.virtualizer.enable", false).apply();
                    mHandler.sendEmptyMessage(MSG_UPDATE_SERVICE);
                }
            }
        });
    }
}
Also used : SizableSeekBar(com.simplecity.amp_library.ui.views.SizableSeekBar) SeekBar(android.widget.SeekBar) SystemBarTintManager(com.readystatesoftware.systembartint.SystemBarTintManager) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) SuppressLint(android.annotation.SuppressLint) SizableSeekBar(com.simplecity.amp_library.ui.views.SizableSeekBar) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) ActionBar(android.support.v7.app.ActionBar) Toolbar(android.support.v7.widget.Toolbar) AudioEffect(android.media.audiofx.AudioEffect) SuppressLint(android.annotation.SuppressLint) TargetApi(android.annotation.TargetApi)

Aggregations

TextView (android.widget.TextView)4994 View (android.view.View)2680 ImageView (android.widget.ImageView)1137 Button (android.widget.Button)442 LinearLayout (android.widget.LinearLayout)439 LayoutInflater (android.view.LayoutInflater)425 Intent (android.content.Intent)397 ListView (android.widget.ListView)389 AdapterView (android.widget.AdapterView)372 ViewGroup (android.view.ViewGroup)322 OnClickListener (android.view.View.OnClickListener)304 RecyclerView (android.support.v7.widget.RecyclerView)197 Test (org.junit.Test)197 ScrollView (android.widget.ScrollView)166 DialogInterface (android.content.DialogInterface)162 Context (android.content.Context)156 Drawable (android.graphics.drawable.Drawable)155 EditText (android.widget.EditText)149 AlertDialog (android.app.AlertDialog)144 Bundle (android.os.Bundle)144