Commit b359a079 authored by Massimiliano's avatar Massimiliano
Browse files

Updated Polls and added in settings

parent cb5bbe96
...@@ -14,8 +14,8 @@ ...@@ -14,8 +14,8 @@
<option name="values"> <option name="values">
<map> <map>
<entry key="assetSourceType" value="FILE" /> <entry key="assetSourceType" value="FILE" />
<entry key="outputName" value="ic_searx" /> <entry key="outputName" value="ic_poll" />
<entry key="sourceFile" value="$PROJECT_DIR$/../DisIcons/v2/ic_searx.svg" /> <entry key="sourceFile" value="$PROJECT_DIR$/../DisIcons/v2/ic_poll.svg" />
</map> </map>
</option> </option>
</PersistentState> </PersistentState>
......
...@@ -85,6 +85,7 @@ public class MainActivity extends AppCompatActivity implements View.OnLongClickL ...@@ -85,6 +85,7 @@ public class MainActivity extends AppCompatActivity implements View.OnLongClickL
ValueCallback<Uri[]> chooserPathUri; ValueCallback<Uri[]> chooserPathUri;
Button button; Button button;
private Button MailBtn,CloudBtn,ForumBtn,ChatBtn,PadBtn,CalcBtn,BinBtn,UploadBtn,SearxBtn,PollsBtn,BoardBtn,NotesBtn,UserBtn,StateBtn,HowToBtn,AboutBtn;//all buttons private Button MailBtn,CloudBtn,ForumBtn,ChatBtn,PadBtn,CalcBtn,BinBtn,UploadBtn,SearxBtn,PollsBtn,BoardBtn,NotesBtn,UserBtn,StateBtn,HowToBtn,AboutBtn;//all buttons
private int[] buttonIDs = new int[] {R.id.MailBtn, R.id.CloudBtn, R.id.ForumBtn,R.id.ChatBtn,R.id.PadBtn,R.id.CalcBtn,R.id.BinBtn,R.id.UploadBtn,R.id.SearxBtn,R.id.PollsBtn,R.id.BoardBtn,R.id.NotesBtn,R.id.UserBtn,R.id.StateBtn,R.id.HowToBtn,R.id.AboutBtn};
private CookieManager cookieManager; private CookieManager cookieManager;
private WebView webView; private WebView webView;
private DisWebChromeClient disWebChromeClient; private DisWebChromeClient disWebChromeClient;
...@@ -131,6 +132,7 @@ public class MainActivity extends AppCompatActivity implements View.OnLongClickL ...@@ -131,6 +132,7 @@ public class MainActivity extends AppCompatActivity implements View.OnLongClickL
BtnPreference = getSharedPreferences( "BinBtn", Context.MODE_PRIVATE );//bin BtnPreference = getSharedPreferences( "BinBtn", Context.MODE_PRIVATE );//bin
BtnPreference = getSharedPreferences( "UploadBtn", Context.MODE_PRIVATE );//upload BtnPreference = getSharedPreferences( "UploadBtn", Context.MODE_PRIVATE );//upload
BtnPreference = getSharedPreferences( "SearxBtn", Context.MODE_PRIVATE );//search BtnPreference = getSharedPreferences( "SearxBtn", Context.MODE_PRIVATE );//search
BtnPreference = getSharedPreferences( "PollsBtn", Context.MODE_PRIVATE );//polls
//Status service //Status service
Intent intent = new Intent( MainActivity.this, StatusService.class); Intent intent = new Intent( MainActivity.this, StatusService.class);
...@@ -218,8 +220,6 @@ public class MainActivity extends AppCompatActivity implements View.OnLongClickL ...@@ -218,8 +220,6 @@ public class MainActivity extends AppCompatActivity implements View.OnLongClickL
for (Map.Entry<String, ?> entry : allEntries.entrySet()) { for (Map.Entry<String, ?> entry : allEntries.entrySet()) {
if (entry.getValue().equals( false )){ if (entry.getValue().equals( false )){
ViewGroup viewGroup =((ViewGroup)findViewById( R.id.StateBtn ).getParent()); ViewGroup viewGroup =((ViewGroup)findViewById( R.id.StateBtn ).getParent());
int[] buttonIDs = new int[] {R.id.MailBtn, R.id.CloudBtn, R.id.ForumBtn,R.id.ChatBtn,R.id.PadBtn,R.id.CalcBtn,R.id.BinBtn,R.id.UploadBtn,R.id.SearxBtn,R.id.PollsBtn,R.id.BoardBtn,R.id.NotesBtn,R.id.UserBtn,R.id.StateBtn,R.id.HowToBtn,R.id.AboutBtn};
for(int i=0; i<buttonIDs.length; i++) { for(int i=0; i<buttonIDs.length; i++) {
Button b = (Button) findViewById(buttonIDs[i]); Button b = (Button) findViewById(buttonIDs[i]);
int resID = getResources().getIdentifier(entry.getKey(), int resID = getResources().getIdentifier(entry.getKey(),
...@@ -227,12 +227,8 @@ public class MainActivity extends AppCompatActivity implements View.OnLongClickL ...@@ -227,12 +227,8 @@ public class MainActivity extends AppCompatActivity implements View.OnLongClickL
if(findViewById(resID)==b) { if(findViewById(resID)==b) {
viewGroup.removeView(b); viewGroup.removeView(b);
} }
Log.e("button values", entry.getKey() + ": "+resID);
} }
} }
Log.e("map values", entry.getKey() + ": " + entry.getValue().toString());
} }
//get preferences //get preferences
...@@ -947,6 +943,16 @@ public class MainActivity extends AppCompatActivity implements View.OnLongClickL ...@@ -947,6 +943,16 @@ public class MainActivity extends AppCompatActivity implements View.OnLongClickL
hideDashboard(); hideDashboard();
} }
}); });
builder.setNeutralButton( R.string.remove , new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
ViewGroup viewGroup =((ViewGroup)findViewById( R.id.StateBtn ).getParent());
if (findViewById( R.id.PollsBtn).getParent()!=null){
viewGroup.removeView(PollsBtn);
BtnPreference.edit().putBoolean( "PollsBtn", false ).apply();
return;}
}
});
builder.show(); builder.show();
} }
......
...@@ -61,6 +61,7 @@ public class SettingsActivity extends AppCompatActivity { ...@@ -61,6 +61,7 @@ public class SettingsActivity extends AppCompatActivity {
BtnPreference = getSharedPreferences( "BinBtn", Context.MODE_PRIVATE );//bin BtnPreference = getSharedPreferences( "BinBtn", Context.MODE_PRIVATE );//bin
BtnPreference = getSharedPreferences( "UploadBtn", Context.MODE_PRIVATE );//upload BtnPreference = getSharedPreferences( "UploadBtn", Context.MODE_PRIVATE );//upload
BtnPreference = getSharedPreferences( "SearxBtn", Context.MODE_PRIVATE );//search BtnPreference = getSharedPreferences( "SearxBtn", Context.MODE_PRIVATE );//search
BtnPreference = getSharedPreferences( "PollsBtn", Context.MODE_PRIVATE );//polls
//checkboxlist //checkboxlist
checkPrefBox(); checkPrefBox();
...@@ -79,6 +80,7 @@ public class SettingsActivity extends AppCompatActivity { ...@@ -79,6 +80,7 @@ public class SettingsActivity extends AppCompatActivity {
final CheckBox checkBinBtn = iconSettings.findViewById( R.id.binBtnPreference );//bin final CheckBox checkBinBtn = iconSettings.findViewById( R.id.binBtnPreference );//bin
final CheckBox checkUploadBtn = iconSettings.findViewById( R.id.uploadBtnPreference );//upload final CheckBox checkUploadBtn = iconSettings.findViewById( R.id.uploadBtnPreference );//upload
final CheckBox checkSearxBtn = iconSettings.findViewById( R.id.searxBtnPreference );//search final CheckBox checkSearxBtn = iconSettings.findViewById( R.id.searxBtnPreference );//search
final CheckBox checkpollsBtn = iconSettings.findViewById( R.id.pollsBtnPreference );//polls
//Set checked if visibility is true //Set checked if visibility is true
if (BtnPreference.getBoolean( "MailBtn", true )) checkMailBtn.setChecked( true );//mail if (BtnPreference.getBoolean( "MailBtn", true )) checkMailBtn.setChecked( true );//mail
...@@ -90,6 +92,7 @@ public class SettingsActivity extends AppCompatActivity { ...@@ -90,6 +92,7 @@ public class SettingsActivity extends AppCompatActivity {
if (BtnPreference.getBoolean( "BinBtn", true )) checkBinBtn.setChecked( true );//bin if (BtnPreference.getBoolean( "BinBtn", true )) checkBinBtn.setChecked( true );//bin
if (BtnPreference.getBoolean( "UploadBtn", true )) checkUploadBtn.setChecked( true );//upload if (BtnPreference.getBoolean( "UploadBtn", true )) checkUploadBtn.setChecked( true );//upload
if (BtnPreference.getBoolean( "SearxBtn", true )) checkSearxBtn.setChecked( true );//search if (BtnPreference.getBoolean( "SearxBtn", true )) checkSearxBtn.setChecked( true );//search
if (BtnPreference.getBoolean( "pollsBtn", true )) checkSearxBtn.setChecked( true );//polls
//Mail //Mail
checkMailBtn.setOnCheckedChangeListener( new CompoundButton.OnCheckedChangeListener() { checkMailBtn.setOnCheckedChangeListener( new CompoundButton.OnCheckedChangeListener() {
...@@ -199,6 +202,18 @@ public class SettingsActivity extends AppCompatActivity { ...@@ -199,6 +202,18 @@ public class SettingsActivity extends AppCompatActivity {
} }
} ); } );
//polls
checkpollsBtn.setOnCheckedChangeListener( new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton view, boolean isChecked) {
if (checkpollsBtn.isChecked()) {
BtnPreference.edit().putBoolean( "PollsBtn", true ).apply();
} else {
BtnPreference.edit().putBoolean( "pollsBtn", false ).apply();
}
}
} );
} }
@Override //make sure changes are applyed when going back @Override //make sure changes are applyed when going back
......
<vector android:height="24dp" android:viewportHeight="48" <vector xmlns:android="http://schemas.android.com/apk/res/android"
android:viewportWidth="48" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> android:width="48dp"
<path android:fillAlpha="1" android:fillColor="#ffffff" android:height="48dp"
android:pathData="m21.4063,36.5938 l19.1875,-19.1875c0.7813,-0.7813 0.7813,-2.0313 0,-2.8125l-3.1875,-3.1875c-0.7813,-0.7813 -2.0313,-0.7813 -2.8125,0L20,26 13.4063,19.4063c-0.7813,-0.7813 -2.0313,-0.7813 -2.8125,0l-3.1875,3.1875c-0.7813,0.7812 -0.7813,2.0312 0,2.8125l11.1875,11.1875c0.7813,0.7812 2.0313,0.7812 2.8125,0zM48,9v30c0,4.9688 -4.0313,9 -9,9H9C4.0313,48 0,43.9688 0,39V9C0,4.0313 4.0313,0 9,0h30c4.9688,0 9,4.0313 9,9z" android:strokeWidth="0.03125"/> android:viewportWidth="48"
android:viewportHeight="48">
<path
android:pathData="M36,10.8203C35.4922,10.8203 34.9844,11.0156 34.5938,11.4063L20,26L13.4063,19.4063C12.625,18.625 11.375,18.625 10.5938,19.4063L7.4063,22.5938C6.625,23.375 6.625,24.625 7.4063,25.4063L18.5938,36.5938C19.375,37.375 20.625,37.375 21.4063,36.5938L40.5938,17.4063C41.375,16.625 41.375,15.375 40.5938,14.5938L37.4063,11.4063C37.0156,11.0156 36.5078,10.8203 36,10.8203z"
android:strokeAlpha="1"
android:strokeLineJoin="miter"
android:strokeWidth="1.72236323"
android:fillColor="#ffffff"
android:strokeColor="#00000000"
android:fillAlpha="0.99215686"
android:strokeLineCap="butt"/>
</vector> </vector>
...@@ -227,6 +227,25 @@ ...@@ -227,6 +227,25 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="end|center_vertical"/> android:layout_gravity="end|center_vertical"/>
</FrameLayout> </FrameLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingHorizontal="@dimen/activity_horizontal_margin">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="?android:attr/borderlessButtonStyle"
android:text="@string/action_poll"
android:textColor="@color/gray"
android:drawableTint="@color/gray"
android:drawableStart="@drawable/ic_poll"
android:drawableLeft="@drawable/ic_poll"/>
<CheckBox
android:id="@+id/pollsBtnPreference"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|center_vertical"/>
</FrameLayout>
</GridLayout> </GridLayout>
</ScrollView> </ScrollView>
</LinearLayout> </LinearLayout>
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment