Search in sources :

Example 1 with ImageButton

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

the class MenuCircleShowingAnimation method addItem.

public void addItem(Drawable drawable, View.OnClickListener onClickListener) {
    ImageButton button = (ImageButton) LayoutInflater.from(context).inflate(R.layout.menu_animation_promoted_action_button, frameLayout, false);
    button.setImageDrawable(drawable);
    button.setOnClickListener(onClickListener);
    promotedActions.add(button);
    frameLayout.addView(button);
    return;
}
Also used : ImageButton(android.widget.ImageButton)

Example 2 with ImageButton

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

the class MenuCircleShowingAnimation method addMainItem.

public ImageButton addMainItem(Drawable drawable) {
    ImageButton button = (ImageButton) LayoutInflater.from(context).inflate(R.layout.menu_animation_main_promoted_action_button, frameLayout, false);
    button.setImageDrawable(drawable);
    button.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            if (isMenuOpened) {
                closePromotedActions().start();
                isMenuOpened = false;
            } else {
                isMenuOpened = true;
                openPromotedActions().start();
            }
        }
    });
    frameLayout.addView(button);
    mainImageButton = button;
    return button;
}
Also used : ImageButton(android.widget.ImageButton) View(android.view.View)

Example 3 with ImageButton

use of android.widget.ImageButton in project GreenDroid by cyrilmottier.

the class NormalActionBarItem method prepareItemView.

@Override
protected void prepareItemView() {
    super.prepareItemView();
    final ImageButton imageButton = (ImageButton) mItemView.findViewById(R.id.gd_action_bar_item);
    imageButton.setImageDrawable(mDrawable);
    imageButton.setContentDescription(mContentDescription);
}
Also used : ImageButton(android.widget.ImageButton)

Example 4 with ImageButton

use of android.widget.ImageButton in project Anki-Android by Ramblurr.

the class CardEditor method populateEditFields.

private void populateEditFields() {
    mFieldsLayoutContainer.removeAllViews();
    mEditFields = new LinkedList<FieldEditText>();
    String[][] fields = mEditorNote.items();
    // Use custom font if selected from preferences
    Typeface mCustomTypeface = null;
    SharedPreferences preferences = AnkiDroidApp.getSharedPrefs(getBaseContext());
    String customFont = preferences.getString("browserEditorFont", "");
    if (!customFont.equals("")) {
        mCustomTypeface = AnkiFont.getTypeface(this, customFont);
    }
    for (int i = 0; i < fields.length; i++) {
        View editline_view = getLayoutInflater().inflate(R.layout.card_multimedia_editline, null);
        FieldEditText newTextbox = (FieldEditText) editline_view.findViewById(R.id.id_note_editText);
        initFieldEditText(newTextbox, i, fields[i], mCustomTypeface);
        TextView label = newTextbox.getLabel();
        label.setTextColor(Color.BLACK);
        label.setPadding((int) UIUtils.getDensityAdjustedValue(this, 3.4f), 0, 0, 0);
        mEditFields.add(newTextbox);
        ImageButton mediaButton = (ImageButton) editline_view.findViewById(R.id.id_media_button);
        mediaButton.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                Intent editCard = new Intent(CardEditor.this, MultimediaCardEditorActivity.class);
                if (!mAddNote) {
                    editCard.putExtra(CardEditor.EXTRA_CARD_ID, mCurrentEditedCard.getId());
                } else {
                    editCard.putExtra(CardEditor.EXTRA_CARD_ID, 0);
                }
                startActivityForResult(editCard, REQUEST_MULTIMEDIA_EDIT);
            }
        });
        mFieldsLayoutContainer.addView(label);
        mFieldsLayoutContainer.addView(editline_view);
    }
}
Also used : MultimediaCardEditorActivity(com.ichi2.anki.multimediacard.activity.MultimediaCardEditorActivity) Typeface(android.graphics.Typeface) SharedPreferences(android.content.SharedPreferences) Intent(android.content.Intent) ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) ListView(android.widget.ListView) ImageButton(android.widget.ImageButton) TextView(android.widget.TextView)

Example 5 with ImageButton

use of android.widget.ImageButton in project storymaker by StoryMaker.

the class BaseActivity method setupDrawerLayout.

public void setupDrawerLayout() {
    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    mDrawerContainer = (ViewGroup) findViewById(R.id.left_drawer);
    mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.drawable.ic_drawer_white, R.string.open_drawer, R.string.close_drawer) {

        /** Called when a drawer has settled in a completely closed state. */
        public void onDrawerClosed(View view) {
            super.onDrawerClosed(view);
            // creates call to onPrepareOptionsMenu()
            invalidateOptionsMenu();
            mDrawerOpen = false;
        }

        /** Called when a drawer has settled in a completely open state. */
        public void onDrawerOpened(View drawerView) {
            super.onDrawerOpened(drawerView);
            // creates call to onPrepareOptionsMenu()
            invalidateOptionsMenu();
            mDrawerOpen = true;
        }
    };
    mDrawerLayout.setDrawerListener(mDrawerToggle);
    final Activity activity = this;
    RelativeLayout llDrawerLogin = (RelativeLayout) findViewById(R.id.llLogin);
    ImageButton btnDrawerQuickCaptureVideo = (ImageButton) findViewById(R.id.btnDrawerQuickCaptureVideo);
    ImageButton btnDrawerQuickCapturePhoto = (ImageButton) findViewById(R.id.btnDrawerQuickCapturePhoto);
    ImageButton btnDrawerQuickCaptureAudio = (ImageButton) findViewById(R.id.btnDrawerQuickCaptureAudio);
    Button btnDrawerHome = (Button) findViewById(R.id.btnDrawerHome);
    Button btnDrawerCatalog = (Button) findViewById(R.id.btnDrawerCatalog);
    //        Button btnDrawerProjects =      (Button) findViewById(R.id.btnDrawerProjects);
    //Button btnDrawerAccount = (Button) findViewById(R.id.btnDrawerAccount);
    Button btnDrawerAccounts = (Button) findViewById(R.id.btnDrawerAccounts);
    Button btnDrawerExports = (Button) findViewById(R.id.btnDrawerExports);
    Button btnDrawerUploadManager = (Button) findViewById(R.id.btnDrawerUploadManager);
    Button btnDrawerSettings = (Button) findViewById(R.id.btnDrawerSettings);
    Button btnDrawerFeedback = (Button) findViewById(R.id.btnDrawerFeedback);
    TextView textViewVersion = (TextView) findViewById(R.id.textViewVersion);
    // NEW/CACHEWORD
    Button btnDrawerLock = (Button) findViewById(R.id.btnDrawerLock);
    // disable button if the user has set a pin
    SharedPreferences sp = getSharedPreferences("appPrefs", MODE_PRIVATE);
    String cachewordStatus = sp.getString("cacheword_status", "default");
    if (cachewordStatus.equals(CACHEWORD_SET)) {
        Timber.d("pin set, so remove button");
        btnDrawerLock.setVisibility(View.GONE);
    } else {
        Timber.d("no pin set, so show button");
    }
    String pkg = getPackageName();
    try {
        String versionName = getPackageManager().getPackageInfo(pkg, 0).versionName;
        int versionCode = getPackageManager().getPackageInfo(pkg, 0).versionCode;
        textViewVersion.setText("v" + versionName + " build " + versionCode);
    } catch (PackageManager.NameNotFoundException e) {
        Timber.e(e, "NameNotFoundException?");
    }
    updateSlidingMenuWithUserState();
    // Set a random profile background
    ImageView imageViewProfileBg = (ImageView) findViewById(R.id.imageViewProfileBg);
    int profileBg = (int) (Math.random() * 2);
    switch(profileBg) {
        case 0:
            imageViewProfileBg.setImageResource(R.drawable.profile_bg1);
            break;
        case 1:
            imageViewProfileBg.setImageResource(R.drawable.profile_bg2);
            break;
        case 2:
            imageViewProfileBg.setImageResource(R.drawable.profile_bg3);
            break;
    }
    llDrawerLogin.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            mDrawerLayout.closeDrawers();
            Intent i = new Intent(activity, ConnectAccountActivity.class);
            activity.startActivity(i);
        }
    });
    btnDrawerHome.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            mDrawerLayout.closeDrawers();
            Intent i = new Intent(activity, HomeActivity.class);
            activity.startActivity(i);
        }
    });
    btnDrawerCatalog.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            mDrawerLayout.closeDrawers();
            Intent i = new Intent(activity, CatalogActivity.class);
            activity.startActivity(i);
        }
    });
    btnDrawerExports.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            mDrawerLayout.closeDrawers();
            Intent i = new Intent(activity, ProjectsActivity.class);
            activity.startActivity(i);
        }
    });
    btnDrawerAccounts.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            mDrawerLayout.closeDrawers();
            Intent i = new Intent(activity, AccountsActivity.class);
            activity.startActivity(i);
        }
    });
    btnDrawerUploadManager.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            mDrawerLayout.closeDrawers();
            Toast.makeText(getApplicationContext(), "Not yet implemented", Toast.LENGTH_LONG).show();
        //                Intent i = new Intent(activity, AccountsActivity.class);
        //                activity.startActivity(i);
        }
    });
    btnDrawerSettings.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            mDrawerLayout.closeDrawers();
            Intent i = new Intent(activity, SimplePreferences.class);
            activity.startActivity(i);
        }
    });
    btnDrawerFeedback.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            mDrawerLayout.closeDrawers();
            FeedbackManager.register(activity, AppConstants.HOCKEY_APP_ID, null);
            FeedbackManager.showFeedbackActivity(activity);
        }
    });
    // NEW/CACHEWORD
    btnDrawerLock.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            // if there has been no first lock, set status so user will be prompted to create a pin
            SharedPreferences sp = getSharedPreferences("appPrefs", MODE_PRIVATE);
            String cachewordStatus = sp.getString("cacheword_status", "default");
            if (cachewordStatus.equals(CACHEWORD_UNSET)) {
                // set flag so user will be prompted to create a pin
                setPin = true;
                Timber.d("set cacheword first lock flag");
            }
            mCacheWordHandler.lock();
        }
    });
}
Also used : SharedPreferences(android.content.SharedPreferences) ActionBarDrawerToggle(android.support.v4.app.ActionBarDrawerToggle) FragmentActivity(android.support.v4.app.FragmentActivity) Activity(android.app.Activity) Intent(android.content.Intent) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView) ImageButton(android.widget.ImageButton) PackageManager(android.content.pm.PackageManager) ImageButton(android.widget.ImageButton) Button(android.widget.Button) RelativeLayout(android.widget.RelativeLayout) OnClickListener(android.view.View.OnClickListener) TextView(android.widget.TextView) ImageView(android.widget.ImageView)

Aggregations

ImageButton (android.widget.ImageButton)149 View (android.view.View)105 TextView (android.widget.TextView)83 ImageView (android.widget.ImageView)51 Button (android.widget.Button)26 ListView (android.widget.ListView)24 AdapterView (android.widget.AdapterView)23 OnClickListener (android.view.View.OnClickListener)21 LinearLayout (android.widget.LinearLayout)19 Intent (android.content.Intent)18 RelativeLayout (android.widget.RelativeLayout)13 DialogInterface (android.content.DialogInterface)11 Bundle (android.os.Bundle)11 LayoutInflater (android.view.LayoutInflater)11 EditText (android.widget.EditText)11 ViewGroup (android.view.ViewGroup)10 ArrayList (java.util.ArrayList)10 Builder (android.app.AlertDialog.Builder)7 MenuItem (android.view.MenuItem)7 Drawable (android.graphics.drawable.Drawable)6