Search in sources :

Example 91 with ImageButton

use of android.widget.ImageButton in project Klyph by jonathangerbaud.

the class StreamAdapter method attachHolder.

@Override
protected void attachHolder(View view) {
    ImageView authorProfileImage = (ImageView) view.findViewById(R.id.author_profile_image);
    TextView story = (TextView) view.findViewById(R.id.story);
    TextView postTime = (TextView) view.findViewById(R.id.post_time);
    ImageView sharedAuthorProfileImage = (ImageView) view.findViewById(R.id.shared_author_profile_image);
    TextView sharedStory = (TextView) view.findViewById(R.id.shared_story);
    TextView sharedPostTime = (TextView) view.findViewById(R.id.shared_post_time);
    TextView message = (TextView) view.findViewById(R.id.message);
    ImageView postPhoto = (ImageView) view.findViewById(R.id.post_photo);
    ImageView postVideoPlay = (ImageView) view.findViewById(R.id.post_video_play);
    TextView videoTitle = (TextView) view.findViewById(R.id.post_video_title);
    TextView videoUrl = (TextView) view.findViewById(R.id.post_video_url);
    ImageView postPicturePlay = (ImageView) view.findViewById(R.id.post_picture_play);
    ImageView postLinkBackground = (ImageView) view.findViewById(R.id.stream_link_image_background);
    TextView postName = (TextView) view.findViewById(R.id.post_name);
    TextView postCaption = (TextView) view.findViewById(R.id.post_caption);
    TextView postDescription = (TextView) view.findViewById(R.id.post_description);
    Button likeButton = (Button) view.findViewById(R.id.like_button);
    Button commentButton = (Button) view.findViewById(R.id.comment_button);
    ImageButton shareButton = (ImageButton) view.findViewById(R.id.share_button);
    ImageButton overflowButton = (ImageButton) view.findViewById(R.id.overflow_button);
    HListView streamAlbum = (HListView) view.findViewById(R.id.stream_album);
    ViewGroup streamLink = (ViewGroup) view.findViewById(R.id.stream_link);
    ViewGroup buttonBar = (ViewGroup) view.findViewById(R.id.button_bar);
    View buttonBarDivider = (View) view.findViewById(R.id.button_bar_divider);
    StreamHolder holder = new StreamHolder(authorProfileImage, story, postTime, sharedAuthorProfileImage, sharedStory, sharedPostTime, message, postPhoto, postVideoPlay, videoTitle, videoUrl, postPicturePlay, postLinkBackground, postName, postCaption, postDescription, likeButton, commentButton, shareButton, overflowButton, streamAlbum, streamLink, buttonBar, buttonBarDivider);
    setHolder(view, holder);
}
Also used : ImageButton(android.widget.ImageButton) HListView(it.sephiroth.android.library.widget.HListView) ImageButton(android.widget.ImageButton) Button(android.widget.Button) ViewGroup(android.view.ViewGroup) TextView(android.widget.TextView) ImageView(android.widget.ImageView) ImageView(android.widget.ImageView) HListView(it.sephiroth.android.library.widget.HListView) TextView(android.widget.TextView) View(android.view.View) StreamHolder(com.abewy.android.apps.klyph.adapter.holder.StreamHolder)

Example 92 with ImageButton

use of android.widget.ImageButton in project Klyph by jonathangerbaud.

the class PostActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Intent intent = getIntent();
    if (intent.getStringExtra(KlyphBundleExtras.EVENT_ID) != null) {
        elementId = intent.getStringExtra(KlyphBundleExtras.EVENT_ID);
        isEventMessage = true;
    } else if (intent.getStringExtra(KlyphBundleExtras.PAGE_ID) != null) {
        elementId = intent.getStringExtra(KlyphBundleExtras.PAGE_ID);
        isPageMessage = true;
    } else if (intent.getStringExtra(KlyphBundleExtras.GROUP_ID) != null) {
        elementId = intent.getStringExtra(KlyphBundleExtras.GROUP_ID);
        isGroupMessage = true;
    } else {
        elementId = KlyphSession.getSessionUserId();
    }
    Log.d("PostActivity", "event " + isEventMessage + " page " + isPageMessage + " group " + isGroupMessage);
    boolean shareLink = intent.getBooleanExtra(KlyphBundleExtras.SHARE, false);
    String action = intent.getAction();
    String type = intent.getType();
    setTitle(isEventMessage == false ? R.string.publish_new_status : R.string.publish_new_event_message);
    photoUris = new ArrayList<String>();
    messageTextView = (TextView) findViewById(R.id.message_textview);
    friendsTextView = (TextView) findViewById(R.id.friends_textview);
    placeTextView = (TextView) findViewById(R.id.place_textview);
    photosFragment = (PostPhotos) getFragmentManager().findFragmentById(R.id.photos_fragment);
    albumsFragment = (PostAlbums) getFragmentManager().findFragmentById(R.id.albums_fragment);
    linkFragment = (PostLink) getFragmentManager().findFragmentById(R.id.link_fragment);
    shareFragment = (PostShare) getFragmentManager().findFragmentById(R.id.share_fragment);
    getFragmentManager().beginTransaction().hide(photosFragment).commitAllowingStateLoss();
    getFragmentManager().beginTransaction().hide(albumsFragment).commitAllowingStateLoss();
    getFragmentManager().beginTransaction().hide(linkFragment).commitAllowingStateLoss();
    if (shareLink == true) {
        shareFragment.initWithIntent(getIntent());
        shareFragmentVisible = true;
    } else {
        getFragmentManager().beginTransaction().hide(shareFragment).commit();
    }
    if (isEventMessage == true) {
        LinearLayout buttonBar = (LinearLayout) findViewById(R.id.button_bar);
        buttonBar.setVisibility(View.GONE);
    } else {
        ImageButton placeDeleteButton = (ImageButton) findViewById(R.id.place_delete_button);
        ImageButton friendsDeleteButton = (ImageButton) findViewById(R.id.friends_delete_button);
        friendsButton = (ImageButton) findViewById(R.id.friends_button);
        photosButton = (ImageButton) findViewById(R.id.picture_button);
        placeButton = (ImageButton) findViewById(R.id.place_button);
        linkButton = (ImageButton) findViewById(R.id.link_button);
        privacyButton = (ImageButton) findViewById(R.id.privacy_button);
        placeDeleteButton.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                clearPlace();
                updateButtonStatus();
            }
        });
        friendsDeleteButton.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                clearFriends();
                updateButtonStatus();
            }
        });
        friendsButton.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                Intent intent = new Intent(PostActivity.this, FriendPickerActivity.class);
                if (friends != null && friends.size() > 0) {
                    ArrayList<String> ids = new ArrayList<String>();
                    ids.addAll(friends.keySet());
                    intent.putStringArrayListExtra(KlyphBundleExtras.FRIEND_PICKER_IDS, ids);
                }
                startActivityForResult(intent, FRIEND_PICKER);
            }
        });
        photosButton.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                startGallery();
            }
        });
        placeButton.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                startActivityForResult(new Intent(PostActivity.this, PlacePickerActivity.class), PLACE_PICKER);
            }
        });
        linkButton.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                linkFragment.reset();
                getFragmentManager().beginTransaction().show(linkFragment).commitAllowingStateLoss();
                linkFragmentVisible = true;
                updateButtonStatus();
            }
        });
        setPrivacyListenerApi11();
        setPrivacy(KlyphPreferences.getPrivacy());
        if (Intent.ACTION_SEND.equals(action) && type != null) {
            displayBackArrow(false);
            setAppIconBackToHomeEnabled(false);
            if ("text/plain".equals(type)) {
                String sharedText = intent.getStringExtra(Intent.EXTRA_TEXT);
                String sharedSubject = intent.getStringExtra(Intent.EXTRA_SUBJECT);
                if (sharedText != null) {
                    boolean isUrl = false;
                    try {
                        new URL(sharedText);
                        isUrl = true;
                    } catch (MalformedURLException e) {
                        isUrl = false;
                    }
                    if (isUrl == true) {
                        linkFragment.setUrl(sharedText);
                        linkFragment.setTitle(sharedSubject);
                        getFragmentManager().beginTransaction().show(linkFragment).commitAllowingStateLoss();
                    } else {
                        messageTextView.setText(sharedText);
                    }
                }
            } else if (type.startsWith("image/")) {
                Uri imageUri = (Uri) intent.getParcelableExtra(Intent.EXTRA_STREAM);
                if (imageUri != null) {
                    // Update UI to reflect image being shared
                    photoUris = new ArrayList<String>();
                    if (StringUtils.startsWith(imageUri.toString(), "content://")) {
                        photoUris.add(getRealPathFromURI(imageUri));
                    } else {
                        photoUris.add(imageUri.getPath());
                    }
                    photosFragment.setImages(photoUris);
                    getFragmentManager().beginTransaction().show(photosFragment).commitAllowingStateLoss();
                    photosFragment.updateLayout();
                }
            }
        } else if (Intent.ACTION_SEND_MULTIPLE.equals(action) && type != null) {
            displayBackArrow(false);
            setAppIconBackToHomeEnabled(false);
            if (type.startsWith("image/")) {
                ArrayList<Uri> imageUris = intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM);
                if (imageUris != null) {
                    // Update UI to reflect multiple images being shared
                    photoUris = new ArrayList<String>();
                    for (Uri uri : imageUris) {
                        if (StringUtils.startsWith(uri.toString(), "content://")) {
                            photoUris.add(getRealPathFromURI(uri));
                        } else {
                            photoUris.add(uri.getPath());
                        }
                    }
                    photosFragment.setImages(photoUris);
                    getFragmentManager().beginTransaction().show(photosFragment).commitAllowingStateLoss();
                    photosFragment.updateLayout();
                }
            }
        } else {
            Log.d("PostActivity", "Received other");
        }
        updateButtonStatus();
        privacyButton.setVisibility(isGroupMessage == true || isEventMessage == true ? View.GONE : View.VISIBLE);
    }
    if (KlyphData.getFriendLists() == null) {
        new AsyncRequest(Query.FRIEND_LISTS, "", "", new Callback() {

            @Override
            public void onComplete(Response response) {
                onRequestComplete(response);
            }
        }).execute();
    }
}
Also used : MalformedURLException(java.net.MalformedURLException) AsyncRequest(com.abewy.android.apps.klyph.request.AsyncRequest) ArrayList(java.util.ArrayList) Intent(android.content.Intent) View(android.view.View) TextView(android.widget.TextView) Uri(android.net.Uri) URL(java.net.URL) Response(com.abewy.android.apps.klyph.core.request.Response) ImageButton(android.widget.ImageButton) Callback(com.abewy.android.apps.klyph.core.request.BaseAsyncRequest.Callback) IFbPermissionCallback(com.abewy.android.apps.klyph.facebook.IFbPermissionCallback) TagCallback(com.abewy.android.apps.klyph.util.TextViewUtil.TagCallback) LinearLayout(android.widget.LinearLayout)

Example 93 with ImageButton

use of android.widget.ImageButton in project Klyph by jonathangerbaud.

the class PostPhotosActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    photoUris = new ArrayList<String>();
    setTitle(R.string.publish_new_photos);
    messageTextView = (TextView) findViewById(R.id.message_textview);
    friendsTextView = (TextView) findViewById(R.id.friends_textview);
    placeTextView = (TextView) findViewById(R.id.place_textview);
    photosFragment = (PostPhotos) getFragmentManager().findFragmentById(R.id.photos_fragment);
    albumsFragment = (AlbumSpinner) getFragmentManager().findFragmentById(R.id.albums_fragment);
    albumsFragment.setDefaultAlbumId(getIntent().getExtras().getString(KlyphBundleExtras.ALBUM_ID));
    albumsFragment.setOnSelectionChangeListener(this);
    getFragmentManager().beginTransaction().hide(photosFragment).commit();
    ImageButton placeDeleteButton = (ImageButton) findViewById(R.id.place_delete_button);
    ImageButton friendsDeleteButton = (ImageButton) findViewById(R.id.friends_delete_button);
    friendsButton = (ImageButton) findViewById(R.id.friends_button);
    ImageButton add = (ImageButton) findViewById(R.id.add_button);
    ImageButton place = (ImageButton) findViewById(R.id.place_button);
    privacyButton = (ImageButton) findViewById(R.id.privacy_button);
    privacyButton.setEnabled(false);
    placeDeleteButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            clearPlace();
        }
    });
    friendsDeleteButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            clearFriends();
        }
    });
    friendsButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Intent intent = new Intent(PostPhotosActivity.this, FriendPickerActivity.class);
            if (friends != null && friends.size() > 0) {
                ArrayList<String> ids = new ArrayList<String>();
                ids.addAll(friends.keySet());
                intent.putStringArrayListExtra(KlyphBundleExtras.FRIEND_PICKER_IDS, ids);
            }
            startActivityForResult(intent, FRIEND_PICKER);
        }
    });
    add.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            startGallery();
        }
    });
    place.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            startActivityForResult(new Intent(PostPhotosActivity.this, PlacePickerActivity.class), PLACE_PICKER);
        }
    });
    setPrivacyListenerApi11();
    setPrivacy(KlyphPreferences.getPrivacy());
    if (KlyphData.getFriendLists() == null) {
        new AsyncRequest(Query.FRIEND_LISTS, "", "", new Callback() {

            @Override
            public void onComplete(Response response) {
                onRequestComplete(response);
            }
        }).execute();
    }
}
Also used : Response(com.abewy.android.apps.klyph.core.request.Response) ImageButton(android.widget.ImageButton) AsyncRequest(com.abewy.android.apps.klyph.request.AsyncRequest) IFbPermissionCallback(com.abewy.android.apps.klyph.facebook.IFbPermissionCallback) Callback(com.abewy.android.apps.klyph.core.request.BaseAsyncRequest.Callback) TagCallback(com.abewy.android.apps.klyph.util.TextViewUtil.TagCallback) ArrayList(java.util.ArrayList) Intent(android.content.Intent) View(android.view.View) TextView(android.widget.TextView)

Example 94 with ImageButton

use of android.widget.ImageButton in project QuickReturn by lawloretienne.

the class QuickReturnFacebookActivity method onCreate.

// endregion
// region Lifecycle Methods
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_quick_return_facebook);
    ButterKnife.bind(this);
    mSectionsPagerAdapter = new SectionsPagerAdapter(getFragmentManager());
    // Set up the ViewPager with the sections adapter.
    mViewPager.setAdapter(mSectionsPagerAdapter);
    mTabs.setAllCaps(false);
    mTabs.setShouldExpand(true);
    //        mTabs.setTextSize(QuickReturnUtils.dp2px(this, 16));
    //        mTabs.setTabBackground(R.drawable.selector_bg_tab);
    mTabs.setIndicatorColorResource(R.color.dark_slate_blue);
    mTabs.setIndicatorHeight(QuickReturnUtils.dp2px(this, 6));
    mTabs.setDividerColor(getResources().getColor(android.R.color.transparent));
    mTabs.setUnderlineHeight(QuickReturnUtils.dp2px(this, 0));
    //        mTabs.setBackgroundColor(getResources().getColor(R.color.indigo));
    mTabs.setOnPageChangeListener(mTabsOnPageChangeListener);
    mTabs.setViewPager(mViewPager);
    // Set first tab selected
    mTabsLinearLayout = ((LinearLayout) mTabs.getChildAt(0));
    ImageButton ib = (ImageButton) mTabsLinearLayout.getChildAt(0);
    ib.setImageResource(R.drawable.ic_action_news_highlighted);
}
Also used : ImageButton(android.widget.ImageButton) LinearLayout(android.widget.LinearLayout)

Example 95 with ImageButton

use of android.widget.ImageButton in project sharelock-android by auth0.

the class AboutActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_about);
    ImageButton newButton = (ImageButton) findViewById(R.id.about_new_button);
    newButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            startNewSecretActivity();
        }
    });
    final Toolbar toolbar = (Toolbar) findViewById(R.id.about_toolbar);
    setSupportActionBar(toolbar);
    mFlexibleSpaceImageHeight = getResources().getDimensionPixelSize(R.dimen.about_flexible_space_height);
    mActionBarSize = getActionBarSize();
    // Even when the top gap has began to change, header bar still can move
    // within mIntersectionHeight.
    mIntersectionHeight = getResources().getDimensionPixelSize(R.dimen.about_intersection_height);
    mHeader = findViewById(R.id.about_header);
    mHeaderBar = findViewById(R.id.about_header_bar);
    mHeaderBackground = findViewById(R.id.about_header_background);
    final ObservableScrollView scrollable = createScrollable();
    final TextView subtitleText = (TextView) findViewById(R.id.about_subtitle);
    subtitleText.setText(getString(R.string.about_subtitle));
    setTitle(null);
    ScrollUtils.addOnGlobalLayoutListener((View) scrollable, new Runnable() {

        @Override
        public void run() {
            mReady = true;
            updateViews(scrollable.getCurrentScrollY(), false);
        }
    });
    TextView aboutText = (TextView) findViewById(R.id.container);
    aboutText.setText(Html.fromHtml(getString(R.string.sharelock_about)));
}
Also used : ImageButton(android.widget.ImageButton) ObservableScrollView(com.github.ksoichiro.android.observablescrollview.ObservableScrollView) TextView(android.widget.TextView) TextView(android.widget.TextView) ObservableScrollView(com.github.ksoichiro.android.observablescrollview.ObservableScrollView) View(android.view.View) Toolbar(android.support.v7.widget.Toolbar)

Aggregations

ImageButton (android.widget.ImageButton)158 View (android.view.View)112 TextView (android.widget.TextView)87 ImageView (android.widget.ImageView)55 Button (android.widget.Button)27 ListView (android.widget.ListView)25 AdapterView (android.widget.AdapterView)24 OnClickListener (android.view.View.OnClickListener)21 LinearLayout (android.widget.LinearLayout)21 Intent (android.content.Intent)19 RelativeLayout (android.widget.RelativeLayout)13 DialogInterface (android.content.DialogInterface)12 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 Drawable (android.graphics.drawable.Drawable)7 RecyclerView (android.support.v7.widget.RecyclerView)7