Skip to content

Commit 2231464

Browse files
authored
Fixes (#18)
- Fix Upload Shortcut - Add Shortcut Icon
1 parent cf7feea commit 2231464

File tree

4 files changed

+36
-14
lines changed

4 files changed

+36
-14
lines changed

app/src/main/java/com/djangofiles/djangofiles/MainActivity.kt

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ class MainActivity : AppCompatActivity() {
150150
//Log.d("handleIntent", "authToken: $authToken")
151151

152152
if (savedUrl.isNullOrEmpty()) {
153-
Log.w("handleIntent", "Missing Saved URL or Token...")
153+
Log.i("handleIntent", "Missing Saved URL or Token...")
154154

155155
navController.navigate(
156156
R.id.nav_item_setup, null, NavOptions.Builder()
@@ -164,15 +164,14 @@ class MainActivity : AppCompatActivity() {
164164
binding.drawerLayout.closeDrawers()
165165

166166
// TODO: Cleanup the logic for handling MAIN intent...
167-
val currentDestinationId = navController.currentDestination?.id
168-
Log.d("handleIntent", "currentDestinationId: $currentDestinationId")
169-
val launcherAction = sharedPreferences.getString("launcher_action", null)
170-
Log.d("handleIntent", "launcherAction: $launcherAction")
171-
val fromShortcut = intent.getStringExtra("fromShortcut")
172-
Log.d("handleIntent", "fromShortcut: $fromShortcut")
167+
168+
//val currentDestinationId = navController.currentDestination?.id
169+
//Log.d("handleIntent", "currentDestinationId: $currentDestinationId")
170+
//val launcherAction = sharedPreferences.getString("launcher_action", null)
171+
//Log.d("handleIntent", "launcherAction: $launcherAction")
172+
173173
//Log.d("handleIntent", "nav_item_preview: ${R.id.nav_item_preview}")
174174
//Log.d("handleIntent", "nav_item_short: ${R.id.nav_item_short}")
175-
//
176175
//if (currentDestinationId == R.id.nav_item_preview || currentDestinationId == R.id.nav_item_short) {
177176
// Log.i("handleIntent", "ON PREVIEW/SHORT - Navigating to HomeFragment w/ setPopUpTo")
178177
// // TODO: Determine the correct navigation call here...
@@ -186,11 +185,14 @@ class MainActivity : AppCompatActivity() {
186185
// Log.i("handleIntent", "HOME SETTING SET - Navigating to HomeFragment")
187186
// navController.navigate(R.id.nav_item_home)
188187
//}
189-
//// TODO: Determine if this needs to be in the above if/else
190-
//if (fromShortcut == "upload") {
191-
// Log.d("handleIntent", "filePickerLauncher.launch")
192-
// filePickerLauncher.launch(arrayOf("*/*"))
193-
//}
188+
189+
// TODO: Determine if this needs to be in the above if/else
190+
val fromShortcut = intent.getStringExtra("fromShortcut")
191+
Log.d("handleIntent", "fromShortcut: $fromShortcut")
192+
if (fromShortcut == "upload") {
193+
Log.d("handleIntent", "filePickerLauncher.launch")
194+
filePickerLauncher.launch(arrayOf("*/*"))
195+
}
194196

195197
} else if (Intent.ACTION_SEND == intent.action) {
196198
Log.d("handleIntent", "ACTION_SEND")
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
android:width="24dp"
3+
android:height="24dp"
4+
android:viewportWidth="512"
5+
android:viewportHeight="512">
6+
<group
7+
android:scaleX="0.4"
8+
android:scaleY="0.4"
9+
android:translateX="153.6"
10+
android:translateY="153.6">
11+
<path
12+
android:fillColor="#FFFFFF"
13+
android:pathData="M288,109.3L288,352c0,17.7 -14.3,32 -32,32s-32,-14.3 -32,-32l0,-242.7 -73.4,73.4c-12.5,12.5 -32.8,12.5 -45.3,0s-12.5,-32.8 0,-45.3l128,-128c12.5,-12.5 32.8,-12.5 45.3,0l128,128c12.5,12.5 12.5,32.8 0,45.3s-32.8,12.5 -45.3,0L288,109.3zM64,352l128,0c0,35.3 28.7,64 64,64s64,-28.7 64,-64l128,0c35.3,0 64,28.7 64,64l0,32c0,35.3 -28.7,64 -64,64L64,512c-35.3,0 -64,-28.7 -64,-64l0,-32c0,-35.3 28.7,-64 64,-64zM432,456a24,24 0,1 0,0 -48,24 24,0 1,0 0,48z"/>
14+
</group>
15+
</vector>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
3+
<background android:drawable="@color/ic_launcher_background" />
4+
<foreground android:drawable="@drawable/fa_upload_shortcut" />
5+
</adaptive-icon>

app/src/main/res/xml/shortcuts.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<shortcut
44
android:shortcutId="upload"
55
android:enabled="true"
6-
android:icon="@mipmap/ic_launcher_round"
6+
android:icon="@drawable/shortcut_upload"
77
android:shortcutShortLabel="@string/upload"
88
android:shortcutLongLabel="@string/upload_file">
99
<intent

0 commit comments

Comments
 (0)