-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c8ac8d5
commit 83a3d8c
Showing
25 changed files
with
445 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
app/schemas/ch.unstable.ost.api.offline.StationsDatabase/1.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
{ | ||
"formatVersion": 1, | ||
"database": { | ||
"version": 1, | ||
"identityHash": "3b0a0f33592ccd09534143ac95e1f9d0", | ||
"entities": [ | ||
{ | ||
"tableName": "stations", | ||
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`frequency` INTEGER, `name` TEXT, `id` TEXT, `types` INTEGER, PRIMARY KEY(`id`))", | ||
"fields": [ | ||
{ | ||
"fieldPath": "frequency", | ||
"columnName": "frequency", | ||
"affinity": "INTEGER" | ||
}, | ||
{ | ||
"fieldPath": "name", | ||
"columnName": "name", | ||
"affinity": "TEXT" | ||
}, | ||
{ | ||
"fieldPath": "id", | ||
"columnName": "id", | ||
"affinity": "TEXT" | ||
}, | ||
{ | ||
"fieldPath": "types", | ||
"columnName": "types", | ||
"affinity": "INTEGER" | ||
} | ||
], | ||
"primaryKey": { | ||
"columnNames": [ | ||
"id" | ||
], | ||
"autoGenerate": false | ||
}, | ||
"indices": [], | ||
"foreignKeys": [] | ||
}, | ||
{ | ||
"tableName": "fts_stations", | ||
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`docid` INTEGER, `fts_stations` INTEGER, PRIMARY KEY(`docid`))", | ||
"fields": [ | ||
{ | ||
"fieldPath": "docid", | ||
"columnName": "docid", | ||
"affinity": "INTEGER" | ||
}, | ||
{ | ||
"fieldPath": "fts_stations", | ||
"columnName": "fts_stations", | ||
"affinity": "INTEGER" | ||
} | ||
], | ||
"primaryKey": { | ||
"columnNames": [ | ||
"docid" | ||
], | ||
"autoGenerate": false | ||
}, | ||
"indices": [], | ||
"foreignKeys": [] | ||
} | ||
], | ||
"setupQueries": [ | ||
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)", | ||
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, \"3b0a0f33592ccd09534143ac95e1f9d0\")" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
app/src/main/java/ch/unstable/ost/api/offline/StationsDAOFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package ch.unstable.ost.api.offline; | ||
|
||
import android.content.Context; | ||
import android.support.annotation.NonNull; | ||
|
||
import ch.unstable.ost.api.transport.TransportAPI; | ||
import ch.unstable.ost.database.Databases; | ||
import ch.unstable.ost.preference.StationDaoLoader; | ||
|
||
public class StationsDAOFactory implements StationDaoLoader.StationDAOFactory { | ||
@NonNull | ||
@Override | ||
public OfflineStationsDAO getStationsDAO(@NonNull Context context) { | ||
StationsDatabase database = Databases.getStationsDatabase(context); | ||
return database.getStationsDAO(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
app/src/main/java/ch/unstable/ost/api/search/StationsDAOFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package ch.unstable.ost.api.search; | ||
|
||
|
||
import android.content.Context; | ||
import android.support.annotation.NonNull; | ||
|
||
import ch.unstable.ost.preference.StationDaoLoader; | ||
|
||
public class StationsDAOFactory implements StationDaoLoader.StationDAOFactory { | ||
@NonNull | ||
@Override | ||
public SearchAPI getStationsDAO(@NonNull Context context) { | ||
return new SearchAPI(); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
app/src/main/java/ch/unstable/ost/api/transport/StationsDAOFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package ch.unstable.ost.api.transport; | ||
|
||
import android.content.Context; | ||
import android.support.annotation.NonNull; | ||
|
||
import ch.unstable.ost.preference.StationDaoLoader; | ||
|
||
public class StationsDAOFactory implements StationDaoLoader.StationDAOFactory { | ||
@NonNull | ||
@Override | ||
public TransportAPI getStationsDAO(@NonNull Context context) { | ||
return new TransportAPI(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
app/src/main/java/ch/unstable/ost/preference/ContentSettingsFragment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package ch.unstable.ost.preference; | ||
|
||
import android.os.Bundle; | ||
import android.preference.PreferenceFragment; | ||
import android.support.annotation.Nullable; | ||
|
||
import ch.unstable.ost.R; | ||
|
||
|
||
public class ContentSettingsFragment extends PreferenceFragment { | ||
@Override | ||
public void onCreate(@Nullable Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
addPreferencesFromResource(R.xml.pref_content); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
app/src/main/java/ch/unstable/ost/preference/StationDaoLoader.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package ch.unstable.ost.preference; | ||
|
||
|
||
import android.content.Context; | ||
import android.content.SharedPreferences; | ||
import android.preference.PreferenceManager; | ||
import android.support.annotation.NonNull; | ||
|
||
import ch.unstable.ost.R; | ||
import ch.unstable.ost.api.StationsDAO; | ||
|
||
public class StationDaoLoader { | ||
public interface StationDAOFactory { | ||
@NonNull | ||
StationsDAO getStationsDAO(@NonNull Context context); | ||
} | ||
|
||
@NonNull | ||
public static StationsDAO createStationDAO(final Context context) { | ||
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context); | ||
String preference = sharedPreferences.getString(PreferenceKeys.KEY_STATIONS_DAO, context.getString(R.string.prefs_station_dao_factory_default)); | ||
|
||
try { | ||
Class<?> clazz = Class.forName(preference); | ||
StationDAOFactory daoFactory = (StationDAOFactory) clazz.newInstance(); | ||
return daoFactory.getStationsDAO(context); | ||
} catch (Exception e) { | ||
throw new IllegalStateException("Couldn't get factory for StationsDAO", e); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="24dp" | ||
android:height="24dp" | ||
android:viewportWidth="24.0" | ||
android:viewportHeight="24.0"> | ||
<path | ||
android:fillColor="#FF000000" | ||
android:pathData="M12,3c-4.97,0 -9,4.03 -9,9s4.03,9 9,9c0.83,0 1.5,-0.67 1.5,-1.5 0,-0.39 -0.15,-0.74 -0.39,-1.01 -0.23,-0.26 -0.38,-0.61 -0.38,-0.99 0,-0.83 0.67,-1.5 1.5,-1.5L16,16c2.76,0 5,-2.24 5,-5 0,-4.42 -4.03,-8 -9,-8zM6.5,12c-0.83,0 -1.5,-0.67 -1.5,-1.5S5.67,9 6.5,9 8,9.67 8,10.5 7.33,12 6.5,12zM9.5,8C8.67,8 8,7.33 8,6.5S8.67,5 9.5,5s1.5,0.67 1.5,1.5S10.33,8 9.5,8zM14.5,8c-0.83,0 -1.5,-0.67 -1.5,-1.5S13.67,5 14.5,5s1.5,0.67 1.5,1.5S15.33,8 14.5,8zM17.5,12c-0.83,0 -1.5,-0.67 -1.5,-1.5S16.67,9 17.5,9s1.5,0.67 1.5,1.5 -0.67,1.5 -1.5,1.5z"/> | ||
</vector> |
4 changes: 4 additions & 0 deletions
4
app/src/main/res/drawable/ic_color_lens_black_24dp_no_vector.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<selector xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<item android:drawable="@drawable/ic_color_lens_black_24dp"/> | ||
</selector> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="24dp" | ||
android:height="24dp" | ||
android:viewportWidth="24.0" | ||
android:viewportHeight="24.0"> | ||
<path | ||
android:fillColor="#FFFFFFFF" | ||
android:pathData="M12,3c-4.97,0 -9,4.03 -9,9s4.03,9 9,9c0.83,0 1.5,-0.67 1.5,-1.5 0,-0.39 -0.15,-0.74 -0.39,-1.01 -0.23,-0.26 -0.38,-0.61 -0.38,-0.99 0,-0.83 0.67,-1.5 1.5,-1.5L16,16c2.76,0 5,-2.24 5,-5 0,-4.42 -4.03,-8 -9,-8zM6.5,12c-0.83,0 -1.5,-0.67 -1.5,-1.5S5.67,9 6.5,9 8,9.67 8,10.5 7.33,12 6.5,12zM9.5,8C8.67,8 8,7.33 8,6.5S8.67,5 9.5,5s1.5,0.67 1.5,1.5S10.33,8 9.5,8zM14.5,8c-0.83,0 -1.5,-0.67 -1.5,-1.5S13.67,5 14.5,5s1.5,0.67 1.5,1.5S15.33,8 14.5,8zM17.5,12c-0.83,0 -1.5,-0.67 -1.5,-1.5S16.67,9 17.5,9s1.5,0.67 1.5,1.5 -0.67,1.5 -1.5,1.5z"/> | ||
</vector> |
4 changes: 4 additions & 0 deletions
4
app/src/main/res/drawable/ic_color_lens_white_24dp_no_vector.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<selector xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<item android:drawable="@drawable/ic_color_lens_white_24dp"/> | ||
</selector> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.