mirror of
https://github.com/nuclearfog/Shitter.git
synced 2025-02-03 20:47:37 +01:00
Bugfix
Code Cleanup Added Multiple Image Upload New Window Animation
This commit is contained in:
parent
da490f26cf
commit
82cf932164
@ -7,6 +7,7 @@ import android.content.SharedPreferences.Editor;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
@ -28,32 +29,32 @@ public class AppSettings extends AppCompatActivity implements View.OnClickListen
|
||||
|
||||
private EditText woeId;
|
||||
private SharedPreferences settings;
|
||||
private ColorPreferences mColor;
|
||||
private ClipboardManager clip;
|
||||
private TextView load_factor;
|
||||
private ColorPreferences mColor;
|
||||
private CheckBox toggleImg;
|
||||
private int row, wId;
|
||||
private boolean imgEnabled;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInst) {
|
||||
super.onCreate(savedInst);
|
||||
setContentView(R.layout.settings);
|
||||
mColor = ColorPreferences.getInstance(this);
|
||||
settings = getApplicationContext().getSharedPreferences("settings", 0);
|
||||
clip = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
|
||||
row = settings.getInt("preload",10);
|
||||
wId = settings.getInt("woeid",23424829);
|
||||
String location = Integer.toString(wId);
|
||||
String load = Integer.toString(row);
|
||||
|
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_setting);
|
||||
setSupportActionBar(toolbar);
|
||||
if(getSupportActionBar() != null)
|
||||
getSupportActionBar().setDisplayShowTitleEnabled(false);
|
||||
|
||||
Button delButon = (Button) findViewById(R.id.delete_db);
|
||||
CheckBox toggleImg = (CheckBox) findViewById(R.id.toggleImg);
|
||||
Button colorButton1 = (Button) findViewById(R.id.color_background);
|
||||
Button colorButton2 = (Button) findViewById(R.id.color_font);
|
||||
Button colorButton3 = (Button) findViewById(R.id.color_tweet);
|
||||
Button colorButton4 = (Button) findViewById(R.id.highlight_color);
|
||||
Button reduce = (Button) findViewById(R.id.less);
|
||||
Button enhance = (Button) findViewById(R.id.more);
|
||||
Button clip = (Button) findViewById(R.id.woeid_clip);
|
||||
Button clipButton = (Button) findViewById(R.id.woeid_clip);
|
||||
toggleImg = (CheckBox) findViewById(R.id.toggleImg);
|
||||
load_factor = (TextView)findViewById(R.id.number_row);
|
||||
woeId = (EditText) findViewById(R.id.woeid);
|
||||
|
||||
@ -65,21 +66,15 @@ public class AppSettings extends AppCompatActivity implements View.OnClickListen
|
||||
toggleImg.setOnCheckedChangeListener(this);
|
||||
reduce.setOnClickListener(this);
|
||||
enhance.setOnClickListener(this);
|
||||
clip.setOnClickListener(this);
|
||||
clipButton.setOnClickListener(this);
|
||||
|
||||
int color1 = mColor.getColor(ColorPreferences.BACKGROUND);
|
||||
int color2 = mColor.getColor(ColorPreferences.FONT_COLOR);
|
||||
int color3 = mColor.getColor(ColorPreferences.TWEET_COLOR);
|
||||
int color4 = mColor.getColor(ColorPreferences.HIGHLIGHTING);
|
||||
colorButton1.setBackgroundColor(color1);
|
||||
colorButton2.setBackgroundColor(color2);
|
||||
colorButton3.setBackgroundColor(color3);
|
||||
colorButton4.setBackgroundColor(color4);
|
||||
mColor = ColorPreferences.getInstance(this);
|
||||
colorButton1.setBackgroundColor(mColor.getColor(ColorPreferences.BACKGROUND));
|
||||
colorButton2.setBackgroundColor(mColor.getColor(ColorPreferences.FONT_COLOR));
|
||||
colorButton3.setBackgroundColor(mColor.getColor(ColorPreferences.TWEET_COLOR));
|
||||
colorButton4.setBackgroundColor( mColor.getColor(ColorPreferences.HIGHLIGHTING));
|
||||
|
||||
toggleImg.setChecked(settings.getBoolean("image_load",true));
|
||||
|
||||
load_factor.setText(load);
|
||||
woeId.setText(location);
|
||||
loadSettings();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -91,22 +86,14 @@ public class AppSettings extends AppCompatActivity implements View.OnClickListen
|
||||
@Override
|
||||
public boolean onOptionsItemSelected( MenuItem item ) {
|
||||
switch(item.getItemId()) {
|
||||
case R.id.save_settings:
|
||||
save();
|
||||
return true;
|
||||
case R.id.back_settings:
|
||||
finish();
|
||||
return true;
|
||||
default:return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
wId = Integer.parseInt(woeId.getText().toString());
|
||||
Editor edit = settings.edit();
|
||||
edit.putInt("woeid", wId);
|
||||
edit.putInt("preload", row);
|
||||
edit.commit();
|
||||
mColor.commit();
|
||||
super.onBackPressed();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -170,6 +157,30 @@ public class AppSettings extends AppCompatActivity implements View.OnClickListen
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton b, boolean checked) {
|
||||
settings.edit().putBoolean("image_load", checked).apply();
|
||||
imgEnabled = true;
|
||||
}
|
||||
|
||||
private void loadSettings() {
|
||||
settings = getApplicationContext().getSharedPreferences("settings", 0);
|
||||
clip = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
|
||||
row = settings.getInt("preload",10);
|
||||
wId = settings.getInt("woeid",23424829);
|
||||
imgEnabled = settings.getBoolean("image_load",true);
|
||||
|
||||
String location = Integer.toString(wId);
|
||||
woeId.setText(location);
|
||||
toggleImg.setChecked(imgEnabled);
|
||||
String load = Integer.toString(row);
|
||||
load_factor.setText(load);
|
||||
}
|
||||
|
||||
private void save() {
|
||||
wId = Integer.parseInt(woeId.getText().toString());
|
||||
Editor edit = settings.edit();
|
||||
edit.putInt("woeid", wId);
|
||||
edit.putInt("preload", row);
|
||||
edit.putBoolean("image_load", imgEnabled);
|
||||
edit.apply();
|
||||
mColor.commit();
|
||||
}
|
||||
}
|
@ -43,8 +43,6 @@ public class TweetPopup extends AppCompatActivity implements View.OnClickListene
|
||||
if(getIntent().hasExtra("Addition"))
|
||||
addition = getIntent().getExtras().getString("Addition");
|
||||
|
||||
// final int size = LinearLayout.LayoutParams.WRAP_CONTENT;
|
||||
// getWindow().setLayout(size, size);
|
||||
mediaPath = new ArrayList<>();
|
||||
|
||||
|
||||
|
@ -2,10 +2,15 @@
|
||||
<menu xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item
|
||||
android:id="@+id/save_settings"
|
||||
android:icon="@drawable/save"
|
||||
android:title="save"
|
||||
app:showAsAction="always" />
|
||||
<item
|
||||
android:id="@+id/back_settings"
|
||||
android:checkable="false"
|
||||
android:icon="@drawable/back"
|
||||
android:icon="@drawable/right"
|
||||
android:title="@string/back"
|
||||
android:visible="true"
|
||||
app:showAsAction="always" />
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="colorPrimary">#3F51B5</color>
|
||||
<color name="colorPrimary">#3f51b5</color>
|
||||
<color name="colorPrimaryDark">#303f9f</color>
|
||||
<color name="colorAccent">#ff4081</color>
|
||||
<color name="twitterBlau">#034059</color>
|
||||
|
@ -6,17 +6,17 @@
|
||||
<item name="android:windowAnimationStyle">@style/TransactionPending</item>
|
||||
<item name="android:navigationBarColor">@android:color/background_dark</item>
|
||||
<item name="android:colorBackground">@color/DarkBlue</item>
|
||||
<item name="android:statusBarColor">@color/transparent</item>
|
||||
<item name="android:statusBarColor">@android:color/transparent</item>
|
||||
</style>
|
||||
|
||||
<style name="Transparency" parent="AppTheme">
|
||||
<item name="android:windowIsTranslucent">true</item>
|
||||
<item name="android:colorBackground">@android:color/transparent</item>
|
||||
</style>
|
||||
|
||||
<style name="TransactionPending" parent="@android:style/Animation.Activity">
|
||||
<item name="android:activityOpenEnterAnimation">@android:anim/fade_in</item>
|
||||
<item name="android:activityOpenExitAnimation">@android:anim/fade_out</item>
|
||||
<item name="android:activityCloseEnterAnimation">@android:anim/fade_in</item>
|
||||
<item name="android:activityCloseExitAnimation">@android:anim/fade_out</item>
|
||||
<style name="TransactionPending" parent="@android:style/Animation.Translucent">
|
||||
<item name="android:windowEnterAnimation">@android:anim/fade_in</item>
|
||||
<item name="android:windowExitAnimation">@android:anim/fade_out</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
Loading…
x
Reference in New Issue
Block a user