Search in sources :

Example 16 with AppCompatActivity

use of androidx.appcompat.app.AppCompatActivity in project Douya by DreaminginCodeZH.

the class SendCommentFragment method onActivityCreated.

@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    AppCompatActivity activity = (AppCompatActivity) getActivity();
    activity.setSupportActionBar(mToolbar);
    if (savedInstanceState == null) {
        mTextEdit.setText(mText);
    }
    updateSendCommentStatus();
}
Also used : AppCompatActivity(androidx.appcompat.app.AppCompatActivity)

Example 17 with AppCompatActivity

use of androidx.appcompat.app.AppCompatActivity in project Douya by DreaminginCodeZH.

the class CalendarFragment method onActivityCreated.

@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    AppCompatActivity activity = (AppCompatActivity) getActivity();
    activity.setSupportActionBar(mToolbar);
    TintHelper.onSetSupportActionBar(mToolbar);
    // TODO
    CalendarDay calendarDay = CalendarDay.SAMPLE;
    mDateText.setText(calendarDay.getDateText(activity));
    mDayOfWeekText.setText(calendarDay.getDayOfWeekText(activity));
    mChineseCalendarDateText.setText(calendarDay.getChineseCalendarDateText());
    mDayOfMonthText.setText(calendarDay.getDayOfMonthText(activity));
    mDayOfMonthText.setTextColor(calendarDay.getThemedDayOfMonthColor(mDayOfMonthText.getContext()));
    mCommentText.setText(calendarDay.comment);
    mMovieLayout.setOnClickListener(view -> UriHandler.open(calendarDay.url, view.getContext()));
    mTitleText.setText(calendarDay.getTitleText(activity));
    mRatingBar.setRating(calendarDay.getRatingBarRating());
    mRatingText.setText(calendarDay.getRatingText(activity));
    mEventText.setText(calendarDay.getEventText(activity));
    ImageUtils.loadImage(mPosterImage, calendarDay.poster);
}
Also used : AppCompatActivity(androidx.appcompat.app.AppCompatActivity) CalendarDay(me.zhanghai.android.douya.calendar.info.CalendarDay)

Example 18 with AppCompatActivity

use of androidx.appcompat.app.AppCompatActivity in project Douya by DreaminginCodeZH.

the class FollowshipListActivityFragment method onActivityCreated.

@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    AppCompatActivity activity = (AppCompatActivity) getActivity();
    activity.setSupportActionBar(mToolbar);
    TransitionUtils.setupTransitionOnActivityCreated(this);
    if (savedInstanceState == null) {
        FragmentUtils.add(onCreateListFragment(), this, R.id.followship_list_fragment);
    }
}
Also used : AppCompatActivity(androidx.appcompat.app.AppCompatActivity)

Example 19 with AppCompatActivity

use of androidx.appcompat.app.AppCompatActivity in project Douya by DreaminginCodeZH.

the class AboutFragment method onActivityCreated.

@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    ScalpelHelperFragment.attachToActivity(this);
    AppCompatActivity activity = (AppCompatActivity) getActivity();
    activity.setSupportActionBar(mToolbar);
    activity.getSupportActionBar().setTitle(null);
    // Seems that ScrollView intercepts touch event, so we have to set the onTouchListener on a
    // view inside it.
    mContainerLayout.setOnTouchListener(new KonamiCodeDetector(activity) {

        @Override
        public void onDetected() {
            onEnableScalpel();
        }
    });
    mVersionText.setText(getString(R.string.about_version_format, BuildConfig.VERSION_NAME));
    mDoubanButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            Activity activity = getActivity();
            activity.startActivity(ProfileActivity.makeIntent("douban-douya", activity));
        }
    });
}
Also used : AppCompatActivity(androidx.appcompat.app.AppCompatActivity) KonamiCodeDetector(me.zhanghai.android.douya.ui.KonamiCodeDetector) ProfileActivity(me.zhanghai.android.douya.profile.ui.ProfileActivity) AppCompatActivity(androidx.appcompat.app.AppCompatActivity) Activity(android.app.Activity) BindView(butterknife.BindView) TextView(android.widget.TextView) View(android.view.View)

Example 20 with AppCompatActivity

use of androidx.appcompat.app.AppCompatActivity in project Etar-Calendar by Etar-Group.

the class EventInfoFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    if (savedInstanceState != null) {
        mIsDialog = savedInstanceState.getBoolean(BUNDLE_KEY_IS_DIALOG, false);
        mWindowStyle = savedInstanceState.getInt(BUNDLE_KEY_WINDOW_STYLE, DIALOG_WINDOW_STYLE);
        mDeleteDialogVisible = savedInstanceState.getBoolean(BUNDLE_KEY_DELETE_DIALOG_VISIBLE, false);
        mCalendarColor = savedInstanceState.getInt(BUNDLE_KEY_CALENDAR_COLOR);
        mCalendarColorInitialized = savedInstanceState.getBoolean(BUNDLE_KEY_CALENDAR_COLOR_INIT);
        mOriginalColor = savedInstanceState.getInt(BUNDLE_KEY_ORIGINAL_COLOR);
        mOriginalColorInitialized = savedInstanceState.getBoolean(BUNDLE_KEY_ORIGINAL_COLOR_INIT);
        mCurrentColor = savedInstanceState.getInt(BUNDLE_KEY_CURRENT_COLOR);
        mCurrentColorInitialized = savedInstanceState.getBoolean(BUNDLE_KEY_CURRENT_COLOR_INIT);
        mCurrentColorKey = savedInstanceState.getString(BUNDLE_KEY_CURRENT_COLOR_KEY);
        mTentativeUserSetResponse = savedInstanceState.getInt(BUNDLE_KEY_TENTATIVE_USER_RESPONSE, Attendees.ATTENDEE_STATUS_NONE);
        if (mTentativeUserSetResponse != Attendees.ATTENDEE_STATUS_NONE && mEditResponseHelper != null) {
            // If the edit response helper dialog is open, we'll need to
            // know if either of the choices were selected.
            mEditResponseHelper.setWhichEvents(savedInstanceState.getInt(BUNDLE_KEY_RESPONSE_WHICH_EVENTS, -1));
        }
        mUserSetResponse = savedInstanceState.getInt(BUNDLE_KEY_USER_SET_ATTENDEE_RESPONSE, Attendees.ATTENDEE_STATUS_NONE);
        if (mUserSetResponse != Attendees.ATTENDEE_STATUS_NONE) {
            // If the response was set by the user before a configuration
            // change, we'll need to know which choice was selected.
            mWhichEvents = savedInstanceState.getInt(BUNDLE_KEY_RESPONSE_WHICH_EVENTS, -1);
        }
        mReminders = Utils.readRemindersFromBundle(savedInstanceState);
    }
    if (mWindowStyle == DIALOG_WINDOW_STYLE) {
        mView = inflater.inflate(R.layout.event_info_dialog, container, false);
    } else {
        mView = inflater.inflate(R.layout.event_info, container, false);
    }
    Toolbar myToolbar = (Toolbar) mView.findViewById(R.id.toolbar);
    AppCompatActivity activity = (AppCompatActivity) getActivity();
    if (myToolbar != null && activity != null) {
        activity.setSupportActionBar(myToolbar);
        activity.getSupportActionBar().setDisplayShowTitleEnabled(false);
        myToolbar.setNavigationIcon(R.drawable.ic_arrow_back);
    }
    mScrollView = (ScrollView) mView.findViewById(R.id.event_info_scroll_view);
    mLoadingMsgView = mView.findViewById(R.id.event_info_loading_msg);
    mErrorMsgView = mView.findViewById(R.id.event_info_error_msg);
    mTitle = (TextView) mView.findViewById(R.id.title);
    mWhenDateTime = (TextView) mView.findViewById(R.id.when_datetime);
    mWhere = (TextView) mView.findViewById(R.id.where);
    mDesc = mView.findViewById(R.id.description);
    mHeadlines = mView.findViewById(R.id.event_info_headline);
    mLongAttendees = (AttendeesView) mView.findViewById(R.id.long_attendee_list);
    mResponseRadioGroup = (RadioGroup) mView.findViewById(R.id.response_value);
    if (mUri == null) {
        // restore event ID from bundle
        mEventId = savedInstanceState.getLong(BUNDLE_KEY_EVENT_ID);
        mUri = ContentUris.withAppendedId(Events.CONTENT_URI, mEventId);
        mStartMillis = savedInstanceState.getLong(BUNDLE_KEY_START_MILLIS);
        mEndMillis = savedInstanceState.getLong(BUNDLE_KEY_END_MILLIS);
    }
    mAnimateAlpha = ObjectAnimator.ofFloat(mScrollView, "Alpha", 0, 1);
    mAnimateAlpha.setDuration(FADE_IN_TIME);
    mAnimateAlpha.addListener(new AnimatorListenerAdapter() {

        int defLayerType;

        @Override
        public void onAnimationStart(Animator animation) {
            // Use hardware layer for better performance during animation
            defLayerType = mScrollView.getLayerType();
            mScrollView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
            // Ensure that the loading message is gone before showing the
            // event info
            mLoadingMsgView.removeCallbacks(mLoadingMsgAlphaUpdater);
            mLoadingMsgView.setVisibility(View.GONE);
        }

        @Override
        public void onAnimationCancel(Animator animation) {
            mScrollView.setLayerType(defLayerType, null);
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            mScrollView.setLayerType(defLayerType, null);
            // Do not cross fade after the first time
            mNoCrossFade = true;
        }
    });
    mLoadingMsgView.setAlpha(0);
    mScrollView.setAlpha(0);
    mErrorMsgView.setVisibility(View.INVISIBLE);
    mLoadingMsgView.postDelayed(mLoadingMsgAlphaUpdater, LOADING_MSG_DELAY);
    // start loading the data
    mHandler.startQuery(TOKEN_QUERY_EVENT, null, mUri, EVENT_PROJECTION, null, null, null);
    View b = mView.findViewById(R.id.delete);
    b.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            if (!mCanModifyCalendar) {
                return;
            }
            mDeleteHelper = new DeleteEventHelper(mContext, mActivity, !mIsDialog && !mIsTabletConfig);
            mDeleteHelper.setDeleteNotificationListener(EventInfoFragment.this);
            mDeleteHelper.setOnDismissListener(createDeleteOnDismissListener());
            mDeleteDialogVisible = true;
            mDeleteHelper.delete(mStartMillis, mEndMillis, mEventId, -1, onDeleteRunnable);
        }
    });
    b = mView.findViewById(R.id.change_color);
    b.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            if (!mCanModifyCalendar) {
                return;
            }
            showEventColorPickerDialog();
        }
    });
    // Hide Edit/Delete buttons if in full screen mode on a phone
    if (!mIsDialog && !mIsTabletConfig || mWindowStyle == EventInfoFragment.FULL_WINDOW_STYLE) {
        mView.findViewById(R.id.event_info_buttons_container).setVisibility(View.GONE);
    }
    // Create a listener for the email guests button
    emailAttendeesButton = (Button) mView.findViewById(R.id.email_attendees_button);
    if (emailAttendeesButton != null) {
        emailAttendeesButton.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                emailAttendees();
            }
        });
    }
    // Create a listener for the add reminder button
    View reminderAddButton = mView.findViewById(R.id.reminder_add);
    View.OnClickListener addReminderOnClickListener = new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            addReminder();
            mUserModifiedReminders = true;
        }
    };
    reminderAddButton.setOnClickListener(addReminderOnClickListener);
    // Set reminders variables
    SharedPreferences prefs = GeneralPreferences.Companion.getSharedPreferences(mActivity);
    String defaultReminderString = prefs.getString(GeneralPreferences.KEY_DEFAULT_REMINDER, GeneralPreferences.NO_REMINDER_STRING);
    mDefaultReminderMinutes = Integer.parseInt(defaultReminderString);
    prepareReminders();
    return mView;
}
Also used : Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) SharedPreferences(android.content.SharedPreferences) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) AppCompatActivity(androidx.appcompat.app.AppCompatActivity) OnClickListener(android.view.View.OnClickListener) OnClickListener(android.view.View.OnClickListener) ScrollView(android.widget.ScrollView) View(android.view.View) AdapterView(android.widget.AdapterView) AttendeesView(com.android.calendar.event.AttendeesView) TextView(android.widget.TextView) Paint(android.graphics.Paint) Toolbar(androidx.appcompat.widget.Toolbar)

Aggregations

AppCompatActivity (androidx.appcompat.app.AppCompatActivity)76 ActionBar (androidx.appcompat.app.ActionBar)23 View (android.view.View)20 Toolbar (androidx.appcompat.widget.Toolbar)19 LinearLayoutManager (androidx.recyclerview.widget.LinearLayoutManager)10 TextView (android.widget.TextView)7 RecyclerView (androidx.recyclerview.widget.RecyclerView)7 Intent (android.content.Intent)6 Fragment (androidx.fragment.app.Fragment)6 BindView (butterknife.BindView)6 Activity (android.app.Activity)5 LayoutInflater (android.view.LayoutInflater)5 Bundle (android.os.Bundle)4 ImageView (android.widget.ImageView)4 ScrollView (android.widget.ScrollView)4 List (java.util.List)4 Nullable (androidx.annotation.Nullable)3 SuppressLint (android.annotation.SuppressLint)2 TargetApi (android.annotation.TargetApi)2 Dialog (android.app.Dialog)2