From 4482f0943011e39394ace77cd963f892df3d1d94 Mon Sep 17 00:00:00 2001 From: Gregor Santner Date: Sat, 26 Mar 2016 01:14:17 +0100 Subject: [PATCH] Refactoring; package movement;changed package name due to organisation name --- README.md | 8 ++-- app/build.gradle | 6 +-- app/src/main/AndroidManifest.xml | 16 +++---- .../{diaspora => diaspora_android}/App.java | 5 ++- .../activity}/MainActivity.java | 32 ++++++++------ .../activity}/PodsActivity.java | 20 +++++---- .../activity}/ShareActivity.java | 29 +++++++------ .../activity}/ShareActivity2.java | 27 ++++++------ .../activity}/SplashActivity.java | 7 +++- .../data}/AppSettings.java | 15 +++---- .../data}/WebUserProfile.java | 12 ++---- .../listener}/SoftKeyboardStateWatcher.java | 9 ++-- .../WebUserProfileChangedListener.java | 14 +++++++ .../task}/GetPodsService.java | 5 ++- .../task}/ImageDownloadTask.java | 4 +- .../ui}/FloatingActionsMenuBehavior.java | 4 +- .../util}/AvatarImageLoader.java | 10 ++--- .../util}/Helpers.java | 6 +-- app/src/main/res/layout/activity_main.xml | 2 +- app/src/main/res/layout/activity_pods.xml | 42 ++++++++++--------- app/src/main/res/layout/activity_splash.xml | 10 ++--- app/src/main/res/layout/app_bar_main.xml | 38 ++++++++--------- app/src/main/res/layout/content_main.xml | 18 ++++---- app/src/main/res/layout/font_size_chooser.xml | 11 +++-- app/src/main/res/menu/menu_compose.xml | 13 +++--- app/src/main/res/menu/menu_main.xml | 3 +- app/src/main/res/menu/menu_pods.xml | 4 +- ...ity_main_drawer.xml => navdrawer_main.xml} | 4 +- app/src/main/res/values-de/strings.xml | 2 +- app/src/main/res/values/strings.xml | 2 +- 30 files changed, 205 insertions(+), 173 deletions(-) rename app/src/main/java/de/dfa/{diaspora => diaspora_android}/App.java (82%) rename app/src/main/java/de/dfa/{diaspora => diaspora_android/activity}/MainActivity.java (97%) rename app/src/main/java/de/dfa/{diaspora => diaspora_android/activity}/PodsActivity.java (94%) rename app/src/main/java/de/dfa/{diaspora => diaspora_android/activity}/ShareActivity.java (93%) rename app/src/main/java/de/dfa/{diaspora => diaspora_android/activity}/ShareActivity2.java (94%) rename app/src/main/java/de/dfa/{diaspora => diaspora_android/activity}/SplashActivity.java (93%) rename app/src/main/java/de/dfa/{diaspora => diaspora_android/data}/AppSettings.java (91%) rename app/src/main/java/de/dfa/{diaspora => diaspora_android/data}/WebUserProfile.java (94%) rename app/src/main/java/de/dfa/{diaspora/utils => diaspora_android/listener}/SoftKeyboardStateWatcher.java (94%) create mode 100644 app/src/main/java/de/dfa/diaspora_android/listener/WebUserProfileChangedListener.java rename app/src/main/java/de/dfa/{diaspora/services => diaspora_android/task}/GetPodsService.java (98%) rename app/src/main/java/de/dfa/{diaspora => diaspora_android/task}/ImageDownloadTask.java (96%) rename app/src/main/java/de/dfa/{diaspora => diaspora_android/ui}/FloatingActionsMenuBehavior.java (96%) rename app/src/main/java/de/dfa/{diaspora/utils => diaspora_android/util}/AvatarImageLoader.java (82%) rename app/src/main/java/de/dfa/{diaspora/utils => diaspora_android/util}/Helpers.java (95%) rename app/src/main/res/menu/{activity_main_drawer.xml => navdrawer_main.xml} (96%) diff --git a/README.md b/README.md index a28a81fa..e0ee8c9c 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,12 @@ [![F-Droid](https://f-droid.org/wiki/images/0/06/F-Droid-button_get-it-on.png)](https://f-droid.org/repository/browse/?fdfilter=diaspora&fdid=de.baumann.diaspora) -## Contributors: +Project was moved to , README and paths need to be updated. -- [de-live-gdev](https://github.com/de-live-gdev) -- [scoute-dich](https://github.com/scoute-dich) +## Main developers: +- de-live-gdev () +- martinchodev () +- scoute-dich () # Diaspora diff --git a/app/build.gradle b/app/build.gradle index cda8402e..acda24e7 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -6,11 +6,11 @@ android { useLibrary 'org.apache.http.legacy' defaultConfig { - applicationId "de.dfa.diaspora" + applicationId "de.dfa.diaspora_android" minSdkVersion 15 targetSdkVersion 23 - versionCode 17 - versionName "1.3" + versionCode 1 + versionName "0.9.0" } buildTypes { release { diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 55f314e8..b17cf461 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,6 +1,6 @@ + package="de.dfa.diaspora_android"> @@ -10,11 +10,11 @@ android:allowBackup="true" android:fullBackupContent="true" android:icon="@drawable/ic_launcher" - android:name="de.dfa.diaspora.App" + android:name="de.dfa.diaspora_android.App" android:label="@string/app_name" android:theme="@style/AppTheme" > diff --git a/app/src/main/java/de/dfa/diaspora/App.java b/app/src/main/java/de/dfa/diaspora_android/App.java similarity index 82% rename from app/src/main/java/de/dfa/diaspora/App.java rename to app/src/main/java/de/dfa/diaspora_android/App.java index 9339c94b..52066191 100644 --- a/app/src/main/java/de/dfa/diaspora/App.java +++ b/app/src/main/java/de/dfa/diaspora_android/App.java @@ -1,8 +1,9 @@ -package de.dfa.diaspora; +package de.dfa.diaspora_android; import android.app.Application; -import de.dfa.diaspora.utils.AvatarImageLoader; +import de.dfa.diaspora_android.data.AppSettings; +import de.dfa.diaspora_android.util.AvatarImageLoader; /** * Created by gregor on 24.03.16. diff --git a/app/src/main/java/de/dfa/diaspora/MainActivity.java b/app/src/main/java/de/dfa/diaspora_android/activity/MainActivity.java similarity index 97% rename from app/src/main/java/de/dfa/diaspora/MainActivity.java rename to app/src/main/java/de/dfa/diaspora_android/activity/MainActivity.java index 86a7fba6..82bcc535 100644 --- a/app/src/main/java/de/dfa/diaspora/MainActivity.java +++ b/app/src/main/java/de/dfa/diaspora_android/activity/MainActivity.java @@ -17,7 +17,7 @@ If not, see . */ -package de.dfa.diaspora; +package de.dfa.diaspora_android.activity; import android.Manifest; import android.annotation.SuppressLint; @@ -80,8 +80,13 @@ import java.util.Date; import butterknife.Bind; import butterknife.ButterKnife; -import de.dfa.diaspora.utils.Helpers; -import de.dfa.diaspora.utils.SoftKeyboardStateWatcher; +import de.dfa.diaspora_android.App; +import de.dfa.diaspora_android.R; +import de.dfa.diaspora_android.data.AppSettings; +import de.dfa.diaspora_android.data.WebUserProfile; +import de.dfa.diaspora_android.listener.SoftKeyboardStateWatcher; +import de.dfa.diaspora_android.listener.WebUserProfileChangedListener; +import de.dfa.diaspora_android.util.Helpers; public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener, WebUserProfileChangedListener { @@ -138,7 +143,7 @@ public class MainActivity extends AppCompatActivity app = (App) getApplication(); appSettings = app.getSettings(); - webUserProfile = new WebUserProfile(app,uiHandler,this); + webUserProfile = new WebUserProfile(app, uiHandler, this); // Setup toolbar setSupportActionBar(toolbar); @@ -164,6 +169,7 @@ public class MainActivity extends AppCompatActivity public void onSoftKeyboardOpened(int keyboardHeightInPx) { fab.setVisibility(View.GONE); } + @Override public void onSoftKeyboardClosed() { fab.setVisibility(View.VISIBLE); @@ -315,7 +321,7 @@ public class MainActivity extends AppCompatActivity } - private void setupNavigationSlider(){ + 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); @@ -326,19 +332,19 @@ public class MainActivity extends AppCompatActivity 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); + 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("")) { + if (!appSettings.getName().equals("")) { navheaderTitle.setText(appSettings.getName()); } - if(!appSettings.getPodDomain().equals("")){ + if (!appSettings.getPodDomain().equals("")) { navheaderDescription.setText(appSettings.getPodDomain()); } - if(!appSettings.getAvatarUrl().equals("")){ + if (!appSettings.getAvatarUrl().equals("")) { // Try to load image - if(!app.getAvatarImageLoader().loadToImageView(navheaderImage)){ + if (!app.getAvatarImageLoader().loadToImageView(navheaderImage)) { // If not yet loaded, start download app.getAvatarImageLoader().startImageDownload(navheaderImage, appSettings.getAvatarUrl()); } @@ -803,7 +809,7 @@ public class MainActivity extends AppCompatActivity @JavascriptInterface public void setUserProfile(final String webMessage) throws JSONException { - if (webUserProfile.isRefreshNeeded()){ + if (webUserProfile.isRefreshNeeded()) { webUserProfile.parseJson(webMessage); } } diff --git a/app/src/main/java/de/dfa/diaspora/PodsActivity.java b/app/src/main/java/de/dfa/diaspora_android/activity/PodsActivity.java similarity index 94% rename from app/src/main/java/de/dfa/diaspora/PodsActivity.java rename to app/src/main/java/de/dfa/diaspora_android/activity/PodsActivity.java index bb8c27ee..f1362414 100644 --- a/app/src/main/java/de/dfa/diaspora/PodsActivity.java +++ b/app/src/main/java/de/dfa/diaspora_android/activity/PodsActivity.java @@ -17,7 +17,7 @@ If not, see . */ -package de.dfa.diaspora; +package de.dfa.diaspora_android.activity; import android.annotation.TargetApi; import android.app.AlertDialog; @@ -47,8 +47,10 @@ import android.widget.TextView; import java.util.ArrayList; import java.util.Collections; -import de.dfa.diaspora.services.GetPodsService; -import de.dfa.diaspora.utils.Helpers; +import de.dfa.diaspora_android.App; +import de.dfa.diaspora_android.R; +import de.dfa.diaspora_android.task.GetPodsService; +import de.dfa.diaspora_android.util.Helpers; public class PodsActivity extends AppCompatActivity { @@ -64,7 +66,7 @@ public class PodsActivity extends AppCompatActivity { super.onCreate(savedInstanceState); setContentView(R.layout.activity_pods); app = (App) getApplication(); - + filter = (EditText) findViewById(R.id.edtFilter); lv = (ListView) findViewById(R.id.lstPods); lv.setTextFilterEnabled(true); @@ -73,7 +75,7 @@ public class PodsActivity extends AppCompatActivity { imgSelectPod.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - if (filter.getText().length() > 4 && filter.getText().toString().contains(".")) + if (filter.getText().length() > 4 && filter.getText().toString().contains("")) askConfirmation(filter.getText().toString()); else Snackbar.make(lv, R.string.valid_pod, Snackbar.LENGTH_LONG).show(); @@ -90,7 +92,7 @@ public class PodsActivity extends AppCompatActivity { if (progressDialog != null) progressDialog.dismiss(); - if (pods != null && pods.length>0) + if (pods != null && pods.length > 0) updateListview(pods); else { Snackbar.make(lv, R.string.podlist_error, Snackbar.LENGTH_LONG).show(); @@ -117,7 +119,7 @@ public class PodsActivity extends AppCompatActivity { @Override protected void onResume() { super.onResume(); - Intent i= new Intent(PodsActivity.this, GetPodsService.class); + Intent i = new Intent(PodsActivity.this, GetPodsService.class); startService(i); } @@ -164,7 +166,7 @@ public class PodsActivity extends AppCompatActivity { if (Helpers.isOnline(PodsActivity.this)) { new AlertDialog.Builder(PodsActivity.this) .setTitle(getString(R.string.confirmation)) - .setMessage(getString(R.string.confirm_pod)+podDomain+"?") + .setMessage(getString(R.string.confirm_pod) + podDomain + "?") .setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { @@ -238,7 +240,7 @@ public class PodsActivity extends AppCompatActivity { if (id == R.id.action_reload) { if (Helpers.isOnline(PodsActivity.this)) { progressDialog.show(); - Intent i= new Intent(PodsActivity.this, GetPodsService.class); + Intent i = new Intent(PodsActivity.this, GetPodsService.class); startService(i); return true; } else { diff --git a/app/src/main/java/de/dfa/diaspora/ShareActivity.java b/app/src/main/java/de/dfa/diaspora_android/activity/ShareActivity.java similarity index 93% rename from app/src/main/java/de/dfa/diaspora/ShareActivity.java rename to app/src/main/java/de/dfa/diaspora_android/activity/ShareActivity.java index 22607688..4cf45f0c 100644 --- a/app/src/main/java/de/dfa/diaspora/ShareActivity.java +++ b/app/src/main/java/de/dfa/diaspora_android/activity/ShareActivity.java @@ -17,10 +17,9 @@ If not, see . */ -package de.dfa.diaspora; +package de.dfa.diaspora_android.activity; import android.annotation.SuppressLint; -import android.app.Activity; import android.content.Intent; import android.net.Uri; import android.os.Build; @@ -46,7 +45,9 @@ import java.io.IOException; import java.text.SimpleDateFormat; import java.util.Date; -import de.dfa.diaspora.utils.Helpers; +import de.dfa.diaspora_android.App; +import de.dfa.diaspora_android.R; +import de.dfa.diaspora_android.util.Helpers; public class ShareActivity extends MainActivity { @@ -68,7 +69,7 @@ public class ShareActivity extends MainActivity { Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); - progressBar = (ProgressBar)findViewById(R.id.progressBar); + progressBar = (ProgressBar) findViewById(R.id.progressBar); swipeView = (SwipeRefreshLayout) findViewById(R.id.swipe); swipeView.setEnabled(false); @@ -87,12 +88,12 @@ public class ShareActivity extends MainActivity { }); - podDomain = ((App)getApplication()).getSettings().getPodDomain(); + podDomain = ((App) getApplication()).getSettings().getPodDomain(); fab = (com.getbase.floatingactionbutton.FloatingActionsMenu) findViewById(R.id.fab_menubutton); fab.setVisibility(View.GONE); - webView = (WebView)findViewById(R.id.webView); + webView = (WebView) findViewById(R.id.webView); webView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY); WebSettings wSettings = webView.getSettings(); @@ -197,8 +198,6 @@ public class ShareActivity extends MainActivity { }); - - Intent intent = getIntent(); final Bundle extras = intent.getExtras(); String action = intent.getAction(); @@ -229,7 +228,7 @@ public class ShareActivity extends MainActivity { webView.loadUrl("javascript:(function() { " + "document.getElementsByTagName('textarea')[0].style.height='110px'; " + "document.getElementsByTagName('textarea')[0].innerHTML = '> " + - String.format("%s %s'; ",extraText,getString(R.string.shared_by_diaspora_android)) + + String.format("%s %s'; ", extraText, getString(R.string.shared_by_diaspora_android)) + " if(document.getElementById(\"main_nav\")) {" + " document.getElementById(\"main_nav\").parentNode.removeChild(" + " document.getElementById(\"main_nav\"));" + @@ -246,7 +245,7 @@ public class ShareActivity extends MainActivity { if (savedInstanceState == null) { if (Helpers.isOnline(ShareActivity.this)) { - webView.loadUrl("https://"+podDomain+"/status_messages/new"); + webView.loadUrl("https://" + podDomain + "/status_messages/new"); } else { Snackbar.make(getWindow().findViewById(R.id.drawer_layout), R.string.no_internet, Snackbar.LENGTH_LONG).show(); } @@ -256,15 +255,15 @@ public class ShareActivity extends MainActivity { @Override - public void onActivityResult (int requestCode, int resultCode, Intent data) { - if(requestCode != INPUT_FILE_REQUEST_CODE || mFilePathCallback == null) { + public void onActivityResult(int requestCode, int resultCode, Intent data) { + if (requestCode != INPUT_FILE_REQUEST_CODE || mFilePathCallback == null) { super.onActivityResult(requestCode, resultCode, data); return; } Uri[] results = null; - if(resultCode == Activity.RESULT_OK) { - if(data == null) { - if(mCameraPhotoPath != null) { + if (resultCode == RESULT_OK) { + if (data == null) { + if (mCameraPhotoPath != null) { results = new Uri[]{Uri.parse(mCameraPhotoPath)}; } } else { diff --git a/app/src/main/java/de/dfa/diaspora/ShareActivity2.java b/app/src/main/java/de/dfa/diaspora_android/activity/ShareActivity2.java similarity index 94% rename from app/src/main/java/de/dfa/diaspora/ShareActivity2.java rename to app/src/main/java/de/dfa/diaspora_android/activity/ShareActivity2.java index 8d615a90..88397d2e 100644 --- a/app/src/main/java/de/dfa/diaspora/ShareActivity2.java +++ b/app/src/main/java/de/dfa/diaspora_android/activity/ShareActivity2.java @@ -17,10 +17,9 @@ If not, see . */ -package de.dfa.diaspora; +package de.dfa.diaspora_android.activity; import android.annotation.SuppressLint; -import android.app.Activity; import android.content.Intent; import android.net.Uri; import android.os.Build; @@ -46,7 +45,9 @@ import java.io.IOException; import java.text.SimpleDateFormat; import java.util.Date; -import de.dfa.diaspora.utils.Helpers; +import de.dfa.diaspora_android.App; +import de.dfa.diaspora_android.R; +import de.dfa.diaspora_android.util.Helpers; public class ShareActivity2 extends MainActivity { @@ -68,7 +69,7 @@ public class ShareActivity2 extends MainActivity { Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); - progressBar = (ProgressBar)findViewById(R.id.progressBar); + progressBar = (ProgressBar) findViewById(R.id.progressBar); swipeView = (SwipeRefreshLayout) findViewById(R.id.swipe); swipeView.setEnabled(false); @@ -87,12 +88,12 @@ public class ShareActivity2 extends MainActivity { }); - podDomain = ((App)getApplication()).getSettings().getPodDomain(); + podDomain = ((App) getApplication()).getSettings().getPodDomain(); fab = (com.getbase.floatingactionbutton.FloatingActionsMenu) findViewById(R.id.fab_expand_menu_button); fab.setVisibility(View.GONE); - webView = (WebView)findViewById(R.id.webView); + webView = (WebView) findViewById(R.id.webView); webView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY); WebSettings wSettings = webView.getSettings(); @@ -197,8 +198,6 @@ public class ShareActivity2 extends MainActivity { }); - - Intent intent = getIntent(); final Bundle extras = intent.getExtras(); String action = intent.getAction(); @@ -246,7 +245,7 @@ public class ShareActivity2 extends MainActivity { if (savedInstanceState == null) { if (Helpers.isOnline(ShareActivity2.this)) { - webView.loadUrl("https://"+podDomain+"/status_messages/new"); + webView.loadUrl("https://" + podDomain + "/status_messages/new"); } else { Snackbar.make(getWindow().findViewById(R.id.drawer_layout), R.string.no_internet, Snackbar.LENGTH_SHORT).show(); } @@ -256,15 +255,15 @@ public class ShareActivity2 extends MainActivity { @Override - public void onActivityResult (int requestCode, int resultCode, Intent data) { - if(requestCode != INPUT_FILE_REQUEST_CODE || mFilePathCallback == null) { + public void onActivityResult(int requestCode, int resultCode, Intent data) { + if (requestCode != INPUT_FILE_REQUEST_CODE || mFilePathCallback == null) { super.onActivityResult(requestCode, resultCode, data); return; } Uri[] results = null; - if(resultCode == Activity.RESULT_OK) { - if(data == null) { - if(mCameraPhotoPath != null) { + if (resultCode == RESULT_OK) { + if (data == null) { + if (mCameraPhotoPath != null) { results = new Uri[]{Uri.parse(mCameraPhotoPath)}; } } else { diff --git a/app/src/main/java/de/dfa/diaspora/SplashActivity.java b/app/src/main/java/de/dfa/diaspora_android/activity/SplashActivity.java similarity index 93% rename from app/src/main/java/de/dfa/diaspora/SplashActivity.java rename to app/src/main/java/de/dfa/diaspora_android/activity/SplashActivity.java index 0554a78a..1e291bca 100644 --- a/app/src/main/java/de/dfa/diaspora/SplashActivity.java +++ b/app/src/main/java/de/dfa/diaspora_android/activity/SplashActivity.java @@ -17,7 +17,7 @@ If not, see . */ -package de.dfa.diaspora; +package de.dfa.diaspora_android.activity; import android.content.Intent; import android.content.res.TypedArray; @@ -29,6 +29,9 @@ import android.widget.ImageView; import java.util.Timer; import java.util.TimerTask; +import de.dfa.diaspora_android.App; +import de.dfa.diaspora_android.R; + public class SplashActivity extends AppCompatActivity { private App app; @@ -39,7 +42,7 @@ public class SplashActivity extends AppCompatActivity { getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.activity_splash); - app = (App)getApplication(); + app = (App) getApplication(); ImageView imgSplash = (ImageView) findViewById(R.id.imgSplash); diff --git a/app/src/main/java/de/dfa/diaspora/AppSettings.java b/app/src/main/java/de/dfa/diaspora_android/data/AppSettings.java similarity index 91% rename from app/src/main/java/de/dfa/diaspora/AppSettings.java rename to app/src/main/java/de/dfa/diaspora_android/data/AppSettings.java index b88a3bbe..841909bd 100644 --- a/app/src/main/java/de/dfa/diaspora/AppSettings.java +++ b/app/src/main/java/de/dfa/diaspora_android/data/AppSettings.java @@ -1,4 +1,4 @@ -package de.dfa.diaspora; +package de.dfa.diaspora_android.data; import android.content.Context; import android.content.SharedPreferences; @@ -6,7 +6,7 @@ import android.content.SharedPreferences; /** * Created by de-live-gdev on 20.03.16. Part of Diaspora WebApp. */ -class AppSettings { +public class AppSettings { private final SharedPreferences pref; private final Context context; @@ -18,9 +18,11 @@ class AppSettings { private void setString(String key, String value) { pref.edit().putString(key, value).apply(); } + private void setInt(String key, int value) { pref.edit().putInt(key, value).apply(); } + private void setBool(String key, boolean value) { pref.edit().putBoolean(key, value).apply(); } @@ -36,7 +38,6 @@ class AppSettings { private static final String PREF_PODDOMAIN = "podDomain"; - /* // Setters & Getters */ @@ -74,19 +75,19 @@ class AppSettings { setString(PREF_AVATAR_URL, avatarUrl); } - public String getName(){ + public String getName() { return pref.getString(PREF_WEBUSERPROFILE_NAME, ""); } - public void setName(String name){ + public void setName(String name) { setString(PREF_WEBUSERPROFILE_NAME, name); } - public String getPodDomain(){ + public String getPodDomain() { return pref.getString(PREF_PODDOMAIN, ""); } - public void setPodDomain(String podDomain){ + public void setPodDomain(String podDomain) { setString(PREF_PODDOMAIN, podDomain); } diff --git a/app/src/main/java/de/dfa/diaspora/WebUserProfile.java b/app/src/main/java/de/dfa/diaspora_android/data/WebUserProfile.java similarity index 94% rename from app/src/main/java/de/dfa/diaspora/WebUserProfile.java rename to app/src/main/java/de/dfa/diaspora_android/data/WebUserProfile.java index 49be54fa..3cfb36f1 100644 --- a/app/src/main/java/de/dfa/diaspora/WebUserProfile.java +++ b/app/src/main/java/de/dfa/diaspora_android/data/WebUserProfile.java @@ -1,4 +1,4 @@ -package de.dfa.diaspora; +package de.dfa.diaspora_android.data; import android.os.Handler; import android.util.Log; @@ -6,6 +6,9 @@ import android.util.Log; import org.json.JSONException; import org.json.JSONObject; +import de.dfa.diaspora_android.App; +import de.dfa.diaspora_android.listener.WebUserProfileChangedListener; + /** * Created by de-live-gdev on 24.03.16. Part of Diaspora WebApp. */ @@ -156,10 +159,3 @@ public class WebUserProfile { * ? ? */ } - -interface WebUserProfileChangedListener { - void onUserProfileNameChanged(String name); - void onUserProfileAvatarChanged(String avatarUrl); - void onNotificationCountChanged(int notificationCount); - void onUnreadMessageCountChanged(int unreadMessageCount); -} diff --git a/app/src/main/java/de/dfa/diaspora/utils/SoftKeyboardStateWatcher.java b/app/src/main/java/de/dfa/diaspora_android/listener/SoftKeyboardStateWatcher.java similarity index 94% rename from app/src/main/java/de/dfa/diaspora/utils/SoftKeyboardStateWatcher.java rename to app/src/main/java/de/dfa/diaspora_android/listener/SoftKeyboardStateWatcher.java index 2a9f836e..c225ba1e 100644 --- a/app/src/main/java/de/dfa/diaspora/utils/SoftKeyboardStateWatcher.java +++ b/app/src/main/java/de/dfa/diaspora_android/listener/SoftKeyboardStateWatcher.java @@ -1,4 +1,4 @@ -package de.dfa.diaspora.utils; +package de.dfa.diaspora_android.listener; /** * Created by juergen on 25.03.16. Part of Diaspora WebApp. @@ -16,20 +16,21 @@ public class SoftKeyboardStateWatcher implements ViewTreeObserver.OnGlobalLayout public interface SoftKeyboardStateListener { void onSoftKeyboardOpened(int keyboardHeightInPx); + void onSoftKeyboardClosed(); } private final List listeners = new LinkedList<>(); private final View activityRootView; - private int lastSoftKeyboardHeightInPx; - private boolean isSoftKeyboardOpened; + private int lastSoftKeyboardHeightInPx; + private boolean isSoftKeyboardOpened; public SoftKeyboardStateWatcher(View activityRootView) { this(activityRootView, false); } public SoftKeyboardStateWatcher(View activityRootView, boolean isSoftKeyboardOpened) { - this.activityRootView = activityRootView; + this.activityRootView = activityRootView; this.isSoftKeyboardOpened = isSoftKeyboardOpened; activityRootView.getViewTreeObserver().addOnGlobalLayoutListener(this); } diff --git a/app/src/main/java/de/dfa/diaspora_android/listener/WebUserProfileChangedListener.java b/app/src/main/java/de/dfa/diaspora_android/listener/WebUserProfileChangedListener.java new file mode 100644 index 00000000..519a4850 --- /dev/null +++ b/app/src/main/java/de/dfa/diaspora_android/listener/WebUserProfileChangedListener.java @@ -0,0 +1,14 @@ +package de.dfa.diaspora_android.listener; + +/** + * Created by Gregor Santner (de-live-gdev) on 26.03.16. + */ +public interface WebUserProfileChangedListener { + void onUserProfileNameChanged(String name); + + void onUserProfileAvatarChanged(String avatarUrl); + + void onNotificationCountChanged(int notificationCount); + + void onUnreadMessageCountChanged(int unreadMessageCount); +} \ No newline at end of file diff --git a/app/src/main/java/de/dfa/diaspora/services/GetPodsService.java b/app/src/main/java/de/dfa/diaspora_android/task/GetPodsService.java similarity index 98% rename from app/src/main/java/de/dfa/diaspora/services/GetPodsService.java rename to app/src/main/java/de/dfa/diaspora_android/task/GetPodsService.java index fea448a1..cae2bfb0 100644 --- a/app/src/main/java/de/dfa/diaspora/services/GetPodsService.java +++ b/app/src/main/java/de/dfa/diaspora_android/task/GetPodsService.java @@ -17,7 +17,7 @@ If not, see . */ -package de.dfa.diaspora.services; +package de.dfa.diaspora_android.task; import android.app.Service; import android.content.Intent; @@ -46,7 +46,8 @@ public class GetPodsService extends Service { private static final String TAG = "Diaspora Pod Service"; - public GetPodsService() { } + public GetPodsService() { + } @Override public int onStartCommand(Intent intent, int flags, int startId) { diff --git a/app/src/main/java/de/dfa/diaspora/ImageDownloadTask.java b/app/src/main/java/de/dfa/diaspora_android/task/ImageDownloadTask.java similarity index 96% rename from app/src/main/java/de/dfa/diaspora/ImageDownloadTask.java rename to app/src/main/java/de/dfa/diaspora_android/task/ImageDownloadTask.java index f3f4e81a..cc7fa580 100644 --- a/app/src/main/java/de/dfa/diaspora/ImageDownloadTask.java +++ b/app/src/main/java/de/dfa/diaspora_android/task/ImageDownloadTask.java @@ -1,4 +1,4 @@ -package de.dfa.diaspora; +package de.dfa.diaspora_android.task; import android.graphics.Bitmap; import android.graphics.BitmapFactory; @@ -11,6 +11,8 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; +import de.dfa.diaspora_android.App; + /** * Created by Gregor Santner (de-live-gdev) on 24.03.16. */ diff --git a/app/src/main/java/de/dfa/diaspora/FloatingActionsMenuBehavior.java b/app/src/main/java/de/dfa/diaspora_android/ui/FloatingActionsMenuBehavior.java similarity index 96% rename from app/src/main/java/de/dfa/diaspora/FloatingActionsMenuBehavior.java rename to app/src/main/java/de/dfa/diaspora_android/ui/FloatingActionsMenuBehavior.java index f4cf37e8..03a8abc9 100644 --- a/app/src/main/java/de/dfa/diaspora/FloatingActionsMenuBehavior.java +++ b/app/src/main/java/de/dfa/diaspora_android/ui/FloatingActionsMenuBehavior.java @@ -1,13 +1,15 @@ -package de.dfa.diaspora; +package de.dfa.diaspora_android.ui; /** * Created by juergen on 29.02.16. Part of Diaspora WebApp. */ + import android.content.Context; import android.support.design.widget.CoordinatorLayout; import android.support.design.widget.Snackbar.SnackbarLayout; import android.util.AttributeSet; import android.view.View; + import com.getbase.floatingactionbutton.FloatingActionsMenu; public class FloatingActionsMenuBehavior extends CoordinatorLayout.Behavior { diff --git a/app/src/main/java/de/dfa/diaspora/utils/AvatarImageLoader.java b/app/src/main/java/de/dfa/diaspora_android/util/AvatarImageLoader.java similarity index 82% rename from app/src/main/java/de/dfa/diaspora/utils/AvatarImageLoader.java rename to app/src/main/java/de/dfa/diaspora_android/util/AvatarImageLoader.java index cf244348..9bc6cf07 100644 --- a/app/src/main/java/de/dfa/diaspora/utils/AvatarImageLoader.java +++ b/app/src/main/java/de/dfa/diaspora_android/util/AvatarImageLoader.java @@ -1,4 +1,4 @@ -package de.dfa.diaspora.utils; +package de.dfa.diaspora_android.util; import android.content.Context; import android.graphics.Bitmap; @@ -7,7 +7,7 @@ import android.widget.ImageView; import java.io.File; -import de.dfa.diaspora.ImageDownloadTask; +import de.dfa.diaspora_android.task.ImageDownloadTask; /** * Created by Gregor Santner (de-live-gdev) on 24.03.16. @@ -15,11 +15,11 @@ import de.dfa.diaspora.ImageDownloadTask; public class AvatarImageLoader { private File avatarFile; - public AvatarImageLoader(Context context){ + public AvatarImageLoader(Context context) { avatarFile = new File(context.getFilesDir(), "avatar.png"); } - public void clearAvatarImage(){ + public void clearAvatarImage() { if (isAvatarDownloaded()) { avatarFile.delete(); } @@ -39,7 +39,7 @@ public class AvatarImageLoader { } public void startImageDownload(ImageView imageView, String avatarUrl) { - if(!avatarUrl.equals("")) { + if (!avatarUrl.equals("")) { new ImageDownloadTask(imageView, avatarFile.getAbsolutePath()).execute(avatarUrl); } } diff --git a/app/src/main/java/de/dfa/diaspora/utils/Helpers.java b/app/src/main/java/de/dfa/diaspora_android/util/Helpers.java similarity index 95% rename from app/src/main/java/de/dfa/diaspora/utils/Helpers.java rename to app/src/main/java/de/dfa/diaspora_android/util/Helpers.java index 34912086..48792235 100644 --- a/app/src/main/java/de/dfa/diaspora/utils/Helpers.java +++ b/app/src/main/java/de/dfa/diaspora_android/util/Helpers.java @@ -17,7 +17,7 @@ If not, see . */ -package de.dfa.diaspora.utils; +package de.dfa.diaspora_android.util; import android.content.Context; @@ -27,7 +27,7 @@ import android.webkit.WebView; public class Helpers { - public static boolean isOnline(Context context){ + public static boolean isOnline(Context context) { ConnectivityManager cnm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo ni = cnm.getActiveNetworkInfo(); return ni != null && ni.isConnectedOrConnecting(); @@ -47,7 +47,7 @@ public class Helpers { 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;" + " AndroidBridge.setNotificationCount(count.replace(/(\\r\\n|\\n|\\r)/gm, \"\"));" + " } else {" + diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index a61d8a63..5afc15cd 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -20,6 +20,6 @@ android:layout_gravity="start" android:fitsSystemWindows="true" app:headerLayout="@layout/nav_header_main" - app:menu="@menu/activity_main_drawer" /> + app:menu="@menu/navdrawer_main" /> diff --git a/app/src/main/res/layout/activity_pods.xml b/app/src/main/res/layout/activity_pods.xml index ff07f7e2..41c9050e 100644 --- a/app/src/main/res/layout/activity_pods.xml +++ b/app/src/main/res/layout/activity_pods.xml @@ -1,52 +1,54 @@ + tools:context=".activity.PodsActivity"> + android:choiceMode="singleChoice" /> + android:contentDescription="@string/confirm_url" + android:paddingLeft="5dp" + android:paddingRight="5dp" + android:src="@mipmap/ic_arrow_right_grey600_24dp" /> + android:layout_alignParentStart="true" + android:text="@string/podlist_source_note" + android:textAppearance="?android:attr/textAppearanceSmall" /> diff --git a/app/src/main/res/layout/activity_splash.xml b/app/src/main/res/layout/activity_splash.xml index 7d4c9e9a..c2752e03 100644 --- a/app/src/main/res/layout/activity_splash.xml +++ b/app/src/main/res/layout/activity_splash.xml @@ -2,15 +2,15 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" - tools:context="ar.com.tristeslostrestigres.diasporanativewebapp.SplashActivity"> + tools:context=".activity.SplashActivity"> + android:src="@drawable/splashscreen1" /> diff --git a/app/src/main/res/layout/app_bar_main.xml b/app/src/main/res/layout/app_bar_main.xml index 24c48cf7..a20e8dd6 100644 --- a/app/src/main/res/layout/app_bar_main.xml +++ b/app/src/main/res/layout/app_bar_main.xml @@ -1,8 +1,8 @@ + fab:fab_labelStyle="@style/menu_labels_style"> + fab:fab_size="mini" + fab:fab_title="@string/fab3_title" /> + fab:fab_size="mini" + fab:fab_title="@string/fab2_title" /> + fab:fab_icon="@drawable/fab_compose" + fab:fab_size="mini" + fab:fab_title="@string/fab1_title" /> diff --git a/app/src/main/res/layout/content_main.xml b/app/src/main/res/layout/content_main.xml index 65a6b8fc..2489ecc4 100644 --- a/app/src/main/res/layout/content_main.xml +++ b/app/src/main/res/layout/content_main.xml @@ -11,26 +11,26 @@ + android:layout_height="match_parent"> + android:layout_alignParentRight="true" + android:layout_alignParentStart="true" + android:layout_centerVertical="true" /> + android:maxHeight="4dip" + android:minHeight="4dip" /> \ No newline at end of file diff --git a/app/src/main/res/layout/font_size_chooser.xml b/app/src/main/res/layout/font_size_chooser.xml index 8f1f56ab..067ed8e4 100644 --- a/app/src/main/res/layout/font_size_chooser.xml +++ b/app/src/main/res/layout/font_size_chooser.xml @@ -1,16 +1,15 @@ - + android:layout_height="match_parent" + android:gravity="center_horizontal" + android:orientation="vertical"> + android:layout_height="wrap_content"> + xmlns:tools="http://schemas.android.com/tools" + tools:context=".activity.MainActivity"> - - - - - + + + + + diff --git a/app/src/main/res/menu/menu_main.xml b/app/src/main/res/menu/menu_main.xml index 715e6813..8c6ab81e 100644 --- a/app/src/main/res/menu/menu_main.xml +++ b/app/src/main/res/menu/menu_main.xml @@ -1,6 +1,7 @@ + xmlns:tools="http://schemas.android.com/tools" + tools:context=".activity.MainActivity"> + tools:context=".activity.PodsActivity"> diff --git a/app/src/main/res/menu/activity_main_drawer.xml b/app/src/main/res/menu/navdrawer_main.xml similarity index 96% rename from app/src/main/res/menu/activity_main_drawer.xml rename to app/src/main/res/menu/navdrawer_main.xml index 947379b1..dcaf3e6b 100644 --- a/app/src/main/res/menu/activity_main_drawer.xml +++ b/app/src/main/res/menu/navdrawer_main.xml @@ -15,10 +15,10 @@ + android:title="@string/jb_followed_tags" + android:visible="false" /> <br D* Titel und Text Profil D* nur Text - *[geteilt durch #DiasporaAndroid]* + *[geteilt durch #diaspora-android]* diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 903822db..40a6b0f5 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -205,5 +205,5 @@ Exit app Diaspora - *[shared by #DiasporaAndroid]* + *[shared by #diaspora-android]*