Base 1.1
This commit is contained in:
parent
6fd3df16d4
commit
a1081b3cc7
|
@ -25,6 +25,7 @@ dependencies {
|
||||||
compile fileTree(include: ['*.jar'], dir: 'libs')
|
compile fileTree(include: ['*.jar'], dir: 'libs')
|
||||||
compile 'com.android.support:appcompat-v7:26+'
|
compile 'com.android.support:appcompat-v7:26+'
|
||||||
compile 'com.android.support:design:26+'
|
compile 'com.android.support:design:26+'
|
||||||
|
compile(name:'colorpicker', ext:'aar')
|
||||||
compile files('libs/twitter4j-core-4.0.4.jar')
|
compile files('libs/twitter4j-core-4.0.4.jar')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Binary file not shown.
|
@ -122,6 +122,16 @@ public class MainActivity extends AppCompatActivity
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPause(){
|
||||||
|
super.onPause();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onResume(){
|
||||||
|
super.onResume();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load Preferences
|
* Load Preferences
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -4,7 +4,6 @@ import android.content.SharedPreferences;
|
||||||
import android.content.SharedPreferences.Editor;
|
import android.content.SharedPreferences.Editor;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.support.v7.widget.Toolbar;
|
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
@ -14,16 +13,24 @@ import android.widget.EditText;
|
||||||
import android.widget.NumberPicker;
|
import android.widget.NumberPicker;
|
||||||
import android.widget.Switch;
|
import android.widget.Switch;
|
||||||
|
|
||||||
|
import com.flask.colorpicker.ColorPickerView;
|
||||||
|
import com.flask.colorpicker.OnColorSelectedListener;
|
||||||
|
import com.flask.colorpicker.builder.ColorPickerDialogBuilder;
|
||||||
|
|
||||||
import org.nuclearfog.twidda.R;
|
import org.nuclearfog.twidda.R;
|
||||||
|
|
||||||
public class AppSettings extends AppCompatActivity {
|
public class AppSettings extends AppCompatActivity implements View.OnClickListener{
|
||||||
|
|
||||||
private Button delButon;
|
private Button delButon,save_woeid, colorButton1, colorButton2;
|
||||||
|
private int backgroundColor, fontColor;
|
||||||
|
private int mode;
|
||||||
private Switch toggleImg;
|
private Switch toggleImg;
|
||||||
private EditText woeId;
|
private EditText woeId;
|
||||||
private SharedPreferences settings;
|
private SharedPreferences settings;
|
||||||
private NumberPicker load_factor;
|
private NumberPicker load_factor;
|
||||||
private Editor edit;
|
private Editor edit;
|
||||||
|
private boolean modified = false;
|
||||||
|
private boolean imgldr;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInst) {
|
protected void onCreate(Bundle savedInst) {
|
||||||
|
@ -34,19 +41,26 @@ public class AppSettings extends AppCompatActivity {
|
||||||
int location = settings.getInt("woeid",23424829);
|
int location = settings.getInt("woeid",23424829);
|
||||||
edit = settings.edit();
|
edit = settings.edit();
|
||||||
|
|
||||||
Toolbar tool = (Toolbar) findViewById(R.id.toolbar_setting);
|
|
||||||
load_factor = (NumberPicker)findViewById(R.id.tweet_load);
|
load_factor = (NumberPicker)findViewById(R.id.tweet_load);
|
||||||
delButon = (Button) findViewById(R.id.delete_db);
|
delButon = (Button) findViewById(R.id.delete_db);
|
||||||
toggleImg = (Switch) findViewById(R.id.toggleImg);
|
toggleImg = (Switch) findViewById(R.id.toggleImg);
|
||||||
woeId = (EditText) findViewById(R.id.woeid);
|
woeId = (EditText) findViewById(R.id.woeid);
|
||||||
|
colorButton1 = (Button) findViewById(R.id.color_background);
|
||||||
|
colorButton2 = (Button) findViewById(R.id.color_font);
|
||||||
|
save_woeid = (Button) findViewById(R.id.save_woeid);
|
||||||
|
|
||||||
|
delButon.setOnClickListener(this);
|
||||||
|
colorButton1.setOnClickListener(this);
|
||||||
|
colorButton2.setOnClickListener(this);
|
||||||
|
save_woeid.setOnClickListener(this);
|
||||||
|
|
||||||
setSupportActionBar(tool);
|
|
||||||
load_factor.setMinValue(5);
|
load_factor.setMinValue(5);
|
||||||
load_factor.setMaxValue(100);
|
load_factor.setMaxValue(100);
|
||||||
toggleImg.setChecked(settings.getBoolean("image_load",false));
|
toggleImg.setChecked(settings.getBoolean("image_load",false));
|
||||||
load_factor.setValue(settings.getInt("preload",10));
|
load_factor.setValue(settings.getInt("preload",10));
|
||||||
woeId.setText(""+location);
|
woeId.setText(""+location);
|
||||||
|
|
||||||
|
loadSettings();
|
||||||
setListener();
|
setListener();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,7 +68,7 @@ public class AppSettings extends AppCompatActivity {
|
||||||
* Create Actionbar
|
* Create Actionbar
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean onCreateOptionsMenu(Menu m) {
|
public boolean onCreateOptionsMenu( Menu m ) {
|
||||||
getMenuInflater().inflate(R.menu.setting, m);
|
getMenuInflater().inflate(R.menu.setting, m);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -63,7 +77,7 @@ public class AppSettings extends AppCompatActivity {
|
||||||
* Actionbar selection
|
* Actionbar selection
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected( MenuItem item ) {
|
||||||
switch(item.getItemId()) {
|
switch(item.getItemId()) {
|
||||||
case R.id.back_settings:
|
case R.id.back_settings:
|
||||||
finish();
|
finish();
|
||||||
|
@ -74,26 +88,73 @@ public class AppSettings extends AppCompatActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
|
if(modified) {
|
||||||
edit.putInt("woeid", Integer.valueOf(woeId.getText().toString()));
|
edit.putInt("woeid", Integer.valueOf(woeId.getText().toString()));
|
||||||
edit.putInt("preload", load_factor.getValue());
|
edit.putInt("preload", load_factor.getValue());
|
||||||
|
edit.putInt("background", backgroundColor);
|
||||||
|
edit.putInt("fontColor", fontColor);
|
||||||
|
edit.putBoolean("image_load", imgldr);
|
||||||
edit.apply();
|
edit.apply();
|
||||||
|
}
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
switch(v.getId()) {
|
||||||
|
case R.id.delete_db:
|
||||||
|
deleteDatabase(getString(R.string.database));
|
||||||
|
break;
|
||||||
|
case R.id.color_background:
|
||||||
|
mode=0;
|
||||||
|
setColorPicker();
|
||||||
|
break;
|
||||||
|
case R.id.color_font:
|
||||||
|
mode=1;
|
||||||
|
setColorPicker();
|
||||||
|
break;
|
||||||
|
case R.id.save_woeid:
|
||||||
|
modified=true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void setListener() {
|
private void setListener() {
|
||||||
toggleImg.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
toggleImg.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onCheckedChanged(CompoundButton b, boolean checked) {
|
public void onCheckedChanged(CompoundButton b, boolean checked) {
|
||||||
edit.putBoolean("image_load", checked);
|
imgldr = checked;
|
||||||
edit.apply();
|
modified = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
delButon.setOnClickListener(new View.OnClickListener() {
|
private void loadSettings() {
|
||||||
@Override
|
backgroundColor = settings.getInt("background",10);
|
||||||
public void onClick(View v) {
|
fontColor = settings.getInt("fontColor",10);
|
||||||
getApplicationContext().deleteDatabase(getApplicationContext().getString(R.string.database));
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
private void setColorPicker() {
|
||||||
|
ColorPickerDialogBuilder.with(this)
|
||||||
|
.showAlphaSlider(false)
|
||||||
|
.wheelType(ColorPickerView.WHEEL_TYPE.CIRCLE).density(20)
|
||||||
|
.setOnColorSelectedListener(new OnColorSelectedListener() {
|
||||||
|
@Override
|
||||||
|
public void onColorSelected(int i) {
|
||||||
|
changeColor(i);
|
||||||
|
}
|
||||||
|
}).build().show();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void changeColor(int color) {
|
||||||
|
switch(mode){
|
||||||
|
case(0):
|
||||||
|
backgroundColor = color;
|
||||||
|
break;
|
||||||
|
case(1):
|
||||||
|
fontColor = color;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
modified = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -11,6 +11,28 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="?attr/actionBarSize" />
|
android:layout_height="?attr/actionBarSize" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="10dp"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/color_background"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/color_font"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/color_link"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
@ -24,36 +46,34 @@
|
||||||
android:id="@+id/tweet_load"
|
android:id="@+id/tweet_load"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content" />
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginLeft="20dp"
|
|
||||||
android:layout_marginRight="20dp"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:padding="10dp">
|
|
||||||
|
|
||||||
<Switch
|
<Switch
|
||||||
android:id="@+id/toggleImg"
|
android:id="@+id/toggleImg"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="20dp"
|
android:layout_margin="10dp"
|
||||||
android:layout_marginRight="20dp"
|
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:padding="10dp">
|
android:padding="10dp">
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/woeid"
|
android:id="@+id/woeid"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="120dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:inputType="number" />
|
android:inputType="number" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/save_woeid"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="20dp"
|
||||||
|
tools:text="@string/save" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
|
|
|
@ -75,5 +75,6 @@
|
||||||
<string name="banner">Profilbanner</string>
|
<string name="banner">Profilbanner</string>
|
||||||
<string name="link">Webseite</string>
|
<string name="link">Webseite</string>
|
||||||
<string name="location">Ort</string>
|
<string name="location">Ort</string>
|
||||||
|
<string name="save">Speichern</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
|
@ -12,5 +12,6 @@ buildscript {
|
||||||
allprojects {
|
allprojects {
|
||||||
repositories {
|
repositories {
|
||||||
jcenter()
|
jcenter()
|
||||||
|
flatDir{ dirs 'libs'}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue