1
0
Fork 0
mirror of https://github.com/gsantner/dandelion synced 2024-11-25 05:42:10 +01:00

[WIP] Load avatar from webprofile, WebUserProfile, ..

This commit is contained in:
Gregor Santner 2016-03-25 00:12:00 +01:00
parent 9007045b28
commit 1f33c3b4a9
15 changed files with 448 additions and 229 deletions

View file

@ -26,4 +26,5 @@ dependencies {
compile 'com.android.support:appcompat-v7:23.2.1' compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:design:23.2.1' compile 'com.android.support:design:23.2.1'
compile 'com.getbase:floatingactionbutton:1.9.1' compile 'com.getbase:floatingactionbutton:1.9.1'
compile 'com.jakewharton:butterknife:7.0.1'
} }

View file

@ -2,20 +2,30 @@ package de.baumann.diaspora;
import android.app.Application; import android.app.Application;
import java.io.File;
import de.baumann.diaspora.utils.AvatarImageLoader;
/** /**
* Created by gregor on 24.03.16. * Created by gregor on 24.03.16.
*/ */
public class App extends Application { public class App extends Application {
private AppSettings appSettings; private AppSettings appSettings;
private AvatarImageLoader avatarImageLoader;
public static final String APP_LOG_TAG = "DIASPORA_"; public static final String APP_LOG_TAG = "DIASPORA_";
@Override @Override
public void onCreate() { public void onCreate() {
super.onCreate(); super.onCreate();
appSettings = new AppSettings(getApplicationContext()); appSettings = new AppSettings(getApplicationContext());
avatarImageLoader = new AvatarImageLoader(getApplicationContext());
} }
public AppSettings getSettings() { public AppSettings getSettings() {
return appSettings; return appSettings;
} }
public AvatarImageLoader getAvatarImageLoader() {
return avatarImageLoader;
}
} }

View file

@ -2,17 +2,17 @@ package de.baumann.diaspora;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.preference.PreferenceManager;
/** /**
* Created by de-live-gdev on 20.03.16. Part of Diaspora WebApp. * Created by de-live-gdev on 20.03.16. Part of Diaspora WebApp.
*/ */
class AppSettings { class AppSettings {
private final SharedPreferences pref; private final SharedPreferences pref;
private final Context context;
public AppSettings(Context context) { public AppSettings(Context context) {
Context context1 = context.getApplicationContext(); this.context = context.getApplicationContext();
pref = context1.getSharedPreferences("app", Context.MODE_PRIVATE); pref = this.context.getSharedPreferences("app", Context.MODE_PRIVATE);
} }
private void setString(String key, String value) { private void setString(String key, String value) {
@ -28,20 +28,24 @@ class AppSettings {
/* /*
// Preferences // Preferences
*/ */
private static final String PREF_PROFILE_ID = "profileID"; private static final String PREF_WEBUSERPROFILE_ID = "webUserProfile_guid";
private static final String PREF_IS_LOAD_IMAGES = "loadImages"; private static final String PREF_IS_LOAD_IMAGES = "loadImages";
private static final String PREF_MINIMUM_FONT_SIZE = "minimumFontSize"; private static final String PREF_MINIMUM_FONT_SIZE = "minimumFontSize";
private static final String PREF_AVATAR_URL = "webUserProfile_avatar";
private static final String PREF_WEBUSERPROFILE_NAME = "webUserProfile_name";
private static final String PREF_PODDOMAIN = "podDomain";
/* /*
// Setters & Getters // Setters & Getters
*/ */
public String getProfileId() { public String getProfileId() {
return pref.getString(PREF_PROFILE_ID, ""); return pref.getString(PREF_WEBUSERPROFILE_ID, "");
} }
public void setProfileId(String profileId) { public void setProfileId(String profileId) {
setString(PREF_PROFILE_ID, profileId); setString(PREF_WEBUSERPROFILE_ID, profileId);
} }
@ -61,4 +65,30 @@ class AppSettings {
public void setMinimumFontSize(int minimumFontSize) { public void setMinimumFontSize(int minimumFontSize) {
setInt(PREF_MINIMUM_FONT_SIZE, minimumFontSize); setInt(PREF_MINIMUM_FONT_SIZE, minimumFontSize);
} }
public String getAvatarUrl() {
return pref.getString(PREF_AVATAR_URL, "");
}
public void setAvatarUrl(String avatarUrl) {
setString(PREF_AVATAR_URL, avatarUrl);
}
public String getName(){
return pref.getString(PREF_WEBUSERPROFILE_NAME, "");
}
public void setName(String name){
setString(PREF_WEBUSERPROFILE_NAME, name);
}
public String getPodDomain(){
return pref.getString(PREF_PODDOMAIN, "");
}
public void setPodDomain(String podDomain){
setString(PREF_PODDOMAIN, podDomain);
}
} }

View file

@ -0,0 +1,65 @@
package de.baumann.diaspora;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.AsyncTask;
import android.support.annotation.Nullable;
import android.util.Log;
import android.widget.ImageView;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
/**
* Created by Gregor Santner (de-live-gdev) on 24.03.16.
*/
public class ImageDownloadTask extends AsyncTask<String, Void, Bitmap> {
ImageView imageView;
String savePath;
/**
* Download image from URL
*
* @param imageView ImageView to set image to (null = don't set)
* @param savePath Save image to file (null = don't save)
*/
public ImageDownloadTask(@Nullable ImageView imageView, @Nullable String savePath) {
this.imageView = imageView;
this.savePath = savePath;
}
protected Bitmap doInBackground(String... urls) {
String url = urls[0];
Bitmap bitmap = null;
FileOutputStream out = null;
try {
InputStream in = new java.net.URL(url).openStream();
bitmap = BitmapFactory.decodeStream(in);
// Save to file if not null
if (savePath != null) {
out = new FileOutputStream(savePath);
bitmap.compress(Bitmap.CompressFormat.PNG, 100, out);
}
} catch (Exception e) {
Log.e(App.APP_LOG_TAG, e.getMessage());
} finally {
try {
if (out != null) {
out.close();
}
} catch (IOException e) {
}
}
return bitmap;
}
protected void onPostExecute(Bitmap result) {
// Display on imageview if not null
if (imageView != null) {
imageView.setImageBitmap(result);
}
}
}

View file

@ -29,7 +29,6 @@ import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.Canvas; import android.graphics.Canvas;
@ -63,13 +62,15 @@ import android.webkit.WebSettings;
import android.webkit.WebView; import android.webkit.WebView;
import android.webkit.WebViewClient; import android.webkit.WebViewClient;
import android.widget.EditText; import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import android.widget.RadioButton; import android.widget.RadioButton;
import android.widget.RadioGroup; import android.widget.RadioGroup;
import android.widget.TextView; import android.widget.TextView;
import com.getbase.floatingactionbutton.FloatingActionsMenu;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject;
import java.io.File; import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
@ -77,10 +78,12 @@ import java.io.IOException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import butterknife.Bind;
import butterknife.ButterKnife;
import de.baumann.diaspora.utils.Helpers; import de.baumann.diaspora.utils.Helpers;
public class MainActivity extends AppCompatActivity public class MainActivity extends AppCompatActivity
implements NavigationView.OnNavigationItemSelectedListener { implements NavigationView.OnNavigationItemSelectedListener, WebUserProfileChangedListener {
static final int INPUT_FILE_REQUEST_CODE = 1; static final int INPUT_FILE_REQUEST_CODE = 1;
@ -88,20 +91,37 @@ public class MainActivity extends AppCompatActivity
private static final String URL_MESSAGE = "URL_MESSAGE"; private static final String URL_MESSAGE = "URL_MESSAGE";
private App app; private App app;
private final Handler myHandler = new Handler();
private WebView webView;
private String podDomain; private String podDomain;
private Menu menu; private Menu menu;
private int notificationCount = 0; private int notificationCount = 0;
private int conversationCount = 0; private int conversationCount = 0;
private String profileId = "";
private ValueCallback<Uri[]> mFilePathCallback; private ValueCallback<Uri[]> mFilePathCallback;
private String mCameraPhotoPath; private String mCameraPhotoPath;
private com.getbase.floatingactionbutton.FloatingActionsMenu fab; private WebSettings webSettings;
private ProgressBar progressBar;
private WebSettings wSettings;
private AppSettings appSettings; private AppSettings appSettings;
private SwipeRefreshLayout swipeView; private WebUserProfile webUserProfile;
private final Handler uiHandler = new Handler();
@Bind(R.id.swipe)
SwipeRefreshLayout swipeRefreshLayout;
@Bind(R.id.progressBar)
ProgressBar progressBar;
@Bind(R.id.toolbar)
Toolbar toolbar;
@Bind(R.id.webView)
WebView webView;
@Bind(R.id.fab_menubutton)
FloatingActionsMenu fab;
// NavHeader cannot be bound by Butterknife
private TextView navheaderTitle;
private TextView navheaderDescription;
private ImageView navheaderImage;
@SuppressLint("SetJavaScriptEnabled") @SuppressLint("SetJavaScriptEnabled")
@Override @Override
@ -111,11 +131,16 @@ public class MainActivity extends AppCompatActivity
if (android.os.Build.VERSION.SDK_INT >= 21) if (android.os.Build.VERSION.SDK_INT >= 21)
WebView.enableSlowWholeDocumentDraw(); WebView.enableSlowWholeDocumentDraw();
// Bind UI
setContentView(R.layout.activity_main); setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); ButterKnife.bind(this);
app = (App) getApplication();
setSupportActionBar(toolbar);
app = (App) getApplication();
appSettings = app.getSettings();
webUserProfile = new WebUserProfile(app,uiHandler,this);
// Setup toolbar
setSupportActionBar(toolbar);
toolbar.setOnClickListener(new View.OnClickListener() { toolbar.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
@ -123,54 +148,36 @@ public class MainActivity extends AppCompatActivity
webView.loadUrl("https://" + podDomain + "/stream"); webView.loadUrl("https://" + podDomain + "/stream");
setTitle(R.string.jb_stream); setTitle(R.string.jb_stream);
} else { } else {
Snackbar.make(swipeView, R.string.no_internet, Snackbar.LENGTH_LONG).show(); Snackbar.make(swipeRefreshLayout, R.string.no_internet, Snackbar.LENGTH_LONG).show();
} }
} }
}); });
// Load app settings // Load app settings
appSettings = app.getSettings(); setupNavigationSlider();
profileId = appSettings.getProfileId();
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.addDrawerListener(toggle);
toggle.syncState();
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
progressBar = (ProgressBar) findViewById(R.id.progressBar); progressBar = (ProgressBar) findViewById(R.id.progressBar);
podDomain = appSettings.getPodDomain();
SharedPreferences config = getSharedPreferences("PodSettings", MODE_PRIVATE); swipeRefreshLayout.setColorSchemeResources(R.color.colorPrimary,
podDomain = config.getString("podDomain", null);
fab = (com.getbase.floatingactionbutton.FloatingActionsMenu) findViewById(R.id.multiple_actions);
fab.setVisibility(View.GONE);
swipeView = (SwipeRefreshLayout) findViewById(R.id.swipe);
swipeView.setColorSchemeResources(R.color.colorPrimary,
R.color.fab_big); R.color.fab_big);
webView = (WebView) findViewById(R.id.webView);
webView.addJavascriptInterface(new JavaScriptInterface(), "AndroidBridge"); webView.addJavascriptInterface(new JavaScriptInterface(), "AndroidBridge");
if (savedInstanceState != null) { if (savedInstanceState != null) {
webView.restoreState(savedInstanceState); webView.restoreState(savedInstanceState);
} }
wSettings = webView.getSettings(); webSettings = webView.getSettings();
wSettings.setJavaScriptEnabled(true); webSettings.setJavaScriptEnabled(true);
wSettings.setUseWideViewPort(true); webSettings.setUseWideViewPort(true);
wSettings.setLoadWithOverviewMode(true); webSettings.setLoadWithOverviewMode(true);
wSettings.setDomStorageEnabled(true); webSettings.setDomStorageEnabled(true);
wSettings.setMinimumFontSize(appSettings.getMinimumFontSize()); webSettings.setMinimumFontSize(appSettings.getMinimumFontSize());
wSettings.setLoadsImagesAutomatically(appSettings.isLoadImages()); webSettings.setLoadsImagesAutomatically(appSettings.isLoadImages());
if (android.os.Build.VERSION.SDK_INT >= 21) if (android.os.Build.VERSION.SDK_INT >= 21)
wSettings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); webSettings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
/* /*
* WebViewClient * WebViewClient
@ -186,18 +193,18 @@ public class MainActivity extends AppCompatActivity
} }
public void onPageFinished(WebView view, String url) { public void onPageFinished(WebView view, String url) {
swipeView.setRefreshing(false); swipeRefreshLayout.setRefreshing(false);
} }
}); });
swipeView.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override @Override
public void onRefresh() { public void onRefresh() {
if (Helpers.isOnline(MainActivity.this)) { if (Helpers.isOnline(MainActivity.this)) {
webView.reload(); webView.reload();
} else { } else {
Snackbar.make(swipeView, R.string.no_internet, Snackbar.LENGTH_LONG).show(); Snackbar.make(swipeRefreshLayout, R.string.no_internet, Snackbar.LENGTH_LONG).show();
swipeView.setRefreshing(false); swipeRefreshLayout.setRefreshing(false);
} }
} }
}); });
@ -217,7 +224,6 @@ public class MainActivity extends AppCompatActivity
if (progress > 60) { if (progress > 60) {
Helpers.hideTopBar(wv); Helpers.hideTopBar(wv);
Helpers.getProfileId(wv);
fab.setVisibility(View.VISIBLE); fab.setVisibility(View.VISIBLE);
} }
@ -244,7 +250,7 @@ public class MainActivity extends AppCompatActivity
takePictureIntent.putExtra("PhotoPath", mCameraPhotoPath); takePictureIntent.putExtra("PhotoPath", mCameraPhotoPath);
} catch (IOException ex) { } catch (IOException ex) {
// Error occurred while creating the File // Error occurred while creating the File
Snackbar.make(swipeView, R.string.image, Snackbar.LENGTH_LONG).show(); Snackbar.make(swipeRefreshLayout, R.string.image, Snackbar.LENGTH_LONG).show();
return false; return false;
} }
@ -286,12 +292,42 @@ public class MainActivity extends AppCompatActivity
webView.loadData("", "text/html", null); webView.loadData("", "text/html", null);
webView.loadUrl("https://" + podDomain); webView.loadUrl("https://" + podDomain);
} else { } else {
Snackbar.make(swipeView, R.string.no_internet, Snackbar.LENGTH_LONG).show(); Snackbar.make(swipeRefreshLayout, R.string.no_internet, Snackbar.LENGTH_LONG).show();
} }
} }
} }
private void setupNavigationSlider(){
DrawerLayout drawer = ButterKnife.findById(this, R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.addDrawerListener(toggle);
toggle.syncState();
NavigationView navigationView = ButterKnife.findById(this, R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
View navHeader = navigationView.getHeaderView(0);
navheaderTitle = ButterKnife.findById(navHeader,R.id.navheader_title);
navheaderDescription = ButterKnife.findById(navHeader,R.id.navheader_description);
navheaderImage = ButterKnife.findById(navHeader,R.id.navheader_user_image);
if(!appSettings.getName().equals("")) {
navheaderTitle.setText(appSettings.getName());
}
if(!appSettings.getPodDomain().equals("")){
navheaderDescription.setText(appSettings.getPodDomain());
}
if(!appSettings.getAvatarUrl().equals("")){
// Try to load image
if(!app.getAvatarImageLoader().loadToImageView(navheaderImage)){
// If not yet loaded, start download
app.getAvatarImageLoader().startImageDownload(navheaderImage, appSettings.getAvatarUrl());
}
}
}
/* /*
* Fab button events * Fab button events
*/ */
@ -302,7 +338,7 @@ public class MainActivity extends AppCompatActivity
webView.loadUrl("https://" + podDomain + "/status_messages/new"); webView.loadUrl("https://" + podDomain + "/status_messages/new");
setTitle(R.string.fab1_title); setTitle(R.string.fab1_title);
} else { } else {
Snackbar.make(swipeView, R.string.no_internet, Snackbar.LENGTH_LONG).show(); Snackbar.make(swipeRefreshLayout, R.string.no_internet, Snackbar.LENGTH_LONG).show();
} }
} }
@ -321,7 +357,7 @@ public class MainActivity extends AppCompatActivity
// this validate the input data for tagfind // this validate the input data for tagfind
if (cleanTag == null || cleanTag.equals("")) { if (cleanTag == null || cleanTag.equals("")) {
dialog.cancel(); // if user don<EFBFBD>t have added a tag dialog.cancel(); // if user don<EFBFBD>t have added a tag
Snackbar.make(swipeView, R.string.search_alert_bypeople_validate_needsomedata, Snackbar.LENGTH_LONG).show(); Snackbar.make(swipeRefreshLayout, R.string.search_alert_bypeople_validate_needsomedata, Snackbar.LENGTH_LONG).show();
} else { // User have added a search tag } else { // User have added a search tag
webView.loadUrl("https://" + podDomain + "/people.mobile?q=" + cleanTag); webView.loadUrl("https://" + podDomain + "/people.mobile?q=" + cleanTag);
setTitle(R.string.fab2_title_person); setTitle(R.string.fab2_title_person);
@ -336,7 +372,7 @@ public class MainActivity extends AppCompatActivity
// this validate the input data for tagfind // this validate the input data for tagfind
if (cleanTag == null || cleanTag.equals("")) { if (cleanTag == null || cleanTag.equals("")) {
dialog.cancel(); // if user hasn't added a tag dialog.cancel(); // if user hasn't added a tag
Snackbar.make(swipeView, R.string.search_alert_bytags_validate_needsomedata, Snackbar.LENGTH_LONG).show(); Snackbar.make(swipeRefreshLayout, R.string.search_alert_bytags_validate_needsomedata, Snackbar.LENGTH_LONG).show();
} else { // User have added a search tag } else { // User have added a search tag
webView.loadUrl("https://" + podDomain + "/tags/" + cleanTag); webView.loadUrl("https://" + podDomain + "/tags/" + cleanTag);
setTitle(R.string.fab2_title_tag); setTitle(R.string.fab2_title_tag);
@ -345,7 +381,7 @@ public class MainActivity extends AppCompatActivity
}); });
dialog.show(); dialog.show();
} else { } else {
Snackbar.make(swipeView, R.string.no_internet, Snackbar.LENGTH_LONG).show(); Snackbar.make(swipeRefreshLayout, R.string.no_internet, Snackbar.LENGTH_LONG).show();
} }
} }
@ -418,7 +454,7 @@ public class MainActivity extends AppCompatActivity
setTitle(R.string.app_name); setTitle(R.string.app_name);
} else { } else {
Snackbar snackbar = Snackbar Snackbar snackbar = Snackbar
.make(swipeView, R.string.confirm_exit, Snackbar.LENGTH_LONG) .make(swipeRefreshLayout, R.string.confirm_exit, Snackbar.LENGTH_LONG)
.setAction(R.string.yes, new View.OnClickListener() { .setAction(R.string.yes, new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
@ -481,7 +517,7 @@ public class MainActivity extends AppCompatActivity
setTitle(R.string.jb_notifications); setTitle(R.string.jb_notifications);
return true; return true;
} else { } else {
Snackbar.make(swipeView, R.string.no_internet, Snackbar.LENGTH_LONG).show(); Snackbar.make(swipeRefreshLayout, R.string.no_internet, Snackbar.LENGTH_LONG).show();
return false; return false;
} }
} }
@ -492,7 +528,7 @@ public class MainActivity extends AppCompatActivity
setTitle(R.string.jb_conversations); setTitle(R.string.jb_conversations);
return true; return true;
} else { } else {
Snackbar.make(swipeView, R.string.no_internet, Snackbar.LENGTH_LONG).show(); Snackbar.make(swipeRefreshLayout, R.string.no_internet, Snackbar.LENGTH_LONG).show();
return false; return false;
} }
} }
@ -510,7 +546,7 @@ public class MainActivity extends AppCompatActivity
public void onClick(DialogInterface dialog, int item) { public void onClick(DialogInterface dialog, int item) {
if (options[item].equals(getString(R.string.share_link))) { if (options[item].equals(getString(R.string.share_link))) {
Intent sharingIntent = new Intent(Intent.ACTION_SEND); Intent sharingIntent = new Intent(Intent.ACTION_SEND);
sharingIntent.setType("image/png"); sharingIntent.setType("text/plain");
sharingIntent.putExtra(Intent.EXTRA_SUBJECT, webView.getTitle()); sharingIntent.putExtra(Intent.EXTRA_SUBJECT, webView.getTitle());
sharingIntent.putExtra(Intent.EXTRA_TEXT, webView.getUrl()); sharingIntent.putExtra(Intent.EXTRA_TEXT, webView.getUrl());
startActivity(Intent.createChooser(sharingIntent, "Share using")); startActivity(Intent.createChooser(sharingIntent, "Share using"));
@ -539,7 +575,7 @@ public class MainActivity extends AppCompatActivity
return; return;
} }
} }
Snackbar.make(swipeView, R.string.toast_screenshot, Snackbar.LENGTH_LONG).show(); Snackbar.make(swipeRefreshLayout, R.string.toast_screenshot, Snackbar.LENGTH_LONG).show();
File directory = new File(Environment.getExternalStorageDirectory() + "/Pictures/Diaspora/"); File directory = new File(Environment.getExternalStorageDirectory() + "/Pictures/Diaspora/");
if (!directory.exists()) { if (!directory.exists()) {
directory.mkdirs(); directory.mkdirs();
@ -602,7 +638,7 @@ public class MainActivity extends AppCompatActivity
return; return;
} }
} }
Snackbar.make(swipeView, R.string.toast_screenshot, Snackbar.LENGTH_LONG).show(); Snackbar.make(swipeRefreshLayout, R.string.toast_screenshot, Snackbar.LENGTH_LONG).show();
File directory = new File(Environment.getExternalStorageDirectory() + "/Pictures/Diaspora/"); File directory = new File(Environment.getExternalStorageDirectory() + "/Pictures/Diaspora/");
if (!directory.exists()) { if (!directory.exists()) {
directory.mkdirs(); directory.mkdirs();
@ -677,22 +713,44 @@ public class MainActivity extends AppCompatActivity
appSettings.setMinimumFontSize(20); appSettings.setMinimumFontSize(20);
} }
wSettings.setMinimumFontSize(appSettings.getMinimumFontSize()); webSettings.setMinimumFontSize(appSettings.getMinimumFontSize());
if (Helpers.isOnline(MainActivity.this)) { if (Helpers.isOnline(MainActivity.this)) {
webView.loadUrl(webView.getUrl()); webView.loadUrl(webView.getUrl());
} else { } else {
Snackbar.make(swipeView, R.string.no_internet, Snackbar.LENGTH_LONG).show(); Snackbar.make(swipeRefreshLayout, R.string.no_internet, Snackbar.LENGTH_LONG).show();
} }
dialog.cancel(); dialog.cancel();
} }
}).show(); }).show();
} }
@Override
public void onUserProfileNameChanged(String name) {
navheaderTitle.setText(name);
}
@Override
public void onUserProfileAvatarChanged(String avatarUrl) {
app.getAvatarImageLoader().startImageDownload(navheaderImage, avatarUrl);
}
// TODO: Move from Javascript interface
@Override
public void onNotificationCountChanged(int notificationCount) {
}
// TODO: Move from Javascript interface
@Override
public void onUnreadMessageCountChanged(int unreadMessageCount) {
}
private class JavaScriptInterface { private class JavaScriptInterface {
@JavascriptInterface @JavascriptInterface
public void setNotificationCount(final String webMessage) { public void setNotificationCount(final String webMessage) {
myHandler.post(new Runnable() { uiHandler.post(new Runnable() {
@Override @Override
public void run() { public void run() {
notificationCount = Integer.valueOf(webMessage); notificationCount = Integer.valueOf(webMessage);
@ -703,7 +761,7 @@ public class MainActivity extends AppCompatActivity
if (notificationCount > 0) { if (notificationCount > 0) {
item.setIcon(R.drawable.ic_bell_ring_white_24dp); item.setIcon(R.drawable.ic_bell_ring_white_24dp);
Snackbar snackbar = Snackbar Snackbar snackbar = Snackbar
.make(swipeView, R.string.new_notifications, Snackbar.LENGTH_LONG) .make(swipeRefreshLayout, R.string.new_notifications, Snackbar.LENGTH_LONG)
.setAction(R.string.yes, new View.OnClickListener() { .setAction(R.string.yes, new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
@ -711,7 +769,7 @@ public class MainActivity extends AppCompatActivity
webView.loadUrl("https://" + podDomain + "/notifications"); webView.loadUrl("https://" + podDomain + "/notifications");
setTitle(R.string.jb_notifications); setTitle(R.string.jb_notifications);
} else { } else {
Snackbar.make(swipeView, R.string.no_internet, Snackbar.LENGTH_LONG).show(); Snackbar.make(swipeRefreshLayout, R.string.no_internet, Snackbar.LENGTH_LONG).show();
} }
} }
}); });
@ -726,26 +784,16 @@ public class MainActivity extends AppCompatActivity
}); });
} }
@JavascriptInterface
public void setProfileId(final String webMessage) {
if (profileId.equals("") || !profileId.equals(webMessage)) {
profileId = webMessage;
appSettings.setProfileId(profileId);
}
}
@JavascriptInterface @JavascriptInterface
public void setUserProfile(final String webMessage) throws JSONException { public void setUserProfile(final String webMessage) throws JSONException {
JSONObject d = new JSONObject(webMessage); if (webUserProfile.isRefreshNeeded()){
webUserProfile.parseJson(webMessage);
int id = d.getInt("id"); }
System.out.print(id);
} }
@JavascriptInterface @JavascriptInterface
public void setConversationCount(final String webMessage) { public void setConversationCount(final String webMessage) {
myHandler.post(new Runnable() { uiHandler.post(new Runnable() {
@Override @Override
public void run() { public void run() {
conversationCount = Integer.valueOf(webMessage); conversationCount = Integer.valueOf(webMessage);
@ -756,7 +804,7 @@ public class MainActivity extends AppCompatActivity
if (conversationCount > 0) { if (conversationCount > 0) {
item.setIcon(R.drawable.ic_message_text_white_24dp); item.setIcon(R.drawable.ic_message_text_white_24dp);
Snackbar snackbar = Snackbar Snackbar snackbar = Snackbar
.make(swipeView, R.string.new_conversations, Snackbar.LENGTH_LONG) .make(swipeRefreshLayout, R.string.new_conversations, Snackbar.LENGTH_LONG)
.setAction(R.string.yes, new View.OnClickListener() { .setAction(R.string.yes, new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
@ -764,7 +812,7 @@ public class MainActivity extends AppCompatActivity
webView.loadUrl("https://" + podDomain + "/conversations"); webView.loadUrl("https://" + podDomain + "/conversations");
setTitle(R.string.jb_notifications); setTitle(R.string.jb_notifications);
} else { } else {
Snackbar.make(swipeView, R.string.no_internet, Snackbar.LENGTH_LONG).show(); Snackbar.make(swipeRefreshLayout, R.string.no_internet, Snackbar.LENGTH_LONG).show();
} }
} }
}); });
@ -790,17 +838,17 @@ public class MainActivity extends AppCompatActivity
webView.loadUrl("https://" + podDomain + "/stream"); webView.loadUrl("https://" + podDomain + "/stream");
setTitle(R.string.jb_stream); setTitle(R.string.jb_stream);
} else { } else {
Snackbar.make(swipeView, R.string.no_internet, Snackbar.LENGTH_LONG).show(); Snackbar.make(swipeRefreshLayout, R.string.no_internet, Snackbar.LENGTH_LONG).show();
} }
} }
break; break;
case R.id.nav_profile: { case R.id.nav_profile: {
if (Helpers.isOnline(MainActivity.this)) { if (Helpers.isOnline(MainActivity.this)) {
webView.loadUrl("https://" + podDomain + "/people/" + profileId); webView.loadUrl("https://" + podDomain + "/people/" + appSettings.getProfileId());
setTitle(R.string.jb_profile); setTitle(R.string.jb_profile);
} else { } else {
Snackbar.make(swipeView, R.string.no_internet, Snackbar.LENGTH_LONG).show(); Snackbar.make(swipeRefreshLayout, R.string.no_internet, Snackbar.LENGTH_LONG).show();
} }
} }
break; break;
@ -811,7 +859,7 @@ public class MainActivity extends AppCompatActivity
webView.loadUrl("https://" + podDomain + "/followed_tags"); webView.loadUrl("https://" + podDomain + "/followed_tags");
setTitle(R.string.jb_followed_tags); setTitle(R.string.jb_followed_tags);
} else { } else {
Snackbar.make(swipeView, R.string.no_internet, Snackbar.LENGTH_LONG).show(); Snackbar.make(swipeRefreshLayout, R.string.no_internet, Snackbar.LENGTH_LONG).show();
} }
} }
break; break;
@ -821,7 +869,7 @@ public class MainActivity extends AppCompatActivity
webView.loadUrl("https://" + podDomain + "/aspects"); webView.loadUrl("https://" + podDomain + "/aspects");
setTitle(R.string.jb_aspects); setTitle(R.string.jb_aspects);
} else { } else {
Snackbar.make(swipeView, R.string.no_internet, Snackbar.LENGTH_LONG).show(); Snackbar.make(swipeRefreshLayout, R.string.no_internet, Snackbar.LENGTH_LONG).show();
} }
} }
break; break;
@ -831,7 +879,7 @@ public class MainActivity extends AppCompatActivity
webView.loadUrl("https://" + podDomain + "/activity"); webView.loadUrl("https://" + podDomain + "/activity");
setTitle(R.string.jb_activities); setTitle(R.string.jb_activities);
} else { } else {
Snackbar.make(swipeView, R.string.no_internet, Snackbar.LENGTH_LONG).show(); Snackbar.make(swipeRefreshLayout, R.string.no_internet, Snackbar.LENGTH_LONG).show();
} }
} }
break; break;
@ -841,7 +889,7 @@ public class MainActivity extends AppCompatActivity
webView.loadUrl("https://" + podDomain + "/liked"); webView.loadUrl("https://" + podDomain + "/liked");
setTitle(R.string.jb_liked); setTitle(R.string.jb_liked);
} else { } else {
Snackbar.make(swipeView, R.string.no_internet, Snackbar.LENGTH_LONG).show(); Snackbar.make(swipeRefreshLayout, R.string.no_internet, Snackbar.LENGTH_LONG).show();
} }
} }
break; break;
@ -851,7 +899,7 @@ public class MainActivity extends AppCompatActivity
webView.loadUrl("https://" + podDomain + "/commented"); webView.loadUrl("https://" + podDomain + "/commented");
setTitle(R.string.jb_commented); setTitle(R.string.jb_commented);
} else { } else {
Snackbar.make(swipeView, R.string.no_internet, Snackbar.LENGTH_LONG).show(); Snackbar.make(swipeRefreshLayout, R.string.no_internet, Snackbar.LENGTH_LONG).show();
} }
} }
break; break;
@ -861,7 +909,7 @@ public class MainActivity extends AppCompatActivity
webView.loadUrl("https://" + podDomain + "/mentions"); webView.loadUrl("https://" + podDomain + "/mentions");
setTitle(R.string.jb_mentions); setTitle(R.string.jb_mentions);
} else { } else {
Snackbar.make(swipeView, R.string.no_internet, Snackbar.LENGTH_LONG).show(); Snackbar.make(swipeRefreshLayout, R.string.no_internet, Snackbar.LENGTH_LONG).show();
} }
} }
break; break;
@ -871,7 +919,7 @@ public class MainActivity extends AppCompatActivity
webView.loadUrl("https://" + podDomain + "/public"); webView.loadUrl("https://" + podDomain + "/public");
setTitle(R.string.jb_public); setTitle(R.string.jb_public);
} else { } else {
Snackbar.make(swipeView, R.string.no_internet, Snackbar.LENGTH_LONG).show(); Snackbar.make(swipeRefreshLayout, R.string.no_internet, Snackbar.LENGTH_LONG).show();
} }
} }
break; break;
@ -888,13 +936,13 @@ public class MainActivity extends AppCompatActivity
if (options[item].equals(getString(R.string.settings_view))) if (options[item].equals(getString(R.string.settings_view)))
webView.loadUrl("https://" + podDomain + "/mobile/toggle"); webView.loadUrl("https://" + podDomain + "/mobile/toggle");
if (options[item].equals(getString(R.string.settings_image))) if (options[item].equals(getString(R.string.settings_image)))
wSettings.setLoadsImagesAutomatically(!appSettings.isLoadImages()); webSettings.setLoadsImagesAutomatically(!appSettings.isLoadImages());
appSettings.setLoadImages(!appSettings.isLoadImages()); appSettings.setLoadImages(!appSettings.isLoadImages());
webView.loadUrl(webView.getUrl()); webView.loadUrl(webView.getUrl());
} }
}).show(); }).show();
} else { } else {
Snackbar.make(swipeView, R.string.no_internet, Snackbar.LENGTH_LONG).show(); Snackbar.make(swipeRefreshLayout, R.string.no_internet, Snackbar.LENGTH_LONG).show();
} }
} }
break; break;
@ -937,7 +985,7 @@ public class MainActivity extends AppCompatActivity
} }
}).show(); }).show();
} else { } else {
Snackbar.make(swipeView, R.string.no_internet, Snackbar.LENGTH_LONG).show(); Snackbar.make(swipeRefreshLayout, R.string.no_internet, Snackbar.LENGTH_LONG).show();
} }
} }
break; break;

View file

@ -58,11 +58,13 @@ public class PodsActivity extends AppCompatActivity {
private EditText filter; private EditText filter;
private ListView lv; private ListView lv;
private ProgressDialog progressDialog; private ProgressDialog progressDialog;
private App app;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_pods); setContentView(R.layout.activity_pods);
app = (App) getApplication();
filter = (EditText) findViewById(R.id.edtFilter); filter = (EditText) findViewById(R.id.edtFilter);
lv = (ListView) findViewById(R.id.lstPods); lv = (ListView) findViewById(R.id.lstPods);
@ -168,10 +170,7 @@ public class PodsActivity extends AppCompatActivity {
new DialogInterface.OnClickListener() { new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) { public void onClick(DialogInterface dialog, int id) {
SharedPreferences sp = getSharedPreferences("PodSettings", MODE_PRIVATE); app.getSettings().setPodDomain(podDomain);
SharedPreferences.Editor editor = sp.edit();
editor.putString("podDomain", podDomain);
editor.apply();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
try { try {

View file

@ -88,10 +88,9 @@ public class ShareActivity extends MainActivity {
}); });
SharedPreferences config = getSharedPreferences("PodSettings", MODE_PRIVATE); podDomain = ((App)getApplication()).getSettings().getPodDomain();
podDomain = config.getString("podDomain", null);
fab = (com.getbase.floatingactionbutton.FloatingActionsMenu) findViewById(R.id.multiple_actions); fab = (com.getbase.floatingactionbutton.FloatingActionsMenu) findViewById(R.id.fab_menubutton);
fab.setVisibility(View.GONE); fab.setVisibility(View.GONE);
webView = (WebView)findViewById(R.id.webView); webView = (WebView)findViewById(R.id.webView);

View file

@ -88,10 +88,9 @@ public class ShareActivity2 extends MainActivity {
}); });
SharedPreferences config = getSharedPreferences("PodSettings", MODE_PRIVATE); podDomain = ((App)getApplication()).getSettings().getPodDomain();
podDomain = config.getString("podDomain", null);
fab = (com.getbase.floatingactionbutton.FloatingActionsMenu) findViewById(R.id.multiple_actions); fab = (com.getbase.floatingactionbutton.FloatingActionsMenu) findViewById(R.id.fab_expand_menu_button);
fab.setVisibility(View.GONE); fab.setVisibility(View.GONE);
webView = (WebView)findViewById(R.id.webView); webView = (WebView)findViewById(R.id.webView);

View file

@ -32,6 +32,7 @@ import java.util.TimerTask;
public class SplashActivity extends AppCompatActivity { public class SplashActivity extends AppCompatActivity {
private App app;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
@ -39,6 +40,7 @@ public class SplashActivity extends AppCompatActivity {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN); WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_splash); setContentView(R.layout.activity_splash);
app = (App)getApplication();
ImageView imgSplash = (ImageView) findViewById(R.id.imgSplash); ImageView imgSplash = (ImageView) findViewById(R.id.imgSplash);
@ -47,14 +49,13 @@ public class SplashActivity extends AppCompatActivity {
imgSplash.setImageResource(images.getResourceId(choice, R.drawable.splashscreen1)); imgSplash.setImageResource(images.getResourceId(choice, R.drawable.splashscreen1));
images.recycle(); images.recycle();
final SharedPreferences config = getSharedPreferences("PodSettings", MODE_PRIVATE);
Timer timer = new Timer(); Timer timer = new Timer();
timer.schedule(new TimerTask() { timer.schedule(new TimerTask() {
@Override @Override
public void run() { public void run() {
Intent i; Intent i;
if (config.getString("podDomain", null) != null) { if (!app.getSettings().getPodDomain().equals("")) {
i = new Intent(SplashActivity.this, MainActivity.class); i = new Intent(SplashActivity.this, MainActivity.class);
} else { } else {
i = new Intent(SplashActivity.this, PodsActivity.class); i = new Intent(SplashActivity.this, PodsActivity.class);

View file

@ -1,22 +1,42 @@
package de.baumann.diaspora; package de.baumann.diaspora;
import android.os.Handler;
import android.util.Log; import android.util.Log;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
import java.util.concurrent.TimeUnit; import java.io.File;
/** /**
* Created by de-live-gdev on 24.03.16. Part of Diaspora WebApp. * Created by de-live-gdev on 24.03.16. Part of Diaspora WebApp.
*/ */
public class WebUserProfile { public class WebUserProfile {
private final int MINIMUM_WEBUSERPROFILE_LOAD_TIMEDIFF = 5000; private static final int MINIMUM_WEBUSERPROFILE_LOAD_TIMEDIFF = 5000;
JSONObject json;
long lastLoaded;
boolean isWebUserProfileLoaded;
public WebUserProfile(){ private Handler uiHandler;
private WebUserProfileChangedListener listener;
private App app;
private AppSettings appSettings;
private JSONObject json;
private long lastLoaded;
private boolean isWebUserProfileLoaded;
private String avatarUrl;
private String guid;
private String name;
private int notificationCount;
private int unreadMessagesCount;
public WebUserProfile(App app, Handler uiHandler, WebUserProfileChangedListener listener) {
this.listener = listener;
this.uiHandler = uiHandler;
this.app = app;
appSettings = app.getSettings();
avatarUrl = appSettings.getAvatarUrl();
guid = appSettings.getProfileId();
name = appSettings.getName();
} }
public boolean isRefreshNeeded() { public boolean isRefreshNeeded() {
@ -27,102 +47,105 @@ public class WebUserProfile {
return isWebUserProfileLoaded; return isWebUserProfileLoaded;
} }
public boolean loadFromJson(String json) { public boolean parseJson(String jsonStr) {
try { try {
this.json = new JSONObject(json); this.json = new JSONObject(jsonStr);
lastLoaded = System.currentTimeMillis(); lastLoaded = System.currentTimeMillis();
String str;
int integer;
// Avatar
if (json.has("avatar")) {
JSONObject avatarJson = json.getJSONObject("avatar");
if (avatarJson.has("medium") && !((str = avatarJson.getString("medium")).equals(avatarUrl))) {
app.getAvatarImageLoader().clearAvatarImage();
avatarUrl = str;
appSettings.setAvatarUrl(str);
uiHandler.post(new Runnable() {
public void run() {
listener.onUserProfileAvatarChanged(avatarUrl);
}
});
}
}
// GUID (User id)
if (json.has("guid") && !((str = json.getString("guid")).equals(guid))) {
guid = str;
appSettings.setProfileId(guid);
}
// Name
if (json.has("name") && !((str = json.getString("name")).equals(name))) {
name = str;
appSettings.setName(name);
uiHandler.post(new Runnable() {
public void run() {
listener.onUserProfileNameChanged(name);
}
});
}
// Unread message count
if (json.has("notifications_count") && (integer = json.getInt("notifications_count")) != notificationCount) {
notificationCount = integer;
uiHandler.post(new Runnable() {
public void run() {
listener.onNotificationCountChanged(notificationCount);
}
});
}
// Unread message count
if (json.has("unread_messages_count") && (integer = json.getInt("unread_messages_count")) != unreadMessagesCount) {
unreadMessagesCount = integer;
uiHandler.post(new Runnable() {
public void run() {
listener.onUnreadMessageCountChanged(unreadMessagesCount);
}
});
}
isWebUserProfileLoaded = true; isWebUserProfileLoaded = true;
} catch (JSONException e) { } catch (JSONException e) {
Log.d(App.APP_LOG_TAG, e.getMessage()); Log.d(App.APP_LOG_TAG, e.getMessage());
isWebUserProfileLoaded = false; isWebUserProfileLoaded = false;
} }
lastLoaded = System.currentTimeMillis();
return isWebUserProfileLoaded; return isWebUserProfileLoaded;
} }
/** /*
* Get the Avatar URL's // Getters & Setters
* @return Avatar URL's
* [0] small
* [1] medium
* [2] large
*/ */
public String[] getAvatarUrls(){
try { public String getAvatarUrl() {
String[] avatars = new String[3]; return avatarUrl;
JSONObject o = json.getJSONObject("avatar");
avatars[0] = o.getString("small");
avatars[1] = o.getString("medium");
avatars[2] = o.getString("large");
return avatars;
} catch (JSONException e) {
return null;
}
} }
public int getId(){ public String getGuid() {
try { return guid;
return json.getInt("id");
} catch (JSONException e) {
return 0;
}
}
/**
* Get the users profile address id
* @return guid
*/
public int getGuid(){
try {
return json.getInt("guid");
} catch (JSONException e) {
return 0;
}
} }
public String getName() { public String getName() {
try { return name;
return json.getString("guid");
} catch (JSONException e) {
return null;
}
}
public String getDiasporaAddress(){
try {
return json.getString("diaspora_id");
} catch (JSONException e) {
return null;
}
} }
public int getNotificationCount() { public int getNotificationCount() {
try { return notificationCount;
return json.getInt("notifications_count");
} catch (JSONException e) {
return 0;
}
} }
public int getUnreadMessagesCount() { public int getUnreadMessagesCount() {
try { return unreadMessagesCount;
return json.getInt("unread_messages_count");
} catch (JSONException e) {
return 0;
} }
}
public int getFollowingCount(){
try {
return json.getInt("following_count");
} catch (JSONException e) {
return 0;
}
}
/* /*
* Not implemented / not needed yet: * Not implemented / not needed yet:
* string "diasporaAddress"
* int "id"
* boolean "admin" * boolean "admin"
* int "following_count"
* boolean "moderator" * boolean "moderator"
* array "aspects" * array "aspects"
* int "id" * int "id"
@ -133,6 +156,12 @@ public class WebUserProfile {
* ? ? * ? ?
* array "configured_services" * array "configured_services"
* ? ? * ? ?
*
*/ */
} }
interface WebUserProfileChangedListener {
void onUserProfileNameChanged(String name);
void onUserProfileAvatarChanged(String avatarUrl);
void onNotificationCountChanged(int notificationCount);
void onUnreadMessageCountChanged(int unreadMessageCount);
}

View file

@ -0,0 +1,46 @@
package de.baumann.diaspora.utils;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.widget.ImageView;
import java.io.File;
import de.baumann.diaspora.ImageDownloadTask;
/**
* Created by Gregor Santner (de-live-gdev) on 24.03.16.
*/
public class AvatarImageLoader {
private File avatarFile;
public AvatarImageLoader(Context context){
avatarFile = new File(context.getFilesDir(), "avatar.png");
}
public void clearAvatarImage(){
if (isAvatarDownloaded()) {
avatarFile.delete();
}
}
public boolean loadToImageView(ImageView imageView) {
if (avatarFile.exists()) {
Bitmap bitmap = BitmapFactory.decodeFile(avatarFile.getAbsolutePath());
imageView.setImageBitmap(bitmap);
return true;
}
return false;
}
public boolean isAvatarDownloaded() {
return avatarFile.exists();
}
public void startImageDownload(ImageView imageView, String avatarUrl) {
if(!avatarUrl.equals("")) {
new ImageDownloadTask(imageView, avatarFile.getAbsolutePath()).execute(avatarUrl);
}
}
}

View file

@ -62,15 +62,6 @@ public class Helpers {
"})();"); "})();");
} }
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());" +
" } " +
"})();");
}
public static void getUserProfile(final WebView wv) { public static void getUserProfile(final WebView wv) {
wv.loadUrl("javascript: ( function() {" + wv.loadUrl("javascript: ( function() {" +
" if (typeof gon !== 'undefined' && typeof gon.user !== 'undefined') {" + " if (typeof gon !== 'undefined' && typeof gon.user !== 'undefined') {" +

View file

@ -13,7 +13,7 @@
android:id="@+id/lstPods" android:id="@+id/lstPods"
android:choiceMode="singleChoice" android:choiceMode="singleChoice"
android:layout_below="@+id/edtFilter" android:layout_below="@+id/edtFilter"
android:layout_above="@+id/textView" /> android:layout_above="@+id/navheader_description" />
<EditText <EditText
android:layout_width="match_parent" android:layout_width="match_parent"
@ -43,7 +43,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="?android:attr/textAppearanceSmall"
android:text="@string/podlist_source_note" android:text="@string/podlist_source_note"
android:id="@+id/textView" android:id="@+id/navheader_description"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" /> android:layout_alignParentStart="true" />

View file

@ -25,13 +25,14 @@
<include layout="@layout/content_main" /> <include layout="@layout/content_main" />
<com.getbase.floatingactionbutton.FloatingActionsMenu <com.getbase.floatingactionbutton.FloatingActionsMenu
android:id="@+id/multiple_actions" android:id="@+id/fab_menubutton"
fab:fab_addButtonColorNormal="@color/fab_big" fab:fab_addButtonColorNormal="@color/fab_big"
fab:fab_addButtonColorPressed="@color/fab_big_pressed" fab:fab_addButtonColorPressed="@color/fab_big_pressed"
fab:fab_addButtonPlusIconColor="@color/white" fab:fab_addButtonPlusIconColor="@color/white"
fab:fab_labelStyle="@style/menu_labels_style" fab:fab_labelStyle="@style/menu_labels_style"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:visibility="gone"
android:layout_gravity="bottom|end" android:layout_gravity="bottom|end"
android:layout_marginRight="8dp" android:layout_marginRight="8dp"
android:layout_marginBottom="4dp" android:layout_marginBottom="4dp"

View file

@ -7,50 +7,50 @@
android:theme="@style/ThemeOverlay.AppCompat.Dark"> android:theme="@style/ThemeOverlay.AppCompat.Dark">
<ImageView <ImageView
android:id="@+id/navheader_background_image"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:id="@+id/imageView2" android:scaleType="centerCrop"
android:src="@drawable/header" android:src="@drawable/header" />
android:scaleType="centerCrop" />
<ImageView <ImageView
android:id="@+id/imageView" android:id="@+id/navheader_user_image"
android:layout_width="@android:dimen/notification_large_icon_width" android:layout_width="@android:dimen/notification_large_icon_width"
android:layout_height="@android:dimen/notification_large_icon_height" android:layout_height="@android:dimen/notification_large_icon_height"
android:paddingTop="@dimen/nav_header_vertical_spacing" android:layout_above="@+id/navheader_title"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingStart="@dimen/activity_horizontal_margin"
android:src="@drawable/ic_launcher"
android:layout_above="@+id/textView2"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" /> android:layout_alignParentStart="true"
android:layout_marginEnd="@dimen/activity_horizontal_margin"
android:layout_marginStart="@dimen/activity_horizontal_margin"
android:layout_marginTop="@dimen/nav_header_vertical_spacing"
android:src="@drawable/ic_launcher" />
<TextView <TextView
android:id="@+id/navheader_title"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_above="@+id/navheader_description"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:paddingEnd="@dimen/activity_horizontal_margin"
android:paddingStart="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/nav_header_vertical_spacing"
android:text="@string/app_name" android:text="@string/app_name"
android:textAppearance="@style/TextAppearance.AppCompat.Body1" android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="16sp" android:textSize="16sp" />
android:paddingTop="@dimen/nav_header_vertical_spacing"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingStart="@dimen/activity_horizontal_margin"
android:layout_above="@+id/textView"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:id="@+id/textView2" />
<TextView <TextView
android:id="@+id/textView" android:id="@+id/navheader_description"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/app_copyright"
android:textColor="@color/white"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingStart="@dimen/activity_horizontal_margin"
android:paddingBottom="@dimen/activity_horizontal_margin"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" /> android:layout_alignParentStart="true"
android:paddingBottom="@dimen/activity_horizontal_margin"
android:paddingEnd="@dimen/activity_horizontal_margin"
android:paddingStart="@dimen/activity_horizontal_margin"
android:text="@string/app_copyright"
android:textColor="@color/white" />
</RelativeLayout> </RelativeLayout>