Search in sources :

Example 16 with FlexboxLayoutManager

use of com.google.android.flexbox.FlexboxLayoutManager in project odysee-android by OdyseeTeam.

the class PublishFormFragment method onCreateView.

public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View root = inflater.inflate(R.layout.fragment_publish_form, container, false);
    scrollView = root.findViewById(R.id.publish_form_scroll_view);
    progressLoadingChannels = root.findViewById(R.id.publish_form_loading_channels);
    progressPublish = root.findViewById(R.id.publish_form_publishing);
    channelSpinner = root.findViewById(R.id.publish_form_channel_spinner);
    mediaContainer = root.findViewById(R.id.publish_form_media_container);
    inputTagFilter = root.findViewById(R.id.form_tag_filter_input);
    noTagsView = root.findViewById(R.id.form_no_added_tags);
    noTagResultsView = root.findViewById(R.id.form_no_tag_results);
    textInlineAddressInvalid = root.findViewById(R.id.publish_form_inline_address_invalid);
    inlineDepositBalanceContainer = root.findViewById(R.id.publish_form_inline_balance_container);
    inlineDepositBalanceValue = root.findViewById(R.id.publish_form_inline_balance_value);
    cardVideoOptimization = root.findViewById(R.id.publish_form_video_opt_card);
    optimizationProgress = root.findViewById(R.id.publish_form_video_opt_progress);
    optimizationRealProgress = root.findViewById(R.id.publish_form_video_opt_real_progress);
    textOptimizationProgress = root.findViewById(R.id.publish_form_video_opt_progress_text);
    textOptimizationStatus = root.findViewById(R.id.publish_form_video_opt_status);
    textOptimizationElapsed = root.findViewById(R.id.publish_form_video_opt_elapsed);
    layoutExtraFields = root.findViewById(R.id.publish_form_extra_options_container);
    linkShowExtraFields = root.findViewById(R.id.publish_form_toggle_extra);
    layoutPrice = root.findViewById(R.id.publish_form_price_container);
    textNoPrice = root.findViewById(R.id.publish_form_no_price);
    switchPrice = root.findViewById(R.id.publish_form_price_switch);
    uploadProgress = root.findViewById(R.id.publish_form_thumbnail_upload_progress);
    imageThumbnail = root.findViewById(R.id.publish_form_thumbnail_preview);
    linkGenerateAddress = root.findViewById(R.id.publish_form_generate_address);
    inputTitle = root.findViewById(R.id.publish_form_input_title);
    inputDescription = root.findViewById(R.id.publish_form_input_description);
    inputPrice = root.findViewById(R.id.publish_form_input_price);
    inputAddress = root.findViewById(R.id.publish_form_input_address);
    inputDeposit = root.findViewById(R.id.publish_form_input_deposit);
    inputOtherLicenseDescription = root.findViewById(R.id.publish_form_input_license_other);
    layoutOtherLicenseDescription = root.findViewById(R.id.publish_form_license_other_layout);
    priceCurrencySpinner = root.findViewById(R.id.publish_form_currency_spinner);
    languageSpinner = root.findViewById(R.id.publish_form_language_spinner);
    licenseSpinner = root.findViewById(R.id.publish_form_license_spinner);
    linkPublishCancel = root.findViewById(R.id.publish_form_cancel);
    buttonPublish = root.findViewById(R.id.publish_form_publish_button);
    Context context = getContext();
    FlexboxLayoutManager flm1 = new FlexboxLayoutManager(context);
    FlexboxLayoutManager flm2 = new FlexboxLayoutManager(context);
    FlexboxLayoutManager flm3 = new FlexboxLayoutManager(context);
    addedTagsList = root.findViewById(R.id.form_added_tags);
    addedTagsList.setLayoutManager(flm1);
    suggestedTagsList = root.findViewById(R.id.form_suggested_tags);
    suggestedTagsList.setLayoutManager(flm2);
    root.findViewById(R.id.form_mature_tags_container).setVisibility(View.VISIBLE);
    matureTagsList = root.findViewById(R.id.form_mature_tags);
    matureTagsList.setLayoutManager(flm3);
    addedTagsAdapter = new TagListAdapter(new ArrayList<>(), context);
    addedTagsAdapter.setCustomizeMode(TagListAdapter.CUSTOMIZE_MODE_REMOVE);
    addedTagsAdapter.setClickListener(this);
    addedTagsList.setAdapter(addedTagsAdapter);
    suggestedTagsAdapter = new TagListAdapter(new ArrayList<>(), getContext());
    suggestedTagsAdapter.setCustomizeMode(TagListAdapter.CUSTOMIZE_MODE_ADD);
    suggestedTagsAdapter.setClickListener(this);
    suggestedTagsList.setAdapter(suggestedTagsAdapter);
    matureTagsAdapter = new TagListAdapter(Helper.getTagObjectsForTags(Predefined.PUBLISH_MATURE_TAGS), context);
    matureTagsAdapter.setCustomizeMode(TagListAdapter.CUSTOMIZE_MODE_ADD);
    matureTagsAdapter.setClickListener(this);
    matureTagsList.setAdapter(matureTagsAdapter);
    initUi();
    return root;
}
Also used : Context(android.content.Context) TagListAdapter(com.odysee.app.adapter.TagListAdapter) FlexboxLayoutManager(com.google.android.flexbox.FlexboxLayoutManager) NestedScrollView(androidx.core.widget.NestedScrollView) ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView) RecyclerView(androidx.recyclerview.widget.RecyclerView) CardView(androidx.cardview.widget.CardView) TextView(android.widget.TextView)

Example 17 with FlexboxLayoutManager

use of com.google.android.flexbox.FlexboxLayoutManager in project wanandroid by KnightAndroid.

the class SearchActivity method initView.

@Override
public void initView(Bundle savedInstanceState) {
    mDatabind.setClick(new ProcyClick());
    showLoading(mDatabind.homeSearchhotRv);
    mHomeHotKeyAdapter = new HomeHotKeyAdapter(new ArrayList<>());
    FlexboxLayoutManager flexboxLayoutManager = new FlexboxLayoutManager(this);
    // 方向 主轴为水平方向,起点在左端
    flexboxLayoutManager.setFlexDirection(FlexDirection.ROW);
    // 左对齐
    flexboxLayoutManager.setJustifyContent(JustifyContent.FLEX_START);
    SetInitCustomView.initSwipeRecycleview(mDatabind.homeSearchhotRv, flexboxLayoutManager, mHomeHotKeyAdapter, false);
    SystemUtils.showDelaySoftKeyBoard(mDatabind.homeSearchEt);
    mSearchRecordAdapter = new SearchRecordAdapter(new ArrayList<>());
    SetInitCustomView.initSwipeRecycleview(mDatabind.homeSearchhistroyKeywordRv, new LinearLayoutManager(this), mSearchRecordAdapter, false);
    mDatabind.homeSearchEt.setOnEditorActionListener(new TextView.OnEditorActionListener() {

        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (actionId == EditorInfo.IME_ACTION_SEARCH) {
                keyword = mDatabind.homeSearchEt.getText().toString().trim();
                if (TextUtils.isEmpty(keyword)) {
                    ToastUtils.show(R.string.home_input_content_search);
                } else {
                    AppConfig.SEARCH_KEYWORD = keyword;
                    ARouterUtils.startActivity(RoutePathActivity.Home.searchResult, "keyword", keyword);
                }
                return true;
            }
            return false;
        }
    });
    SystemUtils.seteditTextChangeListener(mDatabind.homeSearchEt, mDatabind.homeTvsearchCancel);
    initClickListener();
}
Also used : KeyEvent(android.view.KeyEvent) HomeHotKeyAdapter(com.knight.wanandroid.module_home.module_adapter.HomeHotKeyAdapter) FlexboxLayoutManager(com.google.android.flexbox.FlexboxLayoutManager) ArrayList(java.util.ArrayList) TextView(android.widget.TextView) SearchRecordAdapter(com.knight.wanandroid.module_home.module_adapter.SearchRecordAdapter) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager)

Example 18 with FlexboxLayoutManager

use of com.google.android.flexbox.FlexboxLayoutManager in project lnch by italankin.

the class BaseFolderFragment method onViewCreated.

@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
    alignFrameView = view.findViewById(R.id.folder_frame);
    container = view.findViewById(R.id.folder_container);
    container.setClipToOutline(true);
    list = view.findViewById(R.id.folder_list);
    title = view.findViewById(R.id.folder_title);
    if (isFullscreen) {
        DisplayMetrics dm = getResources().getDisplayMetrics();
        container.setMinimumWidth((int) (dm.widthPixels * MIN_FULLSCREEN_WIDTH_FACTOR));
        container.setMinimumHeight((int) (dm.heightPixels * MIN_FULLSCREEN_HEIGHT_FACTOR));
    } else {
        Point anchor = requireArguments().getParcelable(ARG_ANCHOR);
        alignFrameView.setAnchorPoint(anchor.x, anchor.y);
    }
    alignFrameView.post(() -> {
        WindowInsets insets = alignFrameView.getRootWindowInsets();
        alignFrameView.setPaddingRelative(alignFrameView.getPaddingStart(), insets.getStableInsetTop(), alignFrameView.getPaddingEnd(), insets.getStableInsetBottom());
    });
    alignFrameView.setOnClickListener(v -> dismiss());
    adapter = new HomeAdapter.Builder(requireContext()).add(new AppDescriptorUiAdapter(this, true)).add(new PinnedShortcutDescriptorUiAdapter(this, true)).add(new IntentDescriptorUiAdapter(this, true)).add(new DeepShortcutDescriptorUiAdapter(this, true)).add(new EmptyFolderDescriptorUiAdapter()).setHasStableIds(true).create();
    list.setLayoutManager(new FlexboxLayoutManager(requireContext(), FlexDirection.ROW));
    list.setAdapter(adapter);
    initDelegates(requireContext());
    getPresenter().loadFolder(folderId);
}
Also used : AppDescriptorUiAdapter(com.italankin.lnch.feature.home.adapter.AppDescriptorUiAdapter) WindowInsets(android.view.WindowInsets) DeepShortcutDescriptorUiAdapter(com.italankin.lnch.feature.home.adapter.DeepShortcutDescriptorUiAdapter) FlexboxLayoutManager(com.google.android.flexbox.FlexboxLayoutManager) PinnedShortcutDescriptorUiAdapter(com.italankin.lnch.feature.home.adapter.PinnedShortcutDescriptorUiAdapter) EmptyFolderDescriptorUiAdapter(com.italankin.lnch.feature.home.apps.folder.empty.EmptyFolderDescriptorUiAdapter) IntentDescriptorUiAdapter(com.italankin.lnch.feature.home.adapter.IntentDescriptorUiAdapter) Point(android.graphics.Point) DisplayMetrics(android.util.DisplayMetrics)

Example 19 with FlexboxLayoutManager

use of com.google.android.flexbox.FlexboxLayoutManager in project MusicLake by caiyonglong.

the class SearchActivity method showHotSearchInfo.

@Override
public void showHotSearchInfo(@NonNull List<HotSearchBean> result) {
    if (result.size() > 0) {
        hotSearchView.setVisibility(View.VISIBLE);
        AnimationUtils.animateView(hotSearchView, true, 600);
    } else
        hotSearchView.setVisibility(View.GONE);
    if (hotSearchAdapter == null) {
        hotSearchAdapter = new HotSearchAdapter(result);
        FlexboxLayoutManager layoutManager = new FlexboxLayoutManager(this);
        layoutManager.setFlexDirection(FlexDirection.ROW);
        layoutManager.setJustifyContent(JustifyContent.FLEX_START);
        hotSearchRcv.setLayoutManager(layoutManager);
        hotSearchRcv.setAdapter(hotSearchAdapter);
        hotSearchAdapter.bindToRecyclerView(hotSearchRcv);
        hotSearchAdapter.setOnItemClickListener((adapter, view, position) -> {
        });
        hotSearchAdapter.setOnItemChildClickListener((adapter, view, position) -> {
            if (view.getId() == R.id.titleTv) {
                searchEditText.setText(result.get(position).getTitle());
                searchEditText.setSelection(result.get(position).getTitle().length());
                search(result.get(position).getTitle());
            }
        });
    } else {
        hotSearchAdapter.setNewData(result);
    }
}
Also used : FlexboxLayoutManager(com.google.android.flexbox.FlexboxLayoutManager)

Example 20 with FlexboxLayoutManager

use of com.google.android.flexbox.FlexboxLayoutManager in project Life-Dots by XilinJia.

the class MainActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    binding = DataBindingUtil.setContentView(this, R.layout.activity_main_content);
    setContent(binding.getRoot());
    // initNavigation();
    viewModel = new ViewModelProvider(this).get(DetailViewModel.class);
    mQHandler = new MainAsyncQueryHandler(getApplicationContext().getContentResolver(), viewModel);
    // recovering the instance state
    if (savedInstanceState != null) {
        mCurrentPhotoPath = savedInstanceState.getString("currentPhotoPath");
    }
    setupViewPager(binding.viewpager);
    binding.tablayout.setupWithViewPager(binding.viewpager);
    binding.row.background.setOnLongClickListener(this);
    binding.row.background.setOnClickListener(v -> {
        if (PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).getBoolean(SettingsActivity.KEY_PREF_DISABLE_CURRENT, true)) {
            ActivityHelper.helper.setCurrentActivity(null);
        } else {
            Intent i = new Intent(MainActivity.this, EventDetailActivity.class);
            // no diaryEntryID will edit the last one
            startActivity(i);
        }
    });
    TypedValue value = new TypedValue();
    getTheme().resolveAttribute(android.R.attr.listPreferredItemHeightSmall, value, true);
    layoutManager = new FlexboxLayoutManager(this);
    layoutManager.setFlexDirection(FlexDirection.ROW);
    layoutManager.setJustifyContent(JustifyContent.FLEX_START);
    binding.selectRecycler.setLayoutManager(layoutManager);
    Objects.requireNonNull(Objects.requireNonNull(getSupportActionBar())).setSubtitle(getResources().getString(R.string.activity_subtitle_main));
    likelyhoodSort();
    binding.fabAttachPicture.setOnClickListener(v -> {
        // Handle the click on the FAB
        if (viewModel.currentActivity() != null && viewModel.currentActivity().getValue() != null) {
            Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
            if (takePictureIntent.resolveActivity(getPackageManager()) != null) {
                File photoFile = GraphicsHelper.createImageFile();
                Log.i(TAG, "create file for image capture " + photoFile.getAbsolutePath());
                // Continue only if the File was successfully created
                // Save a file: path for use with ACTION_VIEW intents
                mCurrentPhotoPath = photoFile.getAbsolutePath();
                Uri photoURI = FileProvider.getUriForFile(MainActivity.this, BuildConfig.APPLICATION_ID + ".fileprovider", photoFile);
                takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoURI);
                takePictureIntent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
                startActivityForResult(takePictureIntent, REQUEST_IMAGE_CAPTURE);
            }
        } else
            Toast.makeText(MainActivity.this, getResources().getString(R.string.no_active_activity_error), Toast.LENGTH_LONG).show();
    });
    PackageManager pm = getPackageManager();
    if (pm.hasSystemFeature(PackageManager.FEATURE_CAMERA_ANY))
        binding.fabAttachPicture.show();
    else
        binding.fabAttachPicture.hide();
    // Get the intent, verify the action and get the search query
    Intent intent = getIntent();
    if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
        String query = intent.getStringExtra(SearchManager.QUERY);
        filterActivityView(query);
    }
    // TODO: this is crazy to call onActivityChagned here,
    // as it reloads the statistics and refills the viewModel...
    // Completely against the idea of the viewmodel :-(
    onActivityChanged();
/* do this at the very end to ensure that no Loader finishes its data loading before */
}
Also used : DetailViewModel(com.mdiqentw.lifedots.model.DetailViewModel) PackageManager(android.content.pm.PackageManager) FlexboxLayoutManager(com.google.android.flexbox.FlexboxLayoutManager) Intent(android.content.Intent) File(java.io.File) Uri(android.net.Uri) ViewModelProvider(androidx.lifecycle.ViewModelProvider) TypedValue(android.util.TypedValue)

Aggregations

FlexboxLayoutManager (com.google.android.flexbox.FlexboxLayoutManager)20 View (android.view.View)8 RecyclerView (androidx.recyclerview.widget.RecyclerView)8 TextView (android.widget.TextView)7 ImageView (android.widget.ImageView)5 ArrayList (java.util.ArrayList)5 Context (android.content.Context)4 TagListAdapter (com.odysee.app.adapter.TagListAdapter)4 NestedScrollView (androidx.core.widget.NestedScrollView)3 SuppressLint (android.annotation.SuppressLint)2 Editable (android.text.Editable)2 TextWatcher (android.text.TextWatcher)2 AdapterView (android.widget.AdapterView)2 LinearLayoutManager (androidx.recyclerview.widget.LinearLayoutManager)2 MaterialButton (com.google.android.material.button.MaterialButton)2 MainActivity (com.odysee.app.MainActivity)2 Claim (com.odysee.app.model.Claim)2 Intent (android.content.Intent)1 PackageManager (android.content.pm.PackageManager)1 Paint (android.graphics.Paint)1