bugfix, cleanup
This commit is contained in:
parent
5feca56108
commit
5fdb7cef74
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@ -24,7 +24,7 @@
|
||||
</value>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_9" default="true" project-jdk-name="9.0" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" project-jdk-name="9.0" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
|
@ -180,7 +180,7 @@ public class ProfileLoader extends AsyncTask<Long,Void,Long> {
|
||||
int retry = err.getRetryAfter();
|
||||
errMsg = "Rate limit erreicht!\n Weiter in "+retry+" Sekunden";
|
||||
}
|
||||
else if(errCode != 136 && errCode != -1) {
|
||||
else if(errCode != 136) {
|
||||
errMsg = err.getMessage();
|
||||
}
|
||||
return FAILURE;
|
||||
|
@ -38,7 +38,7 @@ import twitter4j.conf.ConfigurationBuilder;
|
||||
public class TwitterEngine {
|
||||
|
||||
private final String TWITTER_CONSUMER_KEY = "0EKRHWYcakpCkl8Lr4OcBFMZb";
|
||||
private final String TWITTER_CONSUMER_SECRET = "RQrf0uQus5v7IMuYgdlVeBuLw1ApRJhxcAMM8MyUVRh1nKSxnR";
|
||||
private final String TWITTER_CONSUMER_SECRET = "xxx";
|
||||
|
||||
private static TwitterEngine mTwitter;
|
||||
private static long twitterID = -1L;
|
||||
|
@ -1,5 +1,6 @@
|
||||
package org.nuclearfog.twidda.window;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Dialog;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.DialogInterface;
|
||||
@ -11,7 +12,6 @@ import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
@ -36,18 +36,17 @@ import java.util.List;
|
||||
* App Settings Activity
|
||||
*/
|
||||
public class AppSettings extends AppCompatActivity implements View.OnClickListener,
|
||||
CompoundButton.OnCheckedChangeListener, AlertDialog.OnClickListener, Dialog.OnDismissListener, OnColorChangedListener {
|
||||
CompoundButton.OnCheckedChangeListener, OnColorChangedListener {
|
||||
|
||||
private EditText woeId;
|
||||
private SharedPreferences settings;
|
||||
private ClipboardManager clip;
|
||||
private Button colorButton1, colorButton2,colorButton3,colorButton4;
|
||||
private CheckBox toggleImg;
|
||||
private Dialog d;
|
||||
private int row, wId;
|
||||
private int background, tweet, font, highlight;
|
||||
private int mode = 0;
|
||||
private Button colorButton1,colorButton2,colorButton3,colorButton4;
|
||||
private int background,tweet,font,highlight;
|
||||
private boolean imgEnabled;
|
||||
private int row, wId;
|
||||
private int mode = 0;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInst) {
|
||||
@ -58,6 +57,8 @@ public class AppSettings extends AppCompatActivity implements View.OnClickListen
|
||||
if(getSupportActionBar() != null)
|
||||
getSupportActionBar().setDisplayShowTitleEnabled(false);
|
||||
|
||||
clip = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
|
||||
|
||||
Button delButton = findViewById(R.id.delete_db);
|
||||
Button errorcall = findViewById(R.id.error_call);
|
||||
colorButton1 = findViewById(R.id.color_background);
|
||||
@ -68,7 +69,7 @@ public class AppSettings extends AppCompatActivity implements View.OnClickListen
|
||||
Button load_popup = findViewById(R.id.load_dialog);
|
||||
toggleImg = findViewById(R.id.toggleImg);
|
||||
woeId = findViewById(R.id.woeid);
|
||||
|
||||
load();
|
||||
|
||||
load_popup.setOnClickListener(this);
|
||||
delButton.setOnClickListener(this);
|
||||
@ -80,18 +81,10 @@ public class AppSettings extends AppCompatActivity implements View.OnClickListen
|
||||
toggleImg.setOnCheckedChangeListener(this);
|
||||
clipButton.setOnClickListener(this);
|
||||
|
||||
settings = getSharedPreferences("settings",0);
|
||||
background = settings.getInt("background_color",0xff0f114a);
|
||||
font = settings.getInt("font_color",0xffffffff);
|
||||
tweet = settings.getInt("tweet_color",0xff19aae8);
|
||||
highlight = settings.getInt("highlight_color",0xffff00ff);
|
||||
|
||||
colorButton1.setBackgroundColor(background);
|
||||
colorButton2.setBackgroundColor(font);
|
||||
colorButton3.setBackgroundColor(tweet);
|
||||
colorButton4.setBackgroundColor(highlight);
|
||||
|
||||
loadSettings();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -123,26 +116,30 @@ public class AppSettings extends AppCompatActivity implements View.OnClickListen
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressLint("InflateParams")
|
||||
public void onClick( View v ) {
|
||||
switch(v.getId()) {
|
||||
case R.id.delete_db:
|
||||
new AlertDialog.Builder(this)
|
||||
.setMessage("Datenbank löschen?")
|
||||
.setPositiveButton(R.string.yes_confirm, this)
|
||||
.setNegativeButton(R.string.no_confirm, this)
|
||||
.setNegativeButton(R.string.no_confirm, null)
|
||||
.setPositiveButton(R.string.yes_confirm, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
deleteDatabase("database.db");
|
||||
}
|
||||
})
|
||||
.show();
|
||||
break;
|
||||
case R.id.error_call:
|
||||
List<String> messages = new ErrorLog(this).getErrorList();
|
||||
LogAdapter adp = new LogAdapter(messages);
|
||||
View list = LayoutInflater.from(this).inflate(R.layout.errorpage,null);
|
||||
RecyclerView loglist = list.findViewById(R.id.log_list);
|
||||
RecyclerView loglist = new RecyclerView(this);
|
||||
loglist.setLayoutManager(new LinearLayoutManager(this));
|
||||
loglist.setAdapter(adp);
|
||||
Dialog pList = new Dialog(this);
|
||||
pList.setContentView(list);
|
||||
pList.setContentView(loglist);
|
||||
pList.show();
|
||||
|
||||
break;
|
||||
case R.id.color_background:
|
||||
setColor(background);
|
||||
@ -172,28 +169,24 @@ public class AppSettings extends AppCompatActivity implements View.OnClickListen
|
||||
}
|
||||
break;
|
||||
case R.id.load_dialog:
|
||||
Dialog d = new Dialog(this);
|
||||
NumberPicker np = new NumberPicker(this);
|
||||
np.setMaxValue(1000);
|
||||
np.setMinValue(100);
|
||||
np.setValue(row);
|
||||
d.setContentView(np);
|
||||
d.show();
|
||||
|
||||
Dialog load_popup = new Dialog(this);
|
||||
final NumberPicker load = new NumberPicker(this);
|
||||
load.setMaxValue(100);
|
||||
load.setMinValue(10);
|
||||
load.setValue(row);
|
||||
load.setWrapSelectorWheel(false);
|
||||
load_popup.setContentView(load);
|
||||
load_popup.setOnDismissListener(new DialogInterface.OnDismissListener() {
|
||||
@Override
|
||||
public void onDismiss(DialogInterface dialog) {
|
||||
row = load.getValue();
|
||||
}
|
||||
});
|
||||
load_popup.show();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface d, int id) {
|
||||
switch(id) {
|
||||
case DialogInterface.BUTTON_POSITIVE:
|
||||
deleteDatabase("database.db");
|
||||
break;
|
||||
case DialogInterface.BUTTON_NEGATIVE:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onColorChanged(int color) {
|
||||
@ -218,30 +211,33 @@ public class AppSettings extends AppCompatActivity implements View.OnClickListen
|
||||
imgEnabled = checked;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDismiss(DialogInterface i) {
|
||||
colorButton1.setBackgroundColor(background);
|
||||
colorButton2.setBackgroundColor(font);
|
||||
colorButton3.setBackgroundColor(tweet);
|
||||
colorButton4.setBackgroundColor(highlight);
|
||||
d.dismiss();
|
||||
}
|
||||
|
||||
public void setColor(int preColor) {
|
||||
d = ColorPickerDialogBuilder.with(this)
|
||||
Dialog d = ColorPickerDialogBuilder.with(this)
|
||||
.showAlphaSlider(false).initialColor(preColor)
|
||||
.wheelType(ColorPickerView.WHEEL_TYPE.CIRCLE).density(20)
|
||||
.setOnColorChangedListener(this).build();
|
||||
d.setOnDismissListener(this);
|
||||
d.setOnDismissListener(new DialogInterface.OnDismissListener() {
|
||||
@Override
|
||||
public void onDismiss(DialogInterface dialog) {
|
||||
colorButton1.setBackgroundColor(background);
|
||||
colorButton2.setBackgroundColor(font);
|
||||
colorButton3.setBackgroundColor(tweet);
|
||||
colorButton4.setBackgroundColor(highlight);
|
||||
}
|
||||
});
|
||||
d.show();
|
||||
}
|
||||
|
||||
private void loadSettings() {
|
||||
clip = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
|
||||
private void load() {
|
||||
settings = getSharedPreferences("settings",0);
|
||||
background = settings.getInt("background_color",0xff0f114a);
|
||||
font = settings.getInt("font_color",0xffffffff);
|
||||
tweet = settings.getInt("tweet_color",0xff19aae8);
|
||||
highlight = settings.getInt("highlight_color",0xffff00ff);
|
||||
row = settings.getInt("preload",20);
|
||||
wId = settings.getInt("woeid",23424829);
|
||||
imgEnabled = settings.getBoolean("image_load",true);
|
||||
|
||||
String location = Integer.toString(wId);
|
||||
woeId.setText(location);
|
||||
toggleImg.setChecked(imgEnabled);
|
||||
|
@ -1,4 +0,0 @@
|
||||
<vector android:height="24dp" android:viewportHeight="20.0"
|
||||
android:viewportWidth="20.0" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FFFFFF" android:pathData="M16,10c0,0.553 -0.048,1 -0.601,1H4.601C4.049,11 4,10.553 4,10c0,-0.553 0.049,-1 0.601,-1H15.4C15.952,9 16,9.447 16,10z"/>
|
||||
</vector>
|
@ -1,4 +0,0 @@
|
||||
<vector android:height="24dp" android:viewportHeight="20.0"
|
||||
android:viewportWidth="20.0" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FFFFFF" android:pathData="M16,10c0,0.553 -0.048,1 -0.601,1H11v4.399C11,15.951 10.553,16 10,16c-0.553,0 -1,-0.049 -1,-0.601V11H4.601C4.049,11 4,10.553 4,10c0,-0.553 0.049,-1 0.601,-1H9V4.601C9,4.048 9.447,4 10,4c0.553,0 1,0.048 1,0.601V9h4.399C15.952,9 16,9.447 16,10z"/>
|
||||
</vector>
|
@ -1,7 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.v7.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/log_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
</android.support.v7.widget.RecyclerView>
|
@ -19,7 +19,6 @@
|
||||
android:textSize="18sp" />
|
||||
|
||||
<View
|
||||
android:id="@+id/divider2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="2dp"
|
||||
android:background="?android:attr/listDivider" />
|
||||
@ -85,7 +84,6 @@
|
||||
android:textSize="18sp" />
|
||||
|
||||
<View
|
||||
android:id="@+id/divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="2dp"
|
||||
android:background="?android:attr/listDivider" />
|
||||
@ -121,7 +119,6 @@
|
||||
android:textSize="18sp" />
|
||||
|
||||
<View
|
||||
android:id="@+id/divider3"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="2dp"
|
||||
android:background="?android:attr/listDivider" />
|
||||
@ -135,8 +132,8 @@
|
||||
|
||||
<Button
|
||||
android:id="@+id/woeid_clip"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:background="@drawable/copy" />
|
||||
@ -161,6 +158,18 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:text="@string/database"
|
||||
android:textSize="18sp" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="2dp"
|
||||
android:background="?android:attr/listDivider" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@ -186,6 +195,7 @@
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/errorstack_button" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
@ -54,4 +54,8 @@
|
||||
<string name="color_settings">Farbeinstellungen</string>
|
||||
<string name="data_load">Datenverbrauch</string>
|
||||
<string name="trend_setting">Trendeinstellung</string>
|
||||
<string name="animation">Animation</string>
|
||||
<string name="anim_time">Animationszeit</string>
|
||||
<string name="activated">Aktiviert</string>
|
||||
<string name="database">Speicher</string>
|
||||
</resources>
|
Loading…
x
Reference in New Issue
Block a user