Search in sources :

Example 41 with AppCompatActivity

use of androidx.appcompat.app.AppCompatActivity in project Signal-Android by WhisperSystems.

the class KbsSplashFragment method onViewCreated.

@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
    title = view.findViewById(R.id.kbs_splash_title);
    description = view.findViewById(R.id.kbs_splash_description);
    primaryAction = view.findViewById(R.id.kbs_splash_primary_action);
    secondaryAction = view.findViewById(R.id.kbs_splash_secondary_action);
    primaryAction.setOnClickListener(v -> onCreatePin());
    secondaryAction.setOnClickListener(v -> onLearnMore());
    if (RegistrationLockUtil.userHasRegistrationLock(requireContext())) {
        setUpRegLockEnabled();
    } else {
        setUpRegLockDisabled();
    }
    description.setMovementMethod(LinkMovementMethod.getInstance());
    Toolbar toolbar = view.findViewById(R.id.kbs_splash_toolbar);
    ((AppCompatActivity) requireActivity()).setSupportActionBar(toolbar);
    ((AppCompatActivity) requireActivity()).getSupportActionBar().setTitle(null);
    requireActivity().getOnBackPressedDispatcher().addCallback(getViewLifecycleOwner(), new OnBackPressedCallback(true) {

        @Override
        public void handleOnBackPressed() {
        }
    });
}
Also used : OnBackPressedCallback(androidx.activity.OnBackPressedCallback) AppCompatActivity(androidx.appcompat.app.AppCompatActivity) Toolbar(androidx.appcompat.widget.Toolbar)

Example 42 with AppCompatActivity

use of androidx.appcompat.app.AppCompatActivity in project Conversations by siacs.

the class MemorizingTrustManager method init.

void init(final Context m) {
    master = m;
    masterHandler = new Handler(m.getMainLooper());
    notificationManager = (NotificationManager) master.getSystemService(Context.NOTIFICATION_SERVICE);
    Application app;
    if (m instanceof Application) {
        app = (Application) m;
    } else if (m instanceof Service) {
        app = ((Service) m).getApplication();
    } else if (m instanceof AppCompatActivity) {
        app = ((AppCompatActivity) m).getApplication();
    } else
        throw new ClassCastException("MemorizingTrustManager context must be either Activity or Service!");
    File dir = app.getDir(KEYSTORE_DIR, Context.MODE_PRIVATE);
    keyStoreFile = new File(dir + File.separator + KEYSTORE_FILE);
    poshCacheDir = app.getCacheDir().getAbsolutePath() + "/posh_cache/";
    appKeyStore = loadAppKeyStore();
}
Also used : AppCompatActivity(androidx.appcompat.app.AppCompatActivity) Handler(android.os.Handler) Service(android.app.Service) Application(android.app.Application) File(java.io.File)

Example 43 with AppCompatActivity

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

the class SettingsActivityFragment method onActivityCreated.

@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    ScalpelHelperFragment.attachToActivity(this);
    AppCompatActivity activity = (AppCompatActivity) requireActivity();
    activity.setSupportActionBar(mToolbar);
}
Also used : AppCompatActivity(androidx.appcompat.app.AppCompatActivity)

Example 44 with AppCompatActivity

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

the class SendBroadcastFragment method onActivityCreated.

@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    CustomTabsHelperFragment.attachTo(this);
    AppCompatActivity activity = (AppCompatActivity) getActivity();
    activity.setSupportActionBar(mToolbar);
    if (savedInstanceState == null) {
        mTextEdit.setText(mExtraText);
    }
    mTextEdit.addTextChangedListener(new TextWatcher() {

        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
        }

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
        }

        @Override
        public void afterTextChanged(Editable s) {
            mChanged = true;
        }
    });
    mAttachmentLayout.setOnRemoveImageListener(this::removeImage);
    bindAttachmentLayout();
    TooltipUtils.setup(mAddImageButton);
    mAddImageButton.setOnClickListener(view -> pickOrCaptureImage());
    TooltipUtils.setup(mAddMoreImageButton);
    mAddMoreImageButton.setOnClickListener(view -> pickOrCaptureImage());
    TooltipUtils.setup(mRemoveAllImagesButton);
    mRemoveAllImagesButton.setOnClickListener(view -> onRemoveAllImages());
    TooltipUtils.setup(mAddLinkButton);
    mAddLinkButton.setOnClickListener(view -> editLink());
    TooltipUtils.setup(mEditLinkButton);
    mEditLinkButton.setOnClickListener(view -> editLink());
    TooltipUtils.setup(mRemoveLinkButton);
    mRemoveLinkButton.setOnClickListener(view -> onRemoveLink());
    updateBottomBar();
    TooltipUtils.setup(mAddMentionButton);
    mAddMentionButton.setOnClickListener(view -> addMention());
    TooltipUtils.setup(mAddTopicButton);
    mAddTopicButton.setOnClickListener(view -> addTopic());
    mCounterText.setEditText(mTextEdit, Broadcast.MAX_TEXT_LENGTH);
    updateSendStatus();
}
Also used : AppCompatActivity(androidx.appcompat.app.AppCompatActivity) TextWatcher(android.text.TextWatcher) Editable(android.text.Editable)

Example 45 with AppCompatActivity

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

the class BroadcastListActivityFragment method onActivityCreated.

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

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