Initial commit
This commit is contained in:
1
app/.gitignore
vendored
Normal file
1
app/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/build
|
33
app/build.gradle
Normal file
33
app/build.gradle
Normal file
@@ -0,0 +1,33 @@
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
compileSdkVersion 29
|
||||
buildToolsVersion "29.0.3"
|
||||
|
||||
defaultConfig {
|
||||
applicationId "net.dynu.brnstream.minilauncher"
|
||||
minSdkVersion 17
|
||||
targetSdkVersion 29
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: "libs", include: ["*.jar"])
|
||||
implementation 'androidx.appcompat:appcompat:1.1.0'
|
||||
implementation 'com.google.android.material:material:1.1.0'
|
||||
testImplementation 'junit:junit:4.12'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
||||
|
||||
}
|
BIN
app/debug/minilauncher.apk
Normal file
BIN
app/debug/minilauncher.apk
Normal file
Binary file not shown.
21
app/proguard-rules.pro
vendored
Normal file
21
app/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
BIN
app/release/app-release.apk
Normal file
BIN
app/release/app-release.apk
Normal file
Binary file not shown.
BIN
app/release/minilauncher.apk
Normal file
BIN
app/release/minilauncher.apk
Normal file
Binary file not shown.
20
app/release/output.json
Normal file
20
app/release/output.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"version": 1,
|
||||
"artifactType": {
|
||||
"type": "APK",
|
||||
"kind": "Directory"
|
||||
},
|
||||
"applicationId": "net.dynu.brnstream.minilauncher",
|
||||
"variantName": "release",
|
||||
"elements": [
|
||||
{
|
||||
"type": "SINGLE",
|
||||
"filters": [],
|
||||
"properties": [],
|
||||
"versionCode": 1,
|
||||
"versionName": "1",
|
||||
"enabled": true,
|
||||
"outputFile": "app-release.apk"
|
||||
}
|
||||
]
|
||||
}
|
24
app/src/main/AndroidManifest.xml
Normal file
24
app/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="net.dynu.brnstream.minilauncher">
|
||||
<uses-permission android:name="android.permission.GET_TASKS" />
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@drawable/icon"
|
||||
android:label="@string/app_name"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme">
|
||||
<activity
|
||||
android:name=".ScrollingActivity"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/AppTheme.NoActionBar">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.HOME" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
@@ -0,0 +1,11 @@
|
||||
package net.dynu.brnstream.minilauncher;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class Global {
|
||||
public static ArrayList<String> Name = new ArrayList<String>();
|
||||
public static ArrayList<String> PackName = new ArrayList<String>();
|
||||
}
|
@@ -0,0 +1,90 @@
|
||||
package net.dynu.brnstream.minilauncher;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Bundle;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ListView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ScrollingActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
}
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_scrolling);
|
||||
final PackageManager pm = getPackageManager();
|
||||
List<ApplicationInfo> packages = pm.getInstalledApplications(PackageManager.GET_META_DATA);
|
||||
for (ApplicationInfo packageInfo : packages) {
|
||||
String name = (String) pm.getApplicationLabel(packageInfo);
|
||||
String packname = packageInfo.packageName;
|
||||
Global.Name.add(name);
|
||||
Global.PackName.add(packname);
|
||||
}
|
||||
for (int i = 0; i < Global.Name.size(); i++) {
|
||||
ArrayAdapter<String> adapter = new ArrayAdapter<>(this, R.layout.activity_listview, Global.Name);
|
||||
final ListView listView = findViewById(R.id.apps);
|
||||
listView.setAdapter(adapter);
|
||||
listView.setClickable(true);
|
||||
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) {
|
||||
String packname = Global.PackName.get(position);
|
||||
Context dat = ScrollingActivity.this;
|
||||
//Toast toast = Toast.makeText(dat, String.valueOf(packname), (int) 0.1);
|
||||
//toast.show();
|
||||
Intent pack = getPackageManager().getLaunchIntentForPackage(packname);
|
||||
try {
|
||||
startActivity(pack);
|
||||
}
|
||||
catch (Exception e) {
|
||||
Toast toast2 = Toast.makeText(dat, "Cannot run this app", Toast.LENGTH_LONG);
|
||||
toast2.show();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
final EditText text = findViewById(R.id.searchbar);
|
||||
text.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
String value = text.getText().toString();
|
||||
int i=0;
|
||||
for (String name : Global.Name) {
|
||||
if (name.toLowerCase().contains(value.toLowerCase())) {
|
||||
final ListView listView = findViewById(R.id.apps);
|
||||
listView.smoothScrollToPosition(i);
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
BIN
app/src/main/res/drawable/icon.png
Normal file
BIN
app/src/main/res/drawable/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
11
app/src/main/res/layout/activity_listview.xml
Normal file
11
app/src/main/res/layout/activity_listview.xml
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Single List Item Design -->
|
||||
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/label"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:padding="10dip"
|
||||
android:textSize="16dip"
|
||||
android:textStyle="bold" >
|
||||
</TextView>
|
25
app/src/main/res/layout/activity_scrolling.xml
Normal file
25
app/src/main/res/layout/activity_scrolling.xml
Normal file
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true"
|
||||
tools:context=".ScrollingActivity">
|
||||
|
||||
<ListView
|
||||
android:id="@+id/apps"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_marginTop="45dp"
|
||||
android:layout_height="wrap_content"></ListView>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/searchbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ems="10"
|
||||
android:hint="@string/hint"
|
||||
android:importantForAutofill="no"
|
||||
android:inputType="text" />
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
5
app/src/main/res/values/dimens.xml
Normal file
5
app/src/main/res/values/dimens.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<resources>
|
||||
<dimen name="app_bar_height">180dp</dimen>
|
||||
<dimen name="fab_margin">16dp</dimen>
|
||||
<dimen name="text_margin">16dp</dimen>
|
||||
</resources>
|
4
app/src/main/res/values/strings.xml
Normal file
4
app/src/main/res/values/strings.xml
Normal file
@@ -0,0 +1,4 @@
|
||||
<resources>
|
||||
<string name="app_name">MiniLauncher</string>
|
||||
<string name="hint">Search</string>
|
||||
</resources>
|
12
app/src/main/res/values/styles.xml
Normal file
12
app/src/main/res/values/styles.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<resources>
|
||||
<!-- Base application theme. -->
|
||||
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||
<item name="android:windowBackground">@android:color/white</item> </style>
|
||||
|
||||
<style name="AppTheme.NoActionBar">
|
||||
<item name="windowNoTitle">true</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
|
||||
|
||||
</resources>
|
Reference in New Issue
Block a user