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;
}
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;
}
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);
}
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);
}
}
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();
}
});
}
Aggregations