Skip to content

Commit

Permalink
option 2 show widgetshortcuts
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaiserdragon2 committed Mar 2, 2022
1 parent 8c2d3c6 commit da8c9f6
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 16 deletions.
13 changes: 11 additions & 2 deletions app/src/main/java/de/kaiserdragon/iconrequest/RequestActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public class RequestActivity extends AppCompatActivity {
private static boolean updateOnly;
private static boolean OnlyNew;
private static boolean SecondIcon;
private static boolean Shortcut;
private static ArrayList<AppInfo> appListFilter = new ArrayList<>();
private static ArrayList<iPackInfo> IPackListFilter = new ArrayList<>();
private String ImgLocation;
Expand Down Expand Up @@ -211,6 +212,7 @@ public void onCreate(Bundle savedInstanceState) {
updateOnly = getIntent().getBooleanExtra("update", false);
OnlyNew = loadDataBool("SettingOnlyNew");
SecondIcon = loadDataBool("SettingRow");
Shortcut = loadDataBool("Shortcut");

setContentView(R.layout.activity_request);
switcherLoad = findViewById(R.id.viewSwitcherLoadingMain);
Expand Down Expand Up @@ -545,8 +547,15 @@ private void prepareData() {
// sort the apps
ArrayList<AppInfo> arrayList = new ArrayList<>();
PackageManager pm = getPackageManager();
Intent intent = new Intent("android.intent.action.MAIN", null);
intent.addCategory("android.intent.category.LAUNCHER");
Intent intent;
if (Shortcut){
intent = new Intent("android.intent.action.CREATE_SHORTCUT", null);
intent.addCategory("android.intent.category.DEFAULT");
}else{
intent = new Intent("android.intent.action.MAIN", null);
intent.addCategory("android.intent.category.LAUNCHER");
}

List<ResolveInfo> list = pm.queryIntentActivities(intent, 0);
Iterator<ResolveInfo> localIterator = list.iterator();
if (DEBUG) Log.v(TAG, "list size: " + list.size());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ protected void onCreate(Bundle savedInstanceState) {
CheckBox OnlyNew = findViewById(R.id.checkBoxOnly);
OnlyNew.setOnClickListener(view -> start(view, 0));

CheckBox Shortcut = findViewById(R.id.checkShortcut);
Shortcut.setOnClickListener(view -> start(view, 0));

Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
Objects.requireNonNull(getSupportActionBar()).setDisplayHomeAsUpEnabled(true);
Expand All @@ -66,6 +69,9 @@ public void start(View view, int update) {
} else if (view == (CheckBox) findViewById(R.id.checkBoxOnly)) {
saveDataBool("SettingOnlyNew", ((CheckBox) view).isChecked());
}
else if (view == (CheckBox) findViewById(R.id.checkShortcut)) {
saveDataBool("Shortcut", ((CheckBox) view).isChecked());
}
}

}
Expand Down
39 changes: 26 additions & 13 deletions app/src/main/res/layout/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@

<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:paddingStart="10dp"
android:paddingEnd="10dp">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
android:orientation="vertical">

<TextView
android:id="@+id/Settings"
Expand All @@ -30,29 +32,30 @@
android:layout_marginTop="16dp"
android:text="@string/settings"
android:textAlignment="center"
android:textSize="34sp" />
android:textSize="34sp"
android:textStyle="bold" />

<TextView
android:id="@+id/Theme"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:layout_marginTop="8dp"
android:text="@string/Theme"
android:textAlignment="center"
android:textSize="20sp" />
android:textSize="20sp"
android:textStyle="bold" />

<RadioGroup
android:id="@+id/RadioTheme"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:layout_marginTop="8dp">

<RadioButton
android:id="@+id/radioDark"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="48dp"
android:text="@string/DarkMode" />

<RadioButton
Expand All @@ -73,20 +76,18 @@
android:id="@+id/Other"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:layout_marginTop="8dp"
android:text="@string/Other"
android:textSize="20sp"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/RadioTheme" />

<TextView
android:id="@+id/OtherDescription"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:text="@string/notes"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
Expand All @@ -96,9 +97,7 @@
android:id="@+id/checkBoxRows"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:text="@string/ShowSecondRow"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
Expand All @@ -108,10 +107,24 @@
android:id="@+id/checkBoxOnly"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:layout_marginEnd="8dp"
android:text="@string/ShowOnly" />

<TextView
android:id="@+id/Experimental"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:text="@string/Experimental"
android:textSize="20sp"
android:textStyle="bold" />

<CheckBox
android:id="@+id/checkShortcut"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/AppsOrShortcutWidgets" />

</LinearLayout>
</ScrollView>

Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-de-rDE/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@
<string name="RequestNew">Neue Icons anfragen</string>
<string name="CompareIconPacks">Vergleiche Icon Packs</string>
<string name="CompareIPacksText">Vergleiche zwei Icon Packs. Zeige Apps die nicht im ersten Icon Pack sind vom zweitem Icon Pack</string>
<string name="Experimental">Experimentell</string>
<string name="AppsOrShortcutWidgets">Zeige Verknuepfungswidgets anstatt Apps</string>
</resources>
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
<string name="request_email_text">Some app icons are missing on my device.\n\n</string>
<string name="CompareIconPacks">Compare Icon Packs</string>
<string name="CompareIPacksText">Compare two Icon Packs. Shows apps that aren\'t in the first icon pack from the second icon pack</string>
<string name="Experimental">Experimental</string>
<string name="AppsOrShortcutWidgets">Show shortcut widgets insted of apps</string>


</resources>
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:7.1.1'
classpath 'com.android.tools.build:gradle:7.1.2'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down

0 comments on commit da8c9f6

Please sign in to comment.