Search in sources :

Example 6 with Nullable

use of android.support.annotation.Nullable in project storymaker by StoryMaker.

the class ProjectsProvider method query.

@Nullable
@Override
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
    mCacheWordHandler.connectToService();
    setTimer(60000);
    SQLiteDatabase db = getDB();
    if (db != null) {
        int uriType = sURIMatcher.match(uri);
        switch(uriType) {
            case PROJECT_ID:
                return (new ProjectTable(db)).queryOne(getContext(), uri, projection, selection, selectionArgs, sortOrder);
            case PROJECTS:
                return (new ProjectTable(db)).queryAll(getContext(), uri, projection, selection, selectionArgs, sortOrder);
            case SCENE_ID:
                return (new SceneTable(db)).queryOne(getContext(), uri, projection, selection, selectionArgs, sortOrder);
            case SCENES:
                return (new SceneTable(db)).queryAll(getContext(), uri, projection, selection, selectionArgs, sortOrder);
            case LESSON_ID:
                return (new LessonTable(db)).queryOne(getContext(), uri, projection, selection, selectionArgs, sortOrder);
            case LESSONS:
                return (new LessonTable(db)).queryAll(getContext(), uri, projection, selection, selectionArgs, sortOrder);
            case MEDIA_ID:
                return (new MediaTable(db)).queryOne(getContext(), uri, projection, selection, selectionArgs, sortOrder);
            case MEDIA:
                return (new MediaTable(db)).queryAll(getContext(), uri, projection, selection, selectionArgs, sortOrder);
            case AUTH_ID:
                return (new AuthTable(db)).queryOne(getContext(), uri, projection, selection, selectionArgs, sortOrder);
            case AUTH:
                return (new AuthTable(db)).queryAll(getContext(), uri, projection, selection, selectionArgs, sortOrder);
            case TAG_ID:
                return (new TagTable(db)).queryOne(getContext(), uri, projection, selection, selectionArgs, sortOrder);
            case TAGS:
                return (new TagTable(db)).queryAll(getContext(), uri, projection, selection, selectionArgs, sortOrder);
            case DISTINCT_TAG_ID:
                return (new TagTable(db)).queryOneDistinct(getContext(), uri, projection, selection, selectionArgs, sortOrder);
            case DISTINCT_TAGS:
                return (new TagTable(db)).queryAllDistinct(getContext(), uri, projection, selection, selectionArgs, sortOrder);
            case JOB_ID:
                return (new JobTable(db)).queryOne(getContext(), uri, projection, selection, selectionArgs, sortOrder);
            case JOBS:
                return (new JobTable(db)).queryAll(getContext(), uri, projection, selection, selectionArgs, sortOrder);
            case PUBLISH_JOB_ID:
                return (new PublishJobTable(db)).queryOne(getContext(), uri, projection, selection, selectionArgs, sortOrder);
            case PUBLISH_JOBS:
                return (new PublishJobTable(db)).queryAll(getContext(), uri, projection, selection, selectionArgs, sortOrder);
            case AUDIO_CLIP_ID:
                return (new AudioClipTable(db)).queryOne(getContext(), uri, projection, selection, selectionArgs, sortOrder);
            case AUDIO_CLIPS:
                return (new AudioClipTable(db)).queryAll(getContext(), uri, projection, selection, selectionArgs, sortOrder);
            default:
                throw new IllegalArgumentException("Unknown URI");
        }
    }
    return null;
}
Also used : SceneTable(org.storymaker.app.model.SceneTable) PublishJobTable(org.storymaker.app.model.PublishJobTable) JobTable(org.storymaker.app.model.JobTable) PublishJobTable(org.storymaker.app.model.PublishJobTable) MediaTable(org.storymaker.app.model.MediaTable) SQLiteDatabase(net.sqlcipher.database.SQLiteDatabase) AudioClipTable(org.storymaker.app.model.AudioClipTable) AuthTable(org.storymaker.app.model.AuthTable) TagTable(org.storymaker.app.model.TagTable) ProjectTable(org.storymaker.app.model.ProjectTable) LessonTable(org.storymaker.app.model.LessonTable) Nullable(android.support.annotation.Nullable)

Example 7 with Nullable

use of android.support.annotation.Nullable in project material-intro-screen by TangoAgency.

the class SlideFragment method onCreateView.

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_slide, container, false);
    titleTextView = (TextView) view.findViewById(R.id.txt_title_slide);
    descriptionTextView = (TextView) view.findViewById(R.id.txt_description_slide);
    imageView = (ImageView) view.findViewById(R.id.image_slide);
    initializeView();
    return view;
}
Also used : ImageView(android.widget.ImageView) TextView(android.widget.TextView) View(android.view.View) Nullable(android.support.annotation.Nullable)

Example 8 with Nullable

use of android.support.annotation.Nullable in project material-intro-screen by TangoAgency.

the class CustomSlide method onCreateView.

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    final View view = inflater.inflate(R.layout.fragment_custom_slide, container, false);
    checkBox = (CheckBox) view.findViewById(R.id.checkBox);
    return view;
}
Also used : View(android.view.View) Nullable(android.support.annotation.Nullable)

Example 9 with Nullable

use of android.support.annotation.Nullable in project Reader by TheKeeperOfPie.

the class FragmentNewPost method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    final View view = inflater.inflate(R.layout.fragment_new_post, container, false);
    layoutCoordinator = (CoordinatorLayout) view.findViewById(R.id.layout_coordinator);
    layoutAppBar = (AppBarLayout) view.findViewById(R.id.layout_app_bar);
    scrollText = (NestedScrollView) view.findViewById(R.id.scroll_text);
    textInfo = (TextView) view.findViewById(R.id.text_info);
    textSubmit = (TextView) view.findViewById(R.id.text_submit);
    editTextTitle = (EditText) view.findViewById(R.id.edit_title);
    editTextBody = (EditText) view.findViewById(R.id.edit_body);
    toolbar = (Toolbar) view.findViewById(R.id.toolbar);
    toolbar.setTitle(getString(R.string.new_post));
    toolbar.setTitleTextColor(themer.getColorFilterPrimary().getColor());
    toolbar.setNavigationIcon(R.drawable.ic_arrow_back_white_24dp);
    toolbar.setNavigationOnClickListener(v -> {
        UtilsInput.hideKeyboard(editTextBody);
        mListener.onNavigationBackClick();
    });
    toolbar.getNavigationIcon().mutate().setColorFilter(themer.getColorFilterPrimary());
    setUpOptionsMenu();
    textInfo.setText(getString(R.string.submitting_post, getArguments().getString(SUBREDDIT), getArguments().getString(USER)));
    String submitTextHtml = getArguments().getString(SUBMIT_TEXT_HTML);
    Log.d(TAG, "submitTextHtml: " + submitTextHtml);
    if (TextUtils.isEmpty(submitTextHtml) || "null".equals(submitTextHtml)) {
        textSubmit.setVisibility(View.GONE);
    } else {
        textSubmit.setText(UtilsReddit.getFormattedHtml(submitTextHtml));
    }
    textSubmit.setMovementMethod(LinkMovementMethod.getInstance());
    if (Reddit.PostType.LINK == postType) {
        editTextBody.setHint("URL");
    } else {
        editTextBody.setHint("Text");
    }
    View.OnFocusChangeListener onFocusChangeListener = (v, hasFocus) -> {
        if (hasFocus) {
            AppBarLayout.Behavior behaviorAppBar = (AppBarLayout.Behavior) ((CoordinatorLayout.LayoutParams) layoutAppBar.getLayoutParams()).getBehavior();
            behaviorAppBar.onNestedFling(layoutCoordinator, layoutAppBar, null, 0, 1000, true);
        }
    };
    editTextTitle.setOnFocusChangeListener(onFocusChangeListener);
    editTextBody.setOnFocusChangeListener(onFocusChangeListener);
    editMarginDefault = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8, getResources().getDisplayMetrics());
    editMarginWithActions = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 56, getResources().getDisplayMetrics());
    textPreview = (TextView) view.findViewById(R.id.text_preview);
    viewDivider = view.findViewById(R.id.view_divider);
    toolbarActions = (Toolbar) view.findViewById(R.id.toolbar_actions);
    toolbarActions.inflateMenu(R.menu.menu_editor_actions);
    toolbarActions.setOnMenuItemClickListener(this);
    tabLayout = (TabLayout) view.findViewById(R.id.layout_tab);
    tabLayout.setTabMode(TabLayout.MODE_FIXED);
    tabLayout.setTabGravity(TabLayout.GRAVITY_FILL);
    tabLayout.setTabTextColors(themer.getColorFilterTextMuted().getColor(), themer.getColorFilterPrimary().getColor());
    viewPager = (ViewPager) view.findViewById(R.id.view_pager);
    viewPager.setAdapter(new PagerAdapter() {

        @Override
        public CharSequence getPageTitle(int position) {
            switch(position) {
                case PAGE_POST:
                    return getString(R.string.page_post);
                case PAGE_PREVIEW:
                    return getString(R.string.page_preview);
            }
            return super.getPageTitle(position);
        }

        @Override
        public Object instantiateItem(ViewGroup container, int position) {
            return viewPager.getChildAt(position);
        }

        @Override
        public void destroyItem(ViewGroup container, int position, Object object) {
        }

        @Override
        public int getCount() {
            if (Reddit.PostType.LINK == postType) {
                tabLayout.setVisibility(View.GONE);
                toolbarActions.setVisibility(View.GONE);
                viewDivider.setVisibility(View.GONE);
                itemHideActions.setVisible(false);
                return 1;
            }
            return viewPager.getChildCount();
        }

        @Override
        public boolean isViewFromObject(View view, Object object) {
            return view == object;
        }
    });
    viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {

        @Override
        public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
            if (position == PAGE_POST && toolbarActions.getVisibility() == View.VISIBLE) {
                float translationY = positionOffset * (toolbarActions.getHeight() + viewDivider.getHeight());
                viewDivider.setTranslationY(translationY);
                toolbarActions.setTranslationY(translationY);
            }
        }

        @Override
        public void onPageSelected(int position) {
            if (position == PAGE_PREVIEW) {
                if (editTextBody.length() == 0) {
                    textPreview.setText(R.string.empty_reply_preview);
                } else {
                    textPreview.setText(Html.fromHtml(Processor.process(editTextBody.getText().toString())));
                }
            }
            if (Reddit.PostType.SELF == postType) {
                itemHideActions.setVisible(position == PAGE_POST);
            }
        }

        @Override
        public void onPageScrollStateChanged(int state) {
        }
    });
    tabLayout.setupWithViewPager(viewPager);
    viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
    layoutCaptcha = (RelativeLayout) view.findViewById(R.id.layout_captcha);
    imageCaptcha = (ImageView) view.findViewById(R.id.image_captcha);
    editCaptcha = (EditText) view.findViewById(R.id.edit_captcha);
    buttonCaptchaRefresh = (ImageButton) view.findViewById(R.id.button_captcha_refresh);
    buttonCaptchaRefresh.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            loadCaptcha();
        }
    });
    if (getArguments().getBoolean(IS_EDIT, false)) {
        loadEditValues();
    } else {
        reddit.needsCaptcha().subscribe(new Observer<String>() {

            @Override
            public void onCompleted() {
            }

            @Override
            public void onError(Throwable e) {
                e.printStackTrace();
            }

            @Override
            public void onNext(String response) {
                if ("true".equalsIgnoreCase(response)) {
                    layoutCaptcha.setVisibility(View.VISIBLE);
                    loadCaptcha();
                }
            }
        });
    }
    view.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {

        @Override
        public void onGlobalLayout() {
            Menu menu = toolbarActions.getMenu();
            int maxNum = (int) (view.getWidth() / TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 48, getResources().getDisplayMetrics()));
            int numShown = 0;
            for (int index = 0; index < menu.size(); index++) {
                MenuItem menuItem = menu.getItem(index);
                menuItem.getIcon().setColorFilter(themer.getColorFilterIcon());
                if (numShown++ < maxNum - 1) {
                    menuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
                } else {
                    menuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
                }
            }
            // Toggle visibility to fix weird bug causing tabs to not be added
            tabLayout.setVisibility(View.GONE);
            tabLayout.setVisibility(View.VISIBLE);
            view.getViewTreeObserver().removeOnGlobalLayoutListener(this);
        }
    });
    return view;
}
Also used : AppBarLayout(android.support.design.widget.AppBarLayout) CoordinatorLayout(android.support.design.widget.CoordinatorLayout) ImageButton(android.widget.ImageButton) Bundle(android.os.Bundle) ControllerLinks(com.winsonchiu.reader.links.ControllerLinks) UtilsRx(com.winsonchiu.reader.utils.UtilsRx) ImageView(android.widget.ImageView) ViewPager(android.support.v4.view.ViewPager) LinkMovementMethod(android.text.method.LinkMovementMethod) MenuItem(android.view.MenuItem) TabLayout(android.support.design.widget.TabLayout) Inject(javax.inject.Inject) Picasso(com.squareup.picasso.Picasso) JSONException(org.json.JSONException) Reddit(com.winsonchiu.reader.data.reddit.Reddit) JSONObject(org.json.JSONObject) ComponentStatic(com.winsonchiu.reader.dagger.components.ComponentStatic) Toast(android.widget.Toast) Menu(android.view.Menu) Link(com.winsonchiu.reader.data.reddit.Link) View(android.view.View) JsonNode(com.fasterxml.jackson.databind.JsonNode) NestedScrollView(android.support.v4.widget.NestedScrollView) Log(android.util.Log) Processor(com.github.rjeschke.txtmark.Processor) UtilsInput(com.winsonchiu.reader.utils.UtilsInput) URLUtil(android.webkit.URLUtil) LayoutInflater(android.view.LayoutInflater) Listing(com.winsonchiu.reader.data.reddit.Listing) PagerAdapter(android.support.v4.view.PagerAdapter) TextUtils(android.text.TextUtils) Observer(rx.Observer) UtilsReddit(com.winsonchiu.reader.utils.UtilsReddit) ViewGroup(android.view.ViewGroup) TextView(android.widget.TextView) TypedValue(android.util.TypedValue) Toolbar(android.support.v7.widget.Toolbar) Html(android.text.Html) ViewTreeObserver(android.view.ViewTreeObserver) RelativeLayout(android.widget.RelativeLayout) Nullable(android.support.annotation.Nullable) Activity(android.app.Activity) EditText(android.widget.EditText) PagerAdapter(android.support.v4.view.PagerAdapter) TabLayout(android.support.design.widget.TabLayout) AppBarLayout(android.support.design.widget.AppBarLayout) Menu(android.view.Menu) ViewTreeObserver(android.view.ViewTreeObserver) ViewGroup(android.view.ViewGroup) MenuItem(android.view.MenuItem) ImageView(android.widget.ImageView) View(android.view.View) NestedScrollView(android.support.v4.widget.NestedScrollView) TextView(android.widget.TextView) ViewPager(android.support.v4.view.ViewPager) JSONObject(org.json.JSONObject)

Example 10 with Nullable

use of android.support.annotation.Nullable in project SeriesGuide by UweTrottmann.

the class PurchaseDataSource method getEntitlementRecordByReceiptId.

/**
     * Find entitlement record by specified receipt ID.
     */
@Nullable
public PurchaseRecord getEntitlementRecordByReceiptId(final String receiptId) {
    Timber.d("getEntitlementRecordByReceiptId: receiptId (%s)", receiptId);
    final String where = AmazonBillingSQLiteHelper.COLUMN_RECEIPT_ID + "= ?";
    final Cursor cursor = database.query(AmazonBillingSQLiteHelper.TABLE_PURCHASES, allColumns, where, new String[] { receiptId }, null, null, null);
    final PurchaseRecord result;
    cursor.moveToFirst();
    if (cursor.isAfterLast()) {
        result = null;
        Timber.d("getEntitlementRecordByReceiptId: no record found ");
    } else {
        result = cursorToPurchaseRecord(cursor);
        Timber.d("getEntitlementRecordByReceiptId: found ");
    }
    cursor.close();
    return result;
}
Also used : Cursor(android.database.Cursor) Nullable(android.support.annotation.Nullable)

Aggregations

Nullable (android.support.annotation.Nullable)477 View (android.view.View)266 TextView (android.widget.TextView)131 RecyclerView (android.support.v7.widget.RecyclerView)70 ImageView (android.widget.ImageView)41 IOException (java.io.IOException)32 Intent (android.content.Intent)30 Bundle (android.os.Bundle)30 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)28 ViewGroup (android.view.ViewGroup)27 Uri (android.net.Uri)25 BindView (butterknife.BindView)25 ArrayList (java.util.ArrayList)25 Cursor (android.database.Cursor)23 File (java.io.File)22 AdapterView (android.widget.AdapterView)16 Bitmap (android.graphics.Bitmap)15 Context (android.content.Context)14 Drawable (android.graphics.drawable.Drawable)13 EditText (android.widget.EditText)13