Skip to content
This repository has been archived by the owner on Sep 6, 2019. It is now read-only.

Commit

Permalink
Always open correct app details
Browse files Browse the repository at this point in the history
Refs #2109
  • Loading branch information
M66B committed Jan 9, 2015
1 parent c34231b commit 2f02747
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 46 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down
88 changes: 43 additions & 45 deletions src/biz/bokhorst/xprivacy/ActivityMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit 2f02747

Please sign in to comment.