Link to profile; Move menu actions; Refactoring part1
|
@ -1,13 +0,0 @@
|
|||
package de.baumann.diaspora;
|
||||
|
||||
import android.app.Application;
|
||||
import android.test.ApplicationTestCase;
|
||||
|
||||
/**
|
||||
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
|
||||
*/
|
||||
public class ApplicationTest extends ApplicationTestCase<Application> {
|
||||
public ApplicationTest() {
|
||||
super(Application.class);
|
||||
}
|
||||
}
|
32
app/src/main/java/de/baumann/diaspora/AppSettings.java
Normal file
|
@ -0,0 +1,32 @@
|
|||
package de.baumann.diaspora;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
|
||||
/**
|
||||
* Created by de-live-gdev on 20.03.16.
|
||||
*/
|
||||
public class AppSettings {
|
||||
private Context context;
|
||||
private SharedPreferences pref;
|
||||
|
||||
public AppSettings(Context context){
|
||||
this.context = context.getApplicationContext();
|
||||
pref = this.context.getSharedPreferences("app", Context.MODE_PRIVATE);
|
||||
}
|
||||
|
||||
private void setString(String key, String value){
|
||||
pref.edit().putString(key,value).apply();
|
||||
}
|
||||
|
||||
/*
|
||||
// Setters & Getters
|
||||
*/
|
||||
private static final String PREF_PROFILE_ID = "profileID";
|
||||
public String getProfileId(){
|
||||
return pref.getString(PREF_PROFILE_ID, "");
|
||||
}
|
||||
public void setProfileId(String profileId){
|
||||
setString(PREF_PROFILE_ID, profileId);
|
||||
}
|
||||
}
|
|
@ -241,7 +241,7 @@ public class PodsActivity extends ActionBarActivity {
|
|||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
int id = item.getItemId();
|
||||
|
||||
if (id == R.id.reload) {
|
||||
if (id == R.id.action_reload) {
|
||||
if (Helpers.isOnline(PodsActivity.this)) {
|
||||
progressDialog.show();
|
||||
Intent i= new Intent(PodsActivity.this, GetPodsService.class);
|
||||
|
|
|
@ -43,7 +43,6 @@ import android.webkit.WebSettings;
|
|||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
@ -333,7 +332,7 @@ public class ShareActivity extends MainActivity {
|
|||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
int id = item.getItemId();
|
||||
|
||||
if (id == R.id.reload) {
|
||||
if (id == R.id.action_reload) {
|
||||
if (Helpers.isOnline(ShareActivity.this)) {
|
||||
webView.reload();
|
||||
return true;
|
||||
|
|
|
@ -333,7 +333,7 @@ public class ShareActivity2 extends MainActivity {
|
|||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
int id = item.getItemId();
|
||||
|
||||
if (id == R.id.reload) {
|
||||
if (id == R.id.action_reload) {
|
||||
if (Helpers.isOnline(ShareActivity2.this)) {
|
||||
webView.reload();
|
||||
return true;
|
||||
|
|
|
@ -33,7 +33,7 @@ public class Helpers {
|
|||
return ni != null && ni.isConnectedOrConnecting();
|
||||
}
|
||||
|
||||
public static void hideTopBar(WebView wv) {
|
||||
public static void hideTopBar(final WebView wv) {
|
||||
wv.loadUrl("javascript: ( function() {" +
|
||||
" if(document.getElementById('main_nav')) {" +
|
||||
" document.getElementById('main_nav').parentNode.removeChild(" +
|
||||
|
@ -45,20 +45,29 @@ public class Helpers {
|
|||
"})();");
|
||||
}
|
||||
|
||||
public static void getNotificationCount(WebView wv) {
|
||||
public static void getNotificationCount(final WebView wv) {
|
||||
wv.loadUrl("javascript: ( function() {" +
|
||||
" if (document.getElementById('notification')) {" +
|
||||
"if (document.getElementById('notification')) {" +
|
||||
" var count = document.getElementById('notification').innerHTML;" +
|
||||
" NotificationCounter.setNotificationCount(count.replace(/(\\r\\n|\\n|\\r)/gm, \"\"));" +
|
||||
" AndroidBridge.setNotificationCount(count.replace(/(\\r\\n|\\n|\\r)/gm, \"\"));" +
|
||||
" } else {" +
|
||||
" NotificationCounter.setNotificationCount('0');" +
|
||||
" AndroidBridge.setNotificationCount('0');" +
|
||||
" }" +
|
||||
" if (document.getElementById('conversation')) {" +
|
||||
" var count = document.getElementById('conversation').innerHTML;" +
|
||||
" NotificationCounter.setConversationCount(count.replace(/(\\r\\n|\\n|\\r)/gm, \"\"));" +
|
||||
" AndroidBridge.setConversationCount(count.replace(/(\\r\\n|\\n|\\r)/gm, \"\"));" +
|
||||
" } else {" +
|
||||
" NotificationCounter.setConversationCount('0');" +
|
||||
" AndroidBridge.setConversationCount('0');" +
|
||||
" }" +
|
||||
"})();");
|
||||
}
|
||||
|
||||
public static void getProfileId(final WebView wv) {
|
||||
wv.loadUrl("javascript: ( function() {" +
|
||||
" if (typeof gon !== 'undefined' && typeof gon.user !== 'undefined' && typeof gon.user.guid !== 'undefined') {" +
|
||||
" var guid = gon.user.guid;" +
|
||||
" AndroidBridge.setProfileId(guid.toString());" +
|
||||
" } " +
|
||||
"})();");
|
||||
}
|
||||
}
|
||||
|
|
BIN
app/src/main/res/drawable-hdpi/ic_person_black_24dp.png
Normal file
After Width: | Height: | Size: 269 B |
BIN
app/src/main/res/drawable-hdpi/ic_share_white_24dp.png
Normal file
After Width: | Height: | Size: 397 B |
BIN
app/src/main/res/drawable-mdpi/ic_person_black_24dp.png
Normal file
After Width: | Height: | Size: 189 B |
BIN
app/src/main/res/drawable-mdpi/ic_share_white_24dp.png
Normal file
After Width: | Height: | Size: 268 B |
BIN
app/src/main/res/drawable-xhdpi/ic_person_black_24dp.png
Normal file
After Width: | Height: | Size: 307 B |
BIN
app/src/main/res/drawable-xhdpi/ic_share_white_24dp.png
Normal file
After Width: | Height: | Size: 496 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_person_black_24dp.png
Normal file
After Width: | Height: | Size: 428 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_share_white_24dp.png
Normal file
After Width: | Height: | Size: 698 B |
BIN
app/src/main/res/drawable-xxxhdpi/ic_person_black_24dp.png
Normal file
After Width: | Height: | Size: 565 B |
BIN
app/src/main/res/drawable-xxxhdpi/ic_share_white_24dp.png
Normal file
After Width: | Height: | Size: 938 B |
|
@ -3,42 +3,49 @@
|
|||
|
||||
<group android:checkableBehavior="single">
|
||||
<item
|
||||
android:id="@+id/jb_stream"
|
||||
android:id="@+id/nav_stream"
|
||||
android:icon="@drawable/jb_stream"
|
||||
android:title="@string/jb_stream" />
|
||||
|
||||
<item
|
||||
android:id="@+id/jb_followed_tags"
|
||||
android:id="@+id/nav_profile"
|
||||
android:icon="@drawable/ic_person_black_24dp"
|
||||
android:title="@string/jb_profile" />
|
||||
|
||||
<!-- TODO followed_tags currently not implemented as single viewable page
|
||||
(0.5.7.1-paf04894e, 2016 March 20) -->
|
||||
<item
|
||||
android:visible="false"
|
||||
android:id="@+id/nav_followed_tags"
|
||||
android:icon="@drawable/jb_tag2"
|
||||
android:title="@string/jb_followed_tags" />
|
||||
|
||||
<item
|
||||
android:id="@+id/jb_aspects"
|
||||
android:id="@+id/nav_aspects"
|
||||
android:icon="@drawable/jb_aspects"
|
||||
android:title="@string/jb_aspects" />
|
||||
|
||||
<item
|
||||
android:id="@+id/jb_activities"
|
||||
android:id="@+id/nav_activities"
|
||||
android:icon="@drawable/jb_activities"
|
||||
android:title="@string/jb_activities" />
|
||||
|
||||
<item
|
||||
android:id="@+id/jb_liked"
|
||||
android:id="@+id/nav_liked"
|
||||
android:icon="@drawable/jb_heart"
|
||||
android:title="@string/jb_liked" />
|
||||
|
||||
<item
|
||||
android:id="@+id/jb_commented"
|
||||
android:id="@+id/nav_commented"
|
||||
android:icon="@drawable/jb_commented"
|
||||
android:title="@string/jb_commented" />
|
||||
|
||||
<item
|
||||
android:id="@+id/jb_mentions"
|
||||
android:id="@+id/nav_mentions"
|
||||
android:icon="@drawable/jb_mentions"
|
||||
android:title="@string/jb_mentions" />
|
||||
|
||||
<item
|
||||
android:id="@+id/jb_public"
|
||||
android:id="@+id/nav_public"
|
||||
android:icon="@drawable/jb_aspects"
|
||||
android:title="@string/jb_public" />
|
||||
</group>
|
||||
|
@ -46,17 +53,17 @@
|
|||
<item android:title="@string/jb_menu_1">
|
||||
<menu>
|
||||
<item
|
||||
android:id="@+id/jb_settings_view"
|
||||
android:id="@+id/nav_settings_view"
|
||||
android:icon="@drawable/jb_settings"
|
||||
android:title="@string/jb_settings_view" />
|
||||
|
||||
<item
|
||||
android:id="@+id/jb_settings_diaspora"
|
||||
android:id="@+id/nav_settings_diaspora"
|
||||
android:icon="@drawable/jb_stream"
|
||||
android:title="@string/jb_settings_diaspora" />
|
||||
|
||||
<item
|
||||
android:id="@+id/jb_license_help"
|
||||
android:id="@+id/nav_license_help"
|
||||
android:icon="@drawable/jb_license"
|
||||
android:title="@string/jb_help_license" />
|
||||
</menu>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
xmlns:tools="http://schemas.android.com/tools" tools:context=".MainActivity">
|
||||
|
||||
<item
|
||||
android:id="@+id/reload"
|
||||
android:id="@+id/action_reload"
|
||||
android:icon="@drawable/ic_sync_white_24dp"
|
||||
android:title="@string/reload"
|
||||
android:orderInCategory="109"
|
||||
|
|
|
@ -3,34 +3,25 @@
|
|||
xmlns:tools="http://schemas.android.com/tools" tools:context=".MainActivity">
|
||||
|
||||
<item
|
||||
android:id="@+id/notifications"
|
||||
android:id="@+id/action_notifications"
|
||||
android:icon="@drawable/ic_bell_outline_white_24dp"
|
||||
android:title="@string/notifications"
|
||||
app:showAsAction="always" />
|
||||
|
||||
<item
|
||||
android:id="@+id/conversations"
|
||||
android:id="@+id/action_conversations"
|
||||
android:icon="@drawable/ic_message_text_outline_white_24dp"
|
||||
android:title="@string/messages"
|
||||
app:showAsAction="always" />
|
||||
|
||||
<item
|
||||
android:id="@+id/help_license"
|
||||
android:title="@string/jb_help_license"
|
||||
app:showAsAction="never" />
|
||||
|
||||
<item
|
||||
android:id="@+id/view"
|
||||
android:title="@string/jb_settings_view"
|
||||
app:showAsAction="never" />
|
||||
|
||||
<item
|
||||
android:id="@+id/share"
|
||||
android:id="@+id/action_share"
|
||||
android:icon="@drawable/ic_share_white_24dp"
|
||||
android:title="@string/jb_share"
|
||||
app:showAsAction="never" />
|
||||
app:showAsAction="ifRoom" />
|
||||
|
||||
<item
|
||||
android:id="@+id/exit"
|
||||
android:id="@+id/action_exit"
|
||||
android:icon="@drawable/ic_sync_white_24dp"
|
||||
android:title="@string/exit_app"
|
||||
app:showAsAction="never" />
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
tools:context="ar.com.tristeslostrestigres.diasporanativewebapp.PodsActivity">
|
||||
|
||||
<item
|
||||
android:id="@+id/reload"
|
||||
android:id="@+id/action_reload"
|
||||
android:title="@string/reload"
|
||||
android:icon="@drawable/ic_sync_white_24dp"
|
||||
android:orderInCategory="100"
|
||||
|
|
|
@ -29,15 +29,15 @@
|
|||
<string name="jb_stream">Stream</string>
|
||||
<string name="jb_notifications">Benachrichtigungen</string>
|
||||
<string name="jb_conversations">Unterhaltungen</string>
|
||||
<string name="jb_liked">Gelikete Beiträge</string>
|
||||
<string name="jb_liked">Gelikte Beiträge</string>
|
||||
<string name="jb_commented">Kommentierte Beiträge</string>
|
||||
<string name="jb_contacts">Kontakte</string>
|
||||
<string name="jb_mentions">Erwähnungen</string>
|
||||
<string name="jb_activities">Meine Aktivitäten</string>
|
||||
<string name="jb_activities">Aktivitäten</string>
|
||||
<string name="jb_followed_tags">Verfolgte Tags</string>
|
||||
<string name="jb_manage_tags">Tags verwalten</string>
|
||||
<string name="jb_settings">Persönliche Einstellungen</string>
|
||||
<string name="jb_aspects">Meine Aspekte</string>
|
||||
<string name="jb_aspects">Aspekte</string>
|
||||
<string name="jb_pod">Pod wechseln</string>
|
||||
<string name="jb_public">Öffentliche Aktivitäten</string>
|
||||
|
||||
|
@ -144,8 +144,8 @@ along with this program. If not, see http://www.gnu.org/licenses.<br> <br
|
|||
<i>Die Bilder des Startbildschirms können auf Flickr gefunden werden:
|
||||
https://www.flickr.com/photos/129581906@N06/sets/72157651933980136/with/16594947123.
|
||||
Sie wurden von \"Lydia\" veröffentlicht und stehen unter der cc by-nc-sa Lizenz.</i></string>
|
||||
<string name="fab2_title_person">Suche nach Personen ...</string>
|
||||
<string name="fab2_title_tag">Suche nach Tags ...</string>
|
||||
<string name="fab2_title_person">Suche nach Personen …</string>
|
||||
<string name="fab2_title_tag">Suche nach Tags …</string>
|
||||
<string name="donate_1">per Bitcoin</string>
|
||||
<string name="donate_text">Wenn dir die App gefällt, kannst du dem Entwickler der original \"DiasporaNativeWebApp\"
|
||||
eine Kleinigkeit spenden:</string>
|
||||
|
@ -155,5 +155,6 @@ along with this program. If not, see http://www.gnu.org/licenses.<br> <br
|
|||
<string name="new_notifications">Ungelesene Benachrichtigung. Lesen?</string>
|
||||
<string name="help_about">Changelog</string>
|
||||
<string name="new_post2">Titel und Text</string>
|
||||
<string name="jb_profile">Profil</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<color name="fab_small">#607d8b</color>
|
||||
<color name="fab_small_pressed">#90a4ae</color>
|
||||
|
||||
<color name="label_background">#99212121</color>
|
||||
<color name="label_background">#BC212121</color>
|
||||
<color name="label_text">#ffffff</color>
|
||||
|
||||
<color name="white">#ffffff</color>
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
<string name="podlist_source_note">Note: This list is populated with only the secure pods from podupti.me</string>
|
||||
<string name="valid_pod">Please enter a valid domain name</string>
|
||||
<string name="podlist_error">Error: Could not retrieve list of pods!</string>
|
||||
<string name="loading_podlist">Loading pod list ...</string>
|
||||
<string name="loading_podlist">Loading pod list …</string>
|
||||
|
||||
|
||||
<string name="no_internet">Sorry, you must be connected to the Internet to proceed</string>
|
||||
|
@ -48,11 +48,11 @@
|
|||
<string name="jb_commented">Commented</string>
|
||||
<string name="jb_contacts">Contacts</string>
|
||||
<string name="jb_mentions">Mentions</string>
|
||||
<string name="jb_activities">My activity</string>
|
||||
<string name="jb_activities">Activities</string>
|
||||
<string name="jb_followed_tags">Followed Hashtags</string>
|
||||
<string name="jb_manage_tags">Manage Hashtags</string>
|
||||
<string name="jb_settings">Personal settings</string>
|
||||
<string name="jb_aspects">My aspects</string>
|
||||
<string name="jb_aspects">Aspects</string>
|
||||
<string name="jb_pod">Change pod</string>
|
||||
<string name="jb_public">Public activities</string>
|
||||
<string name="jb_settings_view">View settings</string>
|
||||
|
@ -71,15 +71,15 @@
|
|||
<string name="help_donate">Donate</string>
|
||||
<string name="help_about">Changelog</string>
|
||||
|
||||
<string name="toast_screenshot">Taking screenshot ...</string>
|
||||
<string name="toast_screenshot">Taking screenshot …</string>
|
||||
|
||||
|
||||
// Floating Action Buttons - Titles
|
||||
|
||||
<string name="fab3_title">Go to top</string>
|
||||
<string name="fab2_title">Search by tags or persons</string>
|
||||
<string name="fab2_title_tag">Search for tag ...</string>
|
||||
<string name="fab2_title_person">Search for person ...</string>
|
||||
<string name="fab2_title_tag">Search for tag …</string>
|
||||
<string name="fab2_title_person">Search for person …</string>
|
||||
<string name="fab1_title">New message</string>
|
||||
|
||||
|
||||
|
@ -186,6 +186,7 @@
|
|||
<string name="large">Large</string>
|
||||
<string name="huge">Huge</string>
|
||||
<string name="image">Unable to get image</string>
|
||||
<string name="jb_profile">Profile</string>
|
||||
|
||||
<array name="splash_images">
|
||||
<item>@drawable/splashscreen1</item>
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
package de.baumann.diaspora;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* To work on unit tests, switch the Test Artifact in the Build Variants view.
|
||||
*/
|
||||
public class ExampleUnitTest {
|
||||
@Test
|
||||
public void addition_isCorrect() throws Exception {
|
||||
assertEquals(4, 2 + 2);
|
||||
}
|
||||
}
|