use of androidx.fragment.app.FragmentActivity in project twicalico by moko256.
the class BaseListFragment method onCreateView.
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view;
FragmentActivity activity = getActivity();
if (activity instanceof HasRefreshLayoutInterface) {
view = inflater.inflate(R.layout.fragment_base_list, container, false);
} else {
view = inflater.inflate(R.layout.fragment_base_list_refreshable, container, false);
swipeRefreshLayout = view.findViewById(R.id.srl);
swipeRefreshLayout.setColorSchemeResources(R.color.color_primary);
}
if (activity instanceof HasNotifiableAppBar) {
adapterDataObserver = new RecyclerView.AdapterDataObserver() {
@Override
public void onItemRangeInserted(int positionStart, int itemCount) {
if (positionStart == 0) {
((HasNotifiableAppBar) requireActivity()).requestAppBarCollapsed();
}
}
};
}
recyclerView = view.findViewById(R.id.TLlistView);
recyclerView.setLayoutManager(initializeRecyclerViewLayoutManager());
recyclerView.addOnScrollListener(new LoadScrollListener(recyclerView.getLayoutManager(), this));
return view;
}
use of androidx.fragment.app.FragmentActivity in project IITB-App by wncc.
the class Utils method changeTheme.
public static void changeTheme(SettingsFragment fragment, boolean darkTheme) {
isDarkTheme = darkTheme;
FragmentActivity fragmentActivity = fragment.getActivity();
fragmentActivity.setTheme(darkTheme ? R.style.AppThemeDark : R.style.AppTheme);
// Set background color of activity
fragmentActivity.findViewById(R.id.drawer_layout).setBackgroundColor(getAttrColor(fragmentActivity, R.attr.themeColor));
// Put in a new settings fragment
Fragment newFragment = new SettingsFragment();
newFragment.setArguments(fragment.getArguments());
FragmentManager fm = fragmentActivity.getSupportFragmentManager();
fm.popBackStack();
FragmentTransaction ft = fm.beginTransaction();
ft.addToBackStack(getTag(fragment));
ft.replace(R.id.framelayout_for_fragment, newFragment, getTag(fragment)).commit();
}
use of androidx.fragment.app.FragmentActivity in project IITB-App by wncc.
the class MainActivity method openEventFragment.
/**
* Open the event fragment from the provided id
*/
private void openEventFragment(String id) {
RetrofitInterface retrofitInterface = Utils.getRetrofitInterface();
final FragmentActivity self = this;
retrofitInterface.getEvent(Utils.getSessionIDHeader(), id).enqueue(new EmptyCallback<Event>() {
@Override
public void onResponse(Call<Event> call, Response<Event> response) {
Utils.openEventFragment(response.body(), self);
}
});
}
use of androidx.fragment.app.FragmentActivity in project J2ME-Loader by nikita36078.
the class AppsListFragment method onOptionsItemSelected.
@Override
public boolean onOptionsItemSelected(MenuItem item) {
FragmentActivity activity = requireActivity();
int itemId = item.getItemId();
if (itemId == R.id.action_about) {
AboutDialogFragment aboutDialogFragment = new AboutDialogFragment();
aboutDialogFragment.show(getChildFragmentManager(), "about");
} else if (itemId == R.id.action_profiles) {
Intent intentProfiles = new Intent(activity, ProfilesActivity.class);
startActivity(intentProfiles);
} else if (item.getItemId() == R.id.action_settings) {
startActivity(new Intent(activity, SettingsActivity.class));
return true;
} else if (itemId == R.id.action_help) {
HelpDialogFragment helpDialogFragment = new HelpDialogFragment();
helpDialogFragment.show(getChildFragmentManager(), "help");
} else if (itemId == R.id.action_donate) {
Intent donationsIntent = new Intent(activity, DonationsActivity.class);
startActivity(donationsIntent);
} else if (itemId == R.id.action_save_log) {
try {
LogUtils.writeLog();
Toast.makeText(activity, R.string.log_saved, Toast.LENGTH_SHORT).show();
} catch (IOException e) {
e.printStackTrace();
Toast.makeText(activity, R.string.error, Toast.LENGTH_SHORT).show();
}
} else if (itemId == R.id.action_exit_app) {
activity.finish();
} else if (itemId == R.id.action_sort) {
showSortDialog();
}
return false;
}
use of androidx.fragment.app.FragmentActivity in project J2ME-Loader by nikita36078.
the class InstallerDialog method installApp.
private void installApp(String path, Uri uri) {
final FragmentActivity activity = requireActivity();
installer = new AppInstaller(path, uri, activity.getApplication(), appRepository);
btnClose.setOnClickListener(v -> {
installer.deleteTemp();
installer.clearCache();
dismiss();
});
Single.create(installer::loadInfo).subscribeOn(Schedulers.computation()).observeOn(AndroidSchedulers.mainThread()).subscribe(new MidletInfoObserver());
}
Aggregations