mirror of https://github.com/ThmmyNoLife/mTHMMY
Ezerous
5 years ago
11 changed files with 106 additions and 179 deletions
@ -0,0 +1,28 @@ |
|||||
|
body { |
||||
|
font-family: sans-serif; |
||||
|
background-color: #333333; |
||||
|
} |
||||
|
|
||||
|
pre { |
||||
|
background-color: #3C3C3C; |
||||
|
color: #757575; |
||||
|
padding: 1em; |
||||
|
margin-left: 1em; |
||||
|
margin-right: 1em; |
||||
|
white-space: pre-wrap; |
||||
|
word-wrap: break-word; |
||||
|
} |
||||
|
|
||||
|
h4, h5 { |
||||
|
display: inline; |
||||
|
padding: 1em; |
||||
|
} |
||||
|
|
||||
|
a, h4, h5 { |
||||
|
color: #26A69A; |
||||
|
word-wrap: break-word; |
||||
|
} |
||||
|
|
||||
|
li { |
||||
|
color: #26A69A; |
||||
|
} |
@ -0,0 +1,39 @@ |
|||||
|
package gr.thmmy.mthmmy.utils.io; |
||||
|
|
||||
|
import android.content.Context; |
||||
|
|
||||
|
import java.io.BufferedReader; |
||||
|
import java.io.IOException; |
||||
|
import java.io.InputStreamReader; |
||||
|
|
||||
|
import timber.log.Timber; |
||||
|
|
||||
|
public class AssetUtils { |
||||
|
public static String readFileToText(Context context, String fileName) { |
||||
|
StringBuilder stringBuilder = new StringBuilder(); |
||||
|
BufferedReader reader = null; |
||||
|
try { |
||||
|
reader = new BufferedReader(new InputStreamReader(context.getAssets().open(fileName))); |
||||
|
String line; |
||||
|
|
||||
|
while ((line = reader.readLine()) != null) { |
||||
|
stringBuilder.append(line); |
||||
|
stringBuilder.append("\n"); |
||||
|
} |
||||
|
return stringBuilder.toString(); |
||||
|
} catch (IOException e) { |
||||
|
Timber.e(e, "IO error reading file %s from assets.", fileName); |
||||
|
} catch (Exception e) { |
||||
|
Timber.e(e, "Error reading file %s from assets.", fileName); |
||||
|
} finally { |
||||
|
try { |
||||
|
if (reader != null) |
||||
|
reader.close(); |
||||
|
} catch (IOException e) { |
||||
|
Timber.e(e, "Error in AssetUtils (closing reader)."); |
||||
|
} |
||||
|
} |
||||
|
return null; |
||||
|
} |
||||
|
} |
||||
|
|
Loading…
Reference in new issue