diff --git a/app/src/main/java/io/github/subhamtyagi/lastlauncher/LauncherActivity.java b/app/src/main/java/io/github/subhamtyagi/lastlauncher/LauncherActivity.java index 4383e4cf..f025c2a9 100644 --- a/app/src/main/java/io/github/subhamtyagi/lastlauncher/LauncherActivity.java +++ b/app/src/main/java/io/github/subhamtyagi/lastlauncher/LauncherActivity.java @@ -44,6 +44,7 @@ import android.text.TextWatcher; import android.text.style.ForegroundColorSpan; import android.util.ArrayMap; +import android.util.Log; import android.view.ContextThemeWrapper; import android.view.Gravity; import android.view.MotionEvent; @@ -155,6 +156,7 @@ public class LauncherActivity extends Activity implements View.OnClickListener, // gesture detector private Gestures detector; private ShortcutUtils shortcutUtils; + private static ArrayList mAppsListCopy; private static final TextWatcher mTextWatcher= new TextWatcher() { @@ -476,6 +478,38 @@ public void loadApps() { sortApps(DbUtils.getSortsTypes()); } + public void changeAppsList() { +// String[] strings = activity.split("/"); +// Log.i("AAA", strings[0] + " " + strings[1]); +// try { +// final Intent intent = new Intent(Intent.ACTION_MAIN, null); +// intent.setClassName(strings[0], strings[1]); +// intent.setComponent(new ComponentName(strings[0], strings[1])); +// intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); +// startActivity(intent); +// overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out); +// // tell the our db that app is opened +// appOpened(activity); +// } catch (Exception ignore) { +// // Log.e(TAG, "onClick: exception:::" + ignore); +// } + mAppsListCopy.clear(); + mAppsListCopy.addAll(mAppsList); + mAppsList.clear(); + for (Apps app: mAppsListCopy) { + if (app.isHidden()) { + mAppsList.add(app); + } + } + loadApps(); + } + + public void onClickBack(View view) { + mAppsList.clear(); + mAppsList.addAll(mAppsListCopy); + loadApps(); + } + /** * @param type sorting type */ @@ -525,6 +559,7 @@ public void onClick(View view) { } else { //Notes to me:if view store package and component name then this could reduce this splits String[] strings = activity.split("/"); + Log.i("AAA", strings[0] + " " + strings[1]); try { final Intent intent = new Intent(Intent.ACTION_MAIN, null); intent.setClassName(strings[0], strings[1]); diff --git a/app/src/main/java/io/github/subhamtyagi/lastlauncher/dialogs/HiddenAppsModeDialog.java b/app/src/main/java/io/github/subhamtyagi/lastlauncher/dialogs/HiddenAppsModeDialog.java new file mode 100644 index 00000000..cbc172aa --- /dev/null +++ b/app/src/main/java/io/github/subhamtyagi/lastlauncher/dialogs/HiddenAppsModeDialog.java @@ -0,0 +1,39 @@ +package io.github.subhamtyagi.lastlauncher.dialogs; + +import android.app.Activity; +import android.app.Dialog; +import android.content.Context; +import android.os.Bundle; +import android.view.View; +import android.widget.LinearLayout; + +import io.github.subhamtyagi.lastlauncher.R; +import io.github.subhamtyagi.lastlauncher.LauncherActivity; +import io.github.subhamtyagi.lastlauncher.model.Apps; + +public class HiddenAppsModeDialog extends Dialog implements View.OnClickListener { + LauncherActivity launcherActivity; + + public HiddenAppsModeDialog(Context context, LauncherActivity launcherActivity) { + super(context); + this.launcherActivity = launcherActivity; + } + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + LinearLayout ll = findViewById(R.id.hidden_linear_layout); + for (int i = 0; i < ll.getChildCount(); i++) { + ll.getChildAt(i).setOnClickListener(this); + } + } + + @Override + public void onClick(View view) { + if (view.getId() == R.id.in_list) { + launcherActivity.showHiddenApps(); + } else if (view.getId() == R.id.in_main) { + launcherActivity.changeAppsList(); + } + } +} diff --git a/app/src/main/res/layout/activity_launcher.xml b/app/src/main/res/layout/activity_launcher.xml index 2d2e0ccf..0843ce52 100644 --- a/app/src/main/res/layout/activity_launcher.xml +++ b/app/src/main/res/layout/activity_launcher.xml @@ -18,6 +18,14 @@ +