Commit 5ba7ddf0 authored by Dayona Joseph's avatar Dayona Joseph

Add confirmation dialog for removing shortcuts

parent 5bf90d15
Pipeline #55823 passed with stage
in 7 minutes and 17 seconds
......@@ -19,6 +19,7 @@ import android.content.ComponentName;
import android.content.ContentResolver;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.LauncherApps;
......@@ -41,6 +42,7 @@ import android.provider.Settings;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log;
import android.view.ContextThemeWrapper;
import android.view.DragEvent;
import android.view.Gravity;
import android.view.LayoutInflater;
......@@ -1956,7 +1958,25 @@ public class LauncherActivity extends AppCompatActivity implements
startActivity(i);
}
} else if (launcherItem.itemType == Constants.ITEM_TYPE_SHORTCUT) {
removeShortcutView((ShortcutItem) launcherItem, blissFrameLayout);
AlertDialog dialog =new AlertDialog.Builder(new ContextThemeWrapper(this, R.style.AlertDialogCustom))
.setTitle(launcherItem.title)
.setMessage(R.string.uninstall_shortcut_dialog)
.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
removeShortcutView((ShortcutItem) launcherItem, blissFrameLayout);
}
})
.setNegativeButton(R.string.cancel, null)
.setIcon(launcherItem.icon)
.create();
dialog.setOnShowListener( new DialogInterface.OnShowListener() {
@Override
public void onShow(DialogInterface arg0) {
dialog.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(getResources().getColor(R.color.color_blue));
dialog.getButton(AlertDialog.BUTTON_NEGATIVE).setTextColor(getResources().getColor(R.color.color_blue));
}
});
dialog.show();
}
});
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(
......
......@@ -19,4 +19,6 @@
<color name="list_selector_focused">#cc33b5e5</color>
<color name="list_selector_activated">#4d33b5e5</color>
<color name="white">#FFFFFF</color>
<color name="color_blue">#0088ED</color>
</resources>
......@@ -169,5 +169,6 @@
<string name="default_scroll_format">Page %1$d of %2$d</string>
<string name="icon_badging_service_title">Show notification dots</string>
<string name="uninstall_shortcut_dialog">Do you want to uninstall this shortcut?</string>
<string name="ok">ok</string>
</resources>
......@@ -26,4 +26,10 @@
<item name="android:windowNoTitle">false</item>
<item name="android:listDivider">@drawable/list_divider_material</item>
</style>
<style name="AlertDialogCustom" parent="Theme.AppCompat.Light.Dialog">
<item name="android:textColor">#000000</item>
<item name="android:typeface">normal</item>
<item name="android:background">@color/white</item>
</style>
</resources>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment