mirror of
https://github.com/gsantner/dandelion
synced 2025-12-15 16:51:11 +01:00
run analyze -> inspect code -> fixed some issues
This commit is contained in:
parent
1fcafa088f
commit
809c4a8de7
22 changed files with 41 additions and 86 deletions
|
|
@ -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){
|
||||
|
|
|
|||
|
|
@ -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> {
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
|
|
|
|||
|
|
@ -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"));
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue