Skip to content

Commit a8a7003

Browse files
author
Seaflowery
committed
add reveal mode
1 parent a0655ec commit a8a7003

File tree

4 files changed

+131
-0
lines changed

4 files changed

+131
-0
lines changed

app/src/main/java/io/github/subhamtyagi/lastlauncher/LauncherActivity.java

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
import android.text.TextWatcher;
4545
import android.text.style.ForegroundColorSpan;
4646
import android.util.ArrayMap;
47+
import android.util.Log;
4748
import android.view.ContextThemeWrapper;
4849
import android.view.Gravity;
4950
import android.view.MotionEvent;
@@ -155,6 +156,7 @@ public class LauncherActivity extends Activity implements View.OnClickListener,
155156
// gesture detector
156157
private Gestures detector;
157158
private ShortcutUtils shortcutUtils;
159+
private static ArrayList<Apps> mAppsListCopy;
158160

159161
private static final TextWatcher mTextWatcher= new TextWatcher() {
160162

@@ -476,6 +478,38 @@ public void loadApps() {
476478
sortApps(DbUtils.getSortsTypes());
477479
}
478480

481+
public void changeAppsList() {
482+
// String[] strings = activity.split("/");
483+
// Log.i("AAA", strings[0] + " " + strings[1]);
484+
// try {
485+
// final Intent intent = new Intent(Intent.ACTION_MAIN, null);
486+
// intent.setClassName(strings[0], strings[1]);
487+
// intent.setComponent(new ComponentName(strings[0], strings[1]));
488+
// intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
489+
// startActivity(intent);
490+
// overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
491+
// // tell the our db that app is opened
492+
// appOpened(activity);
493+
// } catch (Exception ignore) {
494+
// // Log.e(TAG, "onClick: exception:::" + ignore);
495+
// }
496+
mAppsListCopy.clear();
497+
mAppsListCopy.addAll(mAppsList);
498+
mAppsList.clear();
499+
for (Apps app: mAppsListCopy) {
500+
if (app.isHidden()) {
501+
mAppsList.add(app);
502+
}
503+
}
504+
loadApps();
505+
}
506+
507+
public void onClickBack(View view) {
508+
mAppsList.clear();
509+
mAppsList.addAll(mAppsListCopy);
510+
loadApps();
511+
}
512+
479513
/**
480514
* @param type sorting type
481515
*/
@@ -525,6 +559,7 @@ public void onClick(View view) {
525559
} else {
526560
//Notes to me:if view store package and component name then this could reduce this splits
527561
String[] strings = activity.split("/");
562+
Log.i("AAA", strings[0] + " " + strings[1]);
528563
try {
529564
final Intent intent = new Intent(Intent.ACTION_MAIN, null);
530565
intent.setClassName(strings[0], strings[1]);
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package io.github.subhamtyagi.lastlauncher.dialogs;
2+
3+
import android.app.Activity;
4+
import android.app.Dialog;
5+
import android.content.Context;
6+
import android.os.Bundle;
7+
import android.view.View;
8+
import android.widget.LinearLayout;
9+
10+
import io.github.subhamtyagi.lastlauncher.R;
11+
import io.github.subhamtyagi.lastlauncher.LauncherActivity;
12+
import io.github.subhamtyagi.lastlauncher.model.Apps;
13+
14+
public class HiddenAppsModeDialog extends Dialog implements View.OnClickListener {
15+
LauncherActivity launcherActivity;
16+
17+
public HiddenAppsModeDialog(Context context, LauncherActivity launcherActivity) {
18+
super(context);
19+
this.launcherActivity = launcherActivity;
20+
}
21+
22+
@Override
23+
public void onCreate(Bundle savedInstanceState) {
24+
super.onCreate(savedInstanceState);
25+
LinearLayout ll = findViewById(R.id.hidden_linear_layout);
26+
for (int i = 0; i < ll.getChildCount(); i++) {
27+
ll.getChildAt(i).setOnClickListener(this);
28+
}
29+
}
30+
31+
@Override
32+
public void onClick(View view) {
33+
if (view.getId() == R.id.in_list) {
34+
launcherActivity.showHiddenApps();
35+
} else if (view.getId() == R.id.in_main) {
36+
launcherActivity.changeAppsList();
37+
}
38+
}
39+
}

app/src/main/res/layout/activity_launcher.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@
1818

1919
</ScrollView>
2020

21+
<Button
22+
android:id="@+id/back_to_main"
23+
android:layout_width="match_parent"
24+
android:layout_height="20pt"
25+
android:text="back to main panel"
26+
android:visibility="gone"
27+
android:textSize="11pt"/>
28+
2129
<EditText
2230
android:id="@+id/search_box"
2331
android:layout_width="200dp"
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?xml version="1.0" encoding="utf-8"?><!--
2+
~ Last Launcher
3+
~ Copyright (C) 2019 Shubham Tyagi
4+
~
5+
~ This program is free software: you can redistribute it and/or modify
6+
~ it under the terms of the GNU General Public License as published by
7+
~ the Free Software Foundation, either version 3 of the License, or
8+
~ (at your option) any later version.
9+
~
10+
~ This program is distributed in the hope that it will be useful,
11+
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
~ GNU General Public License for more details.
14+
~
15+
~ You should have received a copy of the GNU General Public License
16+
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
17+
-->
18+
19+
20+
<LinearLayout android:id="@+id/hidden_linear_layout"
21+
android:layout_width="wrap_content"
22+
android:layout_height="wrap_content"
23+
android:orientation="vertical"
24+
xmlns:android="http://schemas.android.com/apk/res/android">
25+
26+
<TextView
27+
android:id="@+id/in_main"
28+
style="@style/AppTheme"
29+
android:layout_width="match_parent"
30+
android:layout_height="wrap_content"
31+
android:gravity="center"
32+
android:padding="5dp"
33+
android:tag="AppTheme"
34+
android:text="show in main screen"
35+
android:textSize="22sp" />
36+
37+
<TextView
38+
android:id="@+id/in_list"
39+
style="@style/AppTheme"
40+
android:layout_width="match_parent"
41+
android:layout_height="wrap_content"
42+
android:gravity="center"
43+
android:padding="5dp"
44+
android:tag="@style/Wallpaper"
45+
android:text="show in list"
46+
android:textSize="22sp" />
47+
48+
49+
</LinearLayout>

0 commit comments

Comments
 (0)