1
0
Fork 0
mirror of https://github.com/gsantner/dandelion synced 2024-12-22 19:08:03 +01:00

run analyze -> inspect code -> fixed some issues

This commit is contained in:
scoute-dich 2016-03-23 22:26:23 +01:00
parent 1fcafa088f
commit 809c4a8de7
22 changed files with 41 additions and 86 deletions

View file

@ -8,6 +8,7 @@
<application
android:allowBackup="true"
android:fullBackupContent="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >

View file

@ -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){

View file

@ -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<FloatingActionsMenu> {

View file

@ -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<Uri[]> 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() {

View file

@ -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<String> 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<String> adapter = new ArrayAdapter<String>(
final ArrayAdapter<String> 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))

View file

@ -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);
}
});

View file

@ -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);
}
});

View file

@ -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());

View file

@ -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<String>();
list = new ArrayList<>();
for (int i = 0; i < jr.length(); i++) {
JSONObject jo = jr.getJSONObject(i);
Log.d(TAG, jo.getString("domain"));

View file

@ -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();
}
}

View file

@ -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">
<com.getbase.floatingactionbutton.FloatingActionButton

View file

@ -31,7 +31,6 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
style="@android:style/Widget.ProgressBar.Horizontal"
android:id="@+id/progressBar"
android:progressTint="@color/fab_big" />
android:id="@+id/progressBar" />
</RelativeLayout>

View file

@ -10,8 +10,7 @@
<RadioGroup
android:id="@+id/genderRadioGroup"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/myCheckBox" >
android:layout_height="wrap_content" >
<RadioButton

View file

@ -2,7 +2,6 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="190dp"
android:background="@color/colorAccent"
android:gravity="bottom"
android:orientation="vertical"
android:theme="@style/ThemeOverlay.AppCompat.Dark">
@ -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"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:re="http://schemas.android.com/tools" xmlns:href="urn:oasis:names:tc:xliff:document:1.2">
<resources>
<string name="reload">Neu laden</string>
<string name="title_activity_pods">Pod auswählen</string>
<string name="filter_hint">Pod-Domain eingeben</string>
@ -8,7 +8,7 @@
<string name="podlist_source_note">Anmerkung: Auf dieser Liste finden sich nur Einträge von podupti.me</string>
<string name="valid_pod">Bitte einen gültigen Domain-Namen (URL) eingeben</string>
<string name="podlist_error">Fehler: Konnte die Podliste nicht abfragen!</string>
<string name="loading_podlist">Podliste wird geladen...</string>
<string name="loading_podlist">Podliste wird geladen</string>
<string name="no_internet">Entschuldigung, du musst mit dem Internet verbunden sein um fortzufahren.</string>
<string name="confirmation">Bestätigung</string>
<string name="confirm_pod">Willst du folgenden Pod benutzen: </string>
@ -44,7 +44,7 @@
// Floating Action Buttons - Titles
<string name="fab3_title">Nach oben scrollen</string>
<string name="fab2_title">Suche nach Tags oder Personen ...</string>
<string name="fab2_title">Suche nach Tags oder Personen </string>
<string name="fab1_title">Neuer Beitrag</string>
<string name="search_alert_title">Suche</string>
@ -63,16 +63,15 @@
<string name="settings_font">Schriftgröße ändern</string>
<string name="settings_image">Bilder laden umschalten</string>
<string name="settings_view">Ansicht wechseln</string>
<string name="please_reload">Bitte den Stream neu laden.</string>
<string name="normal">normal</string>
<string name="large">groß</string>
<string name="huge">riesig</string>
<string name="image">Konnte Bild nicht laden ...</string>
<string name="image">Konnte Bild nicht laden </string>
<string name="jb_share">Inhalt Teilen</string>
<string name="share_link">Link als Text teilen</string>
<string name="share_screenshot">Bildschirmfoto teilen</string>
<string name="take_screenshot">Bildschirmfoto machen</string>
<string name="toast_screenshot">Bildschirmfoto wird gespeichert...</string>
<string name="toast_screenshot">Bildschirmfoto wird gespeichert</string>
<string name="jb_settings_diaspora">Diaspora Einstellungen</string>
<string name="jb_settings_view">Ansichtseinstellungen</string>
<string name="help_help">Markdown Formatierung</string>
@ -122,7 +121,6 @@
&lt;b>Sonderzeichen&lt;/b>&lt;br>
Du kannst Symbole und Sonderzeichen nutzen, indem du bestimmte Zeichenfolgen verwendest. Z.B.:&lt;br>
(c) = © ; (r) = ® ; x^2 = x²"</string>
<string name="license_yes">OK</string>
<string name="license_text">&lt;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

View file

@ -1,7 +1,6 @@
<resources>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="nav_header_vertical_spacing">16dp</dimen>
<dimen name="nav_header_height">160dp</dimen>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>

View file

@ -134,7 +134,7 @@
<string name="donate_text">If you like the app fell free to donate to the devoloper of the original \"DiasporaNativeWebApp\":</string>
<string name="donate_1">Via Bitcoin</string>
<string name="about_text">
<string name="about_text" translatable="false">
&lt;i>For more informations visit the Projectsite on github:&lt;br>
https://github.com/scoute-dich/Diaspora&lt;/i>&lt;br>&lt;br>
@ -167,7 +167,6 @@
&#8226; implemented swipe to refresh
</string>
<string name="license_yes">OK</string>
<string name="license_title" translatable="false">Copyright © 2016 by scoute-dich</string>
<string name="license_text">&lt;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.&lt;/i></string>
<string name="splash_screen_description">Splash screen</string>
<string name="please_reload">Please reload the stream</string>
<string name="normal">Normal</string>
<string name="large">Large</string>
<string name="huge">Huge</string>