func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any]
func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void)
func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
completionHandler()
}
noticeText.layer.cornerRadius = 10
noticeText.layer.borderWidth = 1
noticeText.layer.borderColor = UIColor(red: 245/255, green: 245/255, blue: 245/255, alpha: 1.0).cgColor
noticeText.layer.masksToBounds = false
noticeText.layer.shadowOffset = CGSize(width: 0, height: 0)
noticeText.layer.shadowColor = UIColor.black.cgColor
noticeText.layer.shadowOpacity = 0.03
noticeText.layer.shadowRadius = 3
noticeText.textContainerInset = UIEdgeInsetsMake(10, 5, 10, 5)
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
for (Fragment fragment : getSupportFragmentManager().getFragments())
{
if (fragment != null)
{
fragment.onActivityResult(requestCode, resultCode, data);
}
}
}
ScrollView PageContScroll = (ScrollView) findViewById(R.id.PageContScroll);
PageContScroll.getViewTreeObserver().addOnScrollChangedListener(new ViewTreeObserver.OnScrollChangedListener() {
@Override
public void onScrollChanged() {
if(HaveMorePost == true) {
ScrollView PageContScroll = (ScrollView) findViewById(R.id.PageContScroll);
LinearLayout HeadTitLay = (LinearLayout) findViewById(R.id.HeadTitLay);
LinearLayout PageCont = (LinearLayout) findViewById(R.id.PageCont);
int scrollY = PageContScroll.getScrollY();
int diff = PageCont.getBottom() - (PageContScroll.getHeight() + scrollY + HeadTitLay.getHeight());
// if diff is zero, then the bottom has been reached
if(diff <= 0)
{
Toast toast = Toast.makeText(getApplicationContext(), "Работает!!!", Toast.LENGTH_SHORT);
toast.show();
}
}
}
});
class SendLoginData extends AsyncTask<Void, Void, Void> {
String resultString = null;
@Override
protected void onPreExecute() {
super.onPreExecute();
}
@Override
protected Void doInBackground(Void... params) {
try {
String myURL = "http://site.ru/";
String parammetrs = "param1=1¶m2=XXX";
byte[] data = null;
InputStream is = null;
try {
URL url = new URL(myURL);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setDoOutput(true);
conn.setDoInput(true);
conn.setRequestProperty("Content-Length", "" + Integer.toString(parammetrs.getBytes().length));
OutputStream os = conn.getOutputStream();
data = parammetrs.getBytes("UTF-8");
os.write(data);
data = null;
conn.connect();
int responseCode= conn.getResponseCode();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
if (responseCode == 200) {
is = conn.getInputStream();
byte[] buffer = new byte[8192]; // Такого вот размера буфер
// Далее, например, вот так читаем ответ
int bytesRead;
while ((bytesRead = is.read(buffer)) != -1) {
baos.write(buffer, 0, bytesRead);
}
data = baos.toByteArray();
resultString = new String(data, "UTF-8");
} else {
}
} catch (MalformedURLException e) {
//resultString = "MalformedURLException:" + e.getMessage();
} catch (IOException e) {
//resultString = "IOException:" + e.getMessage();
} catch (Exception e) {
//resultString = "Exception:" + e.getMessage();
}
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute(Void result) {
super.onPostExecute(result);
if(resultString != null) {
Toast toast = Toast.makeText(getApplicationContext(), resultString, Toast.LENGTH_SHORT);
toast.show();
}
}
}
<div id="bl1"></div>
<div id="bl2"></div>
bl[i].addEventListener("click", ToStory, false);
<Page
x:Class="HeartStory.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:HeartStory"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Page.Resources>
<ImageSource x:Key="ImageSource1">Images\logo.png</ImageSource>
</Page.Resources>
<Grid Background="#ffebdd" Grid.Column="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="300"></ColumnDefinition>
<ColumnDefinition Width="5"></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Vertical" Background="#ffebdd" Grid.Column="0">
<Image Width="144" Height="47" Margin="0,30,0,20" Stretch="None" Source="Images/logo.png"/>
<Button BorderThickness="2" Background="#f8b9ca" BorderBrush="#e6a0b3" Width="290" Margin="5,0,0,0" FontSize="18" Foreground="#a52a67">Истории</Button>
<Button BorderThickness="2" Background="#f8b9ca" BorderBrush="#e6a0b3" Width="290" Margin="5,0,0,0" FontSize="18" Foreground="#a52a67">Зарегистрироваться</Button>
<Button BorderThickness="2" Background="#f8b9ca" BorderBrush="#e6a0b3" Width="290" Margin="5,0,0,0" FontSize="18" Foreground="#a52a67">Войти</Button>
</StackPanel>
<StackPanel Orientation="Vertical" Background="#d9d9ff" Grid.Column="1">
<TextBlock FontSize="22" Foreground="#78239b" Margin="30">Одно дождливое утро</TextBlock>
</StackPanel>
<StackPanel Orientation="Vertical" Background="#ffebdd" Grid.Column="2">
</StackPanel>
</Grid>
</Page>
<script type="text/javascript">
var sendLikeRequest = function(id) {
$.ajax({
type: "POST",
url: "http://blabla/engine/functions/rating.php",
data: "text=" + id,
success: function(html){
if(html > 0) {
// Сюда возвращается результат, поставил ли пользователь лайк или убрал его
}
}
})
};
$(document).on('click', '.like', function(e) {
e.preventDefault();
sendLikeRequest($(this).data('id'));
});
</script>