diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 8ae6534b..540c9db4 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -8,6 +8,7 @@ diff --git a/app/src/main/java/de/baumann/diaspora/AppSettings.java b/app/src/main/java/de/baumann/diaspora/AppSettings.java index 41488584..b8f4e8a4 100644 --- a/app/src/main/java/de/baumann/diaspora/AppSettings.java +++ b/app/src/main/java/de/baumann/diaspora/AppSettings.java @@ -4,15 +4,14 @@ import android.content.Context; import android.content.SharedPreferences; /** - * Created by de-live-gdev on 20.03.16. + * Created by de-live-gdev on 20.03.16. Part of Diaspora WebApp. */ -public class AppSettings { - private Context context; - private SharedPreferences pref; +class AppSettings { + private final SharedPreferences pref; public AppSettings(Context context){ - this.context = context.getApplicationContext(); - pref = this.context.getSharedPreferences("app", Context.MODE_PRIVATE); + Context context1 = context.getApplicationContext(); + pref = context1.getSharedPreferences("app", Context.MODE_PRIVATE); } private void setString(String key, String value){ diff --git a/app/src/main/java/de/baumann/diaspora/FloatingActionsMenuBehavior.java b/app/src/main/java/de/baumann/diaspora/FloatingActionsMenuBehavior.java index 1f36ccce..87c80cbd 100644 --- a/app/src/main/java/de/baumann/diaspora/FloatingActionsMenuBehavior.java +++ b/app/src/main/java/de/baumann/diaspora/FloatingActionsMenuBehavior.java @@ -1,15 +1,13 @@ package de.baumann.diaspora; /** - * Created by juergen on 29.02.16. + * 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.FloatingActionButton; import com.getbase.floatingactionbutton.FloatingActionsMenu; public class FloatingActionsMenuBehavior extends CoordinatorLayout.Behavior { diff --git a/app/src/main/java/de/baumann/diaspora/MainActivity.java b/app/src/main/java/de/baumann/diaspora/MainActivity.java index 6ee2e8da..1a305232 100644 --- a/app/src/main/java/de/baumann/diaspora/MainActivity.java +++ b/app/src/main/java/de/baumann/diaspora/MainActivity.java @@ -81,7 +81,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener { - public static final int INPUT_FILE_REQUEST_CODE = 1; + static final int INPUT_FILE_REQUEST_CODE = 1; private static final int REQUEST_CODE_ASK_PERMISSIONS = 123; private static final String URL_MESSAGE = "URL_MESSAGE"; @@ -96,7 +96,6 @@ public class MainActivity extends AppCompatActivity private ValueCallback mFilePathCallback; private String mCameraPhotoPath; private com.getbase.floatingactionbutton.FloatingActionsMenu fab; - private TextView txtTitle; private ProgressBar progressBar; private WebSettings wSettings; private PrefManager pm; @@ -134,7 +133,7 @@ public class MainActivity extends AppCompatActivity 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.setDrawerListener(toggle); + drawer.addDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); @@ -236,7 +235,7 @@ public class MainActivity extends AppCompatActivity Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); if (takePictureIntent.resolveActivity(getPackageManager()) != null) { // Create the File where the photo should go - File photoFile = null; + File photoFile; try { photoFile = createImageFile(); takePictureIntent.putExtra("PhotoPath", mCameraPhotoPath); @@ -432,7 +431,7 @@ public class MainActivity extends AppCompatActivity @Override public void onReceive(Context context, Intent intent) { String url = intent.getStringExtra("url"); - txtTitle.setText(R.string.app_name); + setTitle(R.string.app_name); webView.loadUrl(url); } }; @@ -615,7 +614,7 @@ public class MainActivity extends AppCompatActivity if (screen.exists()) screen.delete(); picture.draw(c); - FileOutputStream fos = null; + FileOutputStream fos; try { fos = new FileOutputStream(screen); if (fos != null) { @@ -687,7 +686,7 @@ public class MainActivity extends AppCompatActivity }).show(); } - public class JavaScriptInterface { + private class JavaScriptInterface { @JavascriptInterface public void setNotificationCount(final String webMessage) { myHandler.post(new Runnable() { diff --git a/app/src/main/java/de/baumann/diaspora/PodsActivity.java b/app/src/main/java/de/baumann/diaspora/PodsActivity.java index 44d80eb3..4918378e 100644 --- a/app/src/main/java/de/baumann/diaspora/PodsActivity.java +++ b/app/src/main/java/de/baumann/diaspora/PodsActivity.java @@ -31,7 +31,7 @@ import android.content.SharedPreferences; import android.os.Build; import android.os.Bundle; import android.support.design.widget.Snackbar; -import android.support.v7.app.ActionBarActivity; +import android.support.v7.app.AppCompatActivity; import android.text.Editable; import android.text.TextWatcher; import android.view.Menu; @@ -52,14 +52,12 @@ import de.baumann.diaspora.services.GetPodsService; import de.baumann.diaspora.utils.Helpers; -public class PodsActivity extends ActionBarActivity { +public class PodsActivity extends AppCompatActivity { - BroadcastReceiver podListReceiver; - EditText filter; - ListView lv; - ImageView imgSelectPod; - ProgressDialog progressDialog; - private static final String TAG = "Diaspora Pods"; + private BroadcastReceiver podListReceiver; + private EditText filter; + private ListView lv; + private ProgressDialog progressDialog; @Override protected void onCreate(Bundle savedInstanceState) { @@ -70,7 +68,7 @@ public class PodsActivity extends ActionBarActivity { lv = (ListView) findViewById(R.id.lstPods); lv.setTextFilterEnabled(true); - imgSelectPod = (ImageView) findViewById(R.id.imgSelectPod); + ImageView imgSelectPod = (ImageView) findViewById(R.id.imgSelectPod); imgSelectPod.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { @@ -96,8 +94,6 @@ public class PodsActivity extends ActionBarActivity { else { Snackbar.make(lv, R.string.podlist_error, Snackbar.LENGTH_LONG).show(); } - } else { - // List of pods empty } } }; @@ -128,12 +124,12 @@ public class PodsActivity extends ActionBarActivity { private void updateListview(String[] source) { final ArrayList podList = new ArrayList<>(); - for (int i = 0 ; i < source.length ; i++) { - podList.add(source[i].toLowerCase()); + for (String aSource : source) { + podList.add(aSource.toLowerCase()); } Collections.sort(podList); - final ArrayAdapter adapter = new ArrayAdapter( + final ArrayAdapter adapter = new ArrayAdapter<>( PodsActivity.this, android.R.layout.simple_list_item_1, podList); @@ -163,7 +159,7 @@ public class PodsActivity extends ActionBarActivity { } - public void askConfirmation(final String podDomain) { + private void askConfirmation(final String podDomain) { if (Helpers.isOnline(PodsActivity.this)) { new AlertDialog.Builder(PodsActivity.this) .setTitle(getString(R.string.confirmation)) diff --git a/app/src/main/java/de/baumann/diaspora/ShareActivity.java b/app/src/main/java/de/baumann/diaspora/ShareActivity.java index d13f3a75..c316cdd9 100644 --- a/app/src/main/java/de/baumann/diaspora/ShareActivity.java +++ b/app/src/main/java/de/baumann/diaspora/ShareActivity.java @@ -21,7 +21,6 @@ package de.baumann.diaspora; import android.annotation.SuppressLint; import android.app.Activity; -import android.app.AlertDialog; import android.content.Intent; import android.content.SharedPreferences; import android.net.Uri; @@ -36,7 +35,6 @@ import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; -import android.webkit.JsResult; import android.webkit.ValueCallback; import android.webkit.WebChromeClient; import android.webkit.WebSettings; @@ -124,16 +122,6 @@ public class ShareActivity extends MainActivity { public void onPageFinished(WebView view, String url) { Log.i(TAG, "Finished loading URL: " + url); } - - public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { - Log.e(TAG, "Error: " + description); - - new AlertDialog.Builder(ShareActivity.this) - .setIcon(android.R.drawable.ic_dialog_alert) - .setMessage(description) - .setPositiveButton("CLOSE", null) - .show(); - } }); @@ -208,10 +196,6 @@ public class ShareActivity extends MainActivity { return true; } - - public boolean onJsAlert(WebView view, String url, String message, JsResult result) { - return super.onJsAlert(view, url, message, result); - } }); diff --git a/app/src/main/java/de/baumann/diaspora/ShareActivity2.java b/app/src/main/java/de/baumann/diaspora/ShareActivity2.java index 28aef6ae..c8c33fd2 100644 --- a/app/src/main/java/de/baumann/diaspora/ShareActivity2.java +++ b/app/src/main/java/de/baumann/diaspora/ShareActivity2.java @@ -21,7 +21,6 @@ package de.baumann.diaspora; import android.annotation.SuppressLint; import android.app.Activity; -import android.app.AlertDialog; import android.content.Intent; import android.content.SharedPreferences; import android.net.Uri; @@ -36,7 +35,6 @@ import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; -import android.webkit.JsResult; import android.webkit.ValueCallback; import android.webkit.WebChromeClient; import android.webkit.WebSettings; @@ -124,16 +122,6 @@ public class ShareActivity2 extends MainActivity { public void onPageFinished(WebView view, String url) { Log.i(TAG, "Finished loading URL: " + url); } - - public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { - Log.e(TAG, "Error: " + description); - - new AlertDialog.Builder(ShareActivity2.this) - .setIcon(android.R.drawable.ic_dialog_alert) - .setMessage(description) - .setPositiveButton("CLOSE", null) - .show(); - } }); @@ -208,10 +196,6 @@ public class ShareActivity2 extends MainActivity { return true; } - - public boolean onJsAlert(WebView view, String url, String message, JsResult result) { - return super.onJsAlert(view, url, message, result); - } }); diff --git a/app/src/main/java/de/baumann/diaspora/SplashActivity.java b/app/src/main/java/de/baumann/diaspora/SplashActivity.java index 7bb03d09..1f9fc3ae 100644 --- a/app/src/main/java/de/baumann/diaspora/SplashActivity.java +++ b/app/src/main/java/de/baumann/diaspora/SplashActivity.java @@ -33,8 +33,6 @@ import java.util.TimerTask; public class SplashActivity extends AppCompatActivity { - ImageView imgSplash; - @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -42,7 +40,7 @@ public class SplashActivity extends AppCompatActivity { WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.activity_splash); - imgSplash = (ImageView) findViewById(R.id.imgSplash); + ImageView imgSplash = (ImageView) findViewById(R.id.imgSplash); TypedArray images = getResources().obtainTypedArray(R.array.splash_images); int choice = (int) (Math.random() * images.length()); diff --git a/app/src/main/java/de/baumann/diaspora/services/GetPodsService.java b/app/src/main/java/de/baumann/diaspora/services/GetPodsService.java index 6a0ab86c..b8d060a8 100644 --- a/app/src/main/java/de/baumann/diaspora/services/GetPodsService.java +++ b/app/src/main/java/de/baumann/diaspora/services/GetPodsService.java @@ -99,7 +99,7 @@ public class GetPodsService extends Service { JSONObject j = new JSONObject(builder.toString()); JSONArray jr = j.getJSONArray("pods"); Log.d(TAG, "Number of entries " + jr.length()); - list = new ArrayList(); + list = new ArrayList<>(); for (int i = 0; i < jr.length(); i++) { JSONObject jo = jr.getJSONObject(i); Log.d(TAG, jo.getString("domain")); diff --git a/app/src/main/java/de/baumann/diaspora/utils/PrefManager.java b/app/src/main/java/de/baumann/diaspora/utils/PrefManager.java index 9cceb3e3..e6868fad 100644 --- a/app/src/main/java/de/baumann/diaspora/utils/PrefManager.java +++ b/app/src/main/java/de/baumann/diaspora/utils/PrefManager.java @@ -35,7 +35,7 @@ public class PrefManager { SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context); Editor edit = sp.edit(); edit.putBoolean("loadImages", loadImages); - edit.commit(); + edit.apply(); } public int getMinimumFontSize() { @@ -47,6 +47,6 @@ public class PrefManager { SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context); Editor edit = sp.edit(); edit.putInt("minimumFontSize", minimumFontSize); - edit.commit(); + edit.apply(); } } diff --git a/app/src/main/res/layout/app_bar_main.xml b/app/src/main/res/layout/app_bar_main.xml index b82ae34f..f7f7d128 100644 --- a/app/src/main/res/layout/app_bar_main.xml +++ b/app/src/main/res/layout/app_bar_main.xml @@ -35,6 +35,7 @@ android:layout_gravity="bottom|end" android:layout_marginRight="8dp" android:layout_marginBottom="4dp" + android:layout_marginEnd="8dp" app:layout_behavior="de.baumann.diaspora.FloatingActionsMenuBehavior"> + android:id="@+id/progressBar" /> \ 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 a5217a0a..8f1f56ab 100644 --- a/app/src/main/res/layout/font_size_chooser.xml +++ b/app/src/main/res/layout/font_size_chooser.xml @@ -10,8 +10,7 @@ + android:layout_height="wrap_content" > @@ -20,6 +19,7 @@ android:layout_height="@android:dimen/notification_large_icon_height" android:paddingTop="@dimen/nav_header_vertical_spacing" 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" @@ -31,9 +31,10 @@ android:text="@string/app_name" android:textAppearance="@style/TextAppearance.AppCompat.Body1" android:textColor="@color/white" - android:textSize="16dp" + 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" @@ -46,6 +47,7 @@ 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_alignParentLeft="true" diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png deleted file mode 100644 index d212a834..00000000 Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher.png and /dev/null differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png deleted file mode 100644 index d212a834..00000000 Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher.png and /dev/null differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png deleted file mode 100644 index d212a834..00000000 Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher.png and /dev/null differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png deleted file mode 100644 index d212a834..00000000 Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and /dev/null differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png deleted file mode 100644 index d212a834..00000000 Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and /dev/null differ diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 6b0e0069..facbc4e3 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -1,5 +1,5 @@ - + Neu laden Pod auswählen Pod-Domain eingeben @@ -8,7 +8,7 @@ Anmerkung: Auf dieser Liste finden sich nur Einträge von podupti.me Bitte einen gültigen Domain-Namen (URL) eingeben Fehler: Konnte die Podliste nicht abfragen! - Podliste wird geladen... + Podliste wird geladen… Entschuldigung, du musst mit dem Internet verbunden sein um fortzufahren. Bestätigung Willst du folgenden Pod benutzen: @@ -44,7 +44,7 @@ // Floating Action Buttons - Titles Nach oben scrollen - Suche nach Tags oder Personen ... + Suche nach Tags oder Personen … Neuer Beitrag Suche @@ -63,16 +63,15 @@ Schriftgröße ändern Bilder laden umschalten Ansicht wechseln - Bitte den Stream neu laden. normal groß riesig - Konnte Bild nicht laden ... + Konnte Bild nicht laden … Inhalt Teilen Link als Text teilen Bildschirmfoto teilen Bildschirmfoto machen - Bildschirmfoto wird gespeichert... + Bildschirmfoto wird gespeichert… Diaspora Einstellungen Ansichtseinstellungen Markdown Formatierung @@ -122,7 +121,6 @@ <b>Sonderzeichen</b><br> Du kannst Symbole und Sonderzeichen nutzen, indem du bestimmte Zeichenfolgen verwendest. Z.B.:<br> (c) = © ; (r) = ® ; x^2 = x²" - OK <i>Zuerst einmal: ich bin kein Entwickler. Ich verstehe ein paar Grundlagen, aber das Meiste meiner Arbeit ist mit \"Copy and Paste\" passiert. Diese App ist ein Fork der original \"DiasporaNativeWebApp\" von \"martinchodev\" (der die allermeiste Arbeit erledigt hat -> mein großer Dank gilt ihm), welche unter der GPL-Lizenz diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index 05cdb953..9848668b 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -1,7 +1,6 @@ 16dp - 160dp 16dp 16dp diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index f75a338a..98477bf4 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -134,7 +134,7 @@ If you like the app fell free to donate to the devoloper of the original \"DiasporaNativeWebApp\": Via Bitcoin - + <i>For more informations visit the Projectsite on github:<br> https://github.com/scoute-dich/Diaspora</i><br><br> @@ -167,7 +167,6 @@ • implemented swipe to refresh - OK Copyright © 2016 by scoute-dich <i>First of all: I am not a developer. I understand a few basics and most of my work is done by copy and paste. This app is a fork of the original \"DiasporaNativeWebApp\" @@ -191,7 +190,6 @@ They were published by \"Lydia\" and are licensed under cc by-nc-sa.</i> Splash screen - Please reload the stream Normal Large Huge