Search in sources :

Example 1 with MainActivityHelper

use of com.amaze.filemanager.utils.MainActivityHelper in project AmazeFileManager by TeamAmaze.

the class MainActivity method onCreate.

/**
 * Called when the activity is first created.
 */
@Override
public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    initialisePreferences();
    initializeInteractiveShell();
    dataUtils.registerOnDataChangedListener(this);
    CustomSshJConfig.init();
    AppConfig.setActivityContext(con);
    setContentView(R.layout.main_toolbar);
    appbar = new AppBar(this, getPrefs(), queue -> {
        if (!queue.isEmpty()) {
            mainActivityHelper.search(getPrefs(), queue);
        }
    });
    initialiseViews();
    tabHandler = new TabHandler(this);
    utilsHandler = AppConfig.getInstance().getUtilsHandler();
    cloudHandler = new CloudHandler(this);
    mainActivityHelper = new MainActivityHelper(this);
    // TODO: 7/12/2017 not init when actionIntent != null
    initialiseFab();
    if (CloudSheetFragment.isCloudProviderAvailable(this)) {
        getSupportLoaderManager().initLoader(REQUEST_CODE_CLOUD_LIST_KEYS, null, this);
    }
    path = getIntent().getStringExtra("path");
    openProcesses = getIntent().getBooleanExtra(KEY_INTENT_PROCESS_VIEWER, false);
    intent = getIntent();
    if (intent.getStringArrayListExtra(TAG_INTENT_FILTER_FAILED_OPS) != null) {
        ArrayList<HybridFileParcelable> failedOps = intent.getParcelableArrayListExtra(TAG_INTENT_FILTER_FAILED_OPS);
        if (failedOps != null) {
            mainActivityHelper.showFailedOperationDialog(failedOps, this);
        }
    }
    checkForExternalIntent(intent);
    if (savedInstanceState != null) {
        drawer.setSomethingSelected(savedInstanceState.getBoolean(KEY_DRAWER_SELECTED));
    }
    // setting window background color instead of each item, in order to reduce pixel overdraw
    if (getAppTheme().equals(AppTheme.LIGHT)) {
        /*if(Main.IS_LIST)
                getWindow().setBackgroundDrawableResource(android.R.color.white);
            else
                getWindow().setBackgroundDrawableResource(R.color.grid_background_light);
            */
        getWindow().setBackgroundDrawableResource(android.R.color.white);
    } else if (getAppTheme().equals(AppTheme.BLACK)) {
        getWindow().setBackgroundDrawableResource(android.R.color.black);
    } else {
        getWindow().setBackgroundDrawableResource(R.color.holo_dark_background);
    }
    /*findViewById(R.id.drawer_buttton).setOnClickListener(new ImageView.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (mDrawerLayout.isOpen(mDrawerLinear)) {
                    mDrawerLayout.close(mDrawerLinear);
                } else mDrawerLayout.openDrawer(mDrawerLinear);
            }
        });*/
    drawer.setDrawerIndicatorEnabled();
    // recents header color implementation
    if (SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        ActivityManager.TaskDescription taskDescription = new ActivityManager.TaskDescription("Amaze", ((BitmapDrawable) getResources().getDrawable(R.mipmap.ic_launcher)).getBitmap(), getColorPreference().getColor(ColorUsage.getPrimary(MainActivity.currentTab)));
        setTaskDescription(taskDescription);
    }
    if (!getBoolean(PREFERENCE_BOOKMARKS_ADDED)) {
        utilsHandler.addCommonBookmarks();
        getPrefs().edit().putBoolean(PREFERENCE_BOOKMARKS_ADDED, true).commit();
    }
    AppConfig.runInBackground(new AppConfig.CustomAsyncCallbacks() {

        @Override
        public <E> E doInBackground() {
            dataUtils.setHiddenFiles(utilsHandler.getHiddenFilesConcurrentRadixTree());
            dataUtils.setHistory(utilsHandler.getHistoryLinkedList());
            dataUtils.setGridfiles(utilsHandler.getGridViewList());
            dataUtils.setListfiles(utilsHandler.getListViewList());
            dataUtils.setBooks(utilsHandler.getBookmarksList());
            ArrayList<String[]> servers = new ArrayList<String[]>();
            servers.addAll(utilsHandler.getSmbList());
            servers.addAll(utilsHandler.getSftpList());
            dataUtils.setServers(servers);
            return null;
        }

        @Override
        public Void onPostExecute(Object result) {
            drawer.refreshDrawer();
            if (savedInstanceState == null) {
                if (openProcesses) {
                    FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
                    transaction.replace(R.id.content_frame, new ProcessViewerFragment(), KEY_INTENT_PROCESS_VIEWER);
                    // transaction.addToBackStack(null);
                    drawer.setSomethingSelected(true);
                    openProcesses = false;
                    // title.setText(utils.getString(con, R.string.process_viewer));
                    // Commit the transaction
                    transaction.commit();
                    supportInvalidateOptionsMenu();
                } else if (intent.getAction() != null && intent.getAction().equals(TileService.ACTION_QS_TILE_PREFERENCES)) {
                    // tile preferences, open ftp fragment
                    FragmentTransaction transaction2 = getSupportFragmentManager().beginTransaction();
                    transaction2.replace(R.id.content_frame, new FTPServerFragment());
                    appBarLayout.animate().translationY(0).setInterpolator(new DecelerateInterpolator(2)).start();
                    drawer.setSomethingSelected(true);
                    drawer.deselectEverything();
                    transaction2.commit();
                } else {
                    if (path != null && path.length() > 0) {
                        HybridFile file = new HybridFile(OpenMode.UNKNOWN, path);
                        file.generateMode(MainActivity.this);
                        if (file.isDirectory(MainActivity.this))
                            goToMain(path);
                        else {
                            goToMain(null);
                            FileUtils.openFile(new File(path), MainActivity.this, getPrefs());
                        }
                    } else {
                        goToMain(null);
                    }
                }
            } else {
                pasteHelper = savedInstanceState.getParcelable(PASTEHELPER_BUNDLE);
                oppathe = savedInstanceState.getString(KEY_OPERATION_PATH);
                oppathe1 = savedInstanceState.getString(KEY_OPERATED_ON_PATH);
                oparrayList = savedInstanceState.getParcelableArrayList(KEY_OPERATIONS_PATH_LIST);
                operation = savedInstanceState.getInt(KEY_OPERATION);
            // mainFragment = (Main) savedInstanceState.getParcelable("main_fragment");
            }
            return null;
        }

        @Override
        public Void onPreExecute() {
            return null;
        }

        @Override
        public Void publishResult(Object... result) {
            return null;
        }

        @Override
        public <T> T[] params() {
            return null;
        }
    });
}
Also used : AppBar(com.amaze.filemanager.ui.views.appbar.AppBar) Arrays(java.util.Arrays) Bundle(android.os.Bundle) AppConfig(com.amaze.filemanager.utils.application.AppConfig) Uri(android.net.Uri) FrameLayout(android.widget.FrameLayout) ColorDrawable(android.graphics.drawable.ColorDrawable) SDK_INT(android.os.Build.VERSION.SDK_INT) AppTheme(com.amaze.filemanager.utils.theme.AppTheme) Handler(android.os.Handler) CryptHandler(com.amaze.filemanager.database.CryptHandler) ParseException(com.cloudrail.si.exceptions.ParseException) Shell(eu.chainfire.libsuperuser.Shell) PREFERENCE_SHOW_HIDDENFILES(com.amaze.filemanager.fragments.preference_fragments.PreferencesConstants.PREFERENCE_SHOW_HIDDENFILES) OnRequestPermissionsResultCallback(android.support.v4.app.ActivityCompat.OnRequestPermissionsResultCallback) SshConnectionPool(com.amaze.filemanager.filesystem.ssh.SshConnectionPool) GeneralDialogCreation(com.amaze.filemanager.ui.dialogs.GeneralDialogCreation) IntentFilter(android.content.IntentFilter) Fragment(android.support.v4.app.Fragment) PREFERENCE_VIEW(com.amaze.filemanager.fragments.preference_fragments.PreferencesConstants.PREFERENCE_VIEW) FABsMenu(jahirfiquitiva.libs.fabsmenu.FABsMenu) CloudPluginException(com.amaze.filemanager.exceptions.CloudPluginException) SmbConnectionListener(com.amaze.filemanager.ui.dialogs.SmbConnectDialog.SmbConnectionListener) R(com.amaze.filemanager.R) Snackbar(android.support.design.widget.Snackbar) CloudStorage(com.cloudrail.si.interfaces.CloudStorage) Environment(android.os.Environment) SftpConnectDialog(com.amaze.filemanager.ui.dialogs.SftpConnectDialog) DataChangeListener(com.amaze.filemanager.utils.DataUtils.DataChangeListener) FTPServerFragment(com.amaze.filemanager.fragments.FTPServerFragment) NonNull(android.support.annotation.NonNull) CompressedExplorerFragment(com.amaze.filemanager.fragments.CompressedExplorerFragment) AppsListFragment(com.amaze.filemanager.fragments.AppsListFragment) ArrayList(java.util.ArrayList) TileService(android.service.quicksettings.TileService) RenameBookmark(com.amaze.filemanager.ui.dialogs.RenameBookmark) MainActivityHelper(com.amaze.filemanager.utils.MainActivityHelper) MenuInflater(android.view.MenuInflater) Toast(android.widget.Toast) DataUtils(com.amaze.filemanager.utils.DataUtils) PreferenceUtils(com.amaze.filemanager.utils.PreferenceUtils) Menu(android.view.Menu) DeleteTask(com.amaze.filemanager.asynchronous.asynctasks.DeleteTask) ProcessViewerFragment(com.amaze.filemanager.fragments.ProcessViewerFragment) TextUtils(android.text.TextUtils) AuthenticationException(com.cloudrail.si.exceptions.AuthenticationException) File(java.io.File) Utils(com.amaze.filemanager.utils.Utils) RingtoneManager(android.media.RingtoneManager) Configuration(android.content.res.Configuration) Box(com.cloudrail.si.services.Box) LinearLayout(android.widget.LinearLayout) BookSorter(com.amaze.filemanager.utils.BookSorter) PreferencesConstants(com.amaze.filemanager.fragments.preference_fragments.PreferencesConstants) ColorUsage(com.amaze.filemanager.utils.color.ColorUsage) PackageManager(android.content.pm.PackageManager) WindowManager(android.view.WindowManager) ThemedActivity(com.amaze.filemanager.activities.superclasses.ThemedActivity) RootHelper(com.amaze.filemanager.filesystem.RootHelper) Drawer(com.amaze.filemanager.ui.views.drawer.Drawer) CopyService(com.amaze.filemanager.asynchronous.services.CopyService) ContentResolver(android.content.ContentResolver) CloudContract(com.amaze.filemanager.database.CloudContract) PasteHelper(com.amaze.filemanager.filesystem.PasteHelper) View(android.view.View) UsbManager(android.hardware.usb.UsbManager) GoogleDrive(com.cloudrail.si.services.GoogleDrive) LoaderManager(android.support.v4.app.LoaderManager) SmbConnectDialog(com.amaze.filemanager.ui.dialogs.SmbConnectDialog) TitleFAB(jahirfiquitiva.libs.fabsmenu.TitleFAB) AsyncTask(android.os.AsyncTask) OTGUtil(com.amaze.filemanager.utils.OTGUtil) CloudConnectionCallbacks(com.amaze.filemanager.fragments.CloudSheetFragment.CloudConnectionCallbacks) BitmapDrawable(android.graphics.drawable.BitmapDrawable) BroadcastReceiver(android.content.BroadcastReceiver) ViewGroup(android.view.ViewGroup) CloudRail(com.cloudrail.si.CloudRail) List(java.util.List) PrepareCopyTask(com.amaze.filemanager.asynchronous.asynctasks.PrepareCopyTask) CloudHandler(com.amaze.filemanager.database.CloudHandler) Pattern(java.util.regex.Pattern) PREFERENCE_COLORED_NAVIGATION(com.amaze.filemanager.fragments.preference_fragments.PreferencesConstants.PREFERENCE_COLORED_NAVIGATION) MaterialDialog(com.afollestad.materialdialogs.MaterialDialog) Tab(com.amaze.filemanager.database.models.Tab) Window(android.view.Window) DecelerateInterpolator(android.view.animation.DecelerateInterpolator) ActivityManager(android.app.ActivityManager) Context(android.content.Context) AppBarLayout(android.support.design.widget.AppBarLayout) CoordinatorLayout(android.support.design.widget.CoordinatorLayout) TabFragment(com.amaze.filemanager.fragments.TabFragment) KeyEvent(android.view.KeyEvent) HybridFile(com.amaze.filemanager.filesystem.HybridFile) MainFragment(com.amaze.filemanager.fragments.MainFragment) FABsMenuListener(jahirfiquitiva.libs.fabsmenu.FABsMenuListener) UtilsHandler(com.amaze.filemanager.database.UtilsHandler) Intent(android.content.Intent) CursorLoader(android.support.v4.content.CursorLoader) TabHandler(com.amaze.filemanager.database.TabHandler) MenuItem(android.view.MenuItem) HybridFileParcelable(com.amaze.filemanager.filesystem.HybridFileParcelable) ServiceWatcherUtil(com.amaze.filemanager.utils.ServiceWatcherUtil) SystemBarTintManager(com.readystatesoftware.systembartint.SystemBarTintManager) Build(android.os.Build) Cursor(android.database.Cursor) CloudEntry(com.amaze.filemanager.database.models.CloudEntry) Loader(android.support.v4.content.Loader) CustomSshJConfig(com.amaze.filemanager.filesystem.ssh.CustomSshJConfig) PREFERENCE_BOOKMARKS_ADDED(com.amaze.filemanager.fragments.preference_fragments.PreferencesConstants.PREFERENCE_BOOKMARKS_ADDED) DialogAction(com.afollestad.materialdialogs.DialogAction) BookmarkCallback(com.amaze.filemanager.ui.dialogs.RenameBookmark.BookmarkCallback) OneDrive(com.cloudrail.si.services.OneDrive) Dropbox(com.cloudrail.si.services.Dropbox) MoveFiles(com.amaze.filemanager.asynchronous.asynctasks.MoveFiles) SearchWorkerFragment(com.amaze.filemanager.fragments.SearchWorkerFragment) HandlerThread(android.os.HandlerThread) PREFERENCE_NEED_TO_SET_HOME(com.amaze.filemanager.fragments.preference_fragments.PreferencesConstants.PREFERENCE_NEED_TO_SET_HOME) FileUtils(com.amaze.filemanager.utils.files.FileUtils) CloudSheetFragment(com.amaze.filemanager.fragments.CloudSheetFragment) Activity(android.app.Activity) FragmentTransaction(android.support.v4.app.FragmentTransaction) OpenMode(com.amaze.filemanager.utils.OpenMode) Collections(java.util.Collections) ContentUris(android.content.ContentUris) FileUtil(com.amaze.filemanager.filesystem.FileUtil) DecelerateInterpolator(android.view.animation.DecelerateInterpolator) PREFERENCE_NEED_TO_SET_HOME(com.amaze.filemanager.fragments.preference_fragments.PreferencesConstants.PREFERENCE_NEED_TO_SET_HOME) ArrayList(java.util.ArrayList) ActivityManager(android.app.ActivityManager) MainActivityHelper(com.amaze.filemanager.utils.MainActivityHelper) FragmentTransaction(android.support.v4.app.FragmentTransaction) AppBar(com.amaze.filemanager.ui.views.appbar.AppBar) AppConfig(com.amaze.filemanager.utils.application.AppConfig) CloudHandler(com.amaze.filemanager.database.CloudHandler) FTPServerFragment(com.amaze.filemanager.fragments.FTPServerFragment) TabHandler(com.amaze.filemanager.database.TabHandler) ProcessViewerFragment(com.amaze.filemanager.fragments.ProcessViewerFragment) HybridFileParcelable(com.amaze.filemanager.filesystem.HybridFileParcelable) HybridFile(com.amaze.filemanager.filesystem.HybridFile) File(java.io.File) HybridFile(com.amaze.filemanager.filesystem.HybridFile)

Example 2 with MainActivityHelper

use of com.amaze.filemanager.utils.MainActivityHelper in project AmazeFileManager by TeamAmaze.

the class BottomBar method updatePath.

public void updatePath(@NonNull final String news, boolean results, String query, OpenMode openmode, int folderCount, int fileCount, BottomBarButtonPath buttonPathInterface) {
    if (news.length() == 0)
        return;
    MainActivityHelper mainActivityHelper = mainActivity.mainActivityHelper;
    switch(openmode) {
        case SFTP:
            newPath = mainActivityHelper.parseSftpPath(news);
            break;
        case SMB:
            newPath = mainActivityHelper.parseSmbPath(news);
            break;
        case OTG:
            newPath = mainActivityHelper.parseOTGPath(news);
            break;
        case CUSTOM:
            newPath = mainActivityHelper.getIntegralNames(news);
            break;
        case DROPBOX:
        case BOX:
        case ONEDRIVE:
        case GDRIVE:
            newPath = mainActivityHelper.parseCloudPath(openmode, news);
            break;
        default:
            newPath = news;
    }
    if (!results) {
        pathText.setText(mainActivity.getString(R.string.folderfilecount, folderCount, fileCount));
    } else {
        fullPathText.setText(mainActivity.getString(R.string.searchresults, query));
        pathText.setText("");
        return;
    }
    final String oldPath = fullPathText.getText().toString();
    if (oldPath.equals(newPath))
        return;
    if (!areButtonsShowing()) {
        final Animation slideIn = AnimationUtils.loadAnimation(mainActivity, R.anim.slide_in);
        Animation slideOut = AnimationUtils.loadAnimation(mainActivity, R.anim.slide_out);
        if (newPath.length() > oldPath.length() && newPath.contains(oldPath) && oldPath.length() != 0) {
            // navigate forward
            fullPathAnim.setAnimation(slideIn);
            fullPathAnim.animate().setListener(new AnimatorListenerAdapter() {

                @Override
                public void onAnimationEnd(Animator animation) {
                    super.onAnimationEnd(animation);
                    new Handler().postDelayed(new Runnable() {

                        @Override
                        public void run() {
                            fullPathAnim.setVisibility(View.GONE);
                            fullPathText.setText(newPath);
                        }
                    }, PATH_ANIM_END_DELAY);
                }

                @Override
                public void onAnimationStart(Animator animation) {
                    super.onAnimationStart(animation);
                    fullPathAnim.setVisibility(View.VISIBLE);
                    fullPathAnim.setText(Utils.differenceStrings(oldPath, newPath));
                    // fullPathText.setText(oldPath);
                    scroll.post(new Runnable() {

                        @Override
                        public void run() {
                            pathScroll.fullScroll(View.FOCUS_RIGHT);
                        }
                    });
                }

                @Override
                public void onAnimationCancel(Animator animation) {
                    super.onAnimationCancel(animation);
                // onAnimationEnd(animation);
                }
            }).setStartDelay(PATH_ANIM_START_DELAY).start();
        } else if (newPath.length() < oldPath.length() && oldPath.contains(newPath)) {
            // navigate backwards
            fullPathAnim.setAnimation(slideOut);
            fullPathAnim.animate().setListener(new AnimatorListenerAdapter() {

                @Override
                public void onAnimationEnd(Animator animation) {
                    super.onAnimationEnd(animation);
                    fullPathAnim.setVisibility(View.GONE);
                    fullPathText.setText(newPath);
                    scroll.post(new Runnable() {

                        @Override
                        public void run() {
                            pathScroll.fullScroll(View.FOCUS_RIGHT);
                        }
                    });
                }

                @Override
                public void onAnimationStart(Animator animation) {
                    super.onAnimationStart(animation);
                    fullPathAnim.setVisibility(View.VISIBLE);
                    fullPathAnim.setText(Utils.differenceStrings(newPath, oldPath));
                    fullPathText.setText(newPath);
                    scroll.post(new Runnable() {

                        @Override
                        public void run() {
                            pathScroll.fullScroll(View.FOCUS_LEFT);
                        }
                    });
                }
            }).setStartDelay(PATH_ANIM_START_DELAY).start();
        } else if (oldPath.isEmpty()) {
            // case when app starts
            fullPathAnim.setAnimation(slideIn);
            fullPathAnim.setText(newPath);
            fullPathAnim.animate().setListener(new AnimatorListenerAdapter() {

                @Override
                public void onAnimationStart(Animator animation) {
                    super.onAnimationStart(animation);
                    fullPathAnim.setVisibility(View.VISIBLE);
                    fullPathText.setText("");
                    scroll.post(new Runnable() {

                        @Override
                        public void run() {
                            pathScroll.fullScroll(View.FOCUS_RIGHT);
                        }
                    });
                }

                @Override
                public void onAnimationEnd(Animator animation) {
                    super.onAnimationEnd(animation);
                    new Handler().postDelayed(new Runnable() {

                        @Override
                        public void run() {
                            fullPathAnim.setVisibility(View.GONE);
                            fullPathText.setText(newPath);
                        }
                    }, PATH_ANIM_END_DELAY);
                }

                @Override
                public void onAnimationCancel(Animator animation) {
                    super.onAnimationCancel(animation);
                // onAnimationEnd(animation);
                }
            }).setStartDelay(PATH_ANIM_START_DELAY).start();
        } else {
            // completely different path
            // first slide out of old path followed by slide in of new path
            fullPathAnim.setAnimation(slideOut);
            fullPathAnim.animate().setListener(new AnimatorListenerAdapter() {

                @Override
                public void onAnimationStart(Animator animator) {
                    super.onAnimationStart(animator);
                    fullPathAnim.setVisibility(View.VISIBLE);
                    fullPathAnim.setText(oldPath);
                    fullPathText.setText("");
                    scroll.post(new Runnable() {

                        @Override
                        public void run() {
                            pathScroll.fullScroll(View.FOCUS_LEFT);
                        }
                    });
                }

                @Override
                public void onAnimationEnd(Animator animator) {
                    super.onAnimationEnd(animator);
                    // fullPathAnim.setVisibility(View.GONE);
                    fullPathAnim.setText(newPath);
                    fullPathText.setText("");
                    fullPathAnim.setAnimation(slideIn);
                    fullPathAnim.animate().setListener(new AnimatorListenerAdapter() {

                        @Override
                        public void onAnimationEnd(Animator animation) {
                            super.onAnimationEnd(animation);
                            new Handler().postDelayed(new Runnable() {

                                @Override
                                public void run() {
                                    fullPathAnim.setVisibility(View.GONE);
                                    fullPathText.setText(newPath);
                                }
                            }, PATH_ANIM_END_DELAY);
                        }

                        @Override
                        public void onAnimationStart(Animator animation) {
                            super.onAnimationStart(animation);
                            // we should not be having anything here in path bar
                            fullPathAnim.setVisibility(View.VISIBLE);
                            fullPathText.setText("");
                            scroll.post(new Runnable() {

                                @Override
                                public void run() {
                                    pathScroll.fullScroll(View.FOCUS_RIGHT);
                                }
                            });
                        }
                    }).start();
                }

                @Override
                public void onAnimationCancel(Animator animation) {
                    super.onAnimationCancel(animation);
                // onAnimationEnd(animation);
                }
            }).setStartDelay(PATH_ANIM_START_DELAY).start();
        }
    } else {
        showButtons(buttonPathInterface);
        fullPathText.setText(newPath);
    }
}
Also used : MainActivityHelper(com.amaze.filemanager.utils.MainActivityHelper) Animator(android.animation.Animator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) Animation(android.view.animation.Animation) Handler(android.os.Handler)

Aggregations

Handler (android.os.Handler)2 MainActivityHelper (com.amaze.filemanager.utils.MainActivityHelper)2 Animator (android.animation.Animator)1 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)1 Activity (android.app.Activity)1 ActivityManager (android.app.ActivityManager)1 BroadcastReceiver (android.content.BroadcastReceiver)1 ContentResolver (android.content.ContentResolver)1 ContentUris (android.content.ContentUris)1 Context (android.content.Context)1 Intent (android.content.Intent)1 IntentFilter (android.content.IntentFilter)1 PackageManager (android.content.pm.PackageManager)1 Configuration (android.content.res.Configuration)1 Cursor (android.database.Cursor)1 BitmapDrawable (android.graphics.drawable.BitmapDrawable)1 ColorDrawable (android.graphics.drawable.ColorDrawable)1 UsbManager (android.hardware.usb.UsbManager)1 RingtoneManager (android.media.RingtoneManager)1 Uri (android.net.Uri)1