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 c53e331..0000000 Binary files a/app/src/main/res/drawable-hdpi/ic_search.png and /dev/null differ diff --git a/app/src/main/res/drawable-ldpi/ic_search.png b/app/src/main/res/drawable-ldpi/ic_search.png deleted file mode 100644 index d190496..0000000 Binary files a/app/src/main/res/drawable-ldpi/ic_search.png and /dev/null differ 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 5feb851..0000000 Binary files a/app/src/main/res/drawable-mdpi/ic_search.png and /dev/null differ 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 3b17455..0000000 Binary files a/app/src/main/res/drawable-xhdpi/ic_search.png and /dev/null differ 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 c635b4a..0000000 Binary files a/app/src/main/res/drawable-xxhdpi/ic_search.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_search.png b/app/src/main/res/drawable-xxxhdpi/ic_search.png deleted file mode 100644 index 88f973d..0000000 Binary files a/app/src/main/res/drawable-xxxhdpi/ic_search.png and /dev/null differ diff --git a/app/src/main/res/drawable/ic_search.xml b/app/src/main/res/drawable/ic_search.xml new file mode 100644 index 0000000..6a5ca80 --- /dev/null +++ b/app/src/main/res/drawable/ic_search.xml @@ -0,0 +1,9 @@ + + + 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