Search in sources :

Example 6 with Spinner

use of android.widget.Spinner in project android_frameworks_base by ResurrectionRemix.

the class BaseActivity method onCreate.

@CallSuper
@Override
public void onCreate(Bundle icicle) {
    // Record the time when onCreate is invoked for metric.
    mStartTime = new Date().getTime();
    super.onCreate(icicle);
    final Intent intent = getIntent();
    addListenerForLaunchCompletion();
    setContentView(mLayoutId);
    mDrawer = DrawerController.create(this);
    mState = getState(icicle);
    Metrics.logActivityLaunch(this, mState, intent);
    mRoots = DocumentsApplication.getRootsCache(this);
    getContentResolver().registerContentObserver(RootsCache.sNotificationUri, false, mRootsCacheObserver);
    mSearchManager = new SearchViewManager(this, icicle);
    DocumentsToolbar toolbar = (DocumentsToolbar) findViewById(R.id.toolbar);
    setActionBar(toolbar);
    mNavigator = new NavigationView(mDrawer, toolbar, (Spinner) findViewById(R.id.stack), mState, this);
    // Base classes must update result in their onCreate.
    setResult(Activity.RESULT_CANCELED);
}
Also used : Spinner(android.widget.Spinner) Intent(android.content.Intent) Date(java.util.Date) CallSuper(android.support.annotation.CallSuper)

Example 7 with Spinner

use of android.widget.Spinner in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class AppOpsDetails method refreshUi.

private boolean refreshUi() {
    if (mPackageInfo == null) {
        return false;
    }
    setAppLabelAndIcon(mPackageInfo);
    Resources res = getActivity().getResources();
    mOperationsSection.removeAllViews();
    String lastPermGroup = "";
    boolean isPlatformSigned = isPlatformSigned();
    for (AppOpsState.OpsTemplate tpl : AppOpsState.ALL_TEMPLATES) {
        /* If we are platform signed, only show the root switch, this
             * one is safe to toggle while other permission-based ones could
             * certainly cause system-wide problems
             */
        if (isPlatformSigned && tpl != AppOpsState.SU_TEMPLATE) {
            continue;
        }
        List<AppOpsState.AppOpEntry> entries = mState.buildState(tpl, mPackageInfo.applicationInfo.uid, mPackageInfo.packageName);
        for (final AppOpsState.AppOpEntry entry : entries) {
            final AppOpsManager.OpEntry firstOp = entry.getOpEntry(0);
            final View view = mInflater.inflate(R.layout.app_ops_details_item, mOperationsSection, false);
            mOperationsSection.addView(view);
            String perm = AppOpsManager.opToPermission(firstOp.getOp());
            if (perm != null) {
                try {
                    PermissionInfo pi = mPm.getPermissionInfo(perm, 0);
                    if (pi.group != null && !lastPermGroup.equals(pi.group)) {
                        lastPermGroup = pi.group;
                        PermissionGroupInfo pgi = mPm.getPermissionGroupInfo(pi.group, 0);
                        if (pgi.icon != 0) {
                            ((ImageView) view.findViewById(R.id.op_icon)).setImageDrawable(pgi.loadIcon(mPm));
                        }
                    }
                } catch (NameNotFoundException e) {
                }
            }
            ((TextView) view.findViewById(R.id.op_name)).setText(entry.getSwitchText(mState));
            ((TextView) view.findViewById(R.id.op_counts)).setText(entry.getCountsText(res));
            ((TextView) view.findViewById(R.id.op_time)).setText(entry.getTimeText(res, true));
            Spinner sp = (Spinner) view.findViewById(R.id.spinnerWidget);
            sp.setVisibility(View.GONE);
            Switch sw = (Switch) view.findViewById(R.id.switchWidget);
            sw.setVisibility(View.GONE);
            final int switchOp = AppOpsManager.opToSwitch(firstOp.getOp());
            int mode = mAppOps.checkOpNoThrow(switchOp, entry.getPackageOps().getUid(), entry.getPackageOps().getPackageName());
            sp.setSelection(modeToPosition(mode));
            sp.setOnItemSelectedListener(new Spinner.OnItemSelectedListener() {

                boolean firstMode = true;

                @Override
                public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) {
                    if (firstMode) {
                        firstMode = false;
                        return;
                    }
                    mAppOps.setMode(switchOp, entry.getPackageOps().getUid(), entry.getPackageOps().getPackageName(), positionToMode(position));
                }

                @Override
                public void onNothingSelected(AdapterView<?> parentView) {
                // Do nothing
                }
            });
            sw.setChecked(mAppOps.checkOpNoThrow(switchOp, entry.getPackageOps().getUid(), entry.getPackageOps().getPackageName()) == AppOpsManager.MODE_ALLOWED);
            sw.setOnCheckedChangeListener(new Switch.OnCheckedChangeListener() {

                public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                    mAppOps.setMode(switchOp, entry.getPackageOps().getUid(), entry.getPackageOps().getPackageName(), isChecked ? AppOpsManager.MODE_ALLOWED : AppOpsManager.MODE_IGNORED);
                }
            });
            if (AppOpsManager.isStrictOp(switchOp)) {
                sp.setVisibility(View.VISIBLE);
            } else {
                sw.setVisibility(View.VISIBLE);
            }
        }
    }
    return true;
}
Also used : Spinner(android.widget.Spinner) TextView(android.widget.TextView) ImageView(android.widget.ImageView) NameNotFoundException(android.content.pm.PackageManager.NameNotFoundException) ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) AppOpsManager(android.app.AppOpsManager) PermissionInfo(android.content.pm.PermissionInfo) Switch(android.widget.Switch) PermissionGroupInfo(android.content.pm.PermissionGroupInfo) Resources(android.content.res.Resources) CompoundButton(android.widget.CompoundButton)

Example 8 with Spinner

use of android.widget.Spinner in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class SupportItemAdapter method bindOfflineEscalationOptions.

private void bindOfflineEscalationOptions(ViewHolder holder, OfflineEscalationData data) {
    // Bind Title
    holder.tileTitleView.setText(data.tileTitle);
    holder.tileTitleView.setContentDescription(data.tileTitleDescription);
    holder.tileSummaryView.setText(data.tileSummary);
    // Bind spinner
    final Spinner spinner = (Spinner) holder.itemView.findViewById(R.id.spinner);
    final ArrayAdapter<String> adapter = new ArrayAdapter(mActivity, android.R.layout.simple_spinner_dropdown_item, data.countries);
    spinner.setAdapter(adapter);
    final List<String> countryCodes = mSupportFeatureProvider.getPhoneSupportCountryCodes();
    for (int i = 0; i < countryCodes.size(); i++) {
        if (TextUtils.equals(countryCodes.get(i), mSelectedCountry)) {
            spinner.setSelection(i);
            break;
        }
    }
    spinner.setOnItemSelectedListener(mSpinnerItemSelectListener);
    // Bind buttons
    if (data.tollFreePhone != null) {
        holder.text1View.setText(data.tollFreePhone.number);
        holder.text1View.setVisibility(View.VISIBLE);
        holder.text1View.setOnClickListener(mEscalationClickListener);
    } else {
        holder.text1View.setVisibility(View.GONE);
    }
    if (data.tolledPhone != null) {
        holder.text2View.setText(mActivity.getString(R.string.support_international_phone_title));
        holder.text2View.setVisibility(View.VISIBLE);
        holder.text2View.setOnClickListener(mEscalationClickListener);
    } else {
        holder.text2View.setVisibility(View.GONE);
    }
    if (ActivityManager.isUserAMonkey()) {
        holder.text1View.setVisibility(View.GONE);
        holder.text2View.setVisibility(View.GONE);
        spinner.setVisibility(View.GONE);
        holder.itemView.findViewById(R.id.support_text).setVisibility(View.GONE);
    }
}
Also used : Spinner(android.widget.Spinner) ArrayAdapter(android.widget.ArrayAdapter)

Example 9 with Spinner

use of android.widget.Spinner in project UltimateAndroid by cymcsg.

the class RecyclerViewItemAnimatorActivity method setupSpinner.

private void setupSpinner() {
    Spinner spinner = (Spinner) findViewById(R.id.spinner);
    // Create an ArrayAdapter using the string array and a default spinner layout
    ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.animators, android.R.layout.simple_spinner_item);
    // Specify the layout to use when the list of choices appears
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    // Apply the adapter to the spinner
    spinner.setAdapter(adapter);
    spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {

        @Override
        public void onItemSelected(AdapterView<?> adapterView, View view, int position, long l) {
            switch(position) {
                case 0:
                    mRecyclerView.setItemAnimator(new SlideInOutLeftItemAnimator(mRecyclerView));
                    break;
                case 1:
                    mRecyclerView.setItemAnimator(new SlideInOutRightItemAnimator(mRecyclerView));
                    break;
                case 2:
                    mRecyclerView.setItemAnimator(new SlideInOutTopItemAnimator(mRecyclerView));
                    break;
                case 3:
                    mRecyclerView.setItemAnimator(new SlideInOutBottomItemAnimator(mRecyclerView));
                    break;
                case 4:
                    mRecyclerView.setItemAnimator(new ScaleInOutItemAnimator(mRecyclerView));
                    break;
                case 5:
                    mRecyclerView.setItemAnimator(new SlideScaleInOutRightItemAnimator(mRecyclerView));
                    break;
            }
        }

        @Override
        public void onNothingSelected(AdapterView<?> adapterView) {
        }
    });
}
Also used : Spinner(android.widget.Spinner) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View) AdapterView(android.widget.AdapterView) AdapterView(android.widget.AdapterView)

Example 10 with Spinner

use of android.widget.Spinner in project UltimateAndroid by cymcsg.

the class CropperSample method onCreate.

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    this.requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.cropper_activity);
    // Sets fonts for all
    Typeface mFont = Typeface.createFromAsset(getAssets(), "Roboto-Thin.ttf");
    ViewGroup root = (ViewGroup) findViewById(R.id.mylayout);
    setFont(root, mFont);
    // Initialize components of the app
    final CropImageView cropImageView = (CropImageView) findViewById(R.id.CropImageView);
    final SeekBar aspectRatioXSeek = (SeekBar) findViewById(R.id.aspectRatioXSeek);
    final SeekBar aspectRatioYSeek = (SeekBar) findViewById(R.id.aspectRatioYSeek);
    final ToggleButton fixedAspectRatioToggle = (ToggleButton) findViewById(R.id.fixedAspectRatioToggle);
    Spinner showGuidelinesSpin = (Spinner) findViewById(R.id.showGuidelinesSpin);
    // Sets sliders to be disabled until fixedAspectRatio is set
    aspectRatioXSeek.setEnabled(false);
    aspectRatioYSeek.setEnabled(false);
    // Set initial spinner value
    showGuidelinesSpin.setSelection(ON_TOUCH);
    //Sets the rotate button
    final Button rotateButton = (Button) findViewById(R.id.Button_rotate);
    rotateButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            cropImageView.rotateImage(ROTATE_NINETY_DEGREES);
        }
    });
    // Sets fixedAspectRatio
    fixedAspectRatioToggle.setOnCheckedChangeListener(new OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            cropImageView.setFixedAspectRatio(isChecked);
            if (isChecked) {
                aspectRatioXSeek.setEnabled(true);
                aspectRatioYSeek.setEnabled(true);
            } else {
                aspectRatioXSeek.setEnabled(false);
                aspectRatioYSeek.setEnabled(false);
            }
        }
    });
    // Sets initial aspect ratio to 10/10, for demonstration purposes
    cropImageView.setAspectRatio(DEFAULT_ASPECT_RATIO_VALUES, DEFAULT_ASPECT_RATIO_VALUES);
    // Sets aspectRatioX
    final TextView aspectRatioX = (TextView) findViewById(R.id.aspectRatioX);
    aspectRatioXSeek.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {

        @Override
        public void onProgressChanged(SeekBar aspectRatioXSeek, int progress, boolean fromUser) {
            try {
                mAspectRatioX = progress;
                cropImageView.setAspectRatio(progress, mAspectRatioY);
                aspectRatioX.setText(" " + progress);
            } catch (IllegalArgumentException e) {
            }
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
        }
    });
    // Sets aspectRatioY
    final TextView aspectRatioY = (TextView) findViewById(R.id.aspectRatioY);
    aspectRatioYSeek.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {

        @Override
        public void onProgressChanged(SeekBar aspectRatioYSeek, int progress, boolean fromUser) {
            try {
                mAspectRatioY = progress;
                cropImageView.setAspectRatio(mAspectRatioX, progress);
                aspectRatioY.setText(" " + progress);
            } catch (IllegalArgumentException e) {
            }
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
        }
    });
    // Sets up the Spinner
    showGuidelinesSpin.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {

        public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
            cropImageView.setGuidelines(i);
        }

        public void onNothingSelected(AdapterView<?> adapterView) {
            return;
        }
    });
    final Button cropButton = (Button) findViewById(R.id.Button_crop);
    cropButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            croppedImage = cropImageView.getCroppedImage();
            ImageView croppedImageView = (ImageView) findViewById(R.id.croppedImageView);
            croppedImageView.setImageBitmap(croppedImage);
        }
    });
}
Also used : ToggleButton(android.widget.ToggleButton) OnCheckedChangeListener(android.widget.CompoundButton.OnCheckedChangeListener) SeekBar(android.widget.SeekBar) Typeface(android.graphics.Typeface) ViewGroup(android.view.ViewGroup) Spinner(android.widget.Spinner) OnSeekBarChangeListener(android.widget.SeekBar.OnSeekBarChangeListener) ImageView(android.widget.ImageView) CropImageView(com.marshalchen.common.uimodule.cropperimage.CropImageView) TextView(android.widget.TextView) View(android.view.View) AdapterView(android.widget.AdapterView) CompoundButton(android.widget.CompoundButton) Button(android.widget.Button) ToggleButton(android.widget.ToggleButton) TextView(android.widget.TextView) AdapterView(android.widget.AdapterView) ImageView(android.widget.ImageView) CropImageView(com.marshalchen.common.uimodule.cropperimage.CropImageView) CropImageView(com.marshalchen.common.uimodule.cropperimage.CropImageView) CompoundButton(android.widget.CompoundButton)

Aggregations

Spinner (android.widget.Spinner)418 View (android.view.View)185 AdapterView (android.widget.AdapterView)146 TextView (android.widget.TextView)134 ArrayAdapter (android.widget.ArrayAdapter)132 EditText (android.widget.EditText)67 ArrayList (java.util.ArrayList)49 LinearLayout (android.widget.LinearLayout)48 Intent (android.content.Intent)45 Button (android.widget.Button)45 ImageView (android.widget.ImageView)43 CheckBox (android.widget.CheckBox)42 DialogInterface (android.content.DialogInterface)41 ViewGroup (android.view.ViewGroup)27 CompoundButton (android.widget.CompoundButton)27 RecyclerView (android.support.v7.widget.RecyclerView)26 LayoutInflater (android.view.LayoutInflater)26 ListView (android.widget.ListView)25 Test (org.junit.Test)23 Context (android.content.Context)19