From 2f027477977a07e06c6aecd48bb82a1cb255ef2a Mon Sep 17 00:00:00 2001 From: M66B Date: Fri, 9 Jan 2015 10:33:51 +0100 Subject: [PATCH] Always open correct app details Refs #2109 --- CHANGELOG.md | 2 +- src/biz/bokhorst/xprivacy/ActivityMain.java | 88 ++++++++++----------- 2 files changed, 44 insertions(+), 46 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 16c892e81..4542a81c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,7 +21,7 @@ Changelog **Next release** -* Prevent accidental application name clicks ([issue](/../../issues/2109)) +* Prevent opening wrong application details ([issue](/../../issues/2109)) * Fixed restriction *USB.getSerialNumber* * Added restriction *Cast.getDeviceId* and *Cast.getIpAddress* ([issue](/../../issues/2108)) diff --git a/src/biz/bokhorst/xprivacy/ActivityMain.java b/src/biz/bokhorst/xprivacy/ActivityMain.java index b3515f195..10b398686 100644 --- a/src/biz/bokhorst/xprivacy/ActivityMain.java +++ b/src/biz/bokhorst/xprivacy/ActivityMain.java @@ -2056,48 +2056,6 @@ public void onClick(View view) { } }); - // Listen for multiple select - holder.llName.setOnLongClickListener(new View.OnLongClickListener() { - @Override - public boolean onLongClick(View view) { - if (mListAppSelected.contains(xAppInfo)) { - mSelecting = false; - mListAppSelected.clear(); - mAppAdapter.notifyDataSetChanged(); - } else { - mSelecting = true; - mListAppSelected.add(xAppInfo); - holder.row.setBackgroundColor(mHighlightColor); - } - showStats(); - return true; - } - }); - - // Listen for application selection - holder.llName.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(final View view) { - if (mSelecting) { - if (mListAppSelected.contains(xAppInfo)) { - mListAppSelected.remove(xAppInfo); - holder.row.setBackgroundColor(Color.TRANSPARENT); - if (mListAppSelected.size() == 0) - mSelecting = false; - } else { - mListAppSelected.add(xAppInfo); - holder.row.setBackgroundColor(mHighlightColor); - } - showStats(); - } else { - Intent intentSettings = new Intent(ActivityMain.this, ActivityApp.class); - intentSettings.putExtra(ActivityApp.cUid, xAppInfo.getUid()); - intentSettings.putExtra(ActivityApp.cRestrictionName, mRestrictionName); - ActivityMain.this.startActivity(intentSettings); - } - } - }); - // Listen for restriction changes holder.imgCbRestricted.setOnClickListener(new View.OnClickListener() { @Override @@ -2252,7 +2210,7 @@ else if (state == ApplicationInfoEx.STATE_SHARED) @Override @SuppressLint("InflateParams") public View getView(int position, View convertView, ViewGroup parent) { - ViewHolder holder; + final ViewHolder holder; if (convertView == null) { convertView = mInflater.inflate(R.layout.mainentry, null); holder = new ViewHolder(convertView, position); @@ -2283,11 +2241,51 @@ public View getView(int position, View convertView, ViewGroup parent) { holder.imgCbRestricted.setEnabled(false); holder.imgIcon.setClickable(false); - holder.llName.setClickable(false); - holder.llName.setOnClickListener(null); holder.imgCbRestricted.setClickable(false); holder.imgCbAsk.setClickable(false); + // Listen for multiple select + holder.llName.setOnLongClickListener(new View.OnLongClickListener() { + @Override + public boolean onLongClick(View view) { + if (mListAppSelected.contains(xAppInfo)) { + mSelecting = false; + mListAppSelected.clear(); + mAppAdapter.notifyDataSetChanged(); + } else { + mSelecting = true; + mListAppSelected.add(xAppInfo); + holder.row.setBackgroundColor(mHighlightColor); + } + showStats(); + return true; + } + }); + + // Listen for application selection + holder.llName.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(final View view) { + if (mSelecting) { + if (mListAppSelected.contains(xAppInfo)) { + mListAppSelected.remove(xAppInfo); + holder.row.setBackgroundColor(Color.TRANSPARENT); + if (mListAppSelected.size() == 0) + mSelecting = false; + } else { + mListAppSelected.add(xAppInfo); + holder.row.setBackgroundColor(mHighlightColor); + } + showStats(); + } else { + Intent intentSettings = new Intent(ActivityMain.this, ActivityApp.class); + intentSettings.putExtra(ActivityApp.cUid, xAppInfo.getUid()); + intentSettings.putExtra(ActivityApp.cRestrictionName, mRestrictionName); + ActivityMain.this.startActivity(intentSettings); + } + } + }); + // Async update new HolderTask(position, holder, xAppInfo).executeOnExecutor(mExecutor, (Object) null);