Skip to content
This repository has been archived by the owner on May 21, 2022. It is now read-only.

Commit

Permalink
Merge pull request #511 from a93h/master
Browse files Browse the repository at this point in the history
codename fingus ready for production
  • Loading branch information
Austin H authored Sep 9, 2019
2 parents 4545382 + 8ba1085 commit d3ac50d
Show file tree
Hide file tree
Showing 10 changed files with 67 additions and 80 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ Before the release of a new version of SLS, it will be available here to test fo
* Store scrobbles before user is logged in
* Manual scrobbling, for example Vinyl Records, CD, Cassette and other older media machines.
* Import database
* Keep more variables in the database including past scrobbles, old scrobbles and statistics
* .. essentially better internal data management

## Features

Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ android {
applicationId "com.adam.aslfms"
minSdkVersion 14
targetSdkVersion 26
versionCode = 53
versionName = "1.6.2"
versionCode = 54
versionName = "1.6.3"

testApplicationId "com.adam.aslfms.test"
testInstrumentationRunner "android.test.InstrumentationTestRunner"
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/assets/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ Visit,
https://github.com/simple-last-fm-scrobbler/sls
For more details.

- 1.6.3 (2018-9-9) codename: fingus
* UI fixes
* Added not logged in warning
* Added database management

- 1.6.2 (2018-9-8) codename: engus
* Fixed music not being recognized immediately
* Skip permissions optionally
Expand Down
35 changes: 18 additions & 17 deletions app/src/main/java/com/adam/aslfms/EditUserCredentials.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import android.view.View;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.TextView;

import com.adam.aslfms.service.NetApp;
import com.adam.aslfms.service.ScrobblingService;
Expand Down Expand Up @@ -71,22 +72,8 @@ public void setNetApp(NetApp napp) {
@Override
protected void onBindDialogView(View view) {
super.onBindDialogView(view);
if (mNetApp == NetApp.LISTENBRAINZ || mNetApp == NetApp.LISTENBRAINZCUSTOM) {
mUsername = (EditText) view.findViewById(R.id.username);
mUsername.setText(settings.getUsername(mNetApp));
mListenBrainzToken = (EditText) view.findViewById(R.id.listenBrainzToken);
view.findViewById(R.id.listenBrainz).setVisibility(View.VISIBLE);
view.findViewById(R.id.userOnly).setVisibility(View.VISIBLE);
if (mNetApp == NetApp.LISTENBRAINZCUSTOM) {
mListenBrainzURL = (EditText) view.findViewById(R.id.listenBrainzURL);
mListenBrainzApiURL = (EditText) view.findViewById(R.id.listenBrainzApiURL);
mListenBrainzSecureSocket = (CheckBox) view.findViewById(R.id.listenBrainzSecureSocketSwitch);
mListenBrainzURL.setText(settings.getListenBrainzUrl(mNetApp));
mListenBrainzApiURL.setText(settings.getListenBrainzApiUrl(mNetApp));
mListenBrainzSecureSocket.setChecked(settings.getSecureSocketListenbrainz(mNetApp));
view.findViewById(R.id.listenBrainzCustom).setVisibility(View.VISIBLE);
}
} else {


mUsername = (EditText) view.findViewById(R.id.username);
mPassword = (EditText) view.findViewById(R.id.password);
mUsername.addTextChangedListener(new TextWatcher() {
Expand All @@ -112,6 +99,11 @@ public void afterTextChanged(Editable s) {

view.findViewById(R.id.userOnly).setVisibility(View.VISIBLE);
view.findViewById(R.id.pwdOnly).setVisibility(View.VISIBLE);
if (mNetApp == NetApp.LISTENBRAINZ){
TextView pwdTitle = (TextView) view.findViewById(R.id.pwdTitle);
pwdTitle.setText(R.string.listen_brainz_token);
}

if (mNetApp == NetApp.LIBREFMCUSTOM) {
mNixtapeUrl = (EditText) view.findViewById(R.id.nixtapeUrl);
mGnukeboxUrl = (EditText) view.findViewById(R.id.gnukeboxUrl);
Expand All @@ -122,7 +114,16 @@ public void afterTextChanged(Editable s) {

view.findViewById(R.id.libreFmCustom).setVisibility(View.VISIBLE);
}
}

if (mNetApp == NetApp.LISTENBRAINZCUSTOM) {
mListenBrainzURL = (EditText) view.findViewById(R.id.listenBrainzURL);
mListenBrainzApiURL = (EditText) view.findViewById(R.id.listenBrainzApiURL);
mListenBrainzSecureSocket = (CheckBox) view.findViewById(R.id.listenBrainzSecureSocketSwitch);
mListenBrainzURL.setText(settings.getListenBrainzUrl(mNetApp));
mListenBrainzApiURL.setText(settings.getListenBrainzApiUrl(mNetApp));
mListenBrainzSecureSocket.setChecked(settings.getSecureSocketListenbrainz(mNetApp));
view.findViewById(R.id.listenBrainzCustom).setVisibility(View.VISIBLE);
}
}

@Override
Expand Down
43 changes: 27 additions & 16 deletions app/src/main/java/com/adam/aslfms/OptionsActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.net.sip.SipSession;
import android.os.Bundle;
import android.preference.CheckBoxPreference;
import android.preference.ListPreference;
Expand Down Expand Up @@ -57,6 +58,7 @@ public class OptionsActivity extends AppCompatPreferenceActivity {
private static final String KEY_NOTIFICATION_PRIORITY = "notification_priority";
private static final String KEY_LANGUAGES_LIST = "languages_list";
private static final String KEY_PERMISSION_SHOW = "permission_activity_show";
private static final String KEY_THEME = "my_theme";

private AppSettings settings;

Expand Down Expand Up @@ -190,6 +192,7 @@ public PowerSpecificPrefs(PowerOptions power,
private Preference exportdatabase;
private ListPreference notification_priority;
private ListPreference languages_list;
private Preference mChangeTheme;

public void create() {
createChooserPreference();
Expand All @@ -200,32 +203,40 @@ public void create() {
createAOCPreference();
createNetPreference();
createRoamingPreference();
mChangeTheme = findPreference(KEY_THEME);
exportdatabase = findPreference(KEY_EXPORT_DB);
showPermissionActivity = findPreference(KEY_PERMISSION_SHOW);
notification_priority = (ListPreference) findPreference(KEY_NOTIFICATION_PRIORITY);
notification_priority.setDefaultValue(Util.notificationStringToInt(getApplicationContext()));
languages_list = (ListPreference) findPreference(KEY_LANGUAGES_LIST);
notification_priority.setOnPreferenceChangeListener((Preference preference, Object object) -> {
settings.setKeyNotificationPriority(notification_priority.getValue());
return false;
}
settings.setKeyNotificationPriority(notification_priority.getValue());
return false;
}
);
languages_list.setOnPreferenceChangeListener((Preference preference, Object object) -> {
String userSelection = (String) object;
String[] country_codes = getResources().getStringArray(R.array.language_codes);
String[] langauge_list = getResources().getStringArray(R.array.language_list);
int position = Arrays.asList(langauge_list).indexOf(userSelection);
settings.setAppLocale(country_codes[position]);
recreate();
return false;
}
String userSelection = (String) object;
String[] country_codes = getResources().getStringArray(R.array.language_codes);
String[] langauge_list = getResources().getStringArray(R.array.language_list);
int position = Arrays.asList(langauge_list).indexOf(userSelection);
settings.setAppLocale(country_codes[position]);
recreate();
return false;
}
);
showPermissionActivity.setOnPreferenceClickListener((Preference preference) ->{
Intent i = new Intent(ctx, PermissionsActivity.class);
startActivity(i);
return false;
}
showPermissionActivity.setOnPreferenceClickListener((Preference preference) -> {
Intent i = new Intent(ctx, PermissionsActivity.class);
startActivity(i);
return false;
}
);

mChangeTheme.setOnPreferenceClickListener((Preference preference) ->
{
Intent i = new Intent(ctx, ChangeThemeActivity.class);
startActivity(i);
return true;
});
}

public boolean onClick(Preference pref) {
Expand Down
14 changes: 1 addition & 13 deletions app/src/main/java/com/adam/aslfms/SettingsActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,6 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
private static final String KEY_VIEW_SCROBBLE_CACHE = "view_scrobble_cache";
private static final String KEY_HEART_CURRENT_TRACK = "my_heart_button";
private static final String KEY_COPY_CURRENT_TRACK = "my_copy_button";
private static final String KEY_THEME = "my_theme";

public static final String ACTION_KILL_SERVICE = "action_kill_service";

private AppSettings settings;

Expand All @@ -72,11 +69,6 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
private Preference mViewScrobbleCache;
private Preference mHeartCurrentTrack;
private Preference mCopyCurrentTrack;
private Preference mChangeTheme;

int WRITE_EXTERNAL_STORAGE;
int REQUEST_READ_STORAGE;
int REQUEST_IGNORE_BATTERY_OPTIMIZATIONS;

Context mCtx;

Expand Down Expand Up @@ -123,13 +115,13 @@ protected void onCreate(Bundle savedInstanceState) {
mScrobbleAllNow = findPreference(KEY_SCROBBLE_ALL_NOW);
mViewScrobbleCache = findPreference(KEY_VIEW_SCROBBLE_CACHE);
mCopyCurrentTrack = findPreference(KEY_COPY_CURRENT_TRACK);
mChangeTheme = findPreference(KEY_THEME);

// TODO: VERIFY EVERYTHING BELOW IS SAFE
int v = Util.getAppVersionCode(this, getPackageName());
if (settings.getWhatsNewViewedVersion() < v && settings.getKeyBypassNewPermissions() != 2) {
new WhatsNewDialog(this).show();
settings.setWhatsNewViewedVersion(v);
mDb.rebuildDataBaseOnce(); // keep as not all users have the newest database.
}
Util.runServices(this); // Scrobbler, Controller, Notification
}
Expand Down Expand Up @@ -183,10 +175,6 @@ public boolean onPreferenceTreeClick(PreferenceScreen prefScreen,
} else if (pref == mCopyCurrentTrack) {
Util.copyIfPossible(this);
return true;
} else if (pref == mChangeTheme){
Intent i = new Intent(this, ChangeThemeActivity.class);
startActivity(i);
return true;
}
return super.onPreferenceTreeClick(prefScreen, pref);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,13 @@
import android.os.Bundle;
import android.util.Log;

import com.adam.aslfms.R;
import com.adam.aslfms.UserCredActivity;
import com.adam.aslfms.service.ScrobblingService;
import com.adam.aslfms.util.AppSettings;
import com.adam.aslfms.util.InternalTrackTransmitter;
import com.adam.aslfms.util.Track;
import com.adam.aslfms.util.Util;

import java.util.Iterator;
import java.util.Set;
Expand Down Expand Up @@ -91,6 +94,7 @@ public final void onReceive(Context context, Intent intent) {
// we must be logged in to scrobble
AppSettings settings = new AppSettings(context);
if (!settings.isAnyAuthenticated()) {
Util.myNotify(context, context.getResources().getString(R.string.warning) , context.getResources().getString(R.string.not_logged_in),05233, UserCredActivity.class);
Log
.d(TAG,
"The user has not authenticated, won't propagate the submission request");
Expand Down
28 changes: 1 addition & 27 deletions app/src/main/res/layout/edit_user_credentials.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@


<TextView
android:id="@+id/pwdTitle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dip"
Expand Down Expand Up @@ -163,32 +164,5 @@
android:layout_height="wrap_content"
android:text="@string/secure_socket_info"/>
</LinearLayout>

<LinearLayout
android:id="@+id/listenBrainz"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="vertical"
android:visibility="gone">


<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dip"
android:paddingRight="10dip"
android:paddingTop="10dip"
android:text="@string/listen_brainz_token" />

<EditText
android:id="@+id/listenBrainzToken"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dip"
android:layout_marginRight="10dip"
android:inputType="textPassword"
android:maxLines="1" />
</LinearLayout>
</LinearLayout>
</ScrollView>
7 changes: 7 additions & 0 deletions app/src/main/res/xml/options_prefs.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">


<PreferenceCategory android:title="@string/theme_title" />
<Preference
android:key="my_theme"
android:title="@string/theme_summary"/>

<PreferenceCategory android:title="@string/advanced_options_type_custom_name" />
<ListPreference android:key="notification_priority"
android:title="@string/notification_priority"
android:defaultValue="3"
Expand Down
5 changes: 0 additions & 5 deletions app/src/main/res/xml/settings_prefs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,4 @@
android:summary="@string/copy_current_track"
android:title="@string/copy_title" />

<PreferenceCategory android:title="@string/theme_title" />
<Preference
android:key="my_theme"
android:title="@string/theme_summary"/>

</PreferenceScreen>

0 comments on commit d3ac50d

Please sign in to comment.