From 1f97fe76885bf2242b736e853ed210bce6e70d3d Mon Sep 17 00:00:00 2001 From: Schoumi Date: Tue, 4 Jun 2019 11:23:27 +0200 Subject: [PATCH] Add App Settings Access in Report pages --- .gitignore | 6 ++ .../exodusprivacy/MainActivity.java | 53 ++++++++++++++---- app/src/main/res/drawable-hdpi/ic_search.png | Bin 448 -> 0 bytes app/src/main/res/drawable-ldpi/ic_search.png | Bin 384 -> 0 bytes app/src/main/res/drawable-mdpi/ic_search.png | Bin 265 -> 0 bytes app/src/main/res/drawable-xhdpi/ic_search.png | Bin 492 -> 0 bytes .../main/res/drawable-xxhdpi/ic_search.png | Bin 744 -> 0 bytes .../main/res/drawable-xxxhdpi/ic_search.png | Bin 967 -> 0 bytes app/src/main/res/drawable/ic_search.xml | 9 +++ app/src/main/res/drawable/ic_settings.xml | 4 ++ app/src/main/res/menu/main.xml | 7 ++- app/src/main/res/values/strings.xml | 2 + build.gradle | 1 + gradle/wrapper/gradle-wrapper.properties | 1 + 14 files changed, 72 insertions(+), 11 deletions(-) delete mode 100644 app/src/main/res/drawable-hdpi/ic_search.png delete mode 100644 app/src/main/res/drawable-ldpi/ic_search.png delete mode 100644 app/src/main/res/drawable-mdpi/ic_search.png delete mode 100644 app/src/main/res/drawable-xhdpi/ic_search.png delete mode 100644 app/src/main/res/drawable-xxhdpi/ic_search.png delete mode 100644 app/src/main/res/drawable-xxxhdpi/ic_search.png create mode 100644 app/src/main/res/drawable/ic_search.xml create mode 100644 app/src/main/res/drawable/ic_settings.xml diff --git a/.gitignore b/.gitignore index d8ec13b..d425b7b 100644 --- a/.gitignore +++ b/.gitignore @@ -22,4 +22,10 @@ proguard/ .idea *.iml +#vim +.*swp +.*swo +.tags + + captures/ diff --git a/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/MainActivity.java b/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/MainActivity.java index 034872a..e960d96 100644 --- a/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/MainActivity.java +++ b/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/MainActivity.java @@ -20,13 +20,17 @@ package org.eu.exodus_privacy.exodusprivacy; import android.support.v4.app.FragmentManager; import android.content.Context; +import android.content.Intent; +import android.net.Uri; import android.databinding.DataBindingUtil; import android.support.design.widget.Snackbar; import android.support.v4.app.FragmentTransaction; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; +import android.provider.Settings; import android.support.v7.widget.SearchView; import android.view.Menu; +import android.view.MenuItem; import android.view.MenuInflater; import android.view.inputmethod.InputMethodManager; @@ -38,15 +42,19 @@ import org.eu.exodus_privacy.exodusprivacy.listener.NetworkListener; public class MainActivity extends AppCompatActivity { - AppListFragment appList; - ReportFragment report; - SearchView searchView; - private Menu mMenu; + private AppListFragment appList; + private ReportFragment report; + private SearchView searchView; + private Menu toolbarMenu; + private MenuItem settingsMenuItem; + private String packageName; + private MainBinding binding; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - final MainBinding mainBinding = DataBindingUtil.setContentView(this,R.layout.main); + binding = DataBindingUtil.setContentView(this,R.layout.main); + final MainBinding mainBinding = binding; NetworkListener networkListener = new NetworkListener() { @Override @@ -84,13 +92,14 @@ public class MainActivity extends AppCompatActivity { .addToBackStack(null) .commit(); + packageName = packageInfo.packageName; + searchView.clearFocus(); - if (mMenu != null) - (mMenu.findItem(R.id.action_filter)).collapseActionView(); + if (toolbarMenu != null) + (toolbarMenu.findItem(R.id.action_filter)).collapseActionView(); InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); assert imm != null; imm.hideSoftInputFromWindow(mainBinding.fragmentContainer.getWindowToken(), 0); - }; appList = AppListFragment.newInstance(networkListener,onAppClickListener); @@ -106,14 +115,16 @@ public class MainActivity extends AppCompatActivity { public void onBackPressed() { if (getSupportFragmentManager().getBackStackEntryCount() == 0) finish(); - else + else { getSupportFragmentManager().popBackStack(); + report = null; + } } @Override public boolean onCreateOptionsMenu(Menu menu) { - mMenu = menu; + toolbarMenu = menu; MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.main, menu); searchView = (SearchView) menu.findItem(R.id.action_filter).getActionView(); @@ -131,6 +142,28 @@ public class MainActivity extends AppCompatActivity { return true; } }); + + settingsMenuItem = menu.findItem(R.id.action_settings); + if (report != null) + settingsMenuItem.setVisible(true); + else + settingsMenuItem.setVisible(false); return true; } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + if(item.getItemId() == R.id.action_settings) { + Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); + intent.setData(Uri.fromParts("package",packageName,null)); + try { + startActivity(intent); + } catch(android.content.ActivityNotFoundException e) { + Snackbar bar = Snackbar.make(binding.fragmentContainer,R.string.no_settings,Snackbar.LENGTH_LONG); + bar.show(); + } + return true; + } + return false; + } } diff --git a/app/src/main/res/drawable-hdpi/ic_search.png b/app/src/main/res/drawable-hdpi/ic_search.png deleted file mode 100644 index c53e3315c06a96e7a0311a8655924065a195636d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 448 zcmV;x0YCnUP) qKMb@-9qed_@(-<%#V7j+Dy~mrwlC~vGhU$p0000y3MC_V;GkVg2QHwlpg43Wb_=DnE9fNR$kLevsY+>altqMo z2VOynyhPN%Avf>5e7QeKN~KdB#u%xNnkYaGRNe~`MUj^z$z__R_vi_|q5*3iyxKmH zn=H%b=nKFMO^Da%6Yq{aer`F+#6muZyWC_@NPG?Oh4m%zEqgr|sIGF9iG`ePKZNTm z{5g77-&~-k?a54;?C=|SBeXIiJ3xVL>_p}4@O``?TIYfE#DN;Cp8Ven`~rW9-ta;f zsH_odI%=$XV&5NM5WEMx4PKA6^StrbG-6H1Hg;sonF@k_i2Lko6?vC@jabuBW7QLt zqf7(=w!nX6U%SXB;@MB*?+8_nG7$vWcVU<#>d diff --git a/app/src/main/res/drawable-mdpi/ic_search.png b/app/src/main/res/drawable-mdpi/ic_search.png deleted file mode 100644 index 5feb851bd766a9c5f9fb4652ba88abeb6e70797a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 265 zcmV+k0rvihP)M=qJV0%oIN_h&L;~PN-N61&hfFozStU1Ur&7 zI$>nd63iwWOkZ#XJCU_Ip=2=27^?%A^i=wD(5oSg0_}za2|KQh29jO~P P00000NkvXXu0mjf?apZ5 diff --git a/app/src/main/res/drawable-xhdpi/ic_search.png b/app/src/main/res/drawable-xhdpi/ic_search.png deleted file mode 100644 index 3b174553ebe8da1fefc56363804de6c02dd3034c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 492 zcmV-Ji<&Jc+N?G zjdxh-4Lo?a3P2cdPfMkDs+SMf#|Q+80NgaEjP6XJ>$~Q;l+@9lH!0@ z-uugw9xtzAD!%RyV;?p3#d!^3F+h{Tx|Ys9IqPD8F@>cqoe$(3hym6V7O-@N$hi~) zY$?oX>2#BGBL{H(8L*QZqM)VohMX%gz=*;!md-3WM`C~mh4n0*PvoqL0U~?@#Y}w( z?zT$#yV`ts%#Z)ljM7};OD<8vUMaeHB3MGnOfaHW%=)m zFzOg!i4AsGv3*|CE*SQ%sifw+uc{tV(IJXz5M>>rpaxOWA@b@GIW>r)dPG4nfFbfq i(|;p!O4Hl2rB0s>&iunp$-!y>0000 diff --git a/app/src/main/res/drawable-xxhdpi/ic_search.png b/app/src/main/res/drawable-xxhdpi/ic_search.png deleted file mode 100644 index c635b4a5337e84f4dbeea17eb4ab73eb60277a21..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 744 zcmVP)`bXBnrASUPoh$skwzK7r?1+kZaYZV_r6kMq2Lb|L* zF<$7RDk6x&`0v-&mhYSy(mBI7nJJtp1^4jJJ(khmNSW8z!N0SG-bTng!5o6-0cAMR>U84^%(92B=yYD- z6y~WRAJxU^gGEFg~-r0A8WRX2|dAElhU&Qs4|oni!OpO$Hi;>{D6eeEbDMC1pkro(-J~!tiwVGeu(j_5<(}e z!w^*oFByLI=l$6Q(rNDP(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{~n*T+Kl<+aeJkA*J%Ep%#bKxjcH`DYe7w3g3U&{6)Gg?6pw ppIK + + diff --git a/app/src/main/res/drawable/ic_settings.xml b/app/src/main/res/drawable/ic_settings.xml new file mode 100644 index 0000000..ed3ac36 --- /dev/null +++ b/app/src/main/res/drawable/ic_settings.xml @@ -0,0 +1,4 @@ + + + diff --git a/app/src/main/res/menu/main.xml b/app/src/main/res/menu/main.xml index 2846266..6e7affd 100644 --- a/app/src/main/res/menu/main.xml +++ b/app/src/main/res/menu/main.xml @@ -7,4 +7,9 @@ android:title="@string/menu_action_filter" app:actionViewClass="android.support.v7.widget.SearchView" app:showAsAction="ifRoom|collapseActionView" /> - \ No newline at end of file + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 6a76a8c..a2b2b20 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -22,7 +22,9 @@ Processing Trackers: Getting trackers: Waiting for server connection Getting trackers + This app doesn\'t have settings Filter + Application Settings diff --git a/build.gradle b/build.gradle index 8a01ecc..75d4bd6 100644 --- a/build.gradle +++ b/build.gradle @@ -6,6 +6,7 @@ buildscript { maven { url "https://maven.google.com" } + google() } dependencies { classpath 'com.android.tools.build:gradle:3.4.1' diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index c67663f..b1b24a5 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -4,3 +4,4 @@ distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip +distributionSha256Sum=14cd15fc8cc8705bd69dcfa3c8fefb27eb7027f5de4b47a8b279218f76895a91