diff --git a/app/src/main/ic_launcher-web.png b/app/src/main/ic_launcher-web.png
new file mode 100644
index 0000000..db367d6
Binary files /dev/null and b/app/src/main/ic_launcher-web.png differ
diff --git a/app/src/main/java/org/pstorch/androidirclogviewer/MainActivity.java b/app/src/main/java/org/pstorch/androidirclogviewer/MainActivity.java
index c7318a7..2a78085 100644
--- a/app/src/main/java/org/pstorch/androidirclogviewer/MainActivity.java
+++ b/app/src/main/java/org/pstorch/androidirclogviewer/MainActivity.java
@@ -1,6 +1,7 @@
package org.pstorch.androidirclogviewer;
import android.content.Intent;
+import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.os.Bundle;
import android.preference.PreferenceManager;
@@ -38,6 +39,7 @@ public class MainActivity extends AppCompatActivity {
private final SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd", Locale.US);
private String baseUrl = null;
+ private String nickname = null;
private BottomNavigationView.OnNavigationItemSelectedListener mOnNavigationItemSelectedListener
= new BottomNavigationView.OnNavigationItemSelectedListener() {
@@ -115,7 +117,9 @@ protected void onCreate(final Bundle savedInstanceState) {
BottomNavigationView navigation = (BottomNavigationView) findViewById(R.id.navigation);
navigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);
- baseUrl = PreferenceManager.getDefaultSharedPreferences(this).getString("base_url", null);
+ final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
+ baseUrl = preferences.getString("base_url", null);
+ nickname = preferences.getString("nickname", null);
loadLog();
}
@@ -150,9 +154,16 @@ private void appendFormatted(final StringBuilder formattedText, final String lin
if (matcher.matches()) {
final String user = matcher.group(2);
final String color = "#" + Integer.toHexString(user.hashCode()).substring(0, 6);
+ final String message = matcher.group(3);
+ if (nickname != null && message.contains(nickname)) {
+ formattedText.append("");
+ }
formattedText.append(matcher.group(1))
.append(" ").append(user).append(": ")
- .append(Html.escapeHtml(matcher.group(3)));
+ .append(Html.escapeHtml(message));
+ if (nickname != null && message.contains(nickname)) {
+ formattedText.append("");
+ }
} else {
formattedText.append("").append(Html.escapeHtml(line)).append("");
}
diff --git a/app/src/main/java/org/pstorch/androidirclogviewer/SettingsActivity.java b/app/src/main/java/org/pstorch/androidirclogviewer/SettingsActivity.java
index 2174524..0dc3339 100644
--- a/app/src/main/java/org/pstorch/androidirclogviewer/SettingsActivity.java
+++ b/app/src/main/java/org/pstorch/androidirclogviewer/SettingsActivity.java
@@ -2,9 +2,6 @@
import android.annotation.TargetApi;
-import android.content.Context;
-import android.content.Intent;
-import android.content.res.Configuration;
import android.os.Build;
import android.os.Bundle;
import android.preference.ListPreference;
@@ -15,8 +12,6 @@
import android.support.v7.app.ActionBar;
import android.view.MenuItem;
-import java.util.List;
-
/**
* A {@link PreferenceActivity} that presents a set of application settings. On
* handset devices, settings are presented as a single list. On tablets,
@@ -59,15 +54,6 @@ public boolean onPreferenceChange(Preference preference, Object value) {
}
};
- /**
- * Helper method to determine if the device has an extra-large screen. For
- * example, 10" tablets are extra-large.
- */
- private static boolean isXLargeTablet(Context context) {
- return (context.getResources().getConfiguration().screenLayout
- & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE;
- }
-
/**
* Binds a preference's summary to its value. More specifically, when the
* preference's value is changed, its summary (line of text below the
@@ -92,6 +78,8 @@ private static void bindPreferenceSummaryToValue(Preference preference) {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ getFragmentManager().beginTransaction().replace(android.R.id.content,
+ new GeneralPreferenceFragment()).commit();
setupActionBar();
}
@@ -106,32 +94,6 @@ private void setupActionBar() {
}
}
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean onIsMultiPane() {
- return isXLargeTablet(this);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- @TargetApi(Build.VERSION_CODES.HONEYCOMB)
- public void onBuildHeaders(List target) {
- loadHeadersFromResource(R.xml.pref_headers, target);
- }
-
- /**
- * This method stops fragment injection in malicious applications.
- * Make sure to deny any unknown fragments here.
- */
- protected boolean isValidFragment(String fragmentName) {
- return PreferenceFragment.class.getName().equals(fragmentName)
- || GeneralPreferenceFragment.class.getName().equals(fragmentName);
- }
-
/**
* This fragment shows general preferences only. It is used when the
* activity is showing a two-pane settings UI.
@@ -141,7 +103,7 @@ public static class GeneralPreferenceFragment extends PreferenceFragment {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- addPreferencesFromResource(R.xml.pref_general);
+ addPreferencesFromResource(R.xml.preferences);
setHasOptionsMenu(true);
// Bind the summaries of EditText/List/Dialog/Ringtone preferences
@@ -149,17 +111,20 @@ public void onCreate(Bundle savedInstanceState) {
// updated to reflect the new value, per the Android Design
// guidelines.
bindPreferenceSummaryToValue(findPreference("base_url"));
+ bindPreferenceSummaryToValue(findPreference("nickname"));
}
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- int id = item.getItemId();
- if (id == android.R.id.home) {
- startActivity(new Intent(getActivity(), SettingsActivity.class));
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ switch (item.getItemId()) {
+ // Respond to the action bar's Up/Home button
+ case android.R.id.home:
+ super.onBackPressed();
return true;
- }
- return super.onOptionsItemSelected(item);
}
+ return super.onOptionsItemSelected(item);
}
}
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png
index cde69bc..d9f0c62 100644
Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher.png and b/app/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png
index c133a0c..7dd9051 100644
Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher.png and b/app/src/main/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png
index bfa42f0..5f94fdc 100644
Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher.png and b/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
index 324e72c..185e224 100644
Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
index aee44e1..5eb1014 100644
Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 5baf98d..97f9b0a 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -1,5 +1,5 @@
- Android IRC LogViewer
+ IRC LogViewer
Forward
Refresh
Back
@@ -12,5 +12,7 @@
Base URL
http://krul.finf.uni-hannover.de/~sammyshp/cgeo-logs
+ Nickname
+ Nickname
diff --git a/app/src/main/res/xml/pref_headers.xml b/app/src/main/res/xml/pref_headers.xml
deleted file mode 100644
index 794f33c..0000000
--- a/app/src/main/res/xml/pref_headers.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/app/src/main/res/xml/pref_general.xml b/app/src/main/res/xml/preferences.xml
similarity index 63%
rename from app/src/main/res/xml/pref_general.xml
rename to app/src/main/res/xml/preferences.xml
index 9aed912..f99782c 100644
--- a/app/src/main/res/xml/pref_general.xml
+++ b/app/src/main/res/xml/preferences.xml
@@ -12,5 +12,14 @@
android:singleLine="true"
android:title="@string/pref_title_base_url"/>
+