當前位置: 首頁>>代碼示例>>Java>>正文


Java PhotoAlbumPickerActivity類代碼示例

本文整理匯總了Java中org.telegram.ui.PhotoAlbumPickerActivity的典型用法代碼示例。如果您正苦於以下問題:Java PhotoAlbumPickerActivity類的具體用法?Java PhotoAlbumPickerActivity怎麽用?Java PhotoAlbumPickerActivity使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


PhotoAlbumPickerActivity類屬於org.telegram.ui包,在下文中一共展示了PhotoAlbumPickerActivity類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: openGallery

import org.telegram.ui.PhotoAlbumPickerActivity; //導入依賴的package包/類
public void openGallery() {
    if (Build.VERSION.SDK_INT >= 23 && parentFragment != null && parentFragment.getParentActivity() != null) {
        if (parentFragment.getParentActivity().checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
            parentFragment.getParentActivity().requestPermissions(new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, 4);
            return;
        }
    }
    PhotoAlbumPickerActivity fragment = new PhotoAlbumPickerActivity(true, false, null);
    fragment.setDelegate(new PhotoAlbumPickerActivity.PhotoAlbumPickerActivityDelegate() {
        @Override
        public void didSelectPhotos(ArrayList<String> photos, ArrayList<String> captions, ArrayList<MediaController.SearchImage> webPhotos) {
            if (!photos.isEmpty()) {
                Bitmap bitmap = ImageLoader.loadBitmap(photos.get(0), null, 800, 800, true);
                processBitmap(bitmap);
            }
        }

        @Override
        public void startPhotoSelectActivity() {
            try {
                Intent photoPickerIntent = new Intent(Intent.ACTION_GET_CONTENT);
                photoPickerIntent.setType("image/*");
                parentFragment.startActivityForResult(photoPickerIntent, 14);
            } catch (Exception e) {
                FileLog.e("tmessages", e);
            }
        }

        @Override
        public boolean didSelectVideo(String path) {
            return true;
        }
    });
    parentFragment.presentFragment(fragment);
}
 
開發者ID:MLNO,項目名稱:airgram,代碼行數:36,代碼來源:AvatarUpdater.java

示例2: openGallery

import org.telegram.ui.PhotoAlbumPickerActivity; //導入依賴的package包/類
public void openGallery() {
    if (Build.VERSION.SDK_INT >= 23 && parentFragment != null && parentFragment.getParentActivity() != null) {
        if (parentFragment.getParentActivity().checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
            parentFragment.getParentActivity().requestPermissions(new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, 4);
            return;
        }
    }
    PhotoAlbumPickerActivity fragment = new PhotoAlbumPickerActivity(true, false, false, null);
    fragment.setDelegate(new PhotoAlbumPickerActivity.PhotoAlbumPickerActivityDelegate() {
        @Override
        public void didSelectPhotos(ArrayList<String> photos, ArrayList<String> captions, ArrayList<ArrayList<TLRPC.InputDocument>> masks, ArrayList<MediaController.SearchImage> webPhotos) {
            if (!photos.isEmpty()) {
                Bitmap bitmap = ImageLoader.loadBitmap(photos.get(0), null, 800, 800, true);
                processBitmap(bitmap);
            }
        }

        @Override
        public void startPhotoSelectActivity() {
            try {
                Intent photoPickerIntent = new Intent(Intent.ACTION_GET_CONTENT);
                photoPickerIntent.setType("image/*");
                parentFragment.startActivityForResult(photoPickerIntent, 14);
            } catch (Exception e) {
                FileLog.e("tmessages", e);
            }
        }

        @Override
        public boolean didSelectVideo(String path) {
            return true;
        }
    });
    parentFragment.presentFragment(fragment);
}
 
開發者ID:pooyafaroka,項目名稱:PlusGram,代碼行數:36,代碼來源:AvatarUpdater.java

示例3: openGallery

import org.telegram.ui.PhotoAlbumPickerActivity; //導入依賴的package包/類
public void openGallery() {
    if (Build.VERSION.SDK_INT >= 23 && parentFragment != null && parentFragment.getParentActivity() != null) {
        if (parentFragment.getParentActivity().checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
            parentFragment.getParentActivity().requestPermissions(new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, 4);
            return;
        }
    }
    PhotoAlbumPickerActivity fragment = new PhotoAlbumPickerActivity(true, false, false, null);
    fragment.setDelegate(new PhotoAlbumPickerActivity.PhotoAlbumPickerActivityDelegate() {
        @Override
        public void didSelectPhotos(ArrayList<SendMessagesHelper.SendingMediaInfo> photos) {
            if (!photos.isEmpty()) {
                Bitmap bitmap = ImageLoader.loadBitmap(photos.get(0).path, null, 800, 800, true);
                processBitmap(bitmap);
            }
        }

        @Override
        public void startPhotoSelectActivity() {
            try {
                Intent photoPickerIntent = new Intent(Intent.ACTION_GET_CONTENT);
                photoPickerIntent.setType("image/*");
                parentFragment.startActivityForResult(photoPickerIntent, 14);
            } catch (Exception e) {
                FileLog.e(e);
            }
        }
    });
    parentFragment.presentFragment(fragment);
}
 
開發者ID:DrKLO,項目名稱:Telegram,代碼行數:31,代碼來源:AvatarUpdater.java


注:本文中的org.telegram.ui.PhotoAlbumPickerActivity類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。