Skip to content

Commit

Permalink
add reveal mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Seaflowery committed May 17, 2022
1 parent a0655ec commit a8a7003
Show file tree
Hide file tree
Showing 4 changed files with 131 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -155,6 +156,7 @@ public class LauncherActivity extends Activity implements View.OnClickListener,
// gesture detector
private Gestures detector;
private ShortcutUtils shortcutUtils;
private static ArrayList<Apps> mAppsListCopy;

private static final TextWatcher mTextWatcher= new TextWatcher() {

Expand Down Expand Up @@ -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
*/
Expand Down Expand Up @@ -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]);
Expand Down
Original file line number Diff line number Diff line change
@@ -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();
}
}
}
8 changes: 8 additions & 0 deletions app/src/main/res/layout/activity_launcher.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@

</ScrollView>

<Button
android:id="@+id/back_to_main"
android:layout_width="match_parent"
android:layout_height="20pt"
android:text="back to main panel"
android:visibility="gone"
android:textSize="11pt"/>

<EditText
android:id="@+id/search_box"
android:layout_width="200dp"
Expand Down
49 changes: 49 additions & 0 deletions app/src/main/res/layout/dialog_choose_hidden_mode.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ Last Launcher
~ Copyright (C) 2019 Shubham Tyagi
~
~ This program is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
-->


<LinearLayout android:id="@+id/hidden_linear_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android">

<TextView
android:id="@+id/in_main"
style="@style/AppTheme"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="5dp"
android:tag="AppTheme"
android:text="show in main screen"
android:textSize="22sp" />

<TextView
android:id="@+id/in_list"
style="@style/AppTheme"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="5dp"
android:tag="@style/Wallpaper"
android:text="show in list"
android:textSize="22sp" />


</LinearLayout>

0 comments on commit a8a7003

Please sign in to comment.