Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refresh button #11

Merged
4 commits merged into from
Mar 9, 2017
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import android.view.MenuInflater;
import android.view.MenuItem;
import android.widget.EditText;
import android.widget.Toast;

import de.arcus.framework.logger.Logger;
import de.arcus.framework.crashhandler.CrashHandler;
Expand Down Expand Up @@ -328,28 +329,22 @@ public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.music_track_list, menu);

MenuItem itemRefreshLibrary = menu. findItem(R.id.action_refresh);
itemRefreshLibrary.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener()
MenuItem itemRefreshLibrary = menu.findItem(R.id.action_refresh);
itemRefreshLibrary.setOnMenuItemClickListener(item ->
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

{
@Override
public boolean onMenuItemClick(MenuItem item)
try
{
try
{
mPlayMusicManager.realoadDatabase();
}
catch (NoSuperUserException e)
{
e.printStackTrace();
}
catch (CouldNotOpenDatabaseException e)
{
e.printStackTrace();
}
mPlayMusicManager.realoadDatabase();
mPlayMusicManager = null;
loadPlayMusicExporter();
return true;
Toast.makeText( this, R.string.databasereloaded, Toast.LENGTH_SHORT).show();
}
catch (NoSuperUserException | CouldNotOpenDatabaseException e)
{
Toast.makeText( this, R.string.dialog_superuser_access_denied_title, Toast.LENGTH_SHORT).show();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this quite misleading, if the thrown exception is a CouldNotOpenDatabaseException? I would not expect that to be thrown though, I've never seen it. Still, that might be something we should change later on, even though I wouldn't wait with merging the PR because of that.

e.printStackTrace();
}
return true;
});

// Finds the search item and create the search view
Expand Down
2 changes: 2 additions & 0 deletions playmusicexporter/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,6 @@
<string name="file_handling_category">Dateiverarbeitung</string>
<string name="overwrite_summary">Überschreiben Sie die exportierte Datei immer, auch wenn sie bereits existiert.</string>
<string name="overwrite_title">Bestehende Dateien überschreiben.</string>
<string name="action_refesh">Erfrischen</string>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That sounds weird, someting like "Erneut laden" (enl. load again) would be more fitting I think.

<string name="databasereloaded">Reloaded Musikdatenbank</string>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reloaded is not german, I would suggest "Musikdatenbank neu geladen" or shorter "Datenbank erneuert"

</resources>
2 changes: 1 addition & 1 deletion playmusicexporter/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@
<color name="button_navigation_drawer_active">#11000000</color>
<color name="button_navigation_drawer_text">#88000000</color>
<color name="button_navigation_drawer_text_active">#ef6c00</color>
<color name="white">#ffffffff</color>
<color name="white">#ffffffff</color>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

<color name="black">#ff000000</color>
</resources>
3 changes: 2 additions & 1 deletion playmusicexporter/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -146,5 +146,6 @@
<string name="file_handling_category">File Handling</string>
<string name="overwrite_summary">Always overwrite the exported file, even if it already exists.</string>
<string name="overwrite_title">Overwrite Existing Files</string>
<string name="action_refesh">Refresh</string>
<string name="action_refesh">Refresh</string>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

<string name="databasereloaded">Music Database Reloaded</string>
</resources>