parent
b55e0b11fa
commit
844efce050
|
@ -22,6 +22,7 @@ public class GlobalSettings {
|
||||||
|
|
||||||
private boolean loadImage;
|
private boolean loadImage;
|
||||||
private boolean loggedIn;
|
private boolean loggedIn;
|
||||||
|
private boolean customWorldId;
|
||||||
private int row;
|
private int row;
|
||||||
|
|
||||||
private int woeId;
|
private int woeId;
|
||||||
|
@ -34,6 +35,7 @@ public class GlobalSettings {
|
||||||
private GlobalSettings(Context context) {
|
private GlobalSettings(Context context) {
|
||||||
settings = context.getSharedPreferences("settings",0);
|
settings = context.getSharedPreferences("settings",0);
|
||||||
woeId = settings.getInt("world_id",1);
|
woeId = settings.getInt("world_id",1);
|
||||||
|
customWorldId = settings.getBoolean("custom_woeId", false);
|
||||||
woeIdPos = settings.getInt("world_id_pos",0);
|
woeIdPos = settings.getInt("world_id_pos",0);
|
||||||
background_color = settings.getInt("background_color",0xff0f114a);
|
background_color = settings.getInt("background_color",0xff0f114a);
|
||||||
highlight_color = settings.getInt("highlight_color",0xffff00ff);
|
highlight_color = settings.getInt("highlight_color",0xffff00ff);
|
||||||
|
@ -72,6 +74,10 @@ public class GlobalSettings {
|
||||||
return woeId;
|
return woeId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean customWoeIdset() {
|
||||||
|
return customWorldId;
|
||||||
|
}
|
||||||
|
|
||||||
public int getWoeIdSelection(){
|
public int getWoeIdSelection(){
|
||||||
return woeIdPos;
|
return woeIdPos;
|
||||||
}
|
}
|
||||||
|
@ -142,6 +148,13 @@ public class GlobalSettings {
|
||||||
edit.apply();
|
edit.apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setCustomWoeId(boolean customWoeId) {
|
||||||
|
Editor edit = settings.edit();
|
||||||
|
edit.putBoolean("custom_woeId", customWoeId);
|
||||||
|
customWorldId = customWoeId;
|
||||||
|
edit.apply();
|
||||||
|
}
|
||||||
|
|
||||||
public void setRowLimit(int limit) {
|
public void setRowLimit(int limit) {
|
||||||
Editor edit = settings.edit();
|
Editor edit = settings.edit();
|
||||||
edit.putInt("preload", limit);
|
edit.putInt("preload", limit);
|
||||||
|
|
|
@ -16,6 +16,7 @@ import android.widget.AdapterView;
|
||||||
import android.widget.AdapterView.OnItemSelectedListener;
|
import android.widget.AdapterView.OnItemSelectedListener;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
|
import android.widget.EditText;
|
||||||
import android.widget.NumberPicker;
|
import android.widget.NumberPicker;
|
||||||
import android.widget.Spinner;
|
import android.widget.Spinner;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
@ -39,10 +40,12 @@ public class AppSettings extends AppCompatActivity implements OnClickListener,
|
||||||
private CheckBox toggleImg;
|
private CheckBox toggleImg;
|
||||||
private Button colorButton1,colorButton2,colorButton3,colorButton4;
|
private Button colorButton1,colorButton2,colorButton3,colorButton4;
|
||||||
private Spinner woeId;
|
private Spinner woeId;
|
||||||
|
private EditText woeIdText;
|
||||||
private int background,tweet,font,highlight;
|
private int background,tweet,font,highlight;
|
||||||
private long wId;
|
private long wId;
|
||||||
private int row;
|
private int row;
|
||||||
private int woeIdPos;
|
private int woeIdPos;
|
||||||
|
private boolean customWoeId;
|
||||||
private int mode = 0;
|
private int mode = 0;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -64,6 +67,7 @@ public class AppSettings extends AppCompatActivity implements OnClickListener,
|
||||||
colorButton3 = findViewById(R.id.color_tweet);
|
colorButton3 = findViewById(R.id.color_tweet);
|
||||||
colorButton4 = findViewById(R.id.highlight_color);
|
colorButton4 = findViewById(R.id.highlight_color);
|
||||||
toggleImg = findViewById(R.id.toggleImg);
|
toggleImg = findViewById(R.id.toggleImg);
|
||||||
|
woeIdText = findViewById(R.id.woe_id);
|
||||||
woeId = findViewById(R.id.woeid);
|
woeId = findViewById(R.id.woeid);
|
||||||
load();
|
load();
|
||||||
|
|
||||||
|
@ -81,6 +85,12 @@ public class AppSettings extends AppCompatActivity implements OnClickListener,
|
||||||
colorButton3.setOnClickListener(this);
|
colorButton3.setOnClickListener(this);
|
||||||
colorButton4.setOnClickListener(this);
|
colorButton4.setOnClickListener(this);
|
||||||
woeId.setOnItemSelectedListener(this);
|
woeId.setOnItemSelectedListener(this);
|
||||||
|
|
||||||
|
if (customWoeId) {
|
||||||
|
String text = Long.toString(wId);
|
||||||
|
woeIdText.setVisibility(View.VISIBLE);
|
||||||
|
woeIdText.setText(text);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -190,9 +200,18 @@ public class AppSettings extends AppCompatActivity implements OnClickListener,
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||||
woeIdPos = position;
|
if (position == parent.getCount() - 1) {
|
||||||
|
woeIdText.setVisibility(View.VISIBLE);
|
||||||
|
customWoeId = true;
|
||||||
|
wId = 1;
|
||||||
|
} else {
|
||||||
|
woeIdText.setVisibility(View.INVISIBLE);
|
||||||
|
woeIdText.setText("");
|
||||||
|
customWoeId = false;
|
||||||
wId = id;
|
wId = id;
|
||||||
}
|
}
|
||||||
|
woeIdPos = position;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -227,6 +246,7 @@ public class AppSettings extends AppCompatActivity implements OnClickListener,
|
||||||
wId = settings.getWoeId();
|
wId = settings.getWoeId();
|
||||||
toggleImg.setChecked( settings.loadImages() );
|
toggleImg.setChecked( settings.loadImages() );
|
||||||
woeIdPos = settings.getWoeIdSelection();
|
woeIdPos = settings.getWoeIdSelection();
|
||||||
|
customWoeId = settings.customWoeIdset();
|
||||||
woeId.setAdapter( new WorldIdAdapter(this) );
|
woeId.setAdapter( new WorldIdAdapter(this) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -235,10 +255,14 @@ public class AppSettings extends AppCompatActivity implements OnClickListener,
|
||||||
settings.setHighlightColor(highlight);
|
settings.setHighlightColor(highlight);
|
||||||
settings.setTweetColor(tweet);
|
settings.setTweetColor(tweet);
|
||||||
settings.setFontColor(font);
|
settings.setFontColor(font);
|
||||||
settings.setImageLoad( toggleImg.isChecked() );
|
settings.setImageLoad(toggleImg.isChecked());
|
||||||
settings.setWoeId(wId);
|
|
||||||
settings.setRowLimit(row);
|
settings.setRowLimit(row);
|
||||||
settings.setWoeIdSelection(woeIdPos);
|
settings.setWoeIdSelection(woeIdPos);
|
||||||
Toast.makeText(getApplicationContext(), R.string.saved, Toast.LENGTH_SHORT).show();
|
settings.setCustomWoeId(customWoeId);
|
||||||
|
String woeText = woeIdText.getText().toString();
|
||||||
|
if (customWoeId && !woeText.isEmpty())
|
||||||
|
wId = Long.parseLong(woeText);
|
||||||
|
settings.setWoeId(wId);
|
||||||
|
Toast.makeText(this, R.string.saved, Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -6,7 +6,6 @@
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<ProgressBar
|
<ProgressBar
|
||||||
android:id="@+id/progressBar"
|
|
||||||
style="?android:attr/progressBarStyle"
|
style="?android:attr/progressBarStyle"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content" />
|
||||||
|
|
|
@ -132,9 +132,22 @@
|
||||||
|
|
||||||
<Spinner
|
<Spinner
|
||||||
android:id="@+id/woeid"
|
android:id="@+id/woeid"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginEnd="20dp" />
|
android:layout_weight="1" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/woe_id"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="@android:color/transparent"
|
||||||
|
android:drawablePadding="4dp"
|
||||||
|
android:hint="@string/woeid"
|
||||||
|
android:inputType="number"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:visibility="invisible" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
android:id="@+id/save_settings"
|
android:id="@+id/save_settings"
|
||||||
android:icon="@drawable/save"
|
android:icon="@drawable/save"
|
||||||
android:title="@string/save"
|
android:title="@string/save"
|
||||||
app:showAsAction="ifRoom|always" />
|
app:showAsAction="ifRoom" />
|
||||||
<item
|
<item
|
||||||
android:id="@+id/back_settings"
|
android:id="@+id/back_settings"
|
||||||
android:checkable="false"
|
android:checkable="false"
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
<item>USA</item>
|
<item>USA</item>
|
||||||
<item>Mexico</item>
|
<item>Mexico</item>
|
||||||
<item>Algeria</item>
|
<item>Algeria</item>
|
||||||
|
<!--Last Element should stay here-->
|
||||||
|
<item>custom</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<integer-array name="woeId">
|
<integer-array name="woeId">
|
||||||
|
@ -17,6 +19,7 @@
|
||||||
<item>23424977</item>
|
<item>23424977</item>
|
||||||
<item>23424900</item>
|
<item>23424900</item>
|
||||||
<item>23424740</item>
|
<item>23424740</item>
|
||||||
|
<item>0</item>
|
||||||
</integer-array>
|
</integer-array>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
|
@ -66,5 +66,5 @@
|
||||||
<string name="sent_from">sent from:</string>
|
<string name="sent_from">sent from:</string>
|
||||||
<string name="progress_kill">stop loading</string>
|
<string name="progress_kill">stop loading</string>
|
||||||
<string name="save">save</string>
|
<string name="save">save</string>
|
||||||
<string name="woeid">World-ID</string>
|
<string name="woeid">World ID</string>
|
||||||
</resources>
|
</resources>
|
Loading…
Reference in New Issue