blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
132 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
28 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
352
55c29f673c71422de93fca7744a452a952db5b7b
f00df5ef0d5a848bf442a8b281235483d25daf68
/src/creationalpatterns/builder/Package.java
41ad58d2c32c1087ad2c47232aba239ff2d18d14
[]
no_license
adolphofjun/designPattern
13e5e8eea9bd2e03b6866a937c09e1400ab6484c
b2d46e8566d4beab4af55bbc04eef3445ccf102d
refs/heads/master
2021-01-08T22:48:10.728917
2020-03-10T14:57:28
2020-03-10T14:57:28
242,165,788
0
0
null
null
null
null
UTF-8
Java
false
false
584
java
package creationalpatterns.builder; /** * 套餐 */ public class Package { private Drink drink; private Hamburger hamburger; public Drink getDrink() { return drink; } public void setDrink(Drink drink) { this.drink = drink; } public Hamburger getHamburger() { return hamburger; } public void setHamburger(Hamburger hamburger) { this.hamburger = hamburger; } public void printName(){ if(drink!=null) drink.printName(); if(hamburger!=null) hamburger.printName(); } }
[ "adolph_jun@163.com" ]
adolph_jun@163.com
2b845544cdc17f4fb5a52bfb189580b280b9f096
f8ab2c19c2534ff3dfdd57b68c0a03517b4cea56
/app/src/main/java/com/example/parks/adapter/ViewPagerAdapter.java
1b788586c5168cf38fb56ac251cfecd95a217262
[]
no_license
DhruvGoyal97/Parks
89445182b03b30955dd0c8c170acaec637e71fe1
1c408e65f53201e814d5b0e5d65794948c9b87a4
refs/heads/master
2023-05-03T02:10:15.404959
2021-05-24T13:32:47
2021-05-24T13:32:47
370,363,254
0
0
null
null
null
null
UTF-8
Java
false
false
1,556
java
package com.example.parks.adapter; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; import com.example.parks.R; import com.example.parks.model.Images; import com.squareup.picasso.Picasso; import java.util.List; public class ViewPagerAdapter extends RecyclerView.Adapter<ViewPagerAdapter.ImageSlider> { private List<Images> imagesList; public ViewPagerAdapter(List<Images> imagesList) { this.imagesList = imagesList; } @NonNull @Override public ImageSlider onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { View view = LayoutInflater.from(parent.getContext()) .inflate(R.layout.view_pager_row,parent,false); return new ImageSlider(view); } @Override public void onBindViewHolder(@NonNull ImageSlider holder, int position) { Picasso.get() .load(imagesList.get(position).getUrl()) .fit() .placeholder(android.R.drawable.stat_sys_download) .into(holder.imageView); } @Override public int getItemCount() { return imagesList.size(); } public class ImageSlider extends RecyclerView.ViewHolder{ public ImageView imageView; public ImageSlider(@NonNull View itemView) { super(itemView); imageView = itemView.findViewById(R.id.view_pagerImage); } } }
[ "d9760409062@gmail.com" ]
d9760409062@gmail.com
a5de64f4bd1e5ea65afb68bde0afff2a5e2dc8da
1e9edcb0889050e7c572598337c2dd475fc35972
/src/main/java/org/mabufudyne/designer/core/Memento.java
d2c4cecbe332abec76bd35f44acf9da3f33e607e
[]
no_license
LukasKnapek/AdventureCallFX
d9674cf9fc2817fa209f90b327a3dfdd306a48f7
e6f3b68752afba5cca21712d96e1fe4e0b54d4df
refs/heads/master
2022-08-20T14:31:09.124189
2019-02-26T09:12:34
2019-02-26T09:12:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
730
java
package org.mabufudyne.designer.core; import org.apache.commons.lang3.SerializationUtils; import java.util.Objects; class Memento { private Adventure storedAdventure; Memento(Adventure adv) { storedAdventure = (Adventure) SerializationUtils.clone(adv); } public Adventure getAdventure() { return storedAdventure; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Memento memento = (Memento) o; return Objects.equals(storedAdventure, memento.storedAdventure); } @Override public int hashCode() { return Objects.hash(storedAdventure); } }
[ "lukas.knapek@kolabnow.com" ]
lukas.knapek@kolabnow.com
5e7436daeb060cd7457365459edb1f45ceb242fc
4b50325b013a82ec8341c3a544479269503ff8d9
/app/src/main/java/com/orangechain/laplace/activity/identity/activity/AuthenticationProcessActivity.java
6c21acb620fa99d3d0929d701c81d9bfc59fbbd8
[ "MIT" ]
permissive
LaplaceNetwork/Android
032a1ab7b24175107d8b1cfbd224fb96c31a7968
ac6799d1b896e15b0162acec7620aaae898fe40c
refs/heads/master
2020-03-30T03:16:25.162379
2018-11-26T09:35:08
2018-11-26T09:35:08
150,679,188
0
0
null
null
null
null
UTF-8
Java
false
false
2,618
java
package com.orangechain.laplace.activity.identity.activity; import android.content.Context; import android.content.Intent; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.TextView; import com.orangechain.laplace.R; import com.orangechain.laplace.activity.IndexActivity; import com.orangechain.laplace.base.BaseActivity; import com.orangechain.laplace.base.BaseActivityCollector; public class AuthenticationProcessActivity extends BaseActivity { @Override public void initWithView() { setToolBarText("Laplace Passport"); Button button = findViewById(R.id.auth_process_button); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //查看最终的结果 在此界面上直接显示结果 后期加动画 getLayoutInflater().inflate(R.layout.custom_authentication_process_result,getMainViewGroup()); //修改布局文件的值 setResultViewData("Username","iyouus",R.id.authentication_process_result_username); setResultViewData("ID","198374058797897379746",R.id.authentication_process_result_id); setResultViewData("location","China",R.id.authentication_process_result_location); setResultViewData("Homepage","Http://e8game.net/friends-vision.siejt.html",R.id.authentication_process_result_homepage); setResultViewData("Avatar","Http://e8game.net/friends-vision.siejt.html",R.id.authentication_process_result_avatar); } }); } /** * 动态设置结果数据 */ public void setResultViewData(String name,String content,int superLayout) { //修改布局文件的值 ViewGroup viewGroup_username = findViewById(superLayout); TextView nameTextView = viewGroup_username.findViewById(R.id.custom_authentication_process_name); nameTextView.setText(name); TextView desTextView = viewGroup_username.findViewById(R.id.custom_authentication_process_des); desTextView.setText(content); } @Override public int getLayoutId() { return R.layout.activity_authentication_process; } @Override public void pushActivity(Context context) { Intent intent = getLaunchIntent(context,AuthenticationProcessActivity.class); startWithNewAnimation(context,intent); } @Override public void leftAction() { BaseActivityCollector.finishAndGoBackHistoryActivity(IndexActivity.class); } }
[ "784780299@qq.com" ]
784780299@qq.com
ab45a8dddc76f37ce2df441ef4463e14e3614675
54793cf746cce09db1babe2b61a9fa0b5236ab90
/src/com/vabas/patterns/strategy/Worker.java
dd0327cbe9fac3a5ed2d656dc7808fbf795c6642
[]
no_license
va-bas/Patterns
bd782afc225c95fea02196043c0133555666bba0
36c7448752ec7afcdce22194c452541e50876fb6
refs/heads/master
2023-03-21T09:17:37.319164
2021-03-10T16:43:23
2021-03-10T16:43:23
346,424,306
0
0
null
null
null
null
UTF-8
Java
false
false
660
java
package com.vabas.patterns.strategy; public class Worker { Activity activity; public void setActivity(Activity activity) { this.activity = activity; } public void changeActivity(){ if (activity instanceof Away){ setActivity(new Waiting()); } else if(activity instanceof Waiting){ setActivity(new Working()); } else if(activity instanceof Working){ setActivity(new Dinner()); } else if(activity instanceof Dinner){ setActivity(new Away()); } } public void executeActivity() { activity.justDoIt(); } }
[ "vasalekhin@gmail.com" ]
vasalekhin@gmail.com
213f6d2a9d505adc359c5c8a11c5b026c0934ef4
7a6224e8278f9b3ec07acad1d002ee97add866b8
/microservicesBoot/src/main/java/com/example/demo/domain/Player.java
ff2cd533101e904fbfa16e42b319cce78c6a2820
[]
no_license
rkopace/SpringCheck
d483819cc5e98fe163747dcfb3d67475aa698170
d012806a5d6add890893e96166337e4a1d5c06b2
refs/heads/master
2020-03-14T12:45:23.964126
2018-04-30T16:44:35
2018-04-30T16:44:35
131,618,656
0
0
null
null
null
null
UTF-8
Java
false
false
511
java
package com.example.demo.domain; public class Player { String name; String position; public Player() { super(); } public Player(String name, String position) { this(); this.name = name; this.position = position; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getPosition() { return position; } public void setPosition(String position) { this.position = position; } }
[ "rkopace@us.ibm.com" ]
rkopace@us.ibm.com
dec592162f699cf46dd0cd8f70930a82f00d136d
dd7afd3919ab8efee28f5e40fbdf9d66291c334e
/edu/src/com/edu/service/impl/AnnouncementServiceImpl.java
5cbf906b9c4b92afbb353a91e835c0a86e213b52
[]
no_license
Garfield0902/Edu
4387a6302d9f77131f15c9f1eaa053ef438e985c
b650e183238df2da6937f0042bb6d1e4df424ca1
refs/heads/master
2021-01-01T17:30:15.785771
2017-08-18T00:29:07
2017-08-18T00:29:07
96,480,221
0
0
null
2017-07-06T23:31:18
2017-07-06T23:31:18
null
UTF-8
Java
false
false
1,248
java
package com.edu.service.impl; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.edu.dao.TzggMapper; import com.edu.domain.Tzgg; import com.edu.service.AnnouncementServiceI; import com.edu.vo.AnnouncementVo; import com.edu.vo.Pagination; @Service("AnnouncementService") public class AnnouncementServiceImpl implements AnnouncementServiceI{ @Autowired private TzggMapper tzggMapper; public List<Tzgg> getAllTzgg(AnnouncementVo announcementVo){ if (announcementVo.getPage() == null) { announcementVo.setPage(new Pagination()); } Integer rows = tzggMapper.getAllTzggCount(); announcementVo.getPage().setTotalCount(rows); List<Tzgg> list = tzggMapper.getAllTzgg(announcementVo); return list; } public int deleteByPrimaryKey(String tzggh){ return tzggMapper.deleteByPrimaryKey(tzggh); } public int insert(Tzgg tzgg){ return tzggMapper.insert(tzgg); } public int updateByPrimaryKeySelective(Tzgg tzgg){ return tzggMapper.updateByPrimaryKeySelective(tzgg); } @Override public Tzgg selectByPrimaryKey(String id) { return tzggMapper.selectByPrimaryKey(id); } }
[ "1101631293@qq.com" ]
1101631293@qq.com
9f6765997557e0f66cbc7d8f87b9ead57beb91a2
63ef8ce14f76a4e99667ff5ed7668224458b67bd
/src/test/java/xml/extractXml/testasd.java
fde71d41a1c9f5fe66cdcc4fc951fd36a7aef917
[]
no_license
GmzJy101010000/JdomAndPoiDemo
613510f2e5e50da6e969a708547cf2b746d67a5c
421624167087835c22e016e902badca66a952b35
refs/heads/master
2020-03-18T17:24:49.805425
2018-05-27T08:06:59
2018-05-27T08:06:59
135,027,144
0
0
null
null
null
null
UTF-8
Java
false
false
102
java
package xml.extractXml; import junit.framework.TestCase; public class testasd extends TestCase { }
[ "1452032620@qq.com" ]
1452032620@qq.com
bad52b2f8906e645c49029914440e59d0371e215
1e9def625ebc5d34142be781bec2ada4520647cf
/src/main/java/com/aresPosTaggerModelDataProcessor/writer/bigrams/BigramsWriterImpl.java
47baa2a4662394785a497d9bdce0c41e061b1316
[]
no_license
ares2015/AresPosTaggerModelDataProcessor
a83a910946df10ea0916796ddf7b9efba87ff3bb
1a551629b48c3243fbf0245ec4cfdee841ca312b
refs/heads/master
2021-09-19T09:15:38.597981
2018-07-26T07:49:29
2018-07-26T07:49:29
58,848,615
0
0
null
null
null
null
UTF-8
Java
false
false
1,308
java
package com.aresPosTaggerModelDataProcessor.writer.bigrams; import com.aresPosTaggerModelDataProcessor.data.syntax.BigramData; import java.io.BufferedWriter; import java.io.FileWriter; import java.io.IOException; import java.util.List; /** * Created by Oliver on 2/7/2017. */ public class BigramsWriterImpl implements BigramsWriter { @Override public void write(List<BigramData> bigramDataList) { BufferedWriter bw = null; FileWriter fw = null; try { fw = new FileWriter("C:\\Users\\Oliver\\Documents\\NlpTrainingData\\AresPosTaggerModelData\\Bigrams.txt", true); bw = new BufferedWriter(fw); for (BigramData bigramData : bigramDataList) { String trainingDataRow = bigramData.getTag1() + "#" + bigramData.getTag2(); bw.write(trainingDataRow); bw.newLine(); } System.out.println("Writing into bigrams file finished"); } catch (IOException e) { e.printStackTrace(); } finally { try { if (bw != null) bw.close(); if (fw != null) fw.close(); } catch (IOException ex) { ex.printStackTrace(); } } } }
[ "eder@essential-data.sk" ]
eder@essential-data.sk
2cbba8442827e8c1fba55d8aec3016482e365d09
d2eee6e9a3ad0b3fd2899c3d1cf94778615b10cb
/PROMISE/archives/xalan/2.5/org/apache/xpath/axes/IteratorPool.java
3b403e42860be235c1b88f70b3ad47efb83c0b5e
[]
no_license
hvdthong/DEFECT_PREDICTION
78b8e98c0be3db86ffaed432722b0b8c61523ab2
76a61c69be0e2082faa3f19efd76a99f56a32858
refs/heads/master
2021-01-20T05:19:00.927723
2018-07-10T03:38:14
2018-07-10T03:38:14
89,766,606
5
1
null
null
null
null
UTF-8
Java
false
false
1,994
java
package org.apache.xpath.axes; import java.util.Vector; import org.apache.xml.dtm.DTMIterator; import org.apache.xml.utils.WrappedRuntimeException; /** * <meta name="usage" content="internal"/> * Pool of object of a given type to pick from to help memory usage */ public class IteratorPool implements java.io.Serializable { /** Type of objects in this pool. * @serial */ private final DTMIterator m_orig; /** Vector of given objects this points to. * @serial */ private final Vector m_freeStack; /** * Constructor IteratorPool * * @param original The original iterator from which all others will be cloned. */ public IteratorPool(DTMIterator original) { m_orig = original; m_freeStack = new Vector(); } /** * Get an instance of the given object in this pool * * @return An instance of the given object */ public synchronized DTMIterator getInstanceOrThrow() throws CloneNotSupportedException { if (m_freeStack.isEmpty()) { return (DTMIterator)m_orig.clone(); } else { DTMIterator result = (DTMIterator)m_freeStack.lastElement(); m_freeStack.setSize(m_freeStack.size() - 1); return result; } } /** * Get an instance of the given object in this pool * * @return An instance of the given object */ public synchronized DTMIterator getInstance() { if (m_freeStack.isEmpty()) { try { return (DTMIterator)m_orig.clone(); } catch (Exception ex) { throw new WrappedRuntimeException(ex); } } else { DTMIterator result = (DTMIterator)m_freeStack.lastElement(); m_freeStack.setSize(m_freeStack.size() - 1); return result; } } /** * Add an instance of the given object to the pool * * * @param obj Object to add. */ public synchronized void freeInstance(DTMIterator obj) { m_freeStack.addElement(obj); } }
[ "hvdthong@github.com" ]
hvdthong@github.com
cc769a2654af65e4b1a441e5e0d70e63ab4006be
955583ef082834033478fee62e744618c0baab8c
/jackson/src/test/java/goldzweigapps/com/jackson/ExampleUnitTest.java
f2dd7049f0d25360b546eba227771286d6961625
[ "MIT" ]
permissive
NerdFaisal404/Kotlinify
759ce1905ec702b88c6873a4975199653c3c7e93
0a3501fc5570ff0028259cbf63f47c63b46b1858
refs/heads/master
2021-07-19T18:46:13.349031
2017-10-29T15:22:49
2017-10-29T15:22:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
414
java
package goldzweigapps.com.jackson; import org.junit.Test; import static org.junit.Assert.assertEquals; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
[ "gil5841@gmail.com" ]
gil5841@gmail.com
8609883b17f563c4f2818ff5b4a2f29ddd62c15f
08191109c1707800468a95eddb51dbb0086bdaa9
/app/src/test/java/com/autonomousapps/reactivestopwatch/time/StopwatchImplTest.java
b77fa1053c2df84c84ebc8259bf0ed32d8adfb1f
[ "Apache-2.0" ]
permissive
autonomousapps/ReactiveStopwatch
55b6152ec2a3f655cbb61847bafa421fcc0af0f0
a59d4fbc48600c0c5988adce92182b094e366af3
refs/heads/master
2021-01-13T10:27:49.195154
2016-10-31T04:42:04
2016-10-31T04:42:04
72,241,120
5
1
null
null
null
null
UTF-8
Java
false
false
8,334
java
package com.autonomousapps.reactivestopwatch.time; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.runners.MockitoJUnitRunner; import java.util.Random; import rx.observers.TestSubscriber; import rx.schedulers.TestScheduler; import static org.hamcrest.Matchers.is; import static org.junit.Assert.assertThat; @RunWith(MockitoJUnitRunner.class) public class StopwatchImplTest { private final TestScheduler testScheduler = new TestScheduler(); private TestTimeProvider timeProvider; private StopwatchImpl stopwatch; private final Random numberGenerator = new Random(1L); @Before public void setup() throws Exception { timeProvider = new TestTimeProvider(); stopwatch = new StopwatchImpl(timeProvider); stopwatch.setScheduler(testScheduler); } @After public void teardown() throws Exception { stopwatch.reset(); } @Test public void timerStartsWith1() throws Exception { // Setup TimeWatcher timeWatcher = new TimeWatcher(); stopwatch.start().subscribe(timeWatcher::onNext); // Exercise tick(); // Verify assertThat(timeWatcher.getCurrentTime(), is(1L)); } @Test public void timerAccuratelyTicksTheSeconds() throws Exception { // Setup TimeWatcher timeWatcher = new TimeWatcher(); stopwatch.start().subscribe(timeWatcher::onNext); // Exercise & verify repeatedly tick(); assertThat(timeWatcher.getCurrentTime(), is(1L)); tick(); assertThat(timeWatcher.getCurrentTime(), is(2L)); tick(); assertThat(timeWatcher.getCurrentTime(), is(3L)); tick(); assertThat(timeWatcher.getCurrentTime(), is(4L)); tick(); assertThat(timeWatcher.getCurrentTime(), is(5L)); } @Test public void timerAccuratelyAdvances5s() throws Exception { // Setup TimeWatcher timeWatcher = new TimeWatcher(); stopwatch.start().subscribe(timeWatcher::onNext); // Exercise advanceTimeBy(5L); // Verify assertThat(timeWatcher.getCurrentTime(), is(5L)); } @Test public void pausePauses() throws Exception { // Setup TimeWatcher timeWatcher = new TimeWatcher(); stopwatch.start().subscribe(timeWatcher::onNext); tick(); assertThat(timeWatcher.getCurrentTime(), is(1L)); // Exercise stopwatch.togglePause(); // Verify repeatedly tick(); assertThat(timeWatcher.getCurrentTime(), is(1L)); tick(); assertThat(timeWatcher.getCurrentTime(), is(1L)); tick(); assertThat(timeWatcher.getCurrentTime(), is(1L)); tick(); assertThat(timeWatcher.getCurrentTime(), is(1L)); tick(); assertThat(timeWatcher.getCurrentTime(), is(1L)); } @Test public void pausingTwiceTogglesPauseOff() throws Exception { // Setup TimeWatcher timeWatcher = new TimeWatcher(); stopwatch.start().subscribe(timeWatcher::onNext); tick(); assertThat(timeWatcher.getCurrentTime(), is(1L)); stopwatch.togglePause(); advanceTimeTo(randomTick()); // Exercise stopwatch.togglePause(); tick(); // Verify assertThat(timeWatcher.getCurrentTime(), is(2L)); } @Test public void pausingThricePausesAgain() throws Exception { // Setup TimeWatcher timeWatcher = new TimeWatcher(); stopwatch.start().subscribe(timeWatcher::onNext); tick(); assertThat(timeWatcher.getCurrentTime(), is(1L)); // 1 stopwatch.togglePause(); advanceTimeTo(randomTick()); // 2 stopwatch.togglePause(); tick(); assertThat(timeWatcher.getCurrentTime(), is(2L)); // Exercise // 3 stopwatch.togglePause(); advanceTimeTo(randomTick(timeProvider.now())); // Verify assertThat(timeWatcher.getCurrentTime(), is(2L)); } @Test public void callingLapImmediatelyReturnsVeryShortLap() throws Exception { // Setup TimeWatcher timeWatcher = new TimeWatcher(); stopwatch.start().subscribe(timeWatcher::onNext); // Exercise Lap lap = stopwatch.lap(); // Verify assertThat(lap.duration(), is(0L)); assertThat(lap.endTime(), is(0L)); } @Test public void callingLapAfterATickReturnsAShortLap() throws Exception { // Setup TimeWatcher timeWatcher = new TimeWatcher(); stopwatch.start().subscribe(timeWatcher::onNext); // Exercise tick(); Lap lap = stopwatch.lap(); // Verify assertThat(lap.duration(), is(1L)); assertThat(lap.endTime(), is(1L)); } @Test public void twoLapsWorks() throws Exception { // Setup TimeWatcher timeWatcher = new TimeWatcher(); stopwatch.start().subscribe(timeWatcher::onNext); // Exercise: 1st lap tick(); Lap lap = stopwatch.lap(); // Verify: 1st lap assertThat(lap.duration(), is(1L)); assertThat(lap.endTime(), is(1L)); // Exercise: 2nd lap advanceTimeBy(10L); lap = stopwatch.lap(); // Verify: 2nd lap assertThat(lap.duration(), is(10L)); assertThat(lap.endTime(), is(11L)); } @Test public void threeLapsWorks() throws Exception { // Setup TimeWatcher timeWatcher = new TimeWatcher(); stopwatch.start().subscribe(timeWatcher::onNext); // Exercise: 1st lap tick(); Lap lap = stopwatch.lap(); // Verify: 1st lap assertThat(lap.duration(), is(1L)); assertThat(lap.endTime(), is(1L)); // Exercise: 2nd lap advanceTimeBy(10L); lap = stopwatch.lap(); // Verify: 2nd lap assertThat(lap, is(Lap.create(10L, 11L))); // Exercise: 3rd lap advanceTimeBy(60L); lap = stopwatch.lap(); // Verify: 3rd lap assertThat(lap, is(Lap.create(60L, 71L))); } @Test public void resetEndsTheStreamOfEvents() throws Exception { resetTest(); } @Test public void startingAfterResetStartsOver() throws Exception { // Setup TestSubscriber<Long> testSubscriber = resetTest(); // Exercise stopwatch.start().subscribe(testSubscriber); advanceTimeBy(5L); // Verify testSubscriber.assertValues(1L, 2L, 3L, 4L, 5L); } private TestSubscriber<Long> resetTest() { // Setup TestSubscriber<Long> testSubscriber = new TestSubscriber<>(); stopwatch.start().subscribe(testSubscriber); advanceTimeBy(5L); // Exercise stopwatch.reset(); advanceTimeBy(5L); // Verify testSubscriber.assertValueCount(5); testSubscriber.assertCompleted(); assertThat(testSubscriber.isUnsubscribed(), is(true)); // For additional testing return testSubscriber; } private void tick() { advanceTimeBy(1L); } private void advanceTimeBy(long time) { timeProvider.advanceTimeBy(time); testScheduler.advanceTimeBy(time, StopwatchImpl.TIME_UNIT); } private void advanceTimeTo(long time) { timeProvider.advanceTimeTo(time); testScheduler.advanceTimeTo(time, StopwatchImpl.TIME_UNIT); } private long randomTick() { return randomTick(0L); } private long randomTick(long left) { int max = 1_000_000; // I want the range clamped to [0, N), where N is sufficiently large to demonstrate the // robustness of the system, but not so large as to cause issues with the TestScheduler, // which attempts to trigger every action that gets queued when we advance time. return Math.min(max, left + numberGenerator.nextInt(max)); } static class TimeWatcher { private long currentTime = -1L; void onNext(long now) { currentTime = now; } long getCurrentTime() { return currentTime; } } }
[ "tony.robalik@metova.com" ]
tony.robalik@metova.com
ec5e5673d6523f590041d3e71dae022e78feef50
776f2c8b48ee5d06a08386aa15afc1fdd133620f
/Day-3-Java-Classes and Objects/Day-3-Java-Classes and Objects/src/Person.java
4e88618d89e167d837bcf62f19786bedd8a101cb
[]
no_license
saikiranparvatham/Java-Assignments
005e215a30da228cb6511a506d9d0d28b324f59c
7dfe3fc5d5e865ab4048025e650075599ef94f85
refs/heads/master
2020-04-10T09:12:32.318543
2018-12-19T14:09:24
2018-12-19T14:09:24
160,929,669
0
0
null
null
null
null
UTF-8
Java
false
false
1,181
java
import java.time.LocalDate; import java.time.Period; import java.time.temporal.ChronoUnit; public class Person { private Object personName; private LocalDate dateOfBirth; LocalDate today = LocalDate.of(2018,12,19); public Person(String name, int date, int month, int year) { this.personName=name; this.dateOfBirth = LocalDate.of(year,month, date); } public String display() { Period intervalPeriod = Period.between(this.dateOfBirth, this.today); return "Name:"+this.personName+" Date of Birth:"+this.dateOfBirth+" Age:"+intervalPeriod.getYears()+"years "+intervalPeriod.getMonths()+"Months "+intervalPeriod.getDays()+"Days"; } public String olderOne(Person person2) { Object older ; Object younger; if(this.dateOfBirth.isBefore(person2.dateOfBirth) ) { older = this.personName; younger = person2.personName; } else { older = person2.personName; younger = this.personName; } Period intervalPeriod = Period.between(this.dateOfBirth, person2.dateOfBirth); return older+" is older than "+younger+" by "+intervalPeriod.getYears()+" years "+intervalPeriod.getMonths()+" months "+intervalPeriod.getDays()+" days"; } }
[ "saikiran.parvatham@capgemini.com" ]
saikiran.parvatham@capgemini.com
fab4b040223eb0e221b00292c62d7a29afaf645f
cf93be05cb55d09672eb2a8f29be510f29682a0a
/android/app/src/main/java/com/m_11_nov_2020_dev_14959/MainApplication.java
4c2da0ba44d292ffee034b6a3109144b5527eb6b
[]
no_license
crowdbotics-apps/m-11-nov-2020-dev-14959
ae360767147dab38379e6eaec9bf2a8d251ead5c
3f5ca1e790bbaaef94049eceb3aa7d45413636df
refs/heads/master
2023-01-12T21:45:11.223735
2020-11-11T14:23:35
2020-11-11T14:23:35
311,935,268
0
0
null
null
null
null
UTF-8
Java
false
false
2,700
java
package com.m_11_nov_2020_dev_14959; import android.app.Application; import android.content.Context; import com.facebook.react.PackageList; import com.facebook.react.ReactInstanceManager; import com.facebook.react.ReactApplication; import com.facebook.react.ReactNativeHost; import com.facebook.react.ReactPackage; import com.facebook.soloader.SoLoader; import java.lang.reflect.InvocationTargetException; import java.util.List; public class MainApplication extends Application implements ReactApplication { private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { @Override public boolean getUseDeveloperSupport() { return BuildConfig.DEBUG; } @Override protected List<ReactPackage> getPackages() { @SuppressWarnings("UnnecessaryLocalVariable") List<ReactPackage> packages = new PackageList(this).getPackages(); // Packages that cannot be autolinked yet can be added manually here, for example: // packages.add(new MyReactNativePackage()); return packages; } @Override protected String getJSMainModuleName() { return "index"; } }; @Override public ReactNativeHost getReactNativeHost() { return mReactNativeHost; } @Override public void onCreate() { super.onCreate(); SoLoader.init(this, /* native exopackage */ false); initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); } /** * Loads Flipper in React Native templates. Call this in the onCreate method with something like * initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); * * @param context * @param reactInstanceManager */ private static void initializeFlipper( Context context, ReactInstanceManager reactInstanceManager) { if (BuildConfig.DEBUG) { try { /* We use reflection here to pick up the class that initializes Flipper, since Flipper library is not available in release mode */ Class<?> aClass = Class.forName("com.rndiffapp.ReactNativeFlipper"); aClass .getMethod("initializeFlipper", Context.class, ReactInstanceManager.class) .invoke(null, context, reactInstanceManager); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } } } }
[ "team@crowdbotics.com" ]
team@crowdbotics.com
161a520b9c4a87a6ff5c684ec510521987d4d246
951fe99b556802b6e58ec0d625e289a6addc4bdd
/SMSC-WEB/src/java/dao/clsRespuestaIncidenteDAO.java
879af0438dbdf83a7be16881523cc9222b4b25ae
[ "Apache-2.0" ]
permissive
edham/SMSC
128c13cb25dcf5011aa40b339b6b83b786485bc5
15203f4520b19c88939a67cbc549a20cb1cc3eb4
refs/heads/master
2016-09-05T09:10:20.818498
2015-05-05T07:43:34
2015-05-05T07:43:34
23,979,519
0
0
null
null
null
null
UTF-8
Java
false
false
7,185
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package dao; import entidades.clsIncidente; import entidades.clsRespuestaIncidente; import entidades.clsTipoIncidente; import entidades.clsUsuario; import java.sql.CallableStatement; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; /** * * @author virgil */ public class clsRespuestaIncidenteDAO { public static clsRespuestaIncidente pendiente(int IdSesion) throws Exception { clsRespuestaIncidente entidad=null; Connection conn =null; CallableStatement stmt = null; ResultSet dr = null; try { String sql="SELECT i.id_incidente,i.latitud,i.longuitud,i.detalle,i.fecha_registro,i.estado,\n" + "i.foto,ti.id_tipo_incidente,ti.nombre,u.id_usuario,u.apellido,u.nombre,u.celular,\n" + "u.dni,u.email,u.fecha_nacimiento,u.sexo,ri.id_respuesta_incidente FROM respuesta_incidente \n" + "ri inner join incidente i on ri.id_incidente=i.id_incidente inner join tipo_incidente \n" + "ti on i.id_tipo_incidente=ti.id_tipo_incidente inner join usuario u on\n" + "u.id_usuario=i.id_usuario where ri.estado=1 and ri.id_sesion_personal_vehiculo="+IdSesion; conn = clsConexion.getConnection(); stmt = conn.prepareCall(sql); dr = stmt.executeQuery(); if(dr.next()) { clsUsuario objUsuario = new clsUsuario(); objUsuario.setInt_id_usuario(dr.getInt(10)); objUsuario.setStr_apellido(dr.getString(11)); objUsuario.setStr_nombre(dr.getString(12)); objUsuario.setStr_celular(dr.getString(13)); objUsuario.setStr_dni(dr.getString(14)); objUsuario.setStr_email(dr.getString(15)); objUsuario.setDat_fecha_nacimiento(dr.getTimestamp(16)); objUsuario.setBool_sexo(dr.getBoolean(17)); clsTipoIncidente objTipoIncidente = new clsTipoIncidente(); objTipoIncidente.setInt_id_tipo_incidente(dr.getInt(8)); objTipoIncidente.setStr_nombre(dr.getString(9)); clsIncidente objclsIncidente = new clsIncidente(); objclsIncidente.setInt_id_incidente(dr.getInt(1)); objclsIncidente.setDou_latitud(dr.getDouble(2)); objclsIncidente.setDou_longitud(dr.getDouble(3)); objclsIncidente.setStr_detalle(dr.getString(4)); objclsIncidente.setDat_fecha_registro(dr.getTimestamp(5)); objclsIncidente.setInt_estado(dr.getInt(6)); objclsIncidente.setByte_foto(dr.getBytes(7)); objclsIncidente.setObjTipoIncidente(objTipoIncidente); objclsIncidente.setObjUsuario(objUsuario); entidad = new clsRespuestaIncidente(); entidad.setObjIncidente(objclsIncidente); entidad.setInt_id_respuesta_incidente(dr.getInt(18)); } } catch (Exception e) { throw new Exception("Listar Cargos "+e.getMessage(), e); } finally{ try { dr.close(); stmt.close(); conn.close(); } catch (Exception e) { } } return entidad; } public static int insertar(clsRespuestaIncidente entidad) throws Exception { int rpta = 0; Connection conn =null; CallableStatement stmt = null; try { String sql="insert into respuesta_incidente (id_incidente,id_sesion_personal_vehiculo,fecha_creacion," + "fecha_finalizacion,estado) values (?,?,now(),now(),1)"; conn = clsConexion.getConnection(); conn.setAutoCommit(false); stmt = conn.prepareCall(sql); stmt.setInt(1, entidad.getObjIncidente().getInt_id_incidente()); stmt.setInt(2, entidad.getObjSesionPersonalVehiculo().getInt_sesion_personal_vehiculo()); stmt.executeUpdate(); ResultSet rs = stmt.getGeneratedKeys(); if (rs.next()){ rpta=rs.getInt(1); sql="update incidente set estado=1 where id_incidente=?;"; PreparedStatement psEstadoIncidente = conn.prepareCall(sql); psEstadoIncidente.setInt(1, entidad.getObjIncidente().getInt_id_incidente()); psEstadoIncidente.execute(); psEstadoIncidente.close(); } rs.close(); conn.commit(); } catch (Exception e) { if (conn != null) { conn.rollback(); } throw new Exception("Insertar"+e.getMessage(), e); } finally{ try { stmt.close(); conn.close(); } catch (SQLException e) { } } return rpta; } public static boolean actualizar(clsRespuestaIncidente entidad) throws Exception { boolean rpta = false; Connection conn =null; CallableStatement stmt = null; try { String sql="UPDATE respuesta_incidente SET fecha_finalizacion = now(), descripcion = ?," + "foto =?,estado = ? WHERE id_respuesta_incidente = ?"; conn = clsConexion.getConnection(); conn.setAutoCommit(false); stmt = conn.prepareCall(sql); stmt.setString(1, entidad.getStr_descripccion()); stmt.setBytes(2, entidad.getByte_foto()); stmt.setInt(3, entidad.getInt_estado()); stmt.setInt(4, entidad.getInt_id_respuesta_incidente()); rpta = stmt.executeUpdate() == 1; if(rpta) { sql="update incidente set estado=? where id_incidente=?;"; PreparedStatement psEstadoIncidente = conn.prepareCall(sql); psEstadoIncidente.setInt(1, entidad.getInt_estado()); psEstadoIncidente.setInt(2, entidad.getObjIncidente().getInt_id_incidente()); psEstadoIncidente.execute(); psEstadoIncidente.close(); } conn.commit(); } catch (Exception e) { if (conn != null) { conn.rollback(); } throw new Exception("Insertar"+e.getMessage(), e); } finally{ try { stmt.close(); conn.close(); } catch (SQLException e) { } } return rpta; } }
[ "Edham_@hotmail.com" ]
Edham_@hotmail.com
27ac004acdee4cf4319fac0a3d0d15378f5dc7da
bf9f2e72bc1e895509922a24b09388dd076fa88f
/BubbleTG/BubbleTg/src/main/java/cn/bubbletg/blogs/service/impl/MessageServiceImpl.java
72395944743f2773a21d79bdf8916d2a55a8810e
[]
no_license
bubbletg/blogs
3b057539603568075e1c8fb2be19ec3a05a2095c
7afa2562977d321549fcd0e8ffc2cbc2b7dc6863
refs/heads/master
2022-12-24T02:37:57.555187
2020-08-23T16:09:04
2020-08-23T16:09:04
199,970,724
0
0
null
2022-12-15T23:43:23
2019-08-01T03:36:45
CSS
UTF-8
Java
false
false
625
java
package cn.bubbletg.blogs.service.impl; import cn.bubbletg.blogs.dao.MessageDao; import cn.bubbletg.blogs.domain.Message; import cn.bubbletg.blogs.service.MessageService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; /** * @author www.bubbletg.cn * BubbleTg * @version 1.0 * @date 2019/8/4 0:21 */ @Service("messageService") public class MessageServiceImpl implements MessageService { @Autowired public MessageDao messageDao; @Override public void add(Message message) { messageDao.add(message); } }
[ "bubbletg@163.com" ]
bubbletg@163.com
f4261e8d4dfa41b91a92d4dd2d2169ee3e9bd0d5
23eaf717fda54af96f3e224dde71c6eb7a196d8c
/custos-integration-services/custos-integration-services-commons/src/main/java/org/apache/custos/integration/services/commons/interceptors/LoggingInterceptor.java
9a5eb7a59a59a9763522278667b8cc25ee67b24f
[ "Apache-2.0" ]
permissive
etsangsplk/airavata-custos
8a0e52f0da10ec29e13de03d546962e6038e6266
2d341849dd8ea8a7c2efec6cc73b01dfd495352e
refs/heads/master
2023-02-09T22:56:26.576113
2020-10-14T01:15:22
2020-10-14T01:15:22
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,373
java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.custos.integration.services.commons.interceptors; import com.google.protobuf.Descriptors; import com.google.protobuf.GeneratedMessageV3; import io.grpc.Metadata; import org.apache.custos.integration.core.interceptor.IntegrationServiceInterceptor; import org.apache.custos.integration.core.utils.Constants; import org.apache.custos.logging.client.LoggingClient; import org.apache.custos.logging.service.LogEvent; import org.apache.custos.logging.service.LoggingConfigurationRequest; import org.apache.custos.logging.service.Status; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.util.Map; /** * API calling event capturing Interceptor */ @Component public class LoggingInterceptor implements IntegrationServiceInterceptor { private static final Logger LOGGER = LoggerFactory.getLogger(LoggingInterceptor.class); private static final String X_FORWARDED_FOR = "x-forwarded-for"; @Autowired private LoggingClient loggingClient; @Override public <ReqT> ReqT intercept(String method, Metadata headers, ReqT msg) { if (msg instanceof GeneratedMessageV3) { Map<Descriptors.FieldDescriptor, Object> fieldDescriptors = ((GeneratedMessageV3) msg).getAllFields(); LogEvent.Builder logEventBuilder = LogEvent.newBuilder(); LoggingConfigurationRequest.Builder loggingConfigurationBuilder = LoggingConfigurationRequest.newBuilder(); boolean tenantMatched = false; boolean clientMatched = false; for (Descriptors.FieldDescriptor descriptor : fieldDescriptors.keySet()) { if (descriptor.getName().equals("tenant_id") || descriptor.getName().equals("tenantId")) { logEventBuilder.setTenantId((long) fieldDescriptors.get(descriptor)); loggingConfigurationBuilder.setTenantId((long) fieldDescriptors.get(descriptor)); tenantMatched = true; } else if (descriptor.getName().equals("client_id") || descriptor.getName().equals("clientId")) { logEventBuilder.setClientId((String) fieldDescriptors.get(descriptor)); loggingConfigurationBuilder.setClientId((String) fieldDescriptors.get(descriptor)); clientMatched = true; } else if (descriptor.getName().equals("username") || descriptor.getName().equals("userId")) { logEventBuilder.setUsername((String) fieldDescriptors.get(descriptor)); } String servicename = headers. get(Metadata.Key.of(Constants.SERVICE_NAME, Metadata.ASCII_STRING_MARSHALLER)); String externaIP = headers. get(Metadata.Key.of(Constants.X_FORWARDED_FOR, Metadata.ASCII_STRING_MARSHALLER)); logEventBuilder.setServiceName(servicename); logEventBuilder.setEventType(method); logEventBuilder.setExternalIp(externaIP); logEventBuilder.setCreatedTime(System.currentTimeMillis()); } if (tenantMatched && clientMatched) { Status status = loggingClient.isLogEnabled(loggingConfigurationBuilder.build()); if (status.getStatus()) { loggingClient.addLogEventAsync(logEventBuilder.build()); } } } return msg; } }
[ "irjanith@gmail.com" ]
irjanith@gmail.com
1c8e5155f73bd5a9596923ae7051d8e36492d10d
609bc361c57760e11855b5574fd018066e687174
/programe_take/programe_take-web/src/main/java/com/tang/web/ConcernController.java
73e9bd3b764380429a66991ba78b054823b0baf0
[]
no_license
tangxiaonian/programe_talk
cc135218f92394d59fe953a70342a579193f2850
1dfc9eab683915fe9ea87cd4aa42037af000623a
refs/heads/master
2020-07-03T07:54:05.496294
2019-07-25T11:23:32
2019-07-25T11:23:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,584
java
package com.tang.web; import com.tang.Service.ConcernService; import com.tang.bean.Collect; import com.tang.bean.Concerns; import com.tang.bean.ResultBean; import com.tang.bean.User; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.ResponseBody; import javax.servlet.http.HttpSession; import java.util.Date; import java.util.List; /** * @author ASUS * @create 2019-02-15 22:22 */ @Controller public class ConcernController { @Autowired private ConcernService concernServiceImpl; // 添加关注 @PostMapping("/concern/add/{buid}") @ResponseBody public ResultBean addConcern(@PathVariable("buid") Integer buid, HttpSession httpSession){ ResultBean resultBean = new ResultBean(); User user = (User) httpSession.getAttribute("user"); if (user != null){ // 自己不能关注自己 if (user.getId() == buid){ resultBean.setFlage(0); resultBean.setMsg("这是自己发表的文章!"); return resultBean; } // 检查此用户是否已经被该用户关注过 Long flage = concernServiceImpl.checkRepeatConcern(user.getId(),buid); if (flage.intValue() != 1){ Concerns concerns = new Concerns(); concerns.setAuid(user.getId()); concerns.setBuid(buid); // 添加一个当前用户的关注记录 resultBean = concernServiceImpl.addConcern(concerns); }else { resultBean.setMsg("该用户你已关注过了!"); resultBean.setFlage(1); } }else { resultBean.setFlage(0); resultBean.setMsg("暂时无权操作,请先登录!"); } return resultBean; } // 取消关注 @GetMapping("/user/concern/del") @ResponseBody public ResultBean delConcerns(Integer id){ return concernServiceImpl.delConcern(id); } // 查询指定用户的关注记录 @GetMapping("/user/concern") @ResponseBody public List<Concerns> selectByUserId(HttpSession httpSession){ User user = (User)httpSession.getAttribute("user"); return concernServiceImpl.selectByUserId(user.getId()); } }
[ "2684270465@qq.com" ]
2684270465@qq.com
d17d20b21f804193d09b7ecc2869fa6ce128e5a4
04c7d1406960d97301fc30cbb1e0096cec27c83c
/src/main/java/com/mgmtp/internship_vacation_booking/service/vacation_type/VacationTypeService.java
afbf8af19f6d0401d9f84ab6277f3cb93921bb11
[]
no_license
khanhduy62/vacation_booking
98b5b160eb91a1f0c6db1422e5e8bb27c0025128
d8f18e563051163311199110be1830f57cd16cf9
refs/heads/master
2021-01-23T08:03:47.305090
2017-03-28T15:23:28
2017-03-28T15:23:28
86,472,852
0
0
null
null
null
null
UTF-8
Java
false
false
314
java
package com.mgmtp.internship_vacation_booking.service.vacation_type; import com.mgmtp.internship_vacation_booking.model.VacationTypeEntity; import java.util.List; public interface VacationTypeService { VacationTypeEntity getVacationTypeEntity(int id); List<VacationTypeEntity> getAllVacationType(); }
[ "lekhanhduyduy1201@gmail.com" ]
lekhanhduyduy1201@gmail.com
1bf023e240888a9052e855846bd26ef99be01f61
20eb62855cb3962c2d36fda4377dfd47d82eb777
/newEvaluatedBugs/Jsoup_2_buggy/mutated/1494/HtmlTreeBuilder.java
886c0d582ef0efc3b04abd8228791a934979cdcd
[]
no_license
ozzydong/CapGen
356746618848065cce4e253e5d3c381baa85044a
0ba0321b6b1191443276021f1997833342f02515
refs/heads/master
2023-03-18T20:12:02.923428
2020-08-21T03:08:28
2020-08-21T03:08:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
25,525
java
package org.jsoup.parser; import org.jsoup.helper.StringUtil; import org.jsoup.helper.Validate; import org.jsoup.nodes.Comment; import org.jsoup.nodes.DataNode; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.nodes.FormElement; import org.jsoup.nodes.Node; import org.jsoup.nodes.TextNode; import org.jsoup.select.Elements; import java.io.Reader; import java.io.StringReader; import java.util.ArrayList; import java.util.List; /** * HTML Tree Builder; creates a DOM from Tokens. */ public class HtmlTreeBuilder extends TreeBuilder { // tag searches private static final String[] TagsSearchInScope = new String[]{"applet", "caption", "html", "table", "td", "th", "marquee", "object"}; private static final String[] TagSearchList = new String[]{"ol", "ul"}; private static final String[] TagSearchButton = new String[]{"button"}; private static final String[] TagSearchTableScope = new String[]{"html", "table"}; private static final String[] TagSearchSelectScope = new String[]{"optgroup", "option"}; private static final String[] TagSearchEndTags = new String[]{"dd", "dt", "li", "option", "optgroup", "p", "rp", "rt"}; private static final String[] TagSearchSpecial = new String[]{"address", "applet", "area", "article", "aside", "base", "basefont", "bgsound", "blockquote", "body", "br", "button", "caption", "center", "col", "colgroup", "command", "dd", "details", "dir", "div", "dl", "dt", "embed", "fieldset", "figcaption", "figure", "footer", "form", "frame", "frameset", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "iframe", "img", "input", "isindex", "li", "link", "listing", "marquee", "menu", "meta", "nav", "noembed", "noframes", "noscript", "object", "ol", "p", "param", "plaintext", "pre", "script", "section", "select", "style", "summary", "table", "tbody", "td", "textarea", "tfoot", "th", "thead", "title", "tr", "ul", "wbr", "xmp"}; private HtmlTreeBuilderState state; // the current state private HtmlTreeBuilderState originalState; // original / marked state private boolean baseUriSetFromDoc; private Element headElement; // the current head element private FormElement formElement; // the current form element private Element contextElement; // fragment parse context -- could be null even if fragment parsing private ArrayList<Element> formattingElements; // active (open) formatting elements private List<String> pendingTableCharacters; // chars in table to be shifted out private Token.EndTag emptyEnd; // reused empty end tag private boolean framesetOk; // if ok to go into frameset private boolean fosterInserts; // if next inserts should be fostered private boolean fragmentParsing; // if parsing a fragment of html HtmlTreeBuilder() {} ParseSettings defaultSettings() { return ParseSettings.htmlDefault; } @Override protected void initialiseParse(Reader input, String baseUri, ParseErrorList errors, ParseSettings settings) { super.initialiseParse(input, baseUri, errors, settings); // this is a bit mucky. todo - probably just create new parser objects to ensure all reset. state = HtmlTreeBuilderState.Initial; originalState = null; baseUriSetFromDoc = false; headElement = null; formElement = null; contextElement = null; formattingElements = new ArrayList<>(); pendingTableCharacters = new ArrayList<>(); emptyEnd = new Token.EndTag(); framesetOk = true; fosterInserts = false; fragmentParsing = false; } List<Node> parseFragment(String inputFragment, Element context, String baseUri, ParseErrorList errors, ParseSettings settings) { // context may be null state = HtmlTreeBuilderState.Initial; initialiseParse(new StringReader(inputFragment), baseUri, errors, settings); contextElement = context; fragmentParsing = true; Element root = null; if (context != null) { if (context.ownerDocument() != null) // quirks setup: doc.quirksMode(context.ownerDocument().quirksMode()); // initialise the tokeniser state: String contextTag = context.tagName(); if (StringUtil.in(contextTag, "title", "textarea")) tokeniser.transition(TokeniserState.Rcdata); else if (StringUtil.in(contextTag, "iframe", "noembed", "noframes", "style", "xmp")) tokeniser.transition(TokeniserState.Rawtext); else if (contextTag.equals("script")) tokeniser.transition(TokeniserState.ScriptData); else if (contextTag.equals(("noscript"))) tokeniser.transition(TokeniserState.Data); // if scripting enabled, rawtext else if (contextTag.equals("plaintext")) tokeniser.transition(TokeniserState.Data); else tokeniser.transition(TokeniserState.Data); // default root = new Element(Tag.valueOf("html", settings), baseUri); doc.appendChild(root); stack.add(root); resetInsertionMode(); // setup form element to nearest form on context (up ancestor chain). ensures form controls are associated // with form correctly Elements contextChain = context.parents(); contextChain.add(0, context); for (Element parent: contextChain) { if (parent instanceof FormElement) { formElement = (FormElement) parent; break; } } } runParser(); if (context != null) return root.childNodes(); else return doc.childNodes(); } @Override protected boolean process(Token token) { currentToken = token; return this.state.process(token, this); } boolean process(Token token, HtmlTreeBuilderState state) { currentToken = token; return state.process(token, this); } void transition(HtmlTreeBuilderState state) { this.state = state; } HtmlTreeBuilderState state() { return state; } void markInsertionMode() { originalState = state; } HtmlTreeBuilderState originalState() { return originalState; } void framesetOk(boolean framesetOk) { this.framesetOk = framesetOk; } boolean framesetOk() { return framesetOk; } Document getDocument() { return doc; } String getBaseUri() { return baseUri; } void maybeSetBaseUri(Element base) { if (baseUriSetFromDoc) // only listen to the first <base href> in parse return; String href = base.absUrl("href"); if (href.length() != 0) { // ignore <base target> etc baseUri = href; baseUriSetFromDoc = true; doc.setBaseUri(href); // set on the doc so doc.createElement(Tag) will get updated base, and to update all descendants } } boolean isFragmentParsing() { return fragmentParsing; } void error(HtmlTreeBuilderState state) { if (errors.canAddError()) errors.add(new ParseError(reader.pos(), "Unexpected token [%s] when in state [%s]", currentToken.tokenType(), state)); } Element insert(Token.StartTag startTag) { // handle empty unknown tags // when the spec expects an empty tag, will directly hit insertEmpty, so won't generate this fake end tag. if (startTag.isSelfClosing()) { Element el = insertEmpty(startTag); stack.add(el); tokeniser.transition(TokeniserState.Data); // handles <script />, otherwise needs breakout steps from script data tokeniser.emit(emptyEnd.reset().name(el.tagName())); // ensure we get out of whatever state we are in. emitted for yielded processing return el; } Element el = new Element(Tag.valueOf(startTag.name(), settings), baseUri, settings.normalizeAttributes(startTag.attributes)); insert(el); return el; } Element insertStartTag(String startTagName) { Element el = new Element(Tag.valueOf(startTagName, settings), baseUri); insert(el); return el; } void insert(Element el) { insertNode(el); stack.add(el); } Element insertEmpty(Token.StartTag startTag) { if (baseUriSetFromDoc) return ; Tag tag = Tag.valueOf(startTag.name(), settings); Element el = new Element(tag, baseUri, startTag.attributes); insertNode(el); if (startTag.isSelfClosing()) { if (tag.isKnownTag()) { if (tag.isSelfClosing()) tokeniser.acknowledgeSelfClosingFlag(); // if not acked, promulagates error } else { // unknown tag, remember this is self closing for output tag.setSelfClosing(); tokeniser.acknowledgeSelfClosingFlag(); // not an distinct error } } return el; } FormElement insertForm(Token.StartTag startTag, boolean onStack) { Tag tag = Tag.valueOf(startTag.name(), settings); FormElement el = new FormElement(tag, baseUri, startTag.attributes); setFormElement(el); insertNode(el); if (onStack) stack.add(el); return el; } void insert(Token.Comment commentToken) { Comment comment = new Comment(commentToken.getData(), baseUri); insertNode(comment); } void insert(Token.Character characterToken) { Node node; // characters in script and style go in as datanodes, not text nodes String tagName = currentElement().tagName(); if (tagName.equals("script") || tagName.equals("style")) node = new DataNode(characterToken.getData(), baseUri); else node = new TextNode(characterToken.getData(), baseUri); currentElement().appendChild(node); // doesn't use insertNode, because we don't foster these; and will always have a stack. } private void insertNode(Node node) { // if the stack hasn't been set up yet, elements (doctype, comments) go into the doc if (stack.size() == 0) doc.appendChild(node); else if (isFosterInserts()) insertInFosterParent(node); else currentElement().appendChild(node); // connect form controls to their form element if (node instanceof Element && ((Element) node).tag().isFormListed()) { if (formElement != null) formElement.addElement((Element) node); } } Element pop() { int size = stack.size(); return stack.remove(size-1); } void push(Element element) { stack.add(element); } ArrayList<Element> getStack() { return stack; } boolean onStack(Element el) { return isElementInQueue(stack, el); } private boolean isElementInQueue(ArrayList<Element> queue, Element element) { for (int pos = queue.size() -1; pos >= 0; pos--) { Element next = queue.get(pos); if (next == element) { return true; } } return false; } Element getFromStack(String elName) { for (int pos = stack.size() -1; pos >= 0; pos--) { Element next = stack.get(pos); if (next.nodeName().equals(elName)) { return next; } } return null; } boolean removeFromStack(Element el) { for (int pos = stack.size() -1; pos >= 0; pos--) { Element next = stack.get(pos); if (next == el) { stack.remove(pos); return true; } } return false; } void popStackToClose(String elName) { for (int pos = stack.size() -1; pos >= 0; pos--) { Element next = stack.get(pos); stack.remove(pos); if (next.nodeName().equals(elName)) break; } } void popStackToClose(String... elNames) { for (int pos = stack.size() -1; pos >= 0; pos--) { Element next = stack.get(pos); stack.remove(pos); if (StringUtil.in(next.nodeName(), elNames)) break; } } void popStackToBefore(String elName) { for (int pos = stack.size() -1; pos >= 0; pos--) { Element next = stack.get(pos); if (next.nodeName().equals(elName)) { break; } else { stack.remove(pos); } } } void clearStackToTableContext() { clearStackToContext("table"); } void clearStackToTableBodyContext() { clearStackToContext("tbody", "tfoot", "thead"); } void clearStackToTableRowContext() { clearStackToContext("tr"); } private void clearStackToContext(String... nodeNames) { for (int pos = stack.size() -1; pos >= 0; pos--) { Element next = stack.get(pos); if (StringUtil.in(next.nodeName(), nodeNames) || next.nodeName().equals("html")) break; else stack.remove(pos); } } Element aboveOnStack(Element el) { assert onStack(el); for (int pos = stack.size() -1; pos >= 0; pos--) { Element next = stack.get(pos); if (next == el) { return stack.get(pos-1); } } return null; } void insertOnStackAfter(Element after, Element in) { int i = stack.lastIndexOf(after); Validate.isTrue(i != -1); stack.add(i+1, in); } void replaceOnStack(Element out, Element in) { replaceInQueue(stack, out, in); } private void replaceInQueue(ArrayList<Element> queue, Element out, Element in) { int i = queue.lastIndexOf(out); Validate.isTrue(i != -1); queue.set(i, in); } void resetInsertionMode() { boolean last = false; for (int pos = stack.size() -1; pos >= 0; pos--) { Element node = stack.get(pos); if (pos == 0) { last = true; node = contextElement; } String name = node.nodeName(); if ("select".equals(name)) { transition(HtmlTreeBuilderState.InSelect); break; // frag } else if (("td".equals(name) || "th".equals(name) && !last)) { transition(HtmlTreeBuilderState.InCell); break; } else if ("tr".equals(name)) { transition(HtmlTreeBuilderState.InRow); break; } else if ("tbody".equals(name) || "thead".equals(name) || "tfoot".equals(name)) { transition(HtmlTreeBuilderState.InTableBody); break; } else if ("caption".equals(name)) { transition(HtmlTreeBuilderState.InCaption); break; } else if ("colgroup".equals(name)) { transition(HtmlTreeBuilderState.InColumnGroup); break; // frag } else if ("table".equals(name)) { transition(HtmlTreeBuilderState.InTable); break; } else if ("head".equals(name)) { transition(HtmlTreeBuilderState.InBody); break; // frag } else if ("body".equals(name)) { transition(HtmlTreeBuilderState.InBody); break; } else if ("frameset".equals(name)) { transition(HtmlTreeBuilderState.InFrameset); break; // frag } else if ("html".equals(name)) { transition(HtmlTreeBuilderState.BeforeHead); break; // frag } else if (last) { transition(HtmlTreeBuilderState.InBody); break; // frag } } } // todo: tidy up in specific scope methods private String[] specificScopeTarget = {null}; private boolean inSpecificScope(String targetName, String[] baseTypes, String[] extraTypes) { specificScopeTarget[0] = targetName; return inSpecificScope(specificScopeTarget, baseTypes, extraTypes); } private boolean inSpecificScope(String[] targetNames, String[] baseTypes, String[] extraTypes) { for (int pos = stack.size() -1; pos >= 0; pos--) { Element el = stack.get(pos); String elName = el.nodeName(); if (StringUtil.in(elName, targetNames)) return true; if (StringUtil.in(elName, baseTypes)) return false; if (extraTypes != null && StringUtil.in(elName, extraTypes)) return false; } Validate.fail("Should not be reachable"); return false; } boolean inScope(String[] targetNames) { return inSpecificScope(targetNames, TagsSearchInScope, null); } boolean inScope(String targetName) { return inScope(targetName, null); } boolean inScope(String targetName, String[] extras) { return inSpecificScope(targetName, TagsSearchInScope, extras); // todo: in mathml namespace: mi, mo, mn, ms, mtext annotation-xml // todo: in svg namespace: forignOjbect, desc, title } boolean inListItemScope(String targetName) { return inScope(targetName, TagSearchList); } boolean inButtonScope(String targetName) { return inScope(targetName, TagSearchButton); } boolean inTableScope(String targetName) { return inSpecificScope(targetName, TagSearchTableScope, null); } boolean inSelectScope(String targetName) { for (int pos = stack.size() -1; pos >= 0; pos--) { Element el = stack.get(pos); String elName = el.nodeName(); if (elName.equals(targetName)) return true; if (!StringUtil.in(elName, TagSearchSelectScope)) // all elements except return false; } Validate.fail("Should not be reachable"); return false; } void setHeadElement(Element headElement) { this.headElement = headElement; } Element getHeadElement() { return headElement; } boolean isFosterInserts() { return fosterInserts; } void setFosterInserts(boolean fosterInserts) { this.fosterInserts = fosterInserts; } FormElement getFormElement() { return formElement; } void setFormElement(FormElement formElement) { this.formElement = formElement; } void newPendingTableCharacters() { pendingTableCharacters = new ArrayList<>(); } List<String> getPendingTableCharacters() { return pendingTableCharacters; } void setPendingTableCharacters(List<String> pendingTableCharacters) { this.pendingTableCharacters = pendingTableCharacters; } /** 11.2.5.2 Closing elements that have implied end tags<p/> When the steps below require the UA to generate implied end tags, then, while the current node is a dd element, a dt element, an li element, an option element, an optgroup element, a p element, an rp element, or an rt element, the UA must pop the current node off the stack of open elements. @param excludeTag If a step requires the UA to generate implied end tags but lists an element to exclude from the process, then the UA must perform the above steps as if that element was not in the above list. */ void generateImpliedEndTags(String excludeTag) { while ((excludeTag != null && !currentElement().nodeName().equals(excludeTag)) && StringUtil.in(currentElement().nodeName(), TagSearchEndTags)) pop(); } void generateImpliedEndTags() { generateImpliedEndTags(null); } boolean isSpecial(Element el) { // todo: mathml's mi, mo, mn // todo: svg's foreigObject, desc, title String name = el.nodeName(); return StringUtil.in(name, TagSearchSpecial); } Element lastFormattingElement() { return formattingElements.size() > 0 ? formattingElements.get(formattingElements.size()-1) : null; } Element removeLastFormattingElement() { int size = formattingElements.size(); if (size > 0) return formattingElements.remove(size-1); else return null; } // active formatting elements void pushActiveFormattingElements(Element in) { int numSeen = 0; for (int pos = formattingElements.size() -1; pos >= 0; pos--) { Element el = formattingElements.get(pos); if (el == null) // marker break; if (isSameFormattingElement(in, el)) numSeen++; if (numSeen == 3) { formattingElements.remove(pos); break; } } formattingElements.add(in); } private boolean isSameFormattingElement(Element a, Element b) { // same if: same namespace, tag, and attributes. Element.equals only checks tag, might in future check children return a.nodeName().equals(b.nodeName()) && // a.namespace().equals(b.namespace()) && a.attributes().equals(b.attributes()); // todo: namespaces } void reconstructFormattingElements() { Element last = lastFormattingElement(); if (last == null || onStack(last)) return; Element entry = last; int size = formattingElements.size(); int pos = size - 1; boolean skip = false; while (true) { if (pos == 0) { // step 4. if none before, skip to 8 skip = true; break; } entry = formattingElements.get(--pos); // step 5. one earlier than entry if (entry == null || onStack(entry)) // step 6 - neither marker nor on stack break; // jump to 8, else continue back to 4 } while(true) { if (!skip) // step 7: on later than entry entry = formattingElements.get(++pos); Validate.notNull(entry); // should not occur, as we break at last element // 8. create new element from element, 9 insert into current node, onto stack skip = false; // can only skip increment from 4. Element newEl = insertStartTag(entry.nodeName()); // todo: avoid fostering here? // newEl.namespace(entry.namespace()); // todo: namespaces newEl.attributes().addAll(entry.attributes()); // 10. replace entry with new entry formattingElements.set(pos, newEl); // 11 if (pos == size-1) // if not last entry in list, jump to 7 break; } } void clearFormattingElementsToLastMarker() { while (!formattingElements.isEmpty()) { Element el = removeLastFormattingElement(); if (el == null) break; } } void removeFromActiveFormattingElements(Element el) { for (int pos = formattingElements.size() -1; pos >= 0; pos--) { Element next = formattingElements.get(pos); if (next == el) { formattingElements.remove(pos); break; } } } boolean isInActiveFormattingElements(Element el) { return isElementInQueue(formattingElements, el); } Element getActiveFormattingElement(String nodeName) { for (int pos = formattingElements.size() -1; pos >= 0; pos--) { Element next = formattingElements.get(pos); if (next == null) // scope marker break; else if (next.nodeName().equals(nodeName)) return next; } return null; } void replaceActiveFormattingElement(Element out, Element in) { replaceInQueue(formattingElements, out, in); } void insertMarkerToFormattingElements() { formattingElements.add(null); } void insertInFosterParent(Node in) { Element fosterParent; Element lastTable = getFromStack("table"); boolean isLastTableParent = false; if (lastTable != null) { if (lastTable.parent() != null) { fosterParent = lastTable.parent(); isLastTableParent = true; } else fosterParent = aboveOnStack(lastTable); } else { // no table == frag fosterParent = stack.get(0); } if (isLastTableParent) { Validate.notNull(lastTable); // last table cannot be null by this point. lastTable.before(in); } else fosterParent.appendChild(in); } @Override public String toString() { return "TreeBuilder{" + "currentToken=" + currentToken + ", state=" + state + ", currentElement=" + currentElement() + '}'; } }
[ "justinwm@163.com" ]
justinwm@163.com
5fc01efb981efc1dc037632bfe4e1c4c3ecd92e2
e9df8bcb4dd61ca4b6f63d37dd0be69f28391eac
/src/CurrentDate.java
cf2b5878a05c1d7370c606e55d241bcf0ba2b505
[]
no_license
abhirampadala/Algorithms
3b53e2f03bc0ce5dcd3515cd43655e8c4679bfa5
32c6dbee0bfa6d67b7852b71f9d21b70805c120f
refs/heads/master
2022-12-26T11:49:31.930409
2020-10-06T07:03:42
2020-10-06T07:03:42
301,642,465
0
0
null
null
null
null
UTF-8
Java
false
false
514
java
import java.text.DateFormatSymbols; import java.text.SimpleDateFormat; import java.time.Year; import java.util.Calendar; public class CurrentDate { public static void main(String args[]) { Calendar calendar=Calendar.getInstance(); SimpleDateFormat test1=new SimpleDateFormat("dd/MM/YYYY"); String newdate=test1.format(calendar.getTime()); System.out.println(newdate); String arrDate[]=newdate.split("/"); int day=Integer.valueOf(arrDate[0]); System.out.println(day); } }
[ "abhiram2324@gmail.com" ]
abhiram2324@gmail.com
58a6f5c4dd78840031990f21626bee1509fb3658
254dc99a4a19d2991ad7e00a7e1dc946c5af1408
/VariablesPluaralSight/src/Main.java
8ecddb21615900b057d5e65434a4a34fc00258b6
[]
no_license
dpalmquist84/JavaRepo
f365e515d40a292007f8e442a64e10a45e4e0e57
48faf24ee997037ad8ee7bea6d627416f21b5023
refs/heads/master
2020-03-24T11:18:38.964746
2018-08-14T21:35:06
2018-08-14T21:35:06
142,681,739
0
0
null
null
null
null
UTF-8
Java
false
false
318
java
public class Main { public static void main(String[] args) { // write your code here float floatVal = 1.0f; double doubleVal = 4.0d; byte byteVal = 7; short shortVal = 7; long longVal = 5; short result1 = byteVal; System.out.println("Success"); } }
[ "dpalmquist@Davids-MacBook-Pro.local" ]
dpalmquist@Davids-MacBook-Pro.local
73189277bb0898f9a39bdb8db678811946a24ec5
6755ab0f955543cb2b9356e7b20cf99e73ca7caa
/app/src/main/java/com/sunnygroup/backoffice/tdcapp/PartMovementFormActivity.java
70c840e24530c5f26cf1c4e393bb0e2f386431ec
[]
no_license
ERamkissoon/TDCApp
04d0c064f103eeab081b3079febdf2427af9e423
6b35cdef2505266b8e627054c9fbf4eee91feb1b
refs/heads/master
2020-04-26T06:08:25.708184
2019-03-01T19:18:03
2019-03-01T19:18:03
173,355,465
0
0
null
null
null
null
UTF-8
Java
false
false
1,232
java
package com.sunnygroup.backoffice.tdcapp; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.EditText; import android.widget.ImageView; import android.widget.Spinner; public class PartMovementFormActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_part_movement_form); ImageView backButton = (ImageView) findViewById(R.id.back_image_button); backButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { finish(); } }); ImageView saveButton = (ImageView) findViewById(R.id.save_image_button); saveButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { attemptSave(); } }); } public void attemptSave() { boolean cancel = false; View focusView = null; // if (!TextUtils.isEmpty()) { // // } System.out.println("TESTING"); } }
[ "eramkissoon@dynamic1group.com" ]
eramkissoon@dynamic1group.com
0213b27596ce43b03f9dd6779c8f70e63d4f26dd
39fdbaa47bc18dd76ccc40bccf18a21e3543ab9f
/modules/activiti-camel/src/test/java/org/activiti/camel/util/BrokenService.java
e3a3474cb3faef0740eade9c491ffcafb31e44cb
[]
no_license
jpjyxy/Activiti-activiti-5.16.4
b022494b8f40b817a54bb1cc9c7f6fa41dadb353
ff22517464d8f9d5cfb09551ad6c6cbecff93f69
refs/heads/master
2022-12-24T14:51:08.868694
2017-04-14T14:05:00
2017-04-14T14:05:00
191,682,921
0
0
null
2022-12-16T04:24:04
2019-06-13T03:15:47
Java
UTF-8
Java
false
false
1,217
java
/* Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.activiti.camel.util; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Use with Camel's bean component. * * @author stefan.schulze@accelsis.biz * */ public class BrokenService { private static final Logger LOG = LoggerFactory.getLogger(BrokenService.class); /** * Always throws an exception. * * the current Camel message * * @throws BrokenServiceException */ public void alwaysFails() throws BrokenServiceException { LOG.info("{} called", this.getClass().getSimpleName()); throw new BrokenServiceException("Provoked failure"); } }
[ "905280842@qq.com" ]
905280842@qq.com
263b683918955b59971d3f020d03461fddfe5194
8a69b1bae8eea341a92151c26dc8c8672b122118
/app/src/main/java/com/sunc/app/BaseModel.java
46a6001d151e7f79451354116a8054fd0f268c56
[]
no_license
wukongGit/bigfamily_android
76c3b4317a916c95c444f9c949d32476866ceeee
aa2dd0be8e6688883db7b9aa7201439b62c4a92b
refs/heads/master
2020-03-25T09:40:38.619614
2018-09-19T06:32:17
2018-09-19T06:32:17
143,673,767
0
0
null
null
null
null
UTF-8
Java
false
false
617
java
package com.sunc.app; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; /** * Description: * Date: 2018-08-07 09:21 * Author: suncheng */ @JsonIgnoreProperties(ignoreUnknown = true) public class BaseModel { private int code; private String message; public int getCode() { return code; } public void setCode(int code) { this.code = code; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public boolean isSuccess() { return code == 200; } }
[ "sunchenggx@163.com" ]
sunchenggx@163.com
199c6389c07ee2e2695e0c7eb06baef2677083f5
0ec9946a46c6dafcb2440d7f6e3e8d897f950313
/Java_source/Exam2/src/chapter6/chapter6_1/Student.java
eef49d23669bc730456b385cbbaedf82ca5cca64
[]
no_license
hamilkarr/Java
14c8286f1ecc5edd41bb2956dfd108d7fa9de9d5
f0c209446d35fe2cf48b0d6244ae0a56ac0bf597
refs/heads/main
2023-09-05T17:08:30.344966
2021-11-24T09:13:03
2021-11-24T09:13:03
398,113,790
0
0
null
null
null
null
UTF-8
Java
false
false
338
java
package chapter6.chapter6_1; public class Student { static int serialNum; // 학번 int studentID; public Student() { // 인스턴스를 생성할 때마다 학번 serialNum 증감 studentID = ++serialNum; } public int getSerialNum() { return serialNum; } public int getStudentID() { return studentID; } }
[ "12uclock@gmail.com" ]
12uclock@gmail.com
41a71f45c9661306a39a5400ae6bb6f68e6c8cf9
dd3fc592b8d0c135913aeb462a6473cb1a3e9791
/app/src/main/java/com/example/boardgame/Settings.java
f490aff6015fa4525ae76dda9cf7f67c73c21218
[]
no_license
danteehome/BoardGame
4aa6540ce8d74c2961325ab12e42c6c75fac0e92
e49e69761efdce0e910d3fcb3e58126aee232934
refs/heads/master
2021-02-16T12:24:18.664373
2020-03-04T21:14:43
2020-03-04T21:14:43
245,004,973
0
0
null
null
null
null
UTF-8
Java
false
false
1,908
java
package com.example.boardgame; import android.app.Activity; import android.content.res.Resources; import android.os.Bundle; import android.util.DisplayMetrics; import android.view.Gravity; import android.view.View; import android.view.ViewGroup; import android.view.WindowManager; import android.widget.ArrayAdapter; import android.widget.ListView; import java.util.ArrayList; import java.util.List; import androidx.annotation.Nullable; public class Settings extends Activity { @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.setting_for_hangover); Resources res= getResources(); String setting_items[]= res.getStringArray(R.array.setting_items); final ArrayList<SettingItem> list = new ArrayList<SettingItem>(); for (int i = 0; i < setting_items.length; ++i) { SettingItem item= new SettingItem(setting_items[i],true); list.add(item); } SettingListAdapter listViewAdapter= new SettingListAdapter(this,R.layout.setting_item,list); ListView lV= findViewById(R.id.setting_list); lV.setAdapter(listViewAdapter); populatesetting(); } //TODO list adapter, boolean value handler //get screen size and shrink the size public void populatesetting(){ //get screensize and shrink the page DisplayMetrics dm= new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(dm); int width= dm.widthPixels; int height=dm.heightPixels; getWindow().setLayout((int)(width*.8),(int)(height*.7)); //set offset for the page WindowManager.LayoutParams params=getWindow().getAttributes(); params.gravity= Gravity.CENTER; params.x=0; params.y=-20; getWindow().setAttributes(params); } }
[ "danteehome@gmail.com" ]
danteehome@gmail.com
0fbfca1b920c8cdce0d327fbcb21989600c58f07
1d285c8ec5dcf117a34dcf612f7b94ca52042b04
/src/main/java/book/demo/service/OrderItemService.java
b26093e226019fef7c6b3dcafb17605c21ecf0a9
[ "MIT" ]
permissive
gogowhy/2019WEB-bookstore-backend
710a6b0d36dd2299513d8a9966b49e9d6bc990cd
1d5ee96d6785501a8b06aa411da7ba11cf9c5855
refs/heads/master
2020-05-18T00:02:46.823756
2019-06-28T09:08:15
2019-06-28T09:08:15
184,051,541
1
0
null
null
null
null
UTF-8
Java
false
false
451
java
package book.demo.service; import book.demo.entity.Order; import book.demo.entity.OrderItem; import book.demo.entity.order_out_structure; import org.springframework.stereotype.Service; import javax.servlet.http.HttpServletRequest; import java.util.List; @Service public interface OrderItemService { List<OrderItem> queryAll(); void addorderitem( Integer userid, Integer orderid, Integer bookid, Integer number); }
[ "gogowhy@sjtu.edu.cn" ]
gogowhy@sjtu.edu.cn
8d6608f59b9b43a8d6827e8b343172f52010e247
2ca0a24f289fde763b30701bec3f02475dd3b14a
/de/fraunhofer/iais/eis/SalesRequestBuilder.java
5583282c0e4b8a3991d6519fc8e93415561a57eb
[ "Apache-2.0" ]
permissive
IDSCN/Java-Representation-of-IDS-Information-Model
e71b6b501bb87c318752a3522609be1b1a3cf58a
7afc34c922084046174e52eb6706ac0916824e17
refs/heads/main
2023-08-23T15:47:39.705390
2021-09-30T08:52:27
2021-09-30T08:52:27
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,763
java
package de.fraunhofer.iais.eis; import java.net.URI; import java.util.List; import javax.xml.datatype.XMLGregorianCalendar; import de.fraunhofer.iais.eis.util.*; public class SalesRequestBuilder implements Builder<SalesRequest> { private SalesRequestImpl salesRequestImpl; public SalesRequestBuilder() { salesRequestImpl = new SalesRequestImpl(); } public SalesRequestBuilder(URI id) { this(); salesRequestImpl.id = id; } /** * This function allows setting a value for _contractStart * * @param _contractStart_ desired value to be set * @return Builder object with new value for _contractStart */ public SalesRequestBuilder _contractStart_(XMLGregorianCalendar _contractStart_) { this.salesRequestImpl.setContractStart(_contractStart_); return this; } /** * This function allows setting a value for _contractEnd * * @param _contractEnd_ desired value to be set * @return Builder object with new value for _contractEnd */ public SalesRequestBuilder _contractEnd_(XMLGregorianCalendar _contractEnd_) { this.salesRequestImpl.setContractEnd(_contractEnd_); return this; } /** * This function allows setting a value for _contractDate * * @param _contractDate_ desired value to be set * @return Builder object with new value for _contractDate */ public SalesRequestBuilder _contractDate_(XMLGregorianCalendar _contractDate_) { this.salesRequestImpl.setContractDate(_contractDate_); return this; } /** * This function allows setting a value for _provider * * @param _provider_ desired value to be set * @return Builder object with new value for _provider */ public SalesRequestBuilder _provider_(URI _provider_) { this.salesRequestImpl.setProvider(_provider_); return this; } /** * This function allows setting a value for _consumer * * @param _consumer_ desired value to be set * @return Builder object with new value for _consumer */ public SalesRequestBuilder _consumer_(URI _consumer_) { this.salesRequestImpl.setConsumer(_consumer_); return this; } /** * This function allows setting a value for _contractDocument * * @param _contractDocument_ desired value to be set * @return Builder object with new value for _contractDocument */ public SalesRequestBuilder _contractDocument_(TextResource _contractDocument_) { this.salesRequestImpl.setContractDocument(_contractDocument_); return this; } /** * This function allows setting a value for _contractAnnex * * @param _contractAnnex_ desired value to be set * @return Builder object with new value for _contractAnnex */ public SalesRequestBuilder _contractAnnex_(Resource _contractAnnex_) { this.salesRequestImpl.setContractAnnex(_contractAnnex_); return this; } /** * This function allows setting a value for _permission * * @param _permission_ desired value to be set * @return Builder object with new value for _permission */ public SalesRequestBuilder _permission_(List<Permission> _permission_) { this.salesRequestImpl.setPermission(_permission_); return this; } /** * This function allows adding a value to the List _permission * * @param _permission_ desired value to be added * @return Builder object with new value for _permission */ public SalesRequestBuilder _permission_(Permission _permission_) { this.salesRequestImpl.getPermission().add(_permission_); return this; } /** * This function allows setting a value for _prohibition * * @param _prohibition_ desired value to be set * @return Builder object with new value for _prohibition */ public SalesRequestBuilder _prohibition_(List<Prohibition> _prohibition_) { this.salesRequestImpl.setProhibition(_prohibition_); return this; } /** * This function allows adding a value to the List _prohibition * * @param _prohibition_ desired value to be added * @return Builder object with new value for _prohibition */ public SalesRequestBuilder _prohibition_(Prohibition _prohibition_) { this.salesRequestImpl.getProhibition().add(_prohibition_); return this; } /** * This function allows setting a value for _obligation * * @param _obligation_ desired value to be set * @return Builder object with new value for _obligation */ public SalesRequestBuilder _obligation_(List<Duty> _obligation_) { this.salesRequestImpl.setObligation(_obligation_); return this; } /** * This function allows adding a value to the List _obligation * * @param _obligation_ desired value to be added * @return Builder object with new value for _obligation */ public SalesRequestBuilder _obligation_(Duty _obligation_) { this.salesRequestImpl.getObligation().add(_obligation_); return this; } /** * This function takes the values that were set previously via the other functions of this class and * turns them into a Java bean. * * @return Bean with specified values * @throws ConstraintViolationException This exception is thrown, if a validator is used and a * violation is found. */ @Override public SalesRequest build() throws ConstraintViolationException { VocabUtil.getInstance().validate(salesRequestImpl); return salesRequestImpl; } }
[ "contact@ids.fraunhofer.de" ]
contact@ids.fraunhofer.de
7fe7b988eaff86d455601090bae42d61b6579d5d
f0ef082568f43e3dbc820e2a5c9bb27fe74faa34
/com/google/android/gms/internal/zzmk.java
b2738febfdb95f886e695c65b86018773a026f60
[]
no_license
mzkh/Taxify
f929ea67b6ad12a9d69e84cad027b8dd6bdba587
5c6d0854396b46995ddd4d8b2215592c64fbaecb
refs/heads/master
2020-12-03T05:13:40.604450
2017-05-20T05:19:49
2017-05-20T05:19:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,835
java
package com.google.android.gms.internal; import com.google.android.gms.drive.metadata.SearchableOrderedMetadataField; import com.google.android.gms.drive.metadata.SortableMetadataField; import java.util.Date; public class zzmk { public static final zza zzWe; public static final zzb zzWf; public static final zzd zzWg; public static final zzc zzWh; public static final zze zzWi; public static class zza extends com.google.android.gms.drive.metadata.internal.zzd implements SortableMetadataField<Date> { public zza(String str, int i) { super(str, i); } } public static class zzb extends com.google.android.gms.drive.metadata.internal.zzd implements SearchableOrderedMetadataField<Date>, SortableMetadataField<Date> { public zzb(String str, int i) { super(str, i); } } public static class zzc extends com.google.android.gms.drive.metadata.internal.zzd implements SortableMetadataField<Date> { public zzc(String str, int i) { super(str, i); } } public static class zzd extends com.google.android.gms.drive.metadata.internal.zzd implements SearchableOrderedMetadataField<Date>, SortableMetadataField<Date> { public zzd(String str, int i) { super(str, i); } } public static class zze extends com.google.android.gms.drive.metadata.internal.zzd implements SearchableOrderedMetadataField<Date>, SortableMetadataField<Date> { public zze(String str, int i) { super(str, i); } } static { zzWe = new zza("created", 4100000); zzWf = new zzb("lastOpenedTime", 4300000); zzWg = new zzd("modified", 4100000); zzWh = new zzc("modifiedByMe", 4100000); zzWi = new zze("sharedWithMe", 4100000); } }
[ "mozammil.khan@webyog.com" ]
mozammil.khan@webyog.com
9cc9e4807aeb9fe972a6a159fbe7de0892c49556
dc1dbb7e5a4b95bf44170d2f51fd08b3814f2ac9
/data_defect4j/preprossed_method_corpus/Chart/5/org/jfree/chart/plot/XYPlot_getOrientation_681.java
f00e486cdf666c98780858c966a7e8507789d606
[]
no_license
hvdthong/NetML
dca6cf4d34c5799b400d718e0a6cd2e0b167297d
9bb103da21327912e5a29cbf9be9ff4d058731a5
refs/heads/master
2021-06-30T15:03:52.618255
2020-10-07T01:58:48
2020-10-07T01:58:48
150,383,588
1
1
null
2018-09-26T07:08:45
2018-09-26T07:08:44
null
UTF-8
Java
false
false
5,832
java
org jfree chart plot gener plot data form pair plot data link dataset xydataset code plot xyplot code make link item render xyitemrender draw point plot render chart type produc link org jfree chart chart factori chartfactori method creat pre configur chart plot xyplot plot axi plot valueaxisplot zoomabl return orient plot orient code code set orient setorient plot orient plotorient plot orient plotorient orient getorient orient
[ "hvdthong@gmail.com" ]
hvdthong@gmail.com
2fdacf7b44eac7610432c3b3fcbb7846ab2fbc0c
a5759643ff379dce1339643c4c5ca577d0c0a066
/girl-core/src/main/java/com/imooc/girl/core/aspect/HttpAspect.java
21f27e7a1cb51aba6a825c0b10e00929c71a60fe
[]
no_license
haomeihao/girl
b1c86cbc9de213b867fc1e36dad06d04522de33b
bc08a1ee6e4fc856f5be834093d453877129e9af
refs/heads/master
2021-09-18T18:14:52.234641
2018-07-18T03:49:52
2018-07-18T03:49:52
109,661,813
1
0
null
null
null
null
UTF-8
Java
false
false
1,641
java
package com.imooc.girl.core.aspect; import org.aspectj.lang.JoinPoint; import org.aspectj.lang.annotation.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; import javax.servlet.http.HttpServletRequest; /** * Created by hmh on 2017/8/1. */ @Aspect @Component public class HttpAspect { private final static Logger log = LoggerFactory.getLogger(HttpAspect.class); @Pointcut("execution(public * com.imooc.controller.*.*(..)) || execution(public * com.imooc.shiro.web.*.*(..))") public void log(){ } @Before("log()") public void doBefore(JoinPoint joinPoint){ ServletRequestAttributes attributes = (ServletRequestAttributes)RequestContextHolder.getRequestAttributes(); HttpServletRequest request = attributes.getRequest(); //url log.info("url={}", request.getRequestURL()); //method log.info("method={}", request.getMethod()); //ip log.info("ip={}", request.getRemoteAddr()); //类方法 log.info("class_method={}", joinPoint.getSignature().getDeclaringTypeName()+"."+joinPoint.getSignature().getName()); //参数 log.info("args={}", joinPoint.getArgs()); } @After("log()") public void doAfter(){ log.info("333333"); } @AfterReturning(returning = "object", pointcut = "log()") public void doAfterReturning(Object object) { log.info("response={}", object.toString()); } }
[ "2305863389@qq.com" ]
2305863389@qq.com
59493ad5dc91204d3c32ec6a71f73953ec2bc60c
e7549fdf186f367c2dfd432dd0ad54512abff30d
/src/test/java/net/openj21/mih/protocol/codec/GenericEncoderOctetTest.java
bef9c422ffdb7894ae5961bd39e370796cddf8b3
[ "Apache-2.0", "JSON" ]
permissive
pires/openj21
e2b05af1a6789fc93cdd99d71f08eb78d5ef125b
96710ac9c162b577e85ab5118a161bae13de65e1
refs/heads/master
2020-04-05T23:26:53.288339
2013-04-30T15:44:31
2013-04-30T15:44:31
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,047
java
/** * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. */ package net.openj21.mih.protocol.codec; import static org.junit.Assert.assertEquals; import java.nio.charset.Charset; import net.openj21.mih.datatype.information_elements.CNTRY_CODE; import net.openj21.mih.protocol.codec.basic.BitmapCodec; import net.openj21.mih.protocol.codec.basic.IntegerCodec; import net.openj21.mih.protocol.codec.basic.OctetCodec; import net.openj21.mih.protocol.codec.basic.OctetStringCodec; import net.openj21.mih.protocol.codec.basic.UnsignedIntCodec; import org.jboss.netty.buffer.ChannelBuffer; import org.junit.BeforeClass; import org.junit.Test; /** * Tests that ensure the GenericEncoder encodes OCTET fields properly. */ public class GenericEncoderOctetTest { /** * Unmappable chars. */ @Test(expected = IllegalArgumentException.class) public void testEncodeUnmappableChars() { ChannelBuffer encoded = createGenericEncoder().encodeObject( new CNTRY_CODE("ÛK")); } /** * String is too big. */ @Test(expected = IllegalArgumentException.class) public void testEncodeTooLarge() { ChannelBuffer encoded = createGenericEncoder().encodeObject( new CNTRY_CODE("USA")); } /** * String is too short. */ @Test(expected = IllegalArgumentException.class) public void testEncodeTooSmall() { ChannelBuffer encoded = createGenericEncoder().encodeObject( new CNTRY_CODE("I")); } @Test public void testEncodeAscii() { final String cc = "PT"; final byte[] expected = cc.getBytes(Charset.forName("US-ASCII")); ChannelBuffer encoded = createGenericEncoder().encodeObject( new CNTRY_CODE(cc)); assertEquals(expected.length, encoded.readableBytes()); for (int i = 0; i < expected.length; i++) { assertEquals(expected[i], encoded.getByte(i)); } } /** * Returns a new GenericEncoder encoder instance, already wired with the * necessary dependencies (not mocked). * * @return a GenericEncoder */ private GenericEncoder createGenericEncoder() { TLVLengthCodec lengthCodec = new TLVLengthCodec(); OctetStringCodec stringCodec = new OctetStringCodec(); stringCodec.setLengthCodec(lengthCodec); GenericEncoder encoder = new GenericEncoder(); encoder.setLengthCodec(lengthCodec); encoder.setStringCodec(stringCodec); encoder.setOctetCodec(new OctetCodec()); encoder.setBitmapCodec(new BitmapCodec()); encoder.setIntegerCodec(new IntegerCodec()); encoder.setUnsignedIntCodec(new UnsignedIntCodec()); encoder.setAnnotationUtils(new AnnotationUtils()); return encoder; } }
[ "pjpires@gmail.com" ]
pjpires@gmail.com
a6cfb3e987131c77e0ac261e179a70f8a1b07285
87aee350455cb4bb1afe7e4caa217185b0fd4ade
/EMS/src/com/utility/DeleteEvent.java
7cf0794b0f2a57fcebcabf5ed33fab1045cc78e9
[]
no_license
Aartek-spring-project/hibernate-projects
693e19d147fa1114c0803edbc76bcc8dc4d22d8c
e9aa44dbda8f7713a5c7501a2bde32207bb271bc
refs/heads/master
2020-12-24T05:51:43.580635
2016-11-11T04:15:42
2016-11-11T04:15:42
73,445,133
0
0
null
null
null
null
UTF-8
Java
false
false
1,099
java
package com.utility; import java.util.ArrayList; import java.util.Date; import java.util.HashSet; import java.util.List; import java.util.Set; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.Transaction; import org.hibernate.cfg.Configuration; import com.ems.dto.Event; import com.ems.dto.Manager; public class DeleteEvent { public static void main(String[] args) { Configuration cfg = new Configuration(); cfg.configure("hibernate.cfg.xml"); SessionFactory factory = cfg.buildSessionFactory(); Session session = factory.openSession(); Transaction tx = session.beginTransaction(); /* * Event e = new Event(); e.setEvent_id(1104); * * session.delete(e); */ Object e = session.load(Event.class, new Integer(1104)); Event o = (Event) e; Manager mmm = o.getManager(); Object m = session.load(Manager.class, new Integer(201)); Manager o1 = (Manager) m; session.delete(o1); /* * Event e = new Event(); e.setEvent_id(1104); session.delete(e); */ tx.commit(); System.out.println("Delete SuccessFully"); } }
[ "abhi.chouhan09@gmail.com" ]
abhi.chouhan09@gmail.com
a9773dbcc9df431120bf8d446cc754bf6500a1c2
fe5d04a68c592cebd243719302f78db2e2343bbe
/MobileClient/src/net/sweetmonster/hocuspocus/PackageUtils.java
63135892ccbd517b8856d4b276c093302dbfcbfb
[]
no_license
davidjonas/mediawerf_game
f88c11c998c5e5702d3ae05b064f47e1310fdff9
d039093301afc1bcabacd80227d52698f8a74bab
refs/heads/master
2021-01-17T21:59:31.644387
2013-05-27T21:09:25
2013-05-27T21:09:25
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,862
java
package net.sweetmonster.hocuspocus; import java.util.jar.*; import java.util.*; import java.io.*; public class PackageUtils { private static boolean debug = true; public static List getClasseNamesInPackage(String jarName, String packageName) { ArrayList classes = new ArrayList(); packageName = packageName.replaceAll("\\.", "/"); if (debug) System.out .println("Jar " + jarName + " looking for " + packageName); try { JarInputStream jarFile = new JarInputStream(new FileInputStream( jarName)); JarEntry jarEntry; while (true) { jarEntry = jarFile.getNextJarEntry(); if (jarEntry == null) { break; } if ((jarEntry.getName().startsWith(packageName)) && (jarEntry.getName().endsWith(".class"))) { if (debug) System.out.println("Found " + jarEntry.getName().replaceAll("/", "\\.")); classes.add(jarEntry.getName().replaceAll("/", "\\.")); } } } catch (Exception e) { e.printStackTrace(); } return classes; } /** * */ public static void main(String[] args) { List list = PackageUtils.getClasseNamesInPackage( "C:/j2sdk1.4.1_02/lib/mail.jar", "com.sun.mail.handlers"); System.out.println(list); /* * output : * * Jar C:/j2sdk1.4.1_02/lib/mail.jar looking for com/sun/mail/handlers * Found com.sun.mail.handlers.text_html.class Found * com.sun.mail.handlers.text_plain.class Found * com.sun.mail.handlers.text_xml.class Found * com.sun.mail.handlers.image_gif.class Found * com.sun.mail.handlers.image_jpeg.class Found * com.sun.mail.handlers.multipart_mixed.class Found * com.sun.mail.handlers.message_rfc822.class * [com.sun.mail.handlers.text_html.class, * com.sun.mail.handlers.text_xml.class, com * .sun.mail.handlers.image_jpeg.class, , * com.sun.mail.handlers.message_rfc822.class] */ } }
[ "victormdb@gmail.com" ]
victormdb@gmail.com
557fa5e77ec5f026be13689e0850c3e138106a63
18f2aecff4df644c169d09374c71268df3be20e8
/magic-operation/src/main/java/com/lvshou/magic/operation/service/OperationService.java
8365e63db639bffe3dd216f3649a279654e791c3
[]
no_license
laulunsi/work
39ea55b6dbbdb3302304cbf07e090eaf2d2eb630
1c41e8727d52ebeccd08e13139a024848e4560ae
refs/heads/master
2021-09-25T22:38:42.331769
2018-10-26T08:30:54
2018-10-26T08:30:54
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,645
java
package com.lvshou.magic.operation.service; import java.text.ParseException; import java.util.List; import com.lvshou.magic.operation.entity.Operation; import com.lvshou.magic.operation.vo.OperationVo; public interface OperationService { public int findOperationAmount(); public Operation findById(String id); public Operation findOne(Operation operation); public List<Operation> findAll(String userId); public Operation update(Operation operation); public Operation insert(Operation operation); public void delete(String id); public List<Operation> consumeList(int page,int size); public List<Operation> withList(int status,int page,int size); public int findByStatusAmount(int status); /**按照月份查询 * @throws ParseException */ public List<OperationVo> findMonth(String date,int status,int page,int size) throws ParseException; public int countMonth(String date,int status) throws ParseException; public List<OperationVo> findMonthNoPage(String date,int status) throws ParseException; /**按照名字查询*/ public List<OperationVo> findNames(String name,int status,int page,int size); public int countNames(String name,int status); /**按照编号查询*/ public List<OperationVo> findNumId(String numId,int status,int page,int size); public int countNumId(String numId,int status); /**按照手机号查询*/ public List<OperationVo> findPhone(String phone,int status,int page,int size); public int countPhone(String phone,int status); /**查找所有*/ public List<OperationVo> finds(int status,int page,int size); public int counts(int status); public List<OperationVo> findsNoPage(int status); }
[ "1341672184@qq.com" ]
1341672184@qq.com
60d935321bde1eb9eee7eafcb836d727710b0a45
8bdce5f5e4b75e2b97462d9b93e5663db81312d4
/CircleResizeableTest.java
15c5f946f78e83ecfdf32a3c21968e6d8e44f4b5
[]
no_license
huyenlothi/thuchanh_interface
5cf667a5007b4b96f922aa8e1afbb90f37f679fd
0ce579e19d656ebd7b88a519ea9779854b2266be
refs/heads/master
2022-12-13T13:42:15.809310
2020-09-18T07:27:53
2020-09-18T07:27:53
296,497,164
0
0
null
null
null
null
UTF-8
Java
false
false
698
java
public class CircleResizeableTest { public static void main(String[] args) { Circle[] circle = new Circle[3]; circle[0] = new Circle(2); circle[1] = new Circle(10); circle[2] = new Circle(15); System.out.println("pre-resizeable"); for(Circle circle1: circle){ System.out.println(circle1.getArea()); } for (Circle circle1: circle){ Resizeable circleResizeable = new CircleResizeable(circle1); circleResizeable.getresize(30); } System.out.println("after resizeable"); for(Circle circle1: circle){ System.out.println(circle1.getArea()); } } }
[ "69282948+huyenlothi@users.noreply.github.com" ]
69282948+huyenlothi@users.noreply.github.com
b00d5865faba707b091a640255126b5e42f2f65b
034c1d2c9eb3d51898c0cd927133ea7015b69598
/src/main/java/com/springbootbackend/SpringbootBackendApplication.java
789f3ee4607c3f39466e80e7c92e73b1e268767f
[]
no_license
Aakashgautam41/bugtracker-rest-api
43726b6e798dceb60c65b272adb770efcaad4a8d
4122eab0ba3f26125a4d290673681697f7af1c0c
refs/heads/main
2023-08-25T21:33:53.902737
2021-10-12T19:30:35
2021-10-12T19:30:35
416,041,750
0
0
null
null
null
null
UTF-8
Java
false
false
2,161
java
package com.springbootbackend; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.CommandLineRunner; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import com.springbootbackend.model.Employee; import com.springbootbackend.model.Project; import com.springbootbackend.model.Ticket; import com.springbootbackend.repository.EmployeeRepository; import com.springbootbackend.repository.ProjectRepository; import com.springbootbackend.repository.TicketRepository; @SpringBootApplication public class SpringbootBackendApplication implements CommandLineRunner{ public static void main(String[] args) { SpringApplication.run(SpringbootBackendApplication.class, args); } @Autowired private EmployeeRepository employeeRepository; @Autowired private ProjectRepository projectRepository; @Autowired private TicketRepository ticketRepository; @Override public void run(String... args) throws Exception { this.employeeRepository.save(new Employee("avrana", "kern", "avrana@gmail.com","123456",1)); this.employeeRepository.save(new Employee("holsten", "mason", "holsten@gmail.com","123456",1)); this.employeeRepository.save(new Employee("isa", "lain", "isa@gmail.com","123456",1)); this.employeeRepository.save(new Employee("clarke", "griffin", "clarke@gmail.com","123456",2)); this.employeeRepository.save(new Employee("marcus", "kane", "marcus@gmail.com","123456",2)); this.projectRepository.save(new Project("Bugtracker", "BugTracker is an online bug tracker and issue tracking software that helps you to track and fix bugs quickly")); this.projectRepository.save(new Project("Inkscape", "Inkscape is professional quality vector graphics software which runs on Linux, Mac OS X and Windows desktop computers")); this.ticketRepository.save(new Ticket(1,"avrana","Holsten","Issue on login page","Error message is coming while login",2)); this.ticketRepository.save(new Ticket(2,"clarke","Marcus","Cannot recreate calligraphy settings","I'm trying to create a gradual text the follow a path using Inkscape",5)); } }
[ "akash@pop-os.localdomain" ]
akash@pop-os.localdomain
d08ea0ee0ac2cddbf52e8c308350785f45de24d8
70ca645297a403d76c7d7ab51d3a7e182430a8cb
/src/ascension_1/Homepage.java
36be6bf1d929565d92e54a80cdf00447a2292ded
[]
no_license
Vithop/Ascension
15f47dc532c466624de42a50ca407d5bc6f6c26c
7ca71f3f1cafafbf3a5d7bdc53de39735783dd0d
refs/heads/master
2021-05-10T23:33:38.731148
2018-01-20T22:18:10
2018-01-20T22:18:10
118,285,088
2
0
null
null
null
null
UTF-8
Java
false
false
7,362
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package ascension_1; import javax.swing.JFrame; /** * * @author 555433 */ public class Homepage extends javax.swing.JFrame { /** * Creates new form Homepage */ public Homepage() { initComponents(); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jPanel1 = new javax.swing.JPanel(); jButton2 = new javax.swing.JButton(); jButton3 = new javax.swing.JButton(); jButton4 = new javax.swing.JButton(); jButton5 = new javax.swing.JButton(); jLabel1 = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("HomePage"); setMaximumSize(new java.awt.Dimension(1280, 720)); setMinimumSize(new java.awt.Dimension(1280, 720)); setName("HomeFrame"); // NOI18N setResizable(false); setSize(new java.awt.Dimension(1280, 720)); jPanel1.setMaximumSize(new java.awt.Dimension(1280, 720)); jPanel1.setMinimumSize(new java.awt.Dimension(1280, 720)); jPanel1.setName("HomePanel"); // NOI18N jPanel1.setPreferredSize(new java.awt.Dimension(1280, 720)); jPanel1.setLayout(null); jButton2.setActionCommand("addButtonHp"); jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); jPanel1.add(jButton2); jButton2.setBounds(870, 290, 230, 90); jButton3.setText("jButton3"); jButton3.setActionCommand("removeButtonHp"); jButton3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton3ActionPerformed(evt); } }); jPanel1.add(jButton3); jButton3.setBounds(873, 393, 230, 80); jButton4.setText("jButton4"); jButton4.setActionCommand("SearchButtonHp"); jButton4.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton4ActionPerformed(evt); } }); jPanel1.add(jButton4); jButton4.setBounds(873, 493, 230, 80); jButton5.setText("jButton5"); jButton5.setActionCommand("DisplayButtonHp"); jButton5.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton5ActionPerformed(evt); } }); jPanel1.add(jButton5); jButton5.setBounds(873, 593, 230, 90); jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ascension_1/Slide1.JPG"))); // NOI18N jLabel1.setOpaque(true); jPanel1.add(jLabel1); jLabel1.setBounds(0, 0, 1290, 730); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 1280, javax.swing.GroupLayout.PREFERRED_SIZE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 720, javax.swing.GroupLayout.PREFERRED_SIZE) ); pack(); }// </editor-fold>//GEN-END:initComponents private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed JFrame newFrame = new AddPage(); this.setVisible(false); newFrame.setVisible(true); }//GEN-LAST:event_jButton2ActionPerformed private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed JFrame newFrame = new Search(); this.setVisible(false); newFrame.setVisible(true); }//GEN-LAST:event_jButton4ActionPerformed private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed JFrame newFrame = new RemovePage(); this.setVisible(false); newFrame.setVisible(true); }//GEN-LAST:event_jButton3ActionPerformed private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed JFrame newFrame = new DisplayPage(); this.setVisible(false); newFrame.setVisible(true); }//GEN-LAST:event_jButton5ActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(Homepage.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(Homepage.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(Homepage.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(Homepage.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new Homepage().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton jButton2; private javax.swing.JButton jButton3; private javax.swing.JButton jButton4; private javax.swing.JButton jButton5; private javax.swing.JLabel jLabel1; private javax.swing.JPanel jPanel1; // End of variables declaration//GEN-END:variables }
[ "vithuransoccer1@gmail.com" ]
vithuransoccer1@gmail.com
886c9ba6a023387f9f230af0d1f9c9cb532a34b0
347b596c85de2ae44cb14b57a92813b2b8f64841
/Projekt1-web/src/main/java/com/soa/MyApplication.java
1a6d9c4d2a667922af9da2f9f9d8cbe2bd390626
[]
no_license
FryderykMuras/SOA-Course
a0be142f20fe8ae71ada588684aee5b636966767
01fdd2ef88f8f69d6ab4b80d759e4b943bc05e2c
refs/heads/master
2022-12-03T13:59:42.327276
2019-06-06T20:43:03
2019-06-06T20:43:03
187,386,753
0
0
null
2022-11-24T02:25:18
2019-05-18T17:29:29
CSS
UTF-8
Java
false
false
1,438
java
package com.soa; import com.soa.ProtoBuffers.StudentProtocMessageBodyProvider; import io.swagger.jaxrs.config.BeanConfig; import javax.ws.rs.ApplicationPath; import javax.ws.rs.core.Application; import java.util.HashSet; import java.util.Set; @ApplicationPath("/api") public class MyApplication extends Application { public MyApplication() { init(); } @Override public Set<Class<?>> getClasses() { HashSet h = new HashSet<Class<?>>(); h.add(StudentEndpoint.class); h.add(UserEndpoint.class); h.add(CompanyEndpoint.class); h.add(JWTTokenNeededFilter.class); h.add(SimpleKeyGenerator.class); h.add(io.swagger.jaxrs.listing.ApiListingResource.class); h.add(io.swagger.jaxrs.listing.SwaggerSerializers.class); h.add(StudentProtocMessageBodyProvider.class); return h; } private void init() { BeanConfig beanConfig = new BeanConfig(); beanConfig.setVersion("1.0.0"); beanConfig.setSchemes(new String[]{"http"}); beanConfig.setHost("localhost:8080"); beanConfig.setBasePath("/Projekt1-web/api"); beanConfig.setResourcePackage(UserEndpoint.class.getPackage().getName()); beanConfig.setTitle("Example swagger documentation"); beanConfig.setDescription("Sample RESTful API built using RESTEasy, Swagger and Swagger UI"); beanConfig.setScan(true); } }
[ "fryderyk.muras@gmail.com" ]
fryderyk.muras@gmail.com
10f08352938024f20598e050a630cc3626b8e7ff
042eb400317af211070771b200d90fc168eba863
/app/src/main/java/com/khalej/ramada/Adapter/RecyclerAdapter_first_order.java
672d12230ce3124bb1427b94422a58ec66063bed
[]
no_license
mohamedfathyd/Ramada
90d062b4c91f806658303e627e95d3a470642368
6d9de29a2c91bf169e7e93c2bdf11b3e8618f70e
refs/heads/master
2022-11-17T06:31:24.303492
2020-07-18T02:52:42
2020-07-18T02:52:42
280,568,918
0
0
null
null
null
null
UTF-8
Java
false
false
3,481
java
package com.khalej.ramada.Adapter; import android.app.Activity; import android.app.AlertDialog; import android.app.ProgressDialog; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.graphics.Typeface; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import com.khalej.ramada.Activity.AddessList; import com.khalej.ramada.R; import com.khalej.ramada.model.Apiclient_home; import com.khalej.ramada.model.Orders; import com.khalej.ramada.model.apiinterface_home; import com.khalej.ramada.model.contact_address; import java.util.HashMap; import java.util.List; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; import okhttp3.ResponseBody; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; public class RecyclerAdapter_first_order extends RecyclerView.Adapter<RecyclerAdapter_first_order.MyViewHolder> { Typeface myTypeface; private Context context; List<Orders.Order_data> contactslist; private apiinterface_home apiinterface; RecyclerView recyclerView; ProgressDialog progressDialog; private SharedPreferences sharedpref; private SharedPreferences.Editor edt; public RecyclerAdapter_first_order(Context context, List<Orders.Order_data> contactslist ){ this.contactslist=contactslist; this.context=context; } @NonNull @Override public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { View view= LayoutInflater.from(parent.getContext()).inflate(R.layout.addresslist,parent,false); return new MyViewHolder(view); } @Override public void onBindViewHolder(@NonNull final MyViewHolder holder, final int position) { sharedpref = context.getSharedPreferences("Education", Context.MODE_PRIVATE); edt = sharedpref.edit(); holder.address.setText(contactslist.get(position).getAddress()); holder.address_receiver.setText(contactslist.get(position).getReceive_address()); holder.price.setText(contactslist.get(position).getPrice()+" "+contactslist.get(position).getCurrency()); holder.weight.setText(contactslist.get(position).getWeight()+""); holder.quantity.setText(contactslist.get(position).getQuantity()+""); holder.date.setText(contactslist.get(position).getDay()); holder.time.setText(contactslist.get(position).getTime()); holder.itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { } }); } @Override public int getItemCount() { return contactslist.size(); } public static class MyViewHolder extends RecyclerView.ViewHolder { TextView address,address_receiver,time,date,price,weight,quantity; public MyViewHolder(View itemView) { super(itemView); address=itemView.findViewById(R.id.address); address_receiver=itemView.findViewById(R.id.address_receiver); time=itemView.findViewById(R.id.time); date=itemView.findViewById(R.id.date); price=itemView.findViewById(R.id.price); quantity=itemView.findViewById(R.id.quantity); weight=itemView.findViewById(R.id.weight); } } }
[ "m.fathy7793@gmail.com" ]
m.fathy7793@gmail.com
dbabede6415ce79ef0286d49772240b34fb90ae0
55f23a2ffdcbb8a72327884fb7b47549f535003c
/kafka-persistence/src/main/java/com/epam/openspaces/persistency/kafka/KafkaPersistenceException.java
5e977c6b8d4da104f785b20008c63976fefc8cd3
[]
no_license
Gigaspaces-sbp/xap-kafka
5c5a4598ad1b53828ef51396d83d63371f173cff
0004e8a345fa8908487f80fb11f417bb8a76c06f
refs/heads/master
2023-02-16T21:09:39.523588
2023-01-24T17:00:54
2023-01-24T17:00:54
202,311,218
0
1
null
2023-01-24T14:25:58
2019-08-14T08:47:41
Java
UTF-8
Java
false
false
549
java
package com.epam.openspaces.persistency.kafka; /** * Indicates a problem during persisting data to Kafka * * @author Oleksiy_Dyagilev */ public class KafkaPersistenceException extends Exception { public KafkaPersistenceException() { super(); } public KafkaPersistenceException(String message) { super(message); } public KafkaPersistenceException(String message, Throwable cause) { super(message, cause); } public KafkaPersistenceException(Throwable cause) { super(cause); } }
[ "aharon@gigaspaces.com" ]
aharon@gigaspaces.com
f1f71e5670d31c54a6f2316cfe328be79936c7b9
b280a34244a58fddd7e76bddb13bc25c83215010
/scmv6/center-task1/src/main/java/com/smate/center/task/dao/sns/quartz/KeywordsEnTranZhDao.java
dcb53e21001e71b025060f42078112333519e04e
[]
no_license
hzr958/myProjects
910d7b7473c33ef2754d79e67ced0245e987f522
d2e8f61b7b99a92ffe19209fcda3c2db37315422
refs/heads/master
2022-12-24T16:43:21.527071
2019-08-16T01:46:18
2019-08-16T01:46:18
202,512,072
2
3
null
2022-12-16T05:31:05
2019-08-15T09:21:04
Java
UTF-8
Java
false
false
782
java
package com.smate.center.task.dao.sns.quartz; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Repository; import com.smate.center.task.model.sns.quartz.KeywordsEnTranZh; import com.smate.core.base.utils.data.SnsHibernateDao; @Repository public class KeywordsEnTranZhDao extends SnsHibernateDao<KeywordsEnTranZh, Long> { /** * 查找英文翻译中文的关键词. * * @param enKw * @return */ public KeywordsEnTranZh findEnTranZhKw(String enKw) { if (StringUtils.isBlank(enKw)) { return null; } String hql = "from KeywordsEnTranZh t where enKwTxt=:enKw "; return (KeywordsEnTranZh) super.createQuery(hql).setParameter("enKw", enKw.trim().toLowerCase()).setMaxResults(1) .uniqueResult(); } }
[ "zhiranhe@irissz.com" ]
zhiranhe@irissz.com
219998558da32f23144479e79c6486a874f8d4be
792071d4de4a380e5438ff036d04a22118b079f0
/src/com/innovative/gnews/feed/NewsLoadEvents.java
20e4837cfd05d1431fa4e4b413208af42750904a
[]
no_license
kietngot/gnews
c1bc6fe0f5cfb2e82bda4a2a233795a17f54329f
0d5da98f52b90b1b54b9be8969fbfbe96b3080ed
refs/heads/master
2016-08-10T10:53:06.729028
2013-02-28T22:52:07
2013-02-28T22:52:07
8,489,764
0
1
null
null
null
null
UTF-8
Java
false
false
527
java
package com.innovative.gnews.feed; import com.innovative.gnews.db.GnewsDatabase.Category; import android.graphics.Bitmap; public interface NewsLoadEvents { void loadNewsCategorySuccess(NewsCategory newsCategory, Category currentCountry, Category currentCategory); void loadNewsCategoryFailed(Category currentCountry, Category currentCategory); void thumbLoaded(String itemTitle, Bitmap thumb, Category currentCountry, Category currentCategory); void allThumbsLoaded(Category currentCountry, Category currentCategory); }
[ "johngummadi@gmail.com" ]
johngummadi@gmail.com
32b5d17aee28523ccc16383fb368f72ef38d28e4
0dfd70e1214301631ce3e213a146ac37813117c7
/tedis-replicator/src/main/java/com/taobao/common/tedis/replicator/redis/RedisHandleException.java
689315d434506af2ede67554650754fbf473642c
[ "Apache-2.0" ]
permissive
zym1995587/tedis
8d20d707ea54074c37ab8eb15174da8b841dd664
4c03c451cfb3bf826b1f3283bc9b7bea15615259
refs/heads/master
2022-07-10T12:14:11.814959
2019-11-04T09:47:04
2019-11-04T09:47:04
219,466,980
0
0
NOASSERTION
2022-06-29T19:44:44
2019-11-04T09:45:41
Java
UTF-8
Java
false
false
756
java
/** * (C) 2011-2012 Alibaba Group Holding Limited. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. * */ package com.taobao.common.tedis.replicator.redis; public class RedisHandleException extends Exception { private static final long serialVersionUID = -9101596261821235497L; public RedisHandleException() { super(); } public RedisHandleException(String message, Throwable cause) { super(message, cause); } public RedisHandleException(String message) { super(message); } public RedisHandleException(Throwable cause) { super(cause); } }
[ "15345309023@163.com" ]
15345309023@163.com
7da71c403443fc208bcb520ddeaeae498533acf4
0f70b2a635845a02a9a6e192d2ae7e104f3d7922
/sso-service/src/main/java/com/hisign/sso/service/impl/helper/TokenHelper.java
c0cc0f762f92c688bc55c596d01b6b30610bb88e
[]
no_license
radtek/UAOP
64391f81202bc5a98fbc41449c4017fc396534b2
fe238345e1c14f7bb8677a8c1d67a95fb57b3f95
refs/heads/master
2020-05-20T07:49:06.912361
2017-03-09T14:44:30
2017-03-09T14:44:30
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,168
java
package com.hisign.sso.service.impl.helper; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.hisign.sso.api.constant.UAOPConstant; /** * @Title: * 登录token超时帮助类 * @description: * * @author lnj */ public class TokenHelper { private final Logger logger = LoggerFactory.getLogger(getClass()); public final static int DEFAULT_TOKEN_TIMEOUT = 7200; public final static int DEFAULT_SYSTEM_TOKEN_TIMEOUT = 5400; private int tokenTimeout = -1; //token超时时间,默认2小时 private int systemTokenTimeout = -1; //各个业务系统token超时时间,默认1.5小时(必须比tokenTimeout小) private static TokenHelper instance = null; public static synchronized TokenHelper getInstance(){ if(instance == null){ instance = new TokenHelper(); } return instance; } private TokenHelper(){ } public int getTokenTimeout(){ if(tokenTimeout > 0){ return tokenTimeout; } String logtokenTimeout = System.getProperty(UAOPConstant.SysParamKey.logtoken_timeout); if(!StringUtils.isEmpty(logtokenTimeout)){ try{ tokenTimeout = Integer.parseInt(logtokenTimeout); }catch(Exception ex){ } } if(tokenTimeout <= 0){ tokenTimeout = DEFAULT_TOKEN_TIMEOUT; } logger.info("######logtoken_timeout="+tokenTimeout); return tokenTimeout; } public int getSystemTokenTimeout(){ if(systemTokenTimeout > 0){ return systemTokenTimeout; } String system_logtoken_timeout = System.getProperty(UAOPConstant.SysParamKey.system_logtoken_timeout); if(!StringUtils.isEmpty(system_logtoken_timeout)){ try{ systemTokenTimeout = Integer.parseInt(system_logtoken_timeout); }catch(Exception ex){ } } if(systemTokenTimeout <= 0){ systemTokenTimeout = DEFAULT_SYSTEM_TOKEN_TIMEOUT; } int logtoken_timeout = getTokenTimeout(); if(systemTokenTimeout > logtoken_timeout){ //system_logtoken_timeout必须比logtoken_timeout小 systemTokenTimeout = (int)(logtoken_timeout * 0.75); } logger.info("######logtoken_timeout="+systemTokenTimeout); return systemTokenTimeout; } }
[ "326083984@qq.com" ]
326083984@qq.com
751e80eee477979906a71835d1b7423ffdfb3cd5
93a0b58e2d9b14e437654cc63cbcbcb160db4837
/src/mycasino/MyCasino.java
dffe41c126c5ea7a0c787675177ada15684079f4
[]
no_license
at200596/My-Casino
51bf98023fc38595e8aecb704e48d8476b8c724a
499b6abd790b0f2c12dba0355ed041edeb8a473e
refs/heads/master
2023-02-28T18:39:46.087691
2021-02-01T18:04:26
2021-02-01T18:04:26
335,038,395
0
0
null
null
null
null
UTF-8
Java
false
false
6,920
java
package mycasino; import java.util.Scanner; import java.util.ArrayList; import java.util.Random; public class MyCasino { static Scanner input = new Scanner(System.in); static int accountNos = 4567; static ArrayList<userAccounts> allAccounts = new ArrayList<>(); static boolean gameFinished = false; static int max = 20; static int min = 10; static Random rand = new Random(); static int cardsDrawn; static boolean overflow = false; static boolean compOverflow = false; static int rounds = 10; static int deaths = 0; static String guess; static int[] cards = new int[10]; static int cardsTotal = 0; static int computersBet = 0; static int usersBet = 0; static ArrayList<Integer> usersCards = new ArrayList<>(); static ArrayList<Integer> compsCards = new ArrayList<>(); static int count = 0; static boolean exit = false; static boolean canPlay = false; public static void main(String[] args) { greeting(); } public static void greeting() { while (exit == false) { System.out.println("Hello welcome to Ailise's Casino!"); System.out.println("What would you like to do?"); System.out.println("1 - Play a game"); System.out.println("2 - Create an account"); System.out.println("3 - View my account"); System.out.println("4 - Add money to my account"); System.out.println("5 - Out of money"); System.out.println("0 - Exit casino"); int userChoice = input.nextInt(); switch (userChoice) { case 1: chooseAGame(); break; case 2: createAccount(); break; case 3: viewAccount(); break; case 4: addMoney(); break; case 5: outOfMoney(); break; case 0: System.out.println("Thank you for coming by Ailise's Casino"); exit = true; } } } public static void chooseAGame() { System.out.println("Welcome to choosing a game"); System.out.println("Here, the currency is Wonka Coins"); System.out.println("In each game you use Wonka Coins to bet and win"); System.out.println("You will be playing against me in each round"); System.out.println("These are the choices of games:"); System.out.println("1 - BlackJack"); System.out.println("2 - Higher or Lower"); System.out.println("3 - Guess the Number"); int userChoice = input.nextInt(); switch (userChoice) { case 1: casinoBlackjack.blackjack(); break; case 2: casinoHigherOrLower.higherOrLower(); break; case 3: casinoGuessTheNumber.numberGuessing(); break; } } public static void cardsSetUp() { // 10 cards for (int i = 0; i < 10; i++) { cards[i] = rand.nextInt(14); } } public static void createAccount() { System.out.println("Welcome to creating an account"); System.out.println("First enter your name"); input.next(); String name = input.nextLine(); System.out.println("How much money would you like to put into your account to start with?"); System.out.println("1 Wonka coin is £1"); int startingMoney = input.nextInt(); double balance = startingMoney; int wonkaCoins = startingMoney; System.out.println("That translates to " + wonkaCoins + " Wonka coins"); int accountNumber = accountNos; userAccounts account = new userAccounts(name, balance, accountNumber); allAccounts.add(account); accountNos++; System.out.println("Perfect, thank you"); System.out.println("Below are your account details:"); System.out.println(account.toString()); System.out.println(""); //include a passwrod //outside of search for account //ask them to enter their password //if password does not equal to .getpassword(index) //then say they cannot play or ask them to reenter until they exit //use a while loop and if loop //they can then choose to leave if they enter e.g. leave or something greeting(); } public static void viewAccount() { if (allAccounts.isEmpty()) { System.out.println("Sorry there are no accounts"); greeting(); } else { int index = searchForAccount(); if (index == -1) { System.out.println("I could not find any matching accounts"); } else { System.out.println(allAccounts.get(index)); } } } public static void addMoney() { int index = searchForAccount(); if (index == -1) { System.out.println("There are no accounts matching that number"); } else { double userBalance = allAccounts.get(index).getBalance(); System.out.println("How much would you like to add to your account?"); int addMoney = input.nextInt(); allAccounts.get(index).setBalance(userBalance + addMoney); System.out.println("You now have £" + allAccounts.get(index).getBalance() + " in your account"); } } public static void outOfMoney(){ int index = searchForAccount(); if (index == -1) { System.out.println("There are no accounts matching that number"); } else { double userBalance = allAccounts.get(index).getBalance(); if(userBalance > 0){ System.out.println("You are not out of money"); } if(userBalance <= 0){ System.out.println("We are granting you Wonka Coins for you to win your money back"); double amountMissing = 0.00; amountMissing = (0 - userBalance); allAccounts.get(index).setBalance(amountMissing + 10); System.out.println("You now have £" + allAccounts.get(index).getBalance() + " in your account"); } } } public static int searchForAccount() { System.out.println("Please enter your account number"); int enteredAccountNumber = input.nextInt(); for (int i = 0; i < allAccounts.size(); i++) { if (enteredAccountNumber == (allAccounts.get(i).getAccountNumber())) { return i; } } return -1; } }
[ "ailisetaylor@localhost" ]
ailisetaylor@localhost
ba374eb1c6250171f9eea68d5f027a12414c37ec
0ea271177f5c42920ac53cd7f01f053dba5c14e4
/5.4.2/sources/org/telegram/ui/PhotoViewer.java
106b835fdef7924cd463a379060f68333db6cd6c
[]
no_license
alireza-ebrahimi/telegram-talaeii
367a81a77f9bc447e729b2ca339f9512a4c2860e
68a67e6f104ab8a0888e63c605e8bbad12c4a20e
refs/heads/master
2020-03-21T13:44:29.008002
2018-12-09T10:30:29
2018-12-09T10:30:29
138,622,926
12
1
null
null
null
null
UTF-8
Java
false
false
441,615
java
package org.telegram.ui; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorSet; import android.animation.ObjectAnimator; import android.annotation.SuppressLint; import android.app.Activity; import android.content.Context; import android.content.DialogInterface; import android.content.DialogInterface.OnDismissListener; import android.content.Intent; import android.content.SharedPreferences.Editor; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.Paint.Cap; import android.graphics.Paint.Join; import android.graphics.Paint.Style; import android.graphics.PorterDuff.Mode; import android.graphics.PorterDuffColorFilter; import android.graphics.Rect; import android.graphics.RectF; import android.graphics.SurfaceTexture; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.media.MediaCodecInfo; import android.net.Uri; import android.os.Build.VERSION; import android.os.Bundle; import android.support.v4.content.FileProvider; import android.text.Layout.Alignment; import android.text.SpannableStringBuilder; import android.text.StaticLayout; import android.text.TextPaint; import android.text.TextUtils; import android.text.TextUtils.TruncateAt; import android.view.ActionMode; import android.view.ContextThemeWrapper; import android.view.GestureDetector; import android.view.GestureDetector.OnDoubleTapListener; import android.view.GestureDetector.OnGestureListener; import android.view.KeyEvent; import android.view.MotionEvent; import android.view.TextureView; import android.view.VelocityTracker; import android.view.View; import android.view.View.MeasureSpec; import android.view.View.OnApplyWindowInsetsListener; import android.view.View.OnClickListener; import android.view.View.OnTouchListener; import android.view.ViewGroup; import android.view.WindowInsets; import android.view.WindowManager; import android.view.WindowManager.LayoutParams; import android.view.animation.AccelerateInterpolator; import android.view.animation.DecelerateInterpolator; import android.view.animation.OvershootInterpolator; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.ImageView.ScaleType; import android.widget.LinearLayout; import android.widget.Scroller; import android.widget.TextView; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import com.p054b.p055a.C1289d; import com.p054b.p055a.p056a.C1246e; import com.p054b.p055a.p056a.C1248b; import com.p054b.p055a.p056a.C1269l; import com.p054b.p055a.p056a.C1270m; import com.p054b.p055a.p056a.C1284y; import com.p054b.p055a.p056a.C1285z; import com.p057c.p058a.p063b.C1320g; import com.p057c.p058a.p063b.C1321h; import java.io.File; import java.lang.reflect.Array; import java.util.ArrayList; import java.util.Collection; import java.util.Date; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Locale; import org.ir.talaeii.R; import org.telegram.messenger.AndroidUtilities; import org.telegram.messenger.ApplicationLoader; import org.telegram.messenger.ChatObject; import org.telegram.messenger.ContactsController; import org.telegram.messenger.DispatchQueue; import org.telegram.messenger.Emoji; import org.telegram.messenger.EmojiSuggestion; import org.telegram.messenger.FileLoader; import org.telegram.messenger.FileLog; import org.telegram.messenger.ImageLoader; import org.telegram.messenger.ImageReceiver; import org.telegram.messenger.ImageReceiver.ImageReceiverDelegate; import org.telegram.messenger.LocaleController; import org.telegram.messenger.MediaController; import org.telegram.messenger.MediaController.PhotoEntry; import org.telegram.messenger.MediaController.SavedFilterState; import org.telegram.messenger.MediaController.SearchImage; import org.telegram.messenger.MessageObject; import org.telegram.messenger.MessagesController; import org.telegram.messenger.MessagesStorage; import org.telegram.messenger.NotificationCenter; import org.telegram.messenger.NotificationCenter.NotificationCenterDelegate; import org.telegram.messenger.SendMessagesHelper; import org.telegram.messenger.UserConfig; import org.telegram.messenger.UserObject; import org.telegram.messenger.Utilities; import org.telegram.messenger.VideoEditedInfo; import org.telegram.messenger.exoplayer2.C3446C; import org.telegram.messenger.exoplayer2.text.ttml.TtmlNode; import org.telegram.messenger.exoplayer2.ui.AspectRatioFrameLayout; import org.telegram.messenger.exoplayer2.util.MimeTypes; import org.telegram.messenger.query.SharedMediaQuery; import org.telegram.messenger.support.widget.LinearLayoutManager; import org.telegram.messenger.support.widget.RecyclerView; import org.telegram.messenger.support.widget.RecyclerView.Adapter; import org.telegram.messenger.support.widget.RecyclerView.ItemDecoration; import org.telegram.messenger.support.widget.RecyclerView.State; import org.telegram.messenger.support.widget.RecyclerView.ViewHolder; import org.telegram.messenger.support.widget.helper.ItemTouchHelper.Callback; import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; import org.telegram.tgnet.TLRPC$TL_inputPhoto; import org.telegram.tgnet.TLRPC$TL_message; import org.telegram.tgnet.TLRPC$TL_messageActionEmpty; import org.telegram.tgnet.TLRPC$TL_messageActionUserUpdatedPhoto; import org.telegram.tgnet.TLRPC$TL_messageMediaEmpty; import org.telegram.tgnet.TLRPC$TL_messageMediaInvoice; import org.telegram.tgnet.TLRPC$TL_messageMediaPhoto; import org.telegram.tgnet.TLRPC$TL_messageMediaWebPage; import org.telegram.tgnet.TLRPC$TL_messageService; import org.telegram.tgnet.TLRPC$TL_pageBlockAuthorDate; import org.telegram.tgnet.TLRPC$TL_pageFull; import org.telegram.tgnet.TLRPC$TL_photoEmpty; import org.telegram.tgnet.TLRPC$WebPage; import org.telegram.tgnet.TLRPC.BotInlineResult; import org.telegram.tgnet.TLRPC.Chat; import org.telegram.tgnet.TLRPC.EncryptedChat; import org.telegram.tgnet.TLRPC.FileLocation; import org.telegram.tgnet.TLRPC.InputPhoto; import org.telegram.tgnet.TLRPC.Message; import org.telegram.tgnet.TLRPC.PageBlock; import org.telegram.tgnet.TLRPC.Photo; import org.telegram.tgnet.TLRPC.PhotoSize; import org.telegram.tgnet.TLRPC.User; import org.telegram.ui.ActionBar.ActionBar; import org.telegram.ui.ActionBar.ActionBar.ActionBarMenuOnItemClick; import org.telegram.ui.ActionBar.ActionBarMenu; import org.telegram.ui.ActionBar.ActionBarMenuItem; import org.telegram.ui.ActionBar.AlertDialog; import org.telegram.ui.ActionBar.AlertDialog.Builder; import org.telegram.ui.ActionBar.BaseFragment; import org.telegram.ui.ActionBar.BottomSheet; import org.telegram.ui.ActionBar.Theme; import org.telegram.ui.Adapters.MentionsAdapter; import org.telegram.ui.Adapters.MentionsAdapter.MentionsAdapterDelegate; import org.telegram.ui.Cells.CheckBoxCell; import org.telegram.ui.Cells.PhotoPickerPhotoCell; import org.telegram.ui.Components.AnimatedFileDrawable; import org.telegram.ui.Components.BackupImageView; import org.telegram.ui.Components.ChatAttachAlert; import org.telegram.ui.Components.CheckBox; import org.telegram.ui.Components.ClippingImageView; import org.telegram.ui.Components.CubicBezierInterpolator; import org.telegram.ui.Components.LayoutHelper; import org.telegram.ui.Components.NumberPicker; import org.telegram.ui.Components.NumberPicker.Formatter; import org.telegram.ui.Components.PhotoCropView; import org.telegram.ui.Components.PhotoCropView.PhotoCropViewDelegate; import org.telegram.ui.Components.PhotoFilterView; import org.telegram.ui.Components.PhotoPaintView; import org.telegram.ui.Components.PhotoViewerCaptionEnterView; import org.telegram.ui.Components.PhotoViewerCaptionEnterView.PhotoViewerCaptionEnterViewDelegate; import org.telegram.ui.Components.PickerBottomLayoutViewer; import org.telegram.ui.Components.RadialProgressView; import org.telegram.ui.Components.RecyclerListView; import org.telegram.ui.Components.RecyclerListView.Holder; import org.telegram.ui.Components.RecyclerListView.OnItemClickListener; import org.telegram.ui.Components.RecyclerListView.OnItemLongClickListener; import org.telegram.ui.Components.RecyclerListView.SelectionAdapter; import org.telegram.ui.Components.SeekBar; import org.telegram.ui.Components.SeekBar.SeekBarDelegate; import org.telegram.ui.Components.SizeNotifierFrameLayoutPhoto; import org.telegram.ui.Components.StickersAlert; import org.telegram.ui.Components.VideoPlayer; import org.telegram.ui.Components.VideoPlayer.VideoPlayerDelegate; import org.telegram.ui.Components.VideoTimelinePlayView; import org.telegram.ui.Components.VideoTimelinePlayView.VideoTimelineViewDelegate; import org.telegram.ui.DialogsActivity.DialogsActivityDelegate; import utils.p178a.C3791b; public class PhotoViewer implements OnDoubleTapListener, OnGestureListener, NotificationCenterDelegate { @SuppressLint({"StaticFieldLeak"}) private static volatile PhotoViewer Instance = null; private static DecelerateInterpolator decelerateInterpolator = null; private static final int gallery_menu_delete = 6; private static final int gallery_menu_masks = 13; private static final int gallery_menu_openin = 11; private static final int gallery_menu_save = 1; private static final int gallery_menu_send = 3; private static final int gallery_menu_share = 10; private static final int gallery_menu_showall = 2; private static final int gallery_menu_showinchat = 4; private static Drawable[] progressDrawables; private static Paint progressPaint; private ActionBar actionBar; private Context actvityContext; private boolean allowMentions; private boolean allowShare; private float animateToScale; private float animateToX; private float animateToY; private ClippingImageView animatingImageView; private Runnable animationEndRunnable; private int animationInProgress; private long animationStartTime; private float animationValue; private float[][] animationValues = ((float[][]) Array.newInstance(Float.TYPE, new int[]{2, 8})); private boolean applying; private AspectRatioFrameLayout aspectRatioFrameLayout; private boolean attachedToWindow; private long audioFramesSize; private ArrayList<Photo> avatarsArr = new ArrayList(); private int avatarsDialogId; private BackgroundDrawable backgroundDrawable = new BackgroundDrawable(Theme.ACTION_BAR_VIDEO_EDIT_COLOR); private int bitrate; private Paint blackPaint = new Paint(); private FrameLayout bottomLayout; private boolean bottomTouchEnabled = true; private boolean canDragDown = true; private boolean canShowBottom = true; private boolean canZoom = true; private PhotoViewerCaptionEnterView captionEditText; private TextView captionTextView; private ImageReceiver centerImage = new ImageReceiver(); private AnimatorSet changeModeAnimation; private boolean changingPage; private CheckBox checkImageView; private int classGuid; private ImageView compressItem; private AnimatorSet compressItemAnimation; private int compressionsCount = -1; private FrameLayoutDrawer containerView; private ImageView cropItem; private AnimatorSet currentActionBarAnimation; private AnimatedFileDrawable currentAnimation; private BotInlineResult currentBotInlineResult; private long currentDialogId; private int currentEditMode; private FileLocation currentFileLocation; private String[] currentFileNames = new String[3]; private int currentIndex; private AnimatorSet currentListViewAnimation; private Runnable currentLoadingVideoRunnable; private MessageObject currentMessageObject; private String currentPathObject; private PlaceProviderObject currentPlaceObject; private File currentPlayingVideoFile; private String currentSubtitle; private Bitmap currentThumb; private FileLocation currentUserAvatarLocation = null; private int dateOverride; private TextView dateTextView; private boolean disableShowCheck; private boolean discardTap; private boolean doneButtonPressed; private boolean dontResetZoomOnFirstLayout; private boolean doubleTap; private float dragY; private boolean draggingDown; private PickerBottomLayoutViewer editorDoneLayout; private boolean[] endReached = new boolean[]{false, true}; private long endTime; private long estimatedDuration; private int estimatedSize; boolean fromCamera; private GestureDetector gestureDetector; private GroupedPhotosListView groupedPhotosListView; private PlaceProviderObject hideAfterAnimation; private AnimatorSet hintAnimation; private Runnable hintHideRunnable; private TextView hintTextView; private boolean ignoreDidSetImage; private AnimatorSet imageMoveAnimation; private ArrayList<MessageObject> imagesArr = new ArrayList(); private ArrayList<Object> imagesArrLocals = new ArrayList(); private ArrayList<FileLocation> imagesArrLocations = new ArrayList(); private ArrayList<Integer> imagesArrLocationsSizes = new ArrayList(); private ArrayList<MessageObject> imagesArrTemp = new ArrayList(); private HashMap<Integer, MessageObject>[] imagesByIds = new HashMap[]{new HashMap(), new HashMap()}; private HashMap<Integer, MessageObject>[] imagesByIdsTemp = new HashMap[]{new HashMap(), new HashMap()}; private boolean inPreview; private DecelerateInterpolator interpolator = new DecelerateInterpolator(1.5f); private boolean invalidCoords; private boolean isActionBarVisible = true; private boolean isCurrentVideo; private boolean isEvent; private boolean isFirstLoading; private boolean isPhotosListViewVisible; private boolean isPlaying; private boolean isVisible; private LinearLayout itemsLayout; private Object lastInsets; private String lastTitle; private ImageReceiver leftImage = new ImageReceiver(); private boolean loadInitialVideo; private boolean loadingMoreImages; private ActionBarMenuItem masksItem; private float maxX; private float maxY; private LinearLayoutManager mentionLayoutManager; private AnimatorSet mentionListAnimation; private RecyclerListView mentionListView; private MentionsAdapter mentionsAdapter; private ActionBarMenuItem menuItem; private long mergeDialogId; private float minX; private float minY; private float moveStartX; private float moveStartY; private boolean moving; private ImageView muteItem; private boolean muteVideo; private String nameOverride; private TextView nameTextView; private boolean needCaptionLayout; private boolean needSearchImageInArr; private boolean opennedFromMedia; private int originalBitrate; private int originalHeight; private long originalSize; private int originalWidth; private ImageView paintItem; private Activity parentActivity; private ChatAttachAlert parentAlert; private ChatActivity parentChatActivity; private PhotoCropView photoCropView; private PhotoFilterView photoFilterView; private PhotoPaintView photoPaintView; private PhotoProgressView[] photoProgressViews = new PhotoProgressView[3]; private CounterView photosCounterView; private FrameLayout pickerView; private ImageView pickerViewSendButton; private float pinchCenterX; private float pinchCenterY; private float pinchStartDistance; private float pinchStartScale = 1.0f; private float pinchStartX; private float pinchStartY; private PhotoViewerProvider placeProvider; private int previewViewEnd; private int previousCompression; private RadialProgressView progressView; private QualityChooseView qualityChooseView; private AnimatorSet qualityChooseViewAnimation; private PickerBottomLayoutViewer qualityPicker; private boolean requestingPreview; private TextView resetButton; private int resultHeight; private int resultWidth; private ImageReceiver rightImage = new ImageReceiver(); private int rotationValue; private float scale = 1.0f; private Scroller scroller; private int selectedCompression; private ListAdapter selectedPhotosAdapter; private RecyclerListView selectedPhotosListView; private ActionBarMenuItem sendItem; private int sendPhotoType; private ImageView shareButton; private PlaceProviderObject showAfterAnimation; private int slideshowMessageId; private long startTime; private int switchImageAfterAnimation; private boolean textureUploaded; private ImageView timeItem; private int totalImagesCount; private int totalImagesCountMerge; private long transitionAnimationStartTime; private float translationX; private float translationY; private boolean tryStartRequestPreviewOnFinish; private ImageView tuneItem; private Runnable updateProgressRunnable = new C50451(); private VelocityTracker velocityTracker; private float videoCrossfadeAlpha; private long videoCrossfadeAlphaLastTime; private boolean videoCrossfadeStarted; private float videoDuration; private long videoFramesSize; private boolean videoHasAudio; private ImageView videoPlayButton; private VideoPlayer videoPlayer; private FrameLayout videoPlayerControlFrameLayout; private SeekBar videoPlayerSeekbar; private TextView videoPlayerTime; private MessageObject videoPreviewMessageObject; private TextureView videoTextureView; private VideoTimelinePlayView videoTimelineView; private AlertDialog visibleDialog; private boolean wasLayout; private LayoutParams windowLayoutParams; private FrameLayout windowView; private boolean zoomAnimation; private boolean zooming; public interface PhotoViewerProvider { boolean allowCaption(); boolean allowGroupPhotos(); boolean canScrollAway(); boolean cancelButtonPressed(); PlaceProviderObject getPlaceForPhoto(MessageObject messageObject, FileLocation fileLocation, int i); int getSelectedCount(); HashMap<Object, Object> getSelectedPhotos(); ArrayList<Object> getSelectedPhotosOrder(); Bitmap getThumbForPhoto(MessageObject messageObject, FileLocation fileLocation, int i); boolean isPhotoChecked(int i); boolean scaleToFill(); void sendButtonPressed(int i, VideoEditedInfo videoEditedInfo); int setPhotoChecked(int i, VideoEditedInfo videoEditedInfo); void toggleGroupPhotosEnabled(); void updatePhotoAtIndex(int i); void willHidePhotoViewer(); void willSwitchFromPhoto(MessageObject messageObject, FileLocation fileLocation, int i); } public static class EmptyPhotoViewerProvider implements PhotoViewerProvider { public boolean allowCaption() { return true; } public boolean allowGroupPhotos() { return true; } public boolean canScrollAway() { return true; } public boolean cancelButtonPressed() { return true; } public PlaceProviderObject getPlaceForPhoto(MessageObject messageObject, FileLocation fileLocation, int i) { return null; } public int getSelectedCount() { return 0; } public HashMap<Object, Object> getSelectedPhotos() { return null; } public ArrayList<Object> getSelectedPhotosOrder() { return null; } public Bitmap getThumbForPhoto(MessageObject messageObject, FileLocation fileLocation, int i) { return null; } public boolean isPhotoChecked(int i) { return false; } public boolean scaleToFill() { return false; } public void sendButtonPressed(int i, VideoEditedInfo videoEditedInfo) { } public int setPhotoChecked(int i, VideoEditedInfo videoEditedInfo) { return -1; } public void toggleGroupPhotosEnabled() { } public void updatePhotoAtIndex(int i) { } public void willHidePhotoViewer() { } public void willSwitchFromPhoto(MessageObject messageObject, FileLocation fileLocation, int i) { } } /* renamed from: org.telegram.ui.PhotoViewer$1 */ class C50451 implements Runnable { C50451() { } public void run() { float f = 1.0f; float f2 = BitmapDescriptorFactory.HUE_RED; if (PhotoViewer.this.videoPlayer != null) { float currentPosition; if (PhotoViewer.this.isCurrentVideo) { if (!PhotoViewer.this.videoTimelineView.isDragging()) { currentPosition = ((float) PhotoViewer.this.videoPlayer.getCurrentPosition()) / ((float) PhotoViewer.this.videoPlayer.getDuration()); if (PhotoViewer.this.inPreview || PhotoViewer.this.videoTimelineView.getVisibility() != 0) { PhotoViewer.this.videoTimelineView.setProgress(currentPosition); } else if (currentPosition >= PhotoViewer.this.videoTimelineView.getRightProgress()) { PhotoViewer.this.videoPlayer.pause(); PhotoViewer.this.videoTimelineView.setProgress(BitmapDescriptorFactory.HUE_RED); PhotoViewer.this.videoPlayer.seekTo((long) ((int) (PhotoViewer.this.videoTimelineView.getLeftProgress() * ((float) PhotoViewer.this.videoPlayer.getDuration())))); PhotoViewer.this.containerView.invalidate(); } else { currentPosition -= PhotoViewer.this.videoTimelineView.getLeftProgress(); if (currentPosition >= BitmapDescriptorFactory.HUE_RED) { f2 = currentPosition; } f2 /= PhotoViewer.this.videoTimelineView.getRightProgress() - PhotoViewer.this.videoTimelineView.getLeftProgress(); if (f2 > 1.0f) { f2 = 1.0f; } PhotoViewer.this.videoTimelineView.setProgress(f2); } PhotoViewer.this.updateVideoPlayerTime(); } } else if (!PhotoViewer.this.videoPlayerSeekbar.isDragging()) { currentPosition = ((float) PhotoViewer.this.videoPlayer.getCurrentPosition()) / ((float) PhotoViewer.this.videoPlayer.getDuration()); if (PhotoViewer.this.inPreview || PhotoViewer.this.videoTimelineView.getVisibility() != 0) { PhotoViewer.this.videoPlayerSeekbar.setProgress(currentPosition); } else if (currentPosition >= PhotoViewer.this.videoTimelineView.getRightProgress()) { PhotoViewer.this.videoPlayer.pause(); PhotoViewer.this.videoPlayerSeekbar.setProgress(BitmapDescriptorFactory.HUE_RED); PhotoViewer.this.videoPlayer.seekTo((long) ((int) (PhotoViewer.this.videoTimelineView.getLeftProgress() * ((float) PhotoViewer.this.videoPlayer.getDuration())))); PhotoViewer.this.containerView.invalidate(); } else { currentPosition -= PhotoViewer.this.videoTimelineView.getLeftProgress(); if (currentPosition >= BitmapDescriptorFactory.HUE_RED) { f2 = currentPosition; } f2 /= PhotoViewer.this.videoTimelineView.getRightProgress() - PhotoViewer.this.videoTimelineView.getLeftProgress(); if (f2 <= 1.0f) { f = f2; } PhotoViewer.this.videoPlayerSeekbar.setProgress(f); } PhotoViewer.this.videoPlayerControlFrameLayout.invalidate(); PhotoViewer.this.updateVideoPlayerTime(); } } if (PhotoViewer.this.isPlaying) { AndroidUtilities.runOnUIThread(PhotoViewer.this.updateProgressRunnable); } } } /* renamed from: org.telegram.ui.PhotoViewer$3 */ class C50573 implements OnApplyWindowInsetsListener { C50573() { } @SuppressLint({"NewApi"}) public WindowInsets onApplyWindowInsets(View view, WindowInsets windowInsets) { WindowInsets windowInsets2 = (WindowInsets) PhotoViewer.this.lastInsets; PhotoViewer.this.lastInsets = windowInsets; if (windowInsets2 == null || !windowInsets2.toString().equals(windowInsets.toString())) { PhotoViewer.this.windowView.requestLayout(); } return windowInsets.consumeSystemWindowInsets(); } } /* renamed from: org.telegram.ui.PhotoViewer$4 */ class C50674 extends ActionBarMenuOnItemClick { C50674() { } public boolean canOpenMenu() { if (PhotoViewer.this.currentMessageObject != null) { if (FileLoader.getPathToMessage(PhotoViewer.this.currentMessageObject.messageOwner).exists()) { return true; } } else if (PhotoViewer.this.currentFileLocation != null) { TLObject access$5600 = PhotoViewer.this.currentFileLocation; boolean z = PhotoViewer.this.avatarsDialogId != 0 || PhotoViewer.this.isEvent; if (FileLoader.getPathToAttach(access$5600, z).exists()) { return true; } } return false; } public void onItemClick(int i) { int i2 = 1; if (i == -1) { if (PhotoViewer.this.needCaptionLayout && (PhotoViewer.this.captionEditText.isPopupShowing() || PhotoViewer.this.captionEditText.isKeyboardVisible())) { PhotoViewer.this.closeCaptionEnter(false); } else { PhotoViewer.this.closePhoto(true, false); } } else if (i == 1) { if (VERSION.SDK_INT < 23 || PhotoViewer.this.parentActivity.checkSelfPermission("android.permission.WRITE_EXTERNAL_STORAGE") == 0) { File pathToMessage; if (PhotoViewer.this.currentMessageObject != null) { pathToMessage = FileLoader.getPathToMessage(PhotoViewer.this.currentMessageObject.messageOwner); } else if (PhotoViewer.this.currentFileLocation != null) { TLObject access$5600 = PhotoViewer.this.currentFileLocation; boolean z = PhotoViewer.this.avatarsDialogId != 0 || PhotoViewer.this.isEvent; pathToMessage = FileLoader.getPathToAttach(access$5600, z); } else { pathToMessage = null; } if (pathToMessage == null || !pathToMessage.exists()) { Builder builder = new Builder(PhotoViewer.this.parentActivity); builder.setTitle(LocaleController.getString("AppName", R.string.AppName)); builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null); builder.setMessage(LocaleController.getString("PleaseDownload", R.string.PleaseDownload)); PhotoViewer.this.showAlertDialog(builder); return; } String file = pathToMessage.toString(); Context access$1500 = PhotoViewer.this.parentActivity; if (PhotoViewer.this.currentMessageObject == null || !PhotoViewer.this.currentMessageObject.isVideo()) { i2 = 0; } MediaController.saveFile(file, access$1500, i2, null, null); return; } PhotoViewer.this.parentActivity.requestPermissions(new String[]{"android.permission.WRITE_EXTERNAL_STORAGE"}, 4); } else if (i == 2) { if (PhotoViewer.this.currentDialogId != 0) { PhotoViewer.this.disableShowCheck = true; r0 = new Bundle(); r0.putLong("dialog_id", PhotoViewer.this.currentDialogId); r3 = new MediaActivity(r0); if (PhotoViewer.this.parentChatActivity != null) { r3.setChatInfo(PhotoViewer.this.parentChatActivity.getCurrentChatInfo()); } PhotoViewer.this.closePhoto(false, false); ((LaunchActivity) PhotoViewer.this.parentActivity).presentFragment(r3, false, true); } } else if (i == 4) { if (PhotoViewer.this.currentMessageObject != null) { Bundle bundle = new Bundle(); r0 = (int) PhotoViewer.this.currentDialogId; int access$5900 = (int) (PhotoViewer.this.currentDialogId >> 32); if (r0 == 0) { bundle.putInt("enc_id", access$5900); } else if (access$5900 == 1) { bundle.putInt("chat_id", r0); } else if (r0 > 0) { bundle.putInt("user_id", r0); } else if (r0 < 0) { r4 = MessagesController.getInstance().getChat(Integer.valueOf(-r0)); if (!(r4 == null || r4.migrated_to == null)) { bundle.putInt("migrated_to", r0); r0 = -r4.migrated_to.channel_id; } bundle.putInt("chat_id", -r0); } bundle.putInt("message_id", PhotoViewer.this.currentMessageObject.getId()); NotificationCenter.getInstance().postNotificationName(NotificationCenter.closeChats, new Object[0]); ((LaunchActivity) PhotoViewer.this.parentActivity).presentFragment(new ChatActivity(bundle), true, true); PhotoViewer.this.currentMessageObject = null; PhotoViewer.this.closePhoto(false, false); } } else if (i == 3) { if (PhotoViewer.this.currentMessageObject != null && PhotoViewer.this.parentActivity != null) { r0 = new Bundle(); r0.putBoolean("onlySelect", true); r0.putInt("dialogsType", 3); r3 = new DialogsActivity(r0); final ArrayList arrayList = new ArrayList(); arrayList.add(PhotoViewer.this.currentMessageObject); r3.setDelegate(new DialogsActivityDelegate() { public void didSelectDialogs(DialogsActivity dialogsActivity, ArrayList<Long> arrayList, CharSequence charSequence, boolean z) { int i = 0; if (arrayList.size() > 1 || ((Long) arrayList.get(0)).longValue() == ((long) UserConfig.getClientUserId()) || charSequence != null) { while (i < arrayList.size()) { long longValue = ((Long) arrayList.get(i)).longValue(); if (charSequence != null) { SendMessagesHelper.getInstance().sendMessage(charSequence.toString(), longValue, null, null, true, null, null, null); } SendMessagesHelper.getInstance().sendMessage(arrayList, longValue); i++; } dialogsActivity.finishFragment(); return; } long longValue2 = ((Long) arrayList.get(0)).longValue(); int i2 = (int) longValue2; int i3 = (int) (longValue2 >> 32); Bundle bundle = new Bundle(); bundle.putBoolean("scrollToTopOnResume", true); if (i2 == 0) { bundle.putInt("enc_id", i3); } else if (i2 > 0) { bundle.putInt("user_id", i2); } else if (i2 < 0) { bundle.putInt("chat_id", -i2); } NotificationCenter.getInstance().postNotificationName(NotificationCenter.closeChats, new Object[0]); BaseFragment chatActivity = new ChatActivity(bundle); if (((LaunchActivity) PhotoViewer.this.parentActivity).presentFragment(chatActivity, true, false)) { chatActivity.showReplyPanel(true, null, arrayList, null, false); return; } dialogsActivity.finishFragment(); } }); ((LaunchActivity) PhotoViewer.this.parentActivity).presentFragment(r3, false, true); PhotoViewer.this.closePhoto(false, false); } } else if (i == 6) { if (PhotoViewer.this.parentActivity != null) { Builder builder2 = new Builder(PhotoViewer.this.parentActivity); if (PhotoViewer.this.currentMessageObject != null && PhotoViewer.this.currentMessageObject.isVideo()) { builder2.setMessage(LocaleController.formatString("AreYouSureDeleteVideo", R.string.AreYouSureDeleteVideo, new Object[0])); } else if (PhotoViewer.this.currentMessageObject == null || !PhotoViewer.this.currentMessageObject.isGif()) { builder2.setMessage(LocaleController.formatString("AreYouSureDeletePhoto", R.string.AreYouSureDeletePhoto, new Object[0])); } else { builder2.setMessage(LocaleController.formatString("AreYouSure", R.string.AreYouSure, new Object[0])); } builder2.setTitle(LocaleController.getString("AppName", R.string.AppName)); final boolean[] zArr = new boolean[1]; if (PhotoViewer.this.currentMessageObject != null) { r0 = (int) PhotoViewer.this.currentMessageObject.getDialogId(); if (r0 != 0) { User user; if (r0 > 0) { user = MessagesController.getInstance().getUser(Integer.valueOf(r0)); r4 = null; } else { r4 = MessagesController.getInstance().getChat(Integer.valueOf(-r0)); user = null; } if (!(user == null && ChatObject.isChannel(r4))) { int currentTime = ConnectionsManager.getInstance().getCurrentTime(); if (!((user == null || user.id == UserConfig.getClientUserId()) && r4 == null) && ((PhotoViewer.this.currentMessageObject.messageOwner.action == null || (PhotoViewer.this.currentMessageObject.messageOwner.action instanceof TLRPC$TL_messageActionEmpty)) && PhotoViewer.this.currentMessageObject.isOut() && currentTime - PhotoViewer.this.currentMessageObject.messageOwner.date <= 172800)) { View frameLayout = new FrameLayout(PhotoViewer.this.parentActivity); View checkBoxCell = new CheckBoxCell(PhotoViewer.this.parentActivity, true); checkBoxCell.setBackgroundDrawable(Theme.getSelectorDrawable(false)); if (r4 != null) { checkBoxCell.setText(LocaleController.getString("DeleteForAll", R.string.DeleteForAll), TtmlNode.ANONYMOUS_REGION_ID, false, false); } else { checkBoxCell.setText(LocaleController.formatString("DeleteForUser", R.string.DeleteForUser, new Object[]{UserObject.getFirstName(user)}), TtmlNode.ANONYMOUS_REGION_ID, false, false); } checkBoxCell.setPadding(LocaleController.isRTL ? AndroidUtilities.dp(16.0f) : AndroidUtilities.dp(8.0f), 0, LocaleController.isRTL ? AndroidUtilities.dp(8.0f) : AndroidUtilities.dp(16.0f), 0); frameLayout.addView(checkBoxCell, LayoutHelper.createFrame(-1, 48.0f, 51, BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED)); checkBoxCell.setOnClickListener(new OnClickListener() { public void onClick(View view) { CheckBoxCell checkBoxCell = (CheckBoxCell) view; zArr[0] = !zArr[0]; checkBoxCell.setChecked(zArr[0], true); } }); builder2.setView(frameLayout); } } } } builder2.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialogInterface, int i) { EncryptedChat encryptedChat = null; if (PhotoViewer.this.imagesArr.isEmpty()) { if (!PhotoViewer.this.avatarsArr.isEmpty() && PhotoViewer.this.currentIndex >= 0 && PhotoViewer.this.currentIndex < PhotoViewer.this.avatarsArr.size()) { boolean z; InputPhoto tLRPC$TL_inputPhoto; int access$1100; Photo photo = (Photo) PhotoViewer.this.avatarsArr.get(PhotoViewer.this.currentIndex); FileLocation fileLocation = (FileLocation) PhotoViewer.this.imagesArrLocations.get(PhotoViewer.this.currentIndex); Photo photo2 = photo instanceof TLRPC$TL_photoEmpty ? null : photo; if (PhotoViewer.this.currentUserAvatarLocation != null) { if (photo2 != null) { Iterator it = photo2.sizes.iterator(); while (it.hasNext()) { PhotoSize photoSize = (PhotoSize) it.next(); if (photoSize.location.local_id == PhotoViewer.this.currentUserAvatarLocation.local_id && photoSize.location.volume_id == PhotoViewer.this.currentUserAvatarLocation.volume_id) { z = true; break; } } } else if (fileLocation.local_id == PhotoViewer.this.currentUserAvatarLocation.local_id && fileLocation.volume_id == PhotoViewer.this.currentUserAvatarLocation.volume_id) { z = true; if (z) { MessagesController.getInstance().deleteUserPhoto(null); PhotoViewer.this.closePhoto(false, false); } else if (photo2 != null) { tLRPC$TL_inputPhoto = new TLRPC$TL_inputPhoto(); tLRPC$TL_inputPhoto.id = photo2.id; tLRPC$TL_inputPhoto.access_hash = photo2.access_hash; MessagesController.getInstance().deleteUserPhoto(tLRPC$TL_inputPhoto); MessagesStorage.getInstance().clearUserPhoto(PhotoViewer.this.avatarsDialogId, photo2.id); PhotoViewer.this.imagesArrLocations.remove(PhotoViewer.this.currentIndex); PhotoViewer.this.imagesArrLocationsSizes.remove(PhotoViewer.this.currentIndex); PhotoViewer.this.avatarsArr.remove(PhotoViewer.this.currentIndex); if (PhotoViewer.this.imagesArrLocations.isEmpty()) { access$1100 = PhotoViewer.this.currentIndex; if (access$1100 >= PhotoViewer.this.avatarsArr.size()) { access$1100 = PhotoViewer.this.avatarsArr.size() - 1; } PhotoViewer.this.currentIndex = -1; PhotoViewer.this.setImageIndex(access$1100, true); return; } PhotoViewer.this.closePhoto(false, false); } } } z = false; if (z) { MessagesController.getInstance().deleteUserPhoto(null); PhotoViewer.this.closePhoto(false, false); } else if (photo2 != null) { tLRPC$TL_inputPhoto = new TLRPC$TL_inputPhoto(); tLRPC$TL_inputPhoto.id = photo2.id; tLRPC$TL_inputPhoto.access_hash = photo2.access_hash; MessagesController.getInstance().deleteUserPhoto(tLRPC$TL_inputPhoto); MessagesStorage.getInstance().clearUserPhoto(PhotoViewer.this.avatarsDialogId, photo2.id); PhotoViewer.this.imagesArrLocations.remove(PhotoViewer.this.currentIndex); PhotoViewer.this.imagesArrLocationsSizes.remove(PhotoViewer.this.currentIndex); PhotoViewer.this.avatarsArr.remove(PhotoViewer.this.currentIndex); if (PhotoViewer.this.imagesArrLocations.isEmpty()) { access$1100 = PhotoViewer.this.currentIndex; if (access$1100 >= PhotoViewer.this.avatarsArr.size()) { access$1100 = PhotoViewer.this.avatarsArr.size() - 1; } PhotoViewer.this.currentIndex = -1; PhotoViewer.this.setImageIndex(access$1100, true); return; } PhotoViewer.this.closePhoto(false, false); } } } else if (PhotoViewer.this.currentIndex >= 0 && PhotoViewer.this.currentIndex < PhotoViewer.this.imagesArr.size()) { MessageObject messageObject = (MessageObject) PhotoViewer.this.imagesArr.get(PhotoViewer.this.currentIndex); if (messageObject.isSent()) { ArrayList arrayList; PhotoViewer.this.closePhoto(false, false); ArrayList arrayList2 = new ArrayList(); if (PhotoViewer.this.slideshowMessageId != 0) { arrayList2.add(Integer.valueOf(PhotoViewer.this.slideshowMessageId)); } else { arrayList2.add(Integer.valueOf(messageObject.getId())); } if (((int) messageObject.getDialogId()) != 0 || messageObject.messageOwner.random_id == 0) { arrayList = null; } else { arrayList = new ArrayList(); arrayList.add(Long.valueOf(messageObject.messageOwner.random_id)); encryptedChat = MessagesController.getInstance().getEncryptedChat(Integer.valueOf((int) (messageObject.getDialogId() >> 32))); } MessagesController.getInstance().deleteMessages(arrayList2, arrayList, encryptedChat, messageObject.messageOwner.to_id.channel_id, zArr[0]); } } } }); builder2.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null); PhotoViewer.this.showAlertDialog(builder2); } } else if (i == 10) { PhotoViewer.this.onSharePressed(); } else if (i == 11) { try { AndroidUtilities.openForView(PhotoViewer.this.currentMessageObject, PhotoViewer.this.parentActivity); PhotoViewer.this.closePhoto(false, false); } catch (Throwable e) { FileLog.e(e); } } else if (i == 13 && PhotoViewer.this.parentActivity != null && PhotoViewer.this.currentMessageObject != null && PhotoViewer.this.currentMessageObject.messageOwner.media != null && PhotoViewer.this.currentMessageObject.messageOwner.media.photo != null) { new StickersAlert(PhotoViewer.this.parentActivity, PhotoViewer.this.currentMessageObject.messageOwner.media.photo).show(); } } } /* renamed from: org.telegram.ui.PhotoViewer$6 */ class C50746 implements OnClickListener { C50746() { } public void onClick(View view) { PhotoViewer.this.openCaptionEnter(); } } /* renamed from: org.telegram.ui.PhotoViewer$7 */ class C50757 implements OnClickListener { C50757() { } public void onClick(View view) { PhotoViewer.this.onSharePressed(); } } /* renamed from: org.telegram.ui.PhotoViewer$8 */ class C50768 implements SeekBarDelegate { C50768() { } public void onSeekBarDrag(float f) { if (PhotoViewer.this.videoPlayer != null) { if (!PhotoViewer.this.inPreview && PhotoViewer.this.videoTimelineView.getVisibility() == 0) { f = PhotoViewer.this.videoTimelineView.getLeftProgress() + ((PhotoViewer.this.videoTimelineView.getRightProgress() - PhotoViewer.this.videoTimelineView.getLeftProgress()) * f); } PhotoViewer.this.videoPlayer.seekTo((long) ((int) (((float) PhotoViewer.this.videoPlayer.getDuration()) * f))); } } } private class BackgroundDrawable extends ColorDrawable { private boolean allowDrawContent; private Runnable drawRunnable; /* renamed from: org.telegram.ui.PhotoViewer$BackgroundDrawable$1 */ class C50781 implements Runnable { C50781() { } public void run() { if (PhotoViewer.this.parentAlert != null) { PhotoViewer.this.parentAlert.setAllowDrawContent(BackgroundDrawable.this.allowDrawContent); } } } public BackgroundDrawable(int i) { super(i); } public void draw(Canvas canvas) { super.draw(canvas); if (getAlpha() != 0 && this.drawRunnable != null) { AndroidUtilities.runOnUIThread(this.drawRunnable); this.drawRunnable = null; } } public void setAlpha(int i) { if (PhotoViewer.this.parentActivity instanceof LaunchActivity) { boolean z = (PhotoViewer.this.isVisible && i == 255) ? false : true; this.allowDrawContent = z; ((LaunchActivity) PhotoViewer.this.parentActivity).drawerLayoutContainer.setAllowDrawContent(this.allowDrawContent); if (PhotoViewer.this.parentAlert != null) { if (!this.allowDrawContent) { AndroidUtilities.runOnUIThread(new C50781(), 50); } else if (PhotoViewer.this.parentAlert != null) { PhotoViewer.this.parentAlert.setAllowDrawContent(this.allowDrawContent); } } } super.setAlpha(i); } } private class CounterView extends View { private int currentCount = 0; private int height; private Paint paint; private RectF rect; private float rotation; private StaticLayout staticLayout; private TextPaint textPaint = new TextPaint(1); private int width; public CounterView(Context context) { super(context); this.textPaint.setTextSize((float) AndroidUtilities.dp(18.0f)); this.textPaint.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); this.textPaint.setColor(-1); this.paint = new Paint(1); this.paint.setColor(-1); this.paint.setStrokeWidth((float) AndroidUtilities.dp(2.0f)); this.paint.setStyle(Style.STROKE); this.paint.setStrokeJoin(Join.ROUND); this.rect = new RectF(); setCount(0); } public float getRotationX() { return this.rotation; } protected void onDraw(Canvas canvas) { int measuredHeight = getMeasuredHeight() / 2; this.paint.setAlpha(255); this.rect.set((float) AndroidUtilities.dp(1.0f), (float) (measuredHeight - AndroidUtilities.dp(14.0f)), (float) (getMeasuredWidth() - AndroidUtilities.dp(1.0f)), (float) (measuredHeight + AndroidUtilities.dp(14.0f))); canvas.drawRoundRect(this.rect, (float) AndroidUtilities.dp(15.0f), (float) AndroidUtilities.dp(15.0f), this.paint); if (this.staticLayout != null) { this.textPaint.setAlpha((int) ((1.0f - this.rotation) * 255.0f)); canvas.save(); canvas.translate((float) ((getMeasuredWidth() - this.width) / 2), (((float) ((getMeasuredHeight() - this.height) / 2)) + AndroidUtilities.dpf2(0.2f)) + (this.rotation * ((float) AndroidUtilities.dp(5.0f)))); this.staticLayout.draw(canvas); canvas.restore(); this.paint.setAlpha((int) (this.rotation * 255.0f)); int centerX = (int) this.rect.centerX(); int centerY = (int) (((float) ((int) this.rect.centerY())) - ((((float) AndroidUtilities.dp(5.0f)) * (1.0f - this.rotation)) + ((float) AndroidUtilities.dp(3.0f)))); canvas.drawLine((float) (AndroidUtilities.dp(0.5f) + centerX), (float) (centerY - AndroidUtilities.dp(0.5f)), (float) (centerX - AndroidUtilities.dp(6.0f)), (float) (AndroidUtilities.dp(6.0f) + centerY), this.paint); canvas.drawLine((float) (centerX - AndroidUtilities.dp(0.5f)), (float) (centerY - AndroidUtilities.dp(0.5f)), (float) (AndroidUtilities.dp(6.0f) + centerX), (float) (AndroidUtilities.dp(6.0f) + centerY), this.paint); } } protected void onMeasure(int i, int i2) { super.onMeasure(MeasureSpec.makeMeasureSpec(Math.max(this.width + AndroidUtilities.dp(20.0f), AndroidUtilities.dp(30.0f)), 1073741824), MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(40.0f), 1073741824)); } public void setCount(int i) { this.staticLayout = new StaticLayout(TtmlNode.ANONYMOUS_REGION_ID + Math.max(1, i), this.textPaint, AndroidUtilities.dp(100.0f), Alignment.ALIGN_NORMAL, 1.0f, BitmapDescriptorFactory.HUE_RED, false); this.width = (int) Math.ceil((double) this.staticLayout.getLineWidth(0)); this.height = this.staticLayout.getLineBottom(0); AnimatorSet animatorSet = new AnimatorSet(); if (i == 0) { Animator[] animatorArr = new Animator[4]; animatorArr[0] = ObjectAnimator.ofFloat(this, "scaleX", new float[]{BitmapDescriptorFactory.HUE_RED}); animatorArr[1] = ObjectAnimator.ofFloat(this, "scaleY", new float[]{BitmapDescriptorFactory.HUE_RED}); animatorArr[2] = ObjectAnimator.ofInt(this.paint, "alpha", new int[]{0}); animatorArr[3] = ObjectAnimator.ofInt(this.textPaint, "alpha", new int[]{0}); animatorSet.playTogether(animatorArr); animatorSet.setInterpolator(new DecelerateInterpolator()); } else if (this.currentCount == 0) { animatorSet.playTogether(new Animator[]{ObjectAnimator.ofFloat(this, "scaleX", new float[]{BitmapDescriptorFactory.HUE_RED, 1.0f}), ObjectAnimator.ofFloat(this, "scaleY", new float[]{BitmapDescriptorFactory.HUE_RED, 1.0f}), ObjectAnimator.ofInt(this.paint, "alpha", new int[]{0, 255}), ObjectAnimator.ofInt(this.textPaint, "alpha", new int[]{0, 255})}); animatorSet.setInterpolator(new DecelerateInterpolator()); } else if (i < this.currentCount) { animatorSet.playTogether(new Animator[]{ObjectAnimator.ofFloat(this, "scaleX", new float[]{1.1f, 1.0f}), ObjectAnimator.ofFloat(this, "scaleY", new float[]{1.1f, 1.0f})}); animatorSet.setInterpolator(new OvershootInterpolator()); } else { animatorSet.playTogether(new Animator[]{ObjectAnimator.ofFloat(this, "scaleX", new float[]{0.9f, 1.0f}), ObjectAnimator.ofFloat(this, "scaleY", new float[]{0.9f, 1.0f})}); animatorSet.setInterpolator(new OvershootInterpolator()); } animatorSet.setDuration(180); animatorSet.start(); requestLayout(); this.currentCount = i; } public void setRotationX(float f) { this.rotation = f; invalidate(); } public void setScaleX(float f) { super.setScaleX(f); invalidate(); } } private class FrameLayoutDrawer extends SizeNotifierFrameLayoutPhoto { private Paint paint = new Paint(); public FrameLayoutDrawer(Context context) { super(context); setWillNotDraw(false); this.paint.setColor(855638016); } protected boolean drawChild(Canvas canvas, View view, long j) { if (view == PhotoViewer.this.mentionListView || view == PhotoViewer.this.captionEditText) { if (!PhotoViewer.this.captionEditText.isPopupShowing() && PhotoViewer.this.captionEditText.getEmojiPadding() == 0 && ((AndroidUtilities.usingHardwareInput && PhotoViewer.this.captionEditText.getTag() == null) || getKeyboardHeight() == 0)) { return false; } } else if (view == PhotoViewer.this.pickerView || view == PhotoViewer.this.captionTextView || (PhotoViewer.this.muteItem.getVisibility() == 0 && view == PhotoViewer.this.bottomLayout)) { int emojiPadding = (getKeyboardHeight() > AndroidUtilities.dp(20.0f) || AndroidUtilities.isInMultiwindow) ? 0 : PhotoViewer.this.captionEditText.getEmojiPadding(); if (PhotoViewer.this.captionEditText.isPopupShowing() || ((AndroidUtilities.usingHardwareInput && PhotoViewer.this.captionEditText.getTag() != null) || getKeyboardHeight() > 0 || emojiPadding != 0)) { PhotoViewer.this.bottomTouchEnabled = false; return false; } PhotoViewer.this.bottomTouchEnabled = true; } else if (view == PhotoViewer.this.checkImageView || view == PhotoViewer.this.photosCounterView) { if (PhotoViewer.this.captionEditText.getTag() != null) { PhotoViewer.this.bottomTouchEnabled = false; return false; } PhotoViewer.this.bottomTouchEnabled = true; } try { return view != PhotoViewer.this.aspectRatioFrameLayout && super.drawChild(canvas, view, j); } catch (Throwable th) { return true; } } protected void onDraw(Canvas canvas) { PhotoViewer.this.onDraw(canvas); if (VERSION.SDK_INT >= 21 && AndroidUtilities.statusBarHeight != 0) { canvas.drawRect(BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED, (float) getMeasuredWidth(), (float) AndroidUtilities.statusBarHeight, this.paint); } } protected void onLayout(boolean z, int i, int i2, int i3, int i4) { int childCount = getChildCount(); int emojiPadding = (getKeyboardHeight() > AndroidUtilities.dp(20.0f) || AndroidUtilities.isInMultiwindow) ? 0 : PhotoViewer.this.captionEditText.getEmojiPadding(); for (int i5 = 0; i5 < childCount; i5++) { View childAt = getChildAt(i5); if (childAt.getVisibility() != 8) { int i6; FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) childAt.getLayoutParams(); int measuredWidth = childAt.getMeasuredWidth(); int measuredHeight = childAt.getMeasuredHeight(); int i7 = layoutParams.gravity; if (i7 == -1) { i7 = 51; } int i8 = i7 & 112; switch ((i7 & 7) & 7) { case 1: i7 = ((((i3 - i) - measuredWidth) / 2) + layoutParams.leftMargin) - layoutParams.rightMargin; break; case 5: i7 = ((i3 - i) - measuredWidth) - layoutParams.rightMargin; break; default: i7 = layoutParams.leftMargin; break; } switch (i8) { case 16: i6 = (((((i4 - emojiPadding) - i2) - measuredHeight) / 2) + layoutParams.topMargin) - layoutParams.bottomMargin; break; case 48: i6 = layoutParams.topMargin; break; case 80: i6 = (((i4 - emojiPadding) - i2) - measuredHeight) - layoutParams.bottomMargin; break; default: i6 = layoutParams.topMargin; break; } if (childAt == PhotoViewer.this.mentionListView) { i6 -= PhotoViewer.this.captionEditText.getMeasuredHeight(); } else if (PhotoViewer.this.captionEditText.isPopupView(childAt)) { i6 = AndroidUtilities.isInMultiwindow ? (PhotoViewer.this.captionEditText.getTop() - childAt.getMeasuredHeight()) + AndroidUtilities.dp(1.0f) : PhotoViewer.this.captionEditText.getBottom(); } else if (childAt == PhotoViewer.this.selectedPhotosListView) { i6 = PhotoViewer.this.actionBar.getMeasuredHeight(); } else if (childAt == PhotoViewer.this.captionTextView) { if (!PhotoViewer.this.groupedPhotosListView.currentPhotos.isEmpty()) { i6 -= PhotoViewer.this.groupedPhotosListView.getMeasuredHeight(); } } else if (PhotoViewer.this.hintTextView != null && childAt == PhotoViewer.this.hintTextView) { i6 = PhotoViewer.this.selectedPhotosListView.getBottom() + AndroidUtilities.dp(3.0f); } childAt.layout(i7, i6, measuredWidth + i7, measuredHeight + i6); } } notifyHeightChanged(); } protected void onMeasure(int i, int i2) { int size = MeasureSpec.getSize(i); int size2 = MeasureSpec.getSize(i2); setMeasuredDimension(size, size2); measureChildWithMargins(PhotoViewer.this.captionEditText, i, 0, i2, 0); int measuredHeight = PhotoViewer.this.captionEditText.getMeasuredHeight(); int childCount = getChildCount(); for (int i3 = 0; i3 < childCount; i3++) { View childAt = getChildAt(i3); if (!(childAt.getVisibility() == 8 || childAt == PhotoViewer.this.captionEditText)) { if (childAt == PhotoViewer.this.aspectRatioFrameLayout) { measureChildWithMargins(childAt, i, 0, MeasureSpec.makeMeasureSpec((VERSION.SDK_INT >= 21 ? AndroidUtilities.statusBarHeight : 0) + AndroidUtilities.displaySize.y, 1073741824), 0); } else if (!PhotoViewer.this.captionEditText.isPopupView(childAt)) { measureChildWithMargins(childAt, i, 0, i2, 0); } else if (!AndroidUtilities.isInMultiwindow) { childAt.measure(MeasureSpec.makeMeasureSpec(size, 1073741824), MeasureSpec.makeMeasureSpec(childAt.getLayoutParams().height, 1073741824)); } else if (AndroidUtilities.isTablet()) { childAt.measure(MeasureSpec.makeMeasureSpec(size, 1073741824), MeasureSpec.makeMeasureSpec(Math.min(AndroidUtilities.dp(320.0f), (size2 - measuredHeight) - AndroidUtilities.statusBarHeight), 1073741824)); } else { childAt.measure(MeasureSpec.makeMeasureSpec(size, 1073741824), MeasureSpec.makeMeasureSpec((size2 - measuredHeight) - AndroidUtilities.statusBarHeight, 1073741824)); } } } } } private class GroupedPhotosListView extends View implements OnGestureListener { private boolean animateAllLine; private int animateToDX; private int animateToDXStart; private int animateToItem = -1; private Paint backgroundPaint = new Paint(); private long currentGroupId; private int currentImage; private float currentItemProgress = 1.0f; private ArrayList<Object> currentObjects = new ArrayList(); private ArrayList<TLObject> currentPhotos = new ArrayList(); private int drawDx; private GestureDetector gestureDetector; private boolean ignoreChanges; private ArrayList<ImageReceiver> imagesToDraw = new ArrayList(); private int itemHeight; private int itemSpacing; private int itemWidth; private int itemY; private long lastUpdateTime; private float moveLineProgress; private boolean moving; private int nextImage; private float nextItemProgress = BitmapDescriptorFactory.HUE_RED; private int nextPhotoScrolling = -1; private Scroller scroll; private boolean scrolling; private boolean stopedScrolling; private ArrayList<ImageReceiver> unusedReceivers = new ArrayList(); public GroupedPhotosListView(Context context) { super(context); this.gestureDetector = new GestureDetector(context, this); this.scroll = new Scroller(context); this.itemWidth = AndroidUtilities.dp(42.0f); this.itemHeight = AndroidUtilities.dp(56.0f); this.itemSpacing = AndroidUtilities.dp(1.0f); this.itemY = AndroidUtilities.dp(3.0f); this.backgroundPaint.setColor(Theme.ACTION_BAR_PHOTO_VIEWER_COLOR); } private void fillImages(boolean z, int i) { if (!(z || this.imagesToDraw.isEmpty())) { this.unusedReceivers.addAll(this.imagesToDraw); this.imagesToDraw.clear(); this.moving = false; this.moveLineProgress = 1.0f; this.currentItemProgress = 1.0f; this.nextItemProgress = BitmapDescriptorFactory.HUE_RED; } invalidate(); if (getMeasuredWidth() != 0 && !this.currentPhotos.isEmpty()) { int i2; int i3; ImageReceiver imageReceiver; int i4; TLObject tLObject; FileLocation fileLocation; TLObject tLObject2; int measuredWidth = getMeasuredWidth(); int measuredWidth2 = (getMeasuredWidth() / 2) - (this.itemWidth / 2); if (z) { int i5 = Integer.MIN_VALUE; i2 = Integer.MAX_VALUE; int size = this.imagesToDraw.size(); i3 = 0; while (i3 < size) { imageReceiver = (ImageReceiver) this.imagesToDraw.get(i3); int param = imageReceiver.getParam(); int i6 = (((param - this.currentImage) * (this.itemWidth + this.itemSpacing)) + measuredWidth2) + i; if (i6 > measuredWidth || i6 + this.itemWidth < 0) { this.unusedReceivers.add(imageReceiver); this.imagesToDraw.remove(i3); i4 = i3 - 1; i3 = size - 1; } else { i4 = i3; i3 = size; } i2 = Math.min(i2, param - 1); i5 = Math.max(i5, param + 1); size = i3; i3 = i4 + 1; } i4 = i5; } else { i4 = this.currentImage; i2 = this.currentImage - 1; } if (i4 != Integer.MIN_VALUE) { int size2 = this.currentPhotos.size(); for (int i7 = i4; i7 < size2; i7++) { i3 = (((i7 - this.currentImage) * (this.itemWidth + this.itemSpacing)) + measuredWidth2) + i; if (i3 >= measuredWidth) { break; } tLObject = (TLObject) this.currentPhotos.get(i7); if (tLObject instanceof PhotoSize) { fileLocation = ((PhotoSize) tLObject).location; } else { tLObject2 = tLObject; } imageReceiver = getFreeReceiver(); imageReceiver.setImageCoords(i3, this.itemY, this.itemWidth, this.itemHeight); imageReceiver.setImage(null, null, null, null, fileLocation, "80_80", 0, null, 1); imageReceiver.setParam(i7); } } if (i2 != Integer.MAX_VALUE) { while (i2 >= 0) { i3 = this.itemWidth + ((((i2 - this.currentImage) * (this.itemWidth + this.itemSpacing)) + measuredWidth2) + i); if (i3 > 0) { tLObject = (TLObject) this.currentPhotos.get(i2); if (tLObject instanceof PhotoSize) { fileLocation = ((PhotoSize) tLObject).location; } else { tLObject2 = tLObject; } imageReceiver = getFreeReceiver(); imageReceiver.setImageCoords(i3, this.itemY, this.itemWidth, this.itemHeight); imageReceiver.setImage(null, null, null, null, fileLocation, "80_80", 0, null, 1); imageReceiver.setParam(i2); i2--; } else { return; } } } } } private ImageReceiver getFreeReceiver() { ImageReceiver imageReceiver; if (this.unusedReceivers.isEmpty()) { imageReceiver = new ImageReceiver(this); } else { imageReceiver = (ImageReceiver) this.unusedReceivers.get(0); this.unusedReceivers.remove(0); } this.imagesToDraw.add(imageReceiver); return imageReceiver; } private int getMaxScrollX() { return this.currentImage * (this.itemWidth + (this.itemSpacing * 2)); } private int getMinScrollX() { return (-((this.currentPhotos.size() - this.currentImage) - 1)) * (this.itemWidth + (this.itemSpacing * 2)); } private void stopScrolling() { this.scrolling = false; if (!this.scroll.isFinished()) { this.scroll.abortAnimation(); } if (this.nextPhotoScrolling >= 0 && this.nextPhotoScrolling < this.currentObjects.size()) { this.stopedScrolling = true; int i = this.nextPhotoScrolling; this.animateToItem = i; this.nextImage = i; this.animateToDX = (this.currentImage - this.nextPhotoScrolling) * (this.itemWidth + this.itemSpacing); this.animateToDXStart = this.drawDx; this.moveLineProgress = 1.0f; this.nextPhotoScrolling = -1; } invalidate(); } private void updateAfterScroll() { int i = this.drawDx; if (Math.abs(i) > (this.itemWidth / 2) + this.itemSpacing) { int i2; if (i > 0) { i -= (this.itemWidth / 2) + this.itemSpacing; i2 = 1; } else { i += (this.itemWidth / 2) + this.itemSpacing; i2 = -1; } i = (i / (this.itemWidth + (this.itemSpacing * 2))) + i2; } else { i = 0; } this.nextPhotoScrolling = this.currentImage - i; if (PhotoViewer.this.currentIndex != this.nextPhotoScrolling && this.nextPhotoScrolling >= 0 && this.nextPhotoScrolling < this.currentPhotos.size()) { Object obj = this.currentObjects.get(this.nextPhotoScrolling); if (!PhotoViewer.this.imagesArr.isEmpty()) { i = PhotoViewer.this.imagesArr.indexOf((MessageObject) obj); } else if (PhotoViewer.this.imagesArrLocations.isEmpty()) { i = -1; } else { i = PhotoViewer.this.imagesArrLocations.indexOf((FileLocation) obj); } if (i >= 0) { this.ignoreChanges = true; PhotoViewer.this.currentIndex = -1; PhotoViewer.this.setImageIndex(i, false); } } if (!this.scrolling) { this.scrolling = true; this.stopedScrolling = false; } fillImages(true, this.drawDx); } public void clear() { this.currentPhotos.clear(); this.currentObjects.clear(); this.imagesToDraw.clear(); } public void fillList() { if (this.ignoreChanges) { this.ignoreChanges = false; return; } int size; Object obj; boolean z; MessageObject messageObject; if (!PhotoViewer.this.imagesArrLocations.isEmpty()) { FileLocation fileLocation = (FileLocation) PhotoViewer.this.imagesArrLocations.get(PhotoViewer.this.currentIndex); size = PhotoViewer.this.imagesArrLocations.size(); obj = fileLocation; z = false; } else if (PhotoViewer.this.imagesArr.isEmpty()) { obj = null; size = 0; z = false; } else { messageObject = (MessageObject) PhotoViewer.this.imagesArr.get(PhotoViewer.this.currentIndex); MessageObject messageObject2; if (messageObject.messageOwner.grouped_id != this.currentGroupId) { this.currentGroupId = messageObject.messageOwner.grouped_id; messageObject2 = messageObject; size = 0; z = true; } else { int access$1100; int min = Math.min(PhotoViewer.this.currentIndex + 10, PhotoViewer.this.imagesArr.size()); size = 0; for (access$1100 = PhotoViewer.this.currentIndex; access$1100 < min; access$1100++) { messageObject2 = (MessageObject) PhotoViewer.this.imagesArr.get(access$1100); if (PhotoViewer.this.slideshowMessageId == 0 && messageObject2.messageOwner.grouped_id != this.currentGroupId) { break; } size++; } min = Math.max(PhotoViewer.this.currentIndex - 10, 0); for (access$1100 = PhotoViewer.this.currentIndex - 1; access$1100 >= min; access$1100--) { messageObject2 = (MessageObject) PhotoViewer.this.imagesArr.get(access$1100); if (PhotoViewer.this.slideshowMessageId == 0 && messageObject2.messageOwner.grouped_id != this.currentGroupId) { break; } size++; } messageObject2 = messageObject; z = false; } } if (obj != null) { int indexOf; if (!z) { if (size != this.currentPhotos.size() || this.currentObjects.indexOf(obj) == -1) { z = true; } else { indexOf = this.currentObjects.indexOf(obj); if (!(this.currentImage == indexOf || indexOf == -1)) { if (this.animateAllLine) { this.animateToItem = indexOf; this.nextImage = indexOf; this.animateToDX = (this.currentImage - indexOf) * (this.itemWidth + this.itemSpacing); this.moving = true; this.animateAllLine = false; this.lastUpdateTime = System.currentTimeMillis(); invalidate(); } else { fillImages(true, (this.currentImage - indexOf) * (this.itemWidth + this.itemSpacing)); this.currentImage = indexOf; this.moving = false; } this.drawDx = 0; } } } if (z) { this.animateAllLine = false; this.currentPhotos.clear(); this.currentObjects.clear(); if (!PhotoViewer.this.imagesArrLocations.isEmpty()) { this.currentObjects.addAll(PhotoViewer.this.imagesArrLocations); this.currentPhotos.addAll(PhotoViewer.this.imagesArrLocations); this.currentImage = PhotoViewer.this.currentIndex; this.animateToItem = -1; } else if (!PhotoViewer.this.imagesArr.isEmpty() && (this.currentGroupId != 0 || PhotoViewer.this.slideshowMessageId != 0)) { size = Math.min(PhotoViewer.this.currentIndex + 10, PhotoViewer.this.imagesArr.size()); for (indexOf = PhotoViewer.this.currentIndex; indexOf < size; indexOf++) { messageObject = (MessageObject) PhotoViewer.this.imagesArr.get(indexOf); if (PhotoViewer.this.slideshowMessageId == 0 && messageObject.messageOwner.grouped_id != this.currentGroupId) { break; } this.currentObjects.add(messageObject); this.currentPhotos.add(FileLoader.getClosestPhotoSizeWithSize(messageObject.photoThumbs, 56, true)); } this.currentImage = 0; this.animateToItem = -1; size = Math.max(PhotoViewer.this.currentIndex - 10, 0); for (indexOf = PhotoViewer.this.currentIndex - 1; indexOf >= size; indexOf--) { messageObject = (MessageObject) PhotoViewer.this.imagesArr.get(indexOf); if (PhotoViewer.this.slideshowMessageId == 0 && messageObject.messageOwner.grouped_id != this.currentGroupId) { break; } this.currentObjects.add(0, messageObject); this.currentPhotos.add(0, FileLoader.getClosestPhotoSizeWithSize(messageObject.photoThumbs, 56, true)); this.currentImage++; } } if (this.currentPhotos.size() == 1) { this.currentPhotos.clear(); this.currentObjects.clear(); } fillImages(false, 0); } } } public boolean onDown(MotionEvent motionEvent) { if (!this.scroll.isFinished()) { this.scroll.abortAnimation(); } this.animateToItem = -1; return true; } protected void onDraw(Canvas canvas) { if (!this.imagesToDraw.isEmpty()) { PhotoSize photoSize; int max; canvas.drawRect(BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED, (float) getMeasuredWidth(), (float) getMeasuredHeight(), this.backgroundPaint); int size = this.imagesToDraw.size(); int i = this.drawDx; int i2 = (int) (((float) this.itemWidth) * 2.0f); int dp = AndroidUtilities.dp(8.0f); TLObject tLObject = (TLObject) this.currentPhotos.get(this.currentImage); if (tLObject instanceof PhotoSize) { photoSize = (PhotoSize) tLObject; max = Math.max(this.itemWidth, (int) ((((float) this.itemHeight) / ((float) photoSize.f10146h)) * ((float) photoSize.f10147w))); } else { max = this.itemHeight; } int i3 = (int) (((float) (dp * 2)) * this.currentItemProgress); int min = (((int) (((float) (Math.min(i2, max) - this.itemWidth)) * this.currentItemProgress)) + this.itemWidth) + i3; if (this.nextImage < 0 || this.nextImage >= this.currentPhotos.size()) { max = this.itemWidth; } else { tLObject = (TLObject) this.currentPhotos.get(this.nextImage); if (tLObject instanceof PhotoSize) { photoSize = (PhotoSize) tLObject; max = Math.max(this.itemWidth, (int) ((((float) this.itemHeight) / ((float) photoSize.f10146h)) * ((float) photoSize.f10147w))); } else { max = this.itemHeight; } } i2 = Math.min(i2, max); dp = (int) (((float) (dp * 2)) * this.nextItemProgress); int i4 = (int) ((((float) (this.nextImage > this.currentImage ? -1 : 1)) * (this.nextItemProgress * ((float) (((i2 + dp) - this.itemWidth) / 2)))) + ((float) i)); i2 = (this.itemWidth + ((int) (((float) (i2 - this.itemWidth)) * this.nextItemProgress))) + dp; int measuredWidth = (getMeasuredWidth() - min) / 2; for (i = 0; i < size; i++) { ImageReceiver imageReceiver = (ImageReceiver) this.imagesToDraw.get(i); int param = imageReceiver.getParam(); if (param == this.currentImage) { imageReceiver.setImageX((measuredWidth + i4) + (i3 / 2)); imageReceiver.setImageWidth(min - i3); } else { if (this.nextImage < this.currentImage) { if (param >= this.currentImage) { imageReceiver.setImageX((((measuredWidth + min) + this.itemSpacing) + (((imageReceiver.getParam() - this.currentImage) - 1) * (this.itemWidth + this.itemSpacing))) + i4); } else if (param <= this.nextImage) { imageReceiver.setImageX((((((imageReceiver.getParam() - this.currentImage) + 1) * (this.itemWidth + this.itemSpacing)) + measuredWidth) - (this.itemSpacing + i2)) + i4); } else { imageReceiver.setImageX((((imageReceiver.getParam() - this.currentImage) * (this.itemWidth + this.itemSpacing)) + measuredWidth) + i4); } } else if (param < this.currentImage) { imageReceiver.setImageX((((imageReceiver.getParam() - this.currentImage) * (this.itemWidth + this.itemSpacing)) + measuredWidth) + i4); } else if (param <= this.nextImage) { imageReceiver.setImageX((((measuredWidth + min) + this.itemSpacing) + (((imageReceiver.getParam() - this.currentImage) - 1) * (this.itemWidth + this.itemSpacing))) + i4); } else { imageReceiver.setImageX(((((measuredWidth + min) + this.itemSpacing) + (((imageReceiver.getParam() - this.currentImage) - 2) * (this.itemWidth + this.itemSpacing))) + (this.itemSpacing + i2)) + i4); } if (param == this.nextImage) { imageReceiver.setImageWidth(i2 - dp); imageReceiver.setImageX(imageReceiver.getImageX() + (dp / 2)); } else { imageReceiver.setImageWidth(this.itemWidth); } } imageReceiver.draw(canvas); } long currentTimeMillis = System.currentTimeMillis(); long j = currentTimeMillis - this.lastUpdateTime; if (j > 17) { j = 17; } this.lastUpdateTime = currentTimeMillis; if (this.animateToItem >= 0) { if (this.moveLineProgress > BitmapDescriptorFactory.HUE_RED) { this.moveLineProgress -= ((float) j) / 200.0f; if (this.animateToItem == this.currentImage) { if (this.currentItemProgress < 1.0f) { this.currentItemProgress += ((float) j) / 200.0f; if (this.currentItemProgress > 1.0f) { this.currentItemProgress = 1.0f; } } this.drawDx = this.animateToDXStart + ((int) Math.ceil((double) (this.currentItemProgress * ((float) (this.animateToDX - this.animateToDXStart))))); } else { this.nextItemProgress = CubicBezierInterpolator.EASE_OUT.getInterpolation(1.0f - this.moveLineProgress); if (this.stopedScrolling) { if (this.currentItemProgress > BitmapDescriptorFactory.HUE_RED) { this.currentItemProgress -= ((float) j) / 200.0f; if (this.currentItemProgress < BitmapDescriptorFactory.HUE_RED) { this.currentItemProgress = BitmapDescriptorFactory.HUE_RED; } } this.drawDx = this.animateToDXStart + ((int) Math.ceil((double) (this.nextItemProgress * ((float) (this.animateToDX - this.animateToDXStart))))); } else { this.currentItemProgress = CubicBezierInterpolator.EASE_OUT.getInterpolation(this.moveLineProgress); this.drawDx = (int) Math.ceil((double) (this.nextItemProgress * ((float) this.animateToDX))); } } if (this.moveLineProgress <= BitmapDescriptorFactory.HUE_RED) { this.currentImage = this.animateToItem; this.moveLineProgress = 1.0f; this.currentItemProgress = 1.0f; this.nextItemProgress = BitmapDescriptorFactory.HUE_RED; this.moving = false; this.stopedScrolling = false; this.drawDx = 0; this.animateToItem = -1; } } fillImages(true, this.drawDx); invalidate(); } if (this.scrolling && this.currentItemProgress > BitmapDescriptorFactory.HUE_RED) { this.currentItemProgress -= ((float) j) / 200.0f; if (this.currentItemProgress < BitmapDescriptorFactory.HUE_RED) { this.currentItemProgress = BitmapDescriptorFactory.HUE_RED; } invalidate(); } if (!this.scroll.isFinished()) { if (this.scroll.computeScrollOffset()) { this.drawDx = this.scroll.getCurrX(); updateAfterScroll(); invalidate(); } if (this.scroll.isFinished()) { stopScrolling(); } } } } public boolean onFling(MotionEvent motionEvent, MotionEvent motionEvent2, float f, float f2) { this.scroll.abortAnimation(); if (this.currentPhotos.size() >= 10) { this.scroll.fling(this.drawDx, 0, Math.round(f), 0, getMinScrollX(), getMaxScrollX(), 0, 0); } return false; } protected void onLayout(boolean z, int i, int i2, int i3, int i4) { super.onLayout(z, i, i2, i3, i4); fillImages(false, 0); } public void onLongPress(MotionEvent motionEvent) { } public boolean onScroll(MotionEvent motionEvent, MotionEvent motionEvent2, float f, float f2) { this.drawDx = (int) (((float) this.drawDx) - f); int minScrollX = getMinScrollX(); int maxScrollX = getMaxScrollX(); if (this.drawDx < minScrollX) { this.drawDx = minScrollX; } else if (this.drawDx > maxScrollX) { this.drawDx = maxScrollX; } updateAfterScroll(); return false; } public void onShowPress(MotionEvent motionEvent) { } public boolean onSingleTapUp(MotionEvent motionEvent) { stopScrolling(); int size = this.imagesToDraw.size(); for (int i = 0; i < size; i++) { ImageReceiver imageReceiver = (ImageReceiver) this.imagesToDraw.get(i); if (imageReceiver.isInsideImage(motionEvent.getX(), motionEvent.getY())) { int param = imageReceiver.getParam(); if (param < 0 || param >= this.currentObjects.size()) { return true; } if (!PhotoViewer.this.imagesArr.isEmpty()) { param = PhotoViewer.this.imagesArr.indexOf((MessageObject) this.currentObjects.get(param)); if (PhotoViewer.this.currentIndex == param) { return true; } this.moveLineProgress = 1.0f; this.animateAllLine = true; PhotoViewer.this.currentIndex = -1; PhotoViewer.this.setImageIndex(param, false); } else if (!PhotoViewer.this.imagesArrLocations.isEmpty()) { param = PhotoViewer.this.imagesArrLocations.indexOf((FileLocation) this.currentObjects.get(param)); if (PhotoViewer.this.currentIndex == param) { return true; } this.moveLineProgress = 1.0f; this.animateAllLine = true; PhotoViewer.this.currentIndex = -1; PhotoViewer.this.setImageIndex(param, false); } return false; } } return false; } public boolean onTouchEvent(MotionEvent motionEvent) { boolean z = this.gestureDetector.onTouchEvent(motionEvent) || super.onTouchEvent(motionEvent); if (this.scrolling && motionEvent.getAction() == 1 && this.scroll.isFinished()) { stopScrolling(); } return z; } public void setMoveProgress(float f) { if (!this.scrolling && this.animateToItem < 0) { if (f > BitmapDescriptorFactory.HUE_RED) { this.nextImage = this.currentImage - 1; } else { this.nextImage = this.currentImage + 1; } if (this.nextImage < 0 || this.nextImage >= this.currentPhotos.size()) { this.currentItemProgress = 1.0f; } else { this.currentItemProgress = 1.0f - Math.abs(f); } this.nextItemProgress = 1.0f - this.currentItemProgress; this.moving = f != BitmapDescriptorFactory.HUE_RED; invalidate(); if (!this.currentPhotos.isEmpty()) { if (f < BitmapDescriptorFactory.HUE_RED && this.currentImage == this.currentPhotos.size() - 1) { return; } if (f <= BitmapDescriptorFactory.HUE_RED || this.currentImage != 0) { this.drawDx = (int) (((float) (this.itemWidth + this.itemSpacing)) * f); fillImages(true, this.drawDx); } } } } } private class ListAdapter extends SelectionAdapter { private Context mContext; /* renamed from: org.telegram.ui.PhotoViewer$ListAdapter$1 */ class C50791 implements OnClickListener { C50791() { } public void onClick(View view) { int indexOf = PhotoViewer.this.imagesArrLocals.indexOf(((View) view.getParent()).getTag()); if (indexOf >= 0) { int photoChecked = PhotoViewer.this.placeProvider.setPhotoChecked(indexOf, PhotoViewer.this.getCurrentVideoEditedInfo()); PhotoViewer.this.placeProvider.isPhotoChecked(indexOf); if (indexOf == PhotoViewer.this.currentIndex) { PhotoViewer.this.checkImageView.setChecked(false, true); } if (photoChecked >= 0) { if (PhotoViewer.this.placeProvider.allowGroupPhotos()) { photoChecked++; } PhotoViewer.this.selectedPhotosAdapter.notifyItemRemoved(photoChecked); } PhotoViewer.this.updateSelectedCount(); } } } public ListAdapter(Context context) { this.mContext = context; } public int getItemCount() { return (PhotoViewer.this.placeProvider == null || PhotoViewer.this.placeProvider.getSelectedPhotosOrder() == null) ? 0 : PhotoViewer.this.placeProvider.allowGroupPhotos() ? PhotoViewer.this.placeProvider.getSelectedPhotosOrder().size() + 1 : PhotoViewer.this.placeProvider.getSelectedPhotosOrder().size(); } public int getItemViewType(int i) { return (i == 0 && PhotoViewer.this.placeProvider.allowGroupPhotos()) ? 1 : 0; } public boolean isEnabled(ViewHolder viewHolder) { return true; } public void onBindViewHolder(ViewHolder viewHolder, int i) { switch (viewHolder.getItemViewType()) { case 0: PhotoPickerPhotoCell photoPickerPhotoCell = (PhotoPickerPhotoCell) viewHolder.itemView; photoPickerPhotoCell.itemWidth = AndroidUtilities.dp(82.0f); BackupImageView backupImageView = photoPickerPhotoCell.photoImage; backupImageView.setOrientation(0, true); ArrayList selectedPhotosOrder = PhotoViewer.this.placeProvider.getSelectedPhotosOrder(); if (PhotoViewer.this.placeProvider.allowGroupPhotos()) { i--; } Object obj = PhotoViewer.this.placeProvider.getSelectedPhotos().get(selectedPhotosOrder.get(i)); if (obj instanceof PhotoEntry) { PhotoEntry photoEntry = (PhotoEntry) obj; photoPickerPhotoCell.setTag(photoEntry); photoPickerPhotoCell.videoInfoContainer.setVisibility(4); if (photoEntry.thumbPath != null) { backupImageView.setImage(photoEntry.thumbPath, null, this.mContext.getResources().getDrawable(R.drawable.nophotos)); } else if (photoEntry.path != null) { backupImageView.setOrientation(photoEntry.orientation, true); if (photoEntry.isVideo) { photoPickerPhotoCell.videoInfoContainer.setVisibility(0); int i2 = photoEntry.duration - ((photoEntry.duration / 60) * 60); photoPickerPhotoCell.videoTextView.setText(String.format("%d:%02d", new Object[]{Integer.valueOf(r4), Integer.valueOf(i2)})); backupImageView.setImage("vthumb://" + photoEntry.imageId + ":" + photoEntry.path, null, this.mContext.getResources().getDrawable(R.drawable.nophotos)); } else { backupImageView.setImage("thumb://" + photoEntry.imageId + ":" + photoEntry.path, null, this.mContext.getResources().getDrawable(R.drawable.nophotos)); } } else { backupImageView.setImageResource(R.drawable.nophotos); } photoPickerPhotoCell.setChecked(-1, true, false); photoPickerPhotoCell.checkBox.setVisibility(0); return; } else if (obj instanceof SearchImage) { SearchImage searchImage = (SearchImage) obj; photoPickerPhotoCell.setTag(searchImage); if (searchImage.thumbPath != null) { backupImageView.setImage(searchImage.thumbPath, null, this.mContext.getResources().getDrawable(R.drawable.nophotos)); } else if (searchImage.thumbUrl != null && searchImage.thumbUrl.length() > 0) { backupImageView.setImage(searchImage.thumbUrl, null, this.mContext.getResources().getDrawable(R.drawable.nophotos)); } else if (searchImage.document == null || searchImage.document.thumb == null) { backupImageView.setImageResource(R.drawable.nophotos); } else { backupImageView.setImage(searchImage.document.thumb.location, null, this.mContext.getResources().getDrawable(R.drawable.nophotos)); } photoPickerPhotoCell.videoInfoContainer.setVisibility(4); photoPickerPhotoCell.setChecked(-1, true, false); photoPickerPhotoCell.checkBox.setVisibility(0); return; } else { return; } case 1: ((ImageView) viewHolder.itemView).setColorFilter(MediaController.getInstance().isGroupPhotosEnabled() ? new PorterDuffColorFilter(-10043398, Mode.MULTIPLY) : null); return; default: return; } } public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) { View photoPickerPhotoCell; switch (i) { case 0: photoPickerPhotoCell = new PhotoPickerPhotoCell(this.mContext, false); photoPickerPhotoCell.checkFrame.setOnClickListener(new C50791()); break; default: photoPickerPhotoCell = new ImageView(this.mContext) { protected void onMeasure(int i, int i2) { super.onMeasure(MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(66.0f), 1073741824), MeasureSpec.makeMeasureSpec(MeasureSpec.getSize(i2), 1073741824)); } }; photoPickerPhotoCell.setScaleType(ScaleType.CENTER); photoPickerPhotoCell.setImageResource(R.drawable.photos_group); break; } return new Holder(photoPickerPhotoCell); } } private class PhotoProgressView { private float alpha = 1.0f; private float animatedAlphaValue = 1.0f; private float animatedProgressValue = BitmapDescriptorFactory.HUE_RED; private float animationProgressStart = BitmapDescriptorFactory.HUE_RED; private int backgroundState = -1; private float currentProgress = BitmapDescriptorFactory.HUE_RED; private long currentProgressTime = 0; private long lastUpdateTime = 0; private View parent = null; private int previousBackgroundState = -2; private RectF progressRect = new RectF(); private float radOffset = BitmapDescriptorFactory.HUE_RED; private float scale = 1.0f; private int size = AndroidUtilities.dp(64.0f); public PhotoProgressView(Context context, View view) { if (PhotoViewer.decelerateInterpolator == null) { PhotoViewer.decelerateInterpolator = new DecelerateInterpolator(1.5f); PhotoViewer.progressPaint = new Paint(1); PhotoViewer.progressPaint.setStyle(Style.STROKE); PhotoViewer.progressPaint.setStrokeCap(Cap.ROUND); PhotoViewer.progressPaint.setStrokeWidth((float) AndroidUtilities.dp(3.0f)); PhotoViewer.progressPaint.setColor(-1); } this.parent = view; } private void updateAnimation() { long currentTimeMillis = System.currentTimeMillis(); long j = currentTimeMillis - this.lastUpdateTime; this.lastUpdateTime = currentTimeMillis; if (this.animatedProgressValue != 1.0f) { this.radOffset += ((float) (360 * j)) / 3000.0f; float f = this.currentProgress - this.animationProgressStart; if (f > BitmapDescriptorFactory.HUE_RED) { this.currentProgressTime += j; if (this.currentProgressTime >= 300) { this.animatedProgressValue = this.currentProgress; this.animationProgressStart = this.currentProgress; this.currentProgressTime = 0; } else { this.animatedProgressValue = (f * PhotoViewer.decelerateInterpolator.getInterpolation(((float) this.currentProgressTime) / 300.0f)) + this.animationProgressStart; } } this.parent.invalidate(); } if (this.animatedProgressValue >= 1.0f && this.previousBackgroundState != -2) { this.animatedAlphaValue -= ((float) j) / 200.0f; if (this.animatedAlphaValue <= BitmapDescriptorFactory.HUE_RED) { this.animatedAlphaValue = BitmapDescriptorFactory.HUE_RED; this.previousBackgroundState = -2; } this.parent.invalidate(); } } public void onDraw(Canvas canvas) { Drawable drawable; int i = (int) (((float) this.size) * this.scale); int access$2100 = (PhotoViewer.this.getContainerViewWidth() - i) / 2; int access$2200 = (PhotoViewer.this.getContainerViewHeight() - i) / 2; if (this.previousBackgroundState >= 0 && this.previousBackgroundState < 4) { drawable = PhotoViewer.progressDrawables[this.previousBackgroundState]; if (drawable != null) { drawable.setAlpha((int) ((this.animatedAlphaValue * 255.0f) * this.alpha)); drawable.setBounds(access$2100, access$2200, access$2100 + i, access$2200 + i); drawable.draw(canvas); } } if (this.backgroundState >= 0 && this.backgroundState < 4) { drawable = PhotoViewer.progressDrawables[this.backgroundState]; if (drawable != null) { if (this.previousBackgroundState != -2) { drawable.setAlpha((int) (((1.0f - this.animatedAlphaValue) * 255.0f) * this.alpha)); } else { drawable.setAlpha((int) (this.alpha * 255.0f)); } drawable.setBounds(access$2100, access$2200, access$2100 + i, access$2200 + i); drawable.draw(canvas); } } if (this.backgroundState == 0 || this.backgroundState == 1 || this.previousBackgroundState == 0 || this.previousBackgroundState == 1) { int dp = AndroidUtilities.dp(4.0f); if (this.previousBackgroundState != -2) { PhotoViewer.progressPaint.setAlpha((int) ((this.animatedAlphaValue * 255.0f) * this.alpha)); } else { PhotoViewer.progressPaint.setAlpha((int) (this.alpha * 255.0f)); } this.progressRect.set((float) (access$2100 + dp), (float) (access$2200 + dp), (float) ((access$2100 + i) - dp), (float) ((i + access$2200) - dp)); canvas.drawArc(this.progressRect, this.radOffset - 0.049804688f, Math.max(4.0f, 360.0f * this.animatedProgressValue), false, PhotoViewer.progressPaint); updateAnimation(); } } public void setAlpha(float f) { this.alpha = f; } public void setBackgroundState(int i, boolean z) { this.lastUpdateTime = System.currentTimeMillis(); if (!z || this.backgroundState == i) { this.previousBackgroundState = -2; } else { this.previousBackgroundState = this.backgroundState; this.animatedAlphaValue = 1.0f; } this.backgroundState = i; this.parent.invalidate(); } public void setProgress(float f, boolean z) { if (z) { this.animationProgressStart = this.animatedProgressValue; } else { this.animatedProgressValue = f; this.animationProgressStart = f; } this.currentProgress = f; this.currentProgressTime = 0; } public void setScale(float f) { this.scale = f; } } public static class PlaceProviderObject { public int clipBottomAddition; public int clipTopAddition; public int dialogId; public ImageReceiver imageReceiver; public int index; public boolean isEvent; public View parentView; public int radius; public float scale = 1.0f; public int size; public Bitmap thumb; public int viewX; public int viewY; } private class QualityChooseView extends View { private int circleSize; private int gapSize; private int lineSize; private boolean moving; private Paint paint = new Paint(1); private int sideSide; private boolean startMoving; private int startMovingQuality; private float startX; private TextPaint textPaint = new TextPaint(1); public QualityChooseView(Context context) { super(context); this.textPaint.setTextSize((float) AndroidUtilities.dp(12.0f)); this.textPaint.setColor(-3289651); } protected void onDraw(Canvas canvas) { if (PhotoViewer.this.compressionsCount != 1) { this.lineSize = (((getMeasuredWidth() - (this.circleSize * PhotoViewer.this.compressionsCount)) - (this.gapSize * 8)) - (this.sideSide * 2)) / (PhotoViewer.this.compressionsCount - 1); } else { this.lineSize = ((getMeasuredWidth() - (this.circleSize * PhotoViewer.this.compressionsCount)) - (this.gapSize * 8)) - (this.sideSide * 2); } int measuredHeight = (getMeasuredHeight() / 2) + AndroidUtilities.dp(6.0f); int i = 0; while (i < PhotoViewer.this.compressionsCount) { int i2 = (this.sideSide + (((this.lineSize + (this.gapSize * 2)) + this.circleSize) * i)) + (this.circleSize / 2); if (i <= PhotoViewer.this.selectedCompression) { this.paint.setColor(-11292945); } else { this.paint.setColor(1728053247); } r0 = i == PhotoViewer.this.compressionsCount + -1 ? Math.min(PhotoViewer.this.originalWidth, PhotoViewer.this.originalHeight) + TtmlNode.TAG_P : i == 0 ? "240p" : i == 1 ? "360p" : i == 2 ? "480p" : "720p"; float measureText = this.textPaint.measureText(r0); canvas.drawCircle((float) i2, (float) measuredHeight, i == PhotoViewer.this.selectedCompression ? (float) AndroidUtilities.dp(8.0f) : (float) (this.circleSize / 2), this.paint); canvas.drawText(r0, ((float) i2) - (measureText / 2.0f), (float) (measuredHeight - AndroidUtilities.dp(16.0f)), this.textPaint); if (i != 0) { int i3 = ((i2 - (this.circleSize / 2)) - this.gapSize) - this.lineSize; canvas.drawRect((float) i3, (float) (measuredHeight - AndroidUtilities.dp(1.0f)), (float) (i3 + this.lineSize), (float) (AndroidUtilities.dp(2.0f) + measuredHeight), this.paint); } i++; } } protected void onMeasure(int i, int i2) { super.onMeasure(i, i2); this.circleSize = AndroidUtilities.dp(12.0f); this.gapSize = AndroidUtilities.dp(2.0f); this.sideSide = AndroidUtilities.dp(18.0f); } public boolean onTouchEvent(MotionEvent motionEvent) { boolean z = false; float x = motionEvent.getX(); int i; int i2; if (motionEvent.getAction() == 0) { getParent().requestDisallowInterceptTouchEvent(true); i = 0; while (i < PhotoViewer.this.compressionsCount) { i2 = (this.sideSide + (((this.lineSize + (this.gapSize * 2)) + this.circleSize) * i)) + (this.circleSize / 2); if (x <= ((float) (i2 - AndroidUtilities.dp(15.0f))) || x >= ((float) (i2 + AndroidUtilities.dp(15.0f)))) { i++; } else { if (i == PhotoViewer.this.selectedCompression) { z = true; } this.startMoving = z; this.startX = x; this.startMovingQuality = PhotoViewer.this.selectedCompression; } } } else if (motionEvent.getAction() == 2) { if (this.startMoving) { if (Math.abs(this.startX - x) >= AndroidUtilities.getPixelsInCM(0.5f, true)) { this.moving = true; this.startMoving = false; } } else if (this.moving) { i = 0; while (i < PhotoViewer.this.compressionsCount) { i2 = (this.sideSide + (((this.lineSize + (this.gapSize * 2)) + this.circleSize) * i)) + (this.circleSize / 2); int i3 = ((this.lineSize / 2) + (this.circleSize / 2)) + this.gapSize; if (x <= ((float) (i2 - i3)) || x >= ((float) (i2 + i3))) { i++; } else if (PhotoViewer.this.selectedCompression != i) { PhotoViewer.this.selectedCompression = i; PhotoViewer.this.didChangedCompressionLevel(false); invalidate(); } } } } else if (motionEvent.getAction() == 1 || motionEvent.getAction() == 3) { if (!this.moving) { i = 0; while (i < PhotoViewer.this.compressionsCount) { i2 = (this.sideSide + (((this.lineSize + (this.gapSize * 2)) + this.circleSize) * i)) + (this.circleSize / 2); if (x <= ((float) (i2 - AndroidUtilities.dp(15.0f))) || x >= ((float) (i2 + AndroidUtilities.dp(15.0f)))) { i++; } else if (PhotoViewer.this.selectedCompression != i) { PhotoViewer.this.selectedCompression = i; PhotoViewer.this.didChangedCompressionLevel(true); invalidate(); } } } else if (PhotoViewer.this.selectedCompression != this.startMovingQuality) { PhotoViewer.this.requestVideoPreview(1); } this.startMoving = false; this.moving = false; } return true; } } public PhotoViewer() { this.blackPaint.setColor(Theme.ACTION_BAR_VIDEO_EDIT_COLOR); } private void animateTo(float f, float f2, float f3, boolean z) { animateTo(f, f2, f3, z, Callback.DEFAULT_SWIPE_ANIMATION_DURATION); } private void animateTo(float f, float f2, float f3, boolean z, int i) { if (this.scale != f || this.translationX != f2 || this.translationY != f3) { this.zoomAnimation = z; this.animateToScale = f; this.animateToX = f2; this.animateToY = f3; this.animationStartTime = System.currentTimeMillis(); this.imageMoveAnimation = new AnimatorSet(); this.imageMoveAnimation.playTogether(new Animator[]{ObjectAnimator.ofFloat(this, "animationValue", new float[]{BitmapDescriptorFactory.HUE_RED, 1.0f})}); this.imageMoveAnimation.setInterpolator(this.interpolator); this.imageMoveAnimation.setDuration((long) i); this.imageMoveAnimation.addListener(new AnimatorListenerAdapter() { public void onAnimationEnd(Animator animator) { PhotoViewer.this.imageMoveAnimation = null; PhotoViewer.this.containerView.invalidate(); } }); this.imageMoveAnimation.start(); } } private void applyCurrentEditMode() { Bitmap bitmap; boolean z; SavedFilterState savedFilterState; Collection collection; if (this.currentEditMode == 1) { bitmap = this.photoCropView.getBitmap(); z = true; savedFilterState = null; collection = null; } else if (this.currentEditMode == 2) { r1 = this.photoFilterView.getBitmap(); z = false; savedFilterState = this.photoFilterView.getSavedFilterState(); collection = null; bitmap = r1; } else if (this.currentEditMode == 3) { r1 = this.photoPaintView.getBitmap(); z = true; savedFilterState = null; Object masks = this.photoPaintView.getMasks(); bitmap = r1; } else { z = false; savedFilterState = null; collection = null; bitmap = null; } if (bitmap != null) { TLObject scaleAndSaveImage = ImageLoader.scaleAndSaveImage(bitmap, (float) AndroidUtilities.getPhotoSize(), (float) AndroidUtilities.getPhotoSize(), 80, false, 101, 101); if (scaleAndSaveImage != null) { Object obj = this.imagesArrLocals.get(this.currentIndex); TLObject scaleAndSaveImage2; if (obj instanceof PhotoEntry) { PhotoEntry photoEntry = (PhotoEntry) obj; photoEntry.imagePath = FileLoader.getPathToAttach(scaleAndSaveImage, true).toString(); scaleAndSaveImage2 = ImageLoader.scaleAndSaveImage(bitmap, (float) AndroidUtilities.dp(120.0f), (float) AndroidUtilities.dp(120.0f), 70, false, 101, 101); if (scaleAndSaveImage2 != null) { photoEntry.thumbPath = FileLoader.getPathToAttach(scaleAndSaveImage2, true).toString(); } if (collection != null) { photoEntry.stickers.addAll(collection); } if (this.currentEditMode == 1) { this.cropItem.setColorFilter(new PorterDuffColorFilter(-12734994, Mode.MULTIPLY)); photoEntry.isCropped = true; } else if (this.currentEditMode == 2) { this.tuneItem.setColorFilter(new PorterDuffColorFilter(-12734994, Mode.MULTIPLY)); photoEntry.isFiltered = true; } else if (this.currentEditMode == 3) { this.paintItem.setColorFilter(new PorterDuffColorFilter(-12734994, Mode.MULTIPLY)); photoEntry.isPainted = true; } if (savedFilterState != null) { photoEntry.savedFilterState = savedFilterState; } else if (z) { photoEntry.savedFilterState = null; } } else if (obj instanceof SearchImage) { SearchImage searchImage = (SearchImage) obj; searchImage.imagePath = FileLoader.getPathToAttach(scaleAndSaveImage, true).toString(); scaleAndSaveImage2 = ImageLoader.scaleAndSaveImage(bitmap, (float) AndroidUtilities.dp(120.0f), (float) AndroidUtilities.dp(120.0f), 70, false, 101, 101); if (scaleAndSaveImage2 != null) { searchImage.thumbPath = FileLoader.getPathToAttach(scaleAndSaveImage2, true).toString(); } if (collection != null) { searchImage.stickers.addAll(collection); } if (this.currentEditMode == 1) { this.cropItem.setColorFilter(new PorterDuffColorFilter(-12734994, Mode.MULTIPLY)); searchImage.isCropped = true; } else if (this.currentEditMode == 2) { this.tuneItem.setColorFilter(new PorterDuffColorFilter(-12734994, Mode.MULTIPLY)); searchImage.isFiltered = true; } else if (this.currentEditMode == 3) { this.paintItem.setColorFilter(new PorterDuffColorFilter(-12734994, Mode.MULTIPLY)); searchImage.isPainted = true; } if (savedFilterState != null) { searchImage.savedFilterState = savedFilterState; } else if (z) { searchImage.savedFilterState = null; } } if (this.sendPhotoType == 0 && this.placeProvider != null) { this.placeProvider.updatePhotoAtIndex(this.currentIndex); if (!this.placeProvider.isPhotoChecked(this.currentIndex)) { setPhotoChecked(); } } if (this.currentEditMode == 1) { float rectSizeX = this.photoCropView.getRectSizeX() / ((float) getContainerViewWidth()); float rectSizeY = this.photoCropView.getRectSizeY() / ((float) getContainerViewHeight()); if (rectSizeX <= rectSizeY) { rectSizeX = rectSizeY; } this.scale = rectSizeX; this.translationX = (this.photoCropView.getRectX() + (this.photoCropView.getRectSizeX() / 2.0f)) - ((float) (getContainerViewWidth() / 2)); this.translationY = (this.photoCropView.getRectY() + (this.photoCropView.getRectSizeY() / 2.0f)) - ((float) (getContainerViewHeight() / 2)); this.zoomAnimation = true; this.applying = true; this.photoCropView.onDisappear(); } this.centerImage.setParentView(null); this.centerImage.setOrientation(0, true); this.ignoreDidSetImage = true; this.centerImage.setImageBitmap(bitmap); this.ignoreDidSetImage = false; this.centerImage.setParentView(this.containerView); } } } private boolean checkAnimation() { if (this.animationInProgress != 0 && Math.abs(this.transitionAnimationStartTime - System.currentTimeMillis()) >= 500) { if (this.animationEndRunnable != null) { this.animationEndRunnable.run(); this.animationEndRunnable = null; } this.animationInProgress = 0; } return this.animationInProgress != 0; } private void checkMinMax(boolean z) { float f = this.translationX; float f2 = this.translationY; updateMinMax(this.scale); if (this.translationX < this.minX) { f = this.minX; } else if (this.translationX > this.maxX) { f = this.maxX; } if (this.translationY < this.minY) { f2 = this.minY; } else if (this.translationY > this.maxY) { f2 = this.maxY; } animateTo(this.scale, f, f2, z); } private void checkProgress(int i, boolean z) { boolean z2 = false; int i2 = this.currentIndex; if (i == 1) { i2++; } else if (i == 2) { i2--; } if (this.currentFileNames[i] != null) { File file; boolean z3; File file2 = null; if (this.currentMessageObject != null) { if (i2 < 0 || i2 >= this.imagesArr.size()) { this.photoProgressViews[i].setBackgroundState(-1, z); return; } MessageObject messageObject = (MessageObject) this.imagesArr.get(i2); if (!TextUtils.isEmpty(messageObject.messageOwner.attachPath)) { file2 = new File(messageObject.messageOwner.attachPath); if (!file2.exists()) { file2 = null; } } if (file2 == null) { file2 = FileLoader.getPathToMessage(messageObject.messageOwner); } boolean isVideo = messageObject.isVideo(); file = file2; z3 = isVideo; } else if (this.currentBotInlineResult != null) { if (i2 < 0 || i2 >= this.imagesArrLocals.size()) { this.photoProgressViews[i].setBackgroundState(-1, z); return; } BotInlineResult botInlineResult = (BotInlineResult) this.imagesArrLocals.get(i2); if (botInlineResult.type.equals(MimeTypes.BASE_TYPE_VIDEO) || MessageObject.isVideoDocument(botInlineResult.document)) { file = botInlineResult.document != null ? FileLoader.getPathToAttach(botInlineResult.document) : botInlineResult.content_url != null ? new File(FileLoader.getInstance().getDirectory(4), Utilities.MD5(botInlineResult.content_url) + "." + ImageLoader.getHttpUrlExtension(botInlineResult.content_url, "mp4")) : null; z3 = true; } else if (botInlineResult.document != null) { file = new File(FileLoader.getInstance().getDirectory(3), this.currentFileNames[i]); z3 = false; } else if (botInlineResult.photo != null) { file = new File(FileLoader.getInstance().getDirectory(0), this.currentFileNames[i]); z3 = false; } else { file = null; z3 = false; } if (file == null || !file.exists()) { file = new File(FileLoader.getInstance().getDirectory(4), this.currentFileNames[i]); } } else if (this.currentFileLocation != null) { if (i2 < 0 || i2 >= this.imagesArrLocations.size()) { this.photoProgressViews[i].setBackgroundState(-1, z); return; } FileLocation fileLocation = (FileLocation) this.imagesArrLocations.get(i2); z3 = this.avatarsDialogId != 0 || this.isEvent; file = FileLoader.getPathToAttach(fileLocation, z3); z3 = false; } else if (this.currentPathObject != null) { file2 = new File(FileLoader.getInstance().getDirectory(3), this.currentFileNames[i]); if (file2.exists()) { file = file2; z3 = false; } else { file = new File(FileLoader.getInstance().getDirectory(4), this.currentFileNames[i]); z3 = false; } } else { file = null; z3 = false; } if (file == null || !file.exists()) { if (!z3) { this.photoProgressViews[i].setBackgroundState(0, z); } else if (FileLoader.getInstance().isLoadingFile(this.currentFileNames[i])) { this.photoProgressViews[i].setBackgroundState(1, false); } else { this.photoProgressViews[i].setBackgroundState(2, false); } Float fileProgress = ImageLoader.getInstance().getFileProgress(this.currentFileNames[i]); if (fileProgress == null) { fileProgress = Float.valueOf(BitmapDescriptorFactory.HUE_RED); } this.photoProgressViews[i].setProgress(fileProgress.floatValue(), false); } else if (z3) { this.photoProgressViews[i].setBackgroundState(3, z); } else { this.photoProgressViews[i].setBackgroundState(-1, z); } if (i == 0) { if (!(this.imagesArrLocals.isEmpty() && (this.currentFileNames[0] == null || z3 || this.photoProgressViews[0].backgroundState == 0))) { z2 = true; } this.canZoom = z2; return; } return; } if (!this.imagesArrLocals.isEmpty() && i2 >= 0 && i2 < this.imagesArrLocals.size()) { Object obj = this.imagesArrLocals.get(i2); if (obj instanceof PhotoEntry) { z2 = ((PhotoEntry) obj).isVideo; } } if (z2) { this.photoProgressViews[i].setBackgroundState(3, z); } else { this.photoProgressViews[i].setBackgroundState(-1, z); } } private void closeCaptionEnter(boolean z) { if (this.currentIndex >= 0 && this.currentIndex < this.imagesArrLocals.size()) { Object obj = this.imagesArrLocals.get(this.currentIndex); if (z) { if (obj instanceof PhotoEntry) { ((PhotoEntry) obj).caption = this.captionEditText.getFieldCharSequence(); } else if (obj instanceof SearchImage) { ((SearchImage) obj).caption = this.captionEditText.getFieldCharSequence(); } if (!(this.captionEditText.getFieldCharSequence().length() == 0 || this.placeProvider.isPhotoChecked(this.currentIndex))) { setPhotoChecked(); } } this.captionEditText.setTag(null); if (this.lastTitle != null) { this.actionBar.setTitle(this.lastTitle); this.lastTitle = null; } if (this.isCurrentVideo) { this.actionBar.setSubtitle(this.muteVideo ? null : this.currentSubtitle); } updateCaptionTextForCurrentPhoto(obj); setCurrentCaption(this.captionEditText.getFieldCharSequence()); if (this.captionEditText.isPopupShowing()) { this.captionEditText.hidePopup(); } this.captionEditText.closeKeyboard(); } } private void didChangedCompressionLevel(boolean z) { Editor edit = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", 0).edit(); edit.putInt("compress_video2", this.selectedCompression); edit.commit(); updateWidthHeightBitrateForCompression(); updateVideoInfo(); if (z) { requestVideoPreview(1); } } private int getAdditionX() { return (this.currentEditMode == 0 || this.currentEditMode == 3) ? 0 : AndroidUtilities.dp(14.0f); } private int getAdditionY() { int i = 0; int dp; if (this.currentEditMode == 3) { dp = AndroidUtilities.dp(8.0f); if (VERSION.SDK_INT >= 21) { i = AndroidUtilities.statusBarHeight; } return i + dp; } else if (this.currentEditMode == 0) { return 0; } else { dp = AndroidUtilities.dp(14.0f); if (VERSION.SDK_INT >= 21) { i = AndroidUtilities.statusBarHeight; } return i + dp; } } private int getContainerViewHeight() { return getContainerViewHeight(this.currentEditMode); } private int getContainerViewHeight(int i) { int i2 = AndroidUtilities.displaySize.y; if (i == 0 && VERSION.SDK_INT >= 21) { i2 += AndroidUtilities.statusBarHeight; } return i == 1 ? i2 - AndroidUtilities.dp(144.0f) : i == 2 ? i2 - AndroidUtilities.dp(214.0f) : i == 3 ? i2 - (AndroidUtilities.dp(48.0f) + ActionBar.getCurrentActionBarHeight()) : i2; } private int getContainerViewWidth() { return getContainerViewWidth(this.currentEditMode); } private int getContainerViewWidth(int i) { int width = this.containerView.getWidth(); return (i == 0 || i == 3) ? width : width - AndroidUtilities.dp(28.0f); } private VideoEditedInfo getCurrentVideoEditedInfo() { int i = -1; if (!this.isCurrentVideo || this.currentPlayingVideoFile == null || this.compressionsCount == 0) { return null; } VideoEditedInfo videoEditedInfo = new VideoEditedInfo(); videoEditedInfo.startTime = this.startTime; videoEditedInfo.endTime = this.endTime; videoEditedInfo.rotationValue = this.rotationValue; videoEditedInfo.originalWidth = this.originalWidth; videoEditedInfo.originalHeight = this.originalHeight; videoEditedInfo.bitrate = this.bitrate; videoEditedInfo.originalPath = this.currentPlayingVideoFile.getAbsolutePath(); videoEditedInfo.estimatedSize = (long) this.estimatedSize; videoEditedInfo.estimatedDuration = this.estimatedDuration; if (this.muteVideo || !(this.compressItem.getTag() == null || this.selectedCompression == this.compressionsCount - 1)) { if (this.muteVideo) { this.selectedCompression = 1; updateWidthHeightBitrateForCompression(); } videoEditedInfo.resultWidth = this.resultWidth; videoEditedInfo.resultHeight = this.resultHeight; if (!this.muteVideo) { i = this.bitrate; } videoEditedInfo.bitrate = i; videoEditedInfo.muted = this.muteVideo; } else { videoEditedInfo.resultWidth = this.originalWidth; videoEditedInfo.resultHeight = this.originalHeight; if (!this.muteVideo) { i = this.originalBitrate; } videoEditedInfo.bitrate = i; videoEditedInfo.muted = this.muteVideo; } return videoEditedInfo; } private TLObject getFileLocation(int i, int[] iArr) { if (i < 0) { return null; } if (this.imagesArrLocations.isEmpty()) { if (!this.imagesArr.isEmpty()) { if (i >= this.imagesArr.size()) { return null; } MessageObject messageObject = (MessageObject) this.imagesArr.get(i); PhotoSize closestPhotoSizeWithSize; if (messageObject.messageOwner instanceof TLRPC$TL_messageService) { if (messageObject.messageOwner.action instanceof TLRPC$TL_messageActionUserUpdatedPhoto) { return messageObject.messageOwner.action.newUserPhoto.photo_big; } closestPhotoSizeWithSize = FileLoader.getClosestPhotoSizeWithSize(messageObject.photoThumbs, AndroidUtilities.getPhotoSize()); if (closestPhotoSizeWithSize != null) { iArr[0] = closestPhotoSizeWithSize.size; if (iArr[0] == 0) { iArr[0] = -1; } return closestPhotoSizeWithSize.location; } iArr[0] = -1; } else if (((messageObject.messageOwner.media instanceof TLRPC$TL_messageMediaPhoto) && messageObject.messageOwner.media.photo != null) || ((messageObject.messageOwner.media instanceof TLRPC$TL_messageMediaWebPage) && messageObject.messageOwner.media.webpage != null)) { closestPhotoSizeWithSize = FileLoader.getClosestPhotoSizeWithSize(messageObject.photoThumbs, AndroidUtilities.getPhotoSize()); if (closestPhotoSizeWithSize != null) { iArr[0] = closestPhotoSizeWithSize.size; if (iArr[0] == 0) { iArr[0] = -1; } return closestPhotoSizeWithSize.location; } iArr[0] = -1; } else if (messageObject.messageOwner.media instanceof TLRPC$TL_messageMediaInvoice) { return ((TLRPC$TL_messageMediaInvoice) messageObject.messageOwner.media).photo; } else { if (!(messageObject.getDocument() == null || messageObject.getDocument().thumb == null)) { iArr[0] = messageObject.getDocument().thumb.size; if (iArr[0] == 0) { iArr[0] = -1; } return messageObject.getDocument().thumb.location; } } } return null; } else if (i >= this.imagesArrLocations.size()) { return null; } else { iArr[0] = ((Integer) this.imagesArrLocationsSizes.get(i)).intValue(); return (TLObject) this.imagesArrLocations.get(i); } } private String getFileName(int i) { if (i < 0) { return null; } if (this.imagesArrLocations.isEmpty() && this.imagesArr.isEmpty()) { if (!this.imagesArrLocals.isEmpty()) { if (i >= this.imagesArrLocals.size()) { return null; } Object obj = this.imagesArrLocals.get(i); if (obj instanceof SearchImage) { SearchImage searchImage = (SearchImage) obj; if (searchImage.document != null) { return FileLoader.getAttachFileName(searchImage.document); } if (!(searchImage.type == 1 || searchImage.localUrl == null || searchImage.localUrl.length() <= 0)) { File file = new File(searchImage.localUrl); if (file.exists()) { return file.getName(); } searchImage.localUrl = TtmlNode.ANONYMOUS_REGION_ID; } return Utilities.MD5(searchImage.imageUrl) + "." + ImageLoader.getHttpUrlExtension(searchImage.imageUrl, "jpg"); } else if (obj instanceof BotInlineResult) { BotInlineResult botInlineResult = (BotInlineResult) obj; if (botInlineResult.document != null) { return FileLoader.getAttachFileName(botInlineResult.document); } if (botInlineResult.photo != null) { return FileLoader.getAttachFileName(FileLoader.getClosestPhotoSizeWithSize(botInlineResult.photo.sizes, AndroidUtilities.getPhotoSize())); } if (botInlineResult.content_url != null) { return Utilities.MD5(botInlineResult.content_url) + "." + ImageLoader.getHttpUrlExtension(botInlineResult.content_url, "jpg"); } } } } else if (this.imagesArrLocations.isEmpty()) { if (!this.imagesArr.isEmpty()) { return i >= this.imagesArr.size() ? null : FileLoader.getMessageFileName(((MessageObject) this.imagesArr.get(i)).messageOwner); } } else if (i >= this.imagesArrLocations.size()) { return null; } else { FileLocation fileLocation = (FileLocation) this.imagesArrLocations.get(i); return fileLocation.volume_id + "_" + fileLocation.local_id + ".jpg"; } return null; } public static PhotoViewer getInstance() { PhotoViewer photoViewer = Instance; if (photoViewer == null) { synchronized (PhotoViewer.class) { photoViewer = Instance; if (photoViewer == null) { photoViewer = new PhotoViewer(); Instance = photoViewer; } } } return photoViewer; } private void goToNext() { float f = BitmapDescriptorFactory.HUE_RED; if (this.scale != 1.0f) { f = ((float) ((getContainerViewWidth() - this.centerImage.getImageWidth()) / 2)) * this.scale; } this.switchImageAfterAnimation = 1; animateTo(this.scale, ((this.minX - ((float) getContainerViewWidth())) - f) - ((float) (AndroidUtilities.dp(30.0f) / 2)), this.translationY, false); } private void goToPrev() { float f = BitmapDescriptorFactory.HUE_RED; if (this.scale != 1.0f) { f = ((float) ((getContainerViewWidth() - this.centerImage.getImageWidth()) / 2)) * this.scale; } this.switchImageAfterAnimation = 2; animateTo(this.scale, (f + (this.maxX + ((float) getContainerViewWidth()))) + ((float) (AndroidUtilities.dp(30.0f) / 2)), this.translationY, false); } private void hideHint() { this.hintAnimation = new AnimatorSet(); AnimatorSet animatorSet = this.hintAnimation; Animator[] animatorArr = new Animator[1]; animatorArr[0] = ObjectAnimator.ofFloat(this.hintTextView, "alpha", new float[]{BitmapDescriptorFactory.HUE_RED}); animatorSet.playTogether(animatorArr); this.hintAnimation.addListener(new AnimatorListenerAdapter() { public void onAnimationCancel(Animator animator) { if (animator.equals(PhotoViewer.this.hintAnimation)) { PhotoViewer.this.hintHideRunnable = null; PhotoViewer.this.hintHideRunnable = null; } } public void onAnimationEnd(Animator animator) { if (animator.equals(PhotoViewer.this.hintAnimation)) { PhotoViewer.this.hintAnimation = null; PhotoViewer.this.hintHideRunnable = null; if (PhotoViewer.this.hintTextView != null) { PhotoViewer.this.hintTextView.setVisibility(8); } } } }); this.hintAnimation.setDuration(300); this.hintAnimation.start(); } /* JADX WARNING: inconsistent code. */ /* Code decompiled incorrectly, please refer to instructions dump. */ private void onActionClick(boolean r9) { /* r8 = this; r7 = 1; r0 = 0; r6 = 0; r1 = r8.currentMessageObject; if (r1 != 0) goto L_0x000b; L_0x0007: r1 = r8.currentBotInlineResult; if (r1 == 0) goto L_0x0011; L_0x000b: r1 = r8.currentFileNames; r1 = r1[r6]; if (r1 != 0) goto L_0x0012; L_0x0011: return; L_0x0012: r1 = r8.currentMessageObject; if (r1 == 0) goto L_0x0070; L_0x0016: r1 = r8.currentMessageObject; r1 = r1.messageOwner; r1 = r1.attachPath; if (r1 == 0) goto L_0x013f; L_0x001e: r1 = r8.currentMessageObject; r1 = r1.messageOwner; r1 = r1.attachPath; r1 = r1.length(); if (r1 == 0) goto L_0x013f; L_0x002a: r1 = new java.io.File; r2 = r8.currentMessageObject; r2 = r2.messageOwner; r2 = r2.attachPath; r1.<init>(r2); r2 = r1.exists(); if (r2 != 0) goto L_0x003c; L_0x003b: r1 = r0; L_0x003c: if (r1 != 0) goto L_0x013c; L_0x003e: r1 = r8.currentMessageObject; r1 = r1.messageOwner; r1 = org.telegram.messenger.FileLoader.getPathToMessage(r1); r2 = r1.exists(); if (r2 != 0) goto L_0x0088; L_0x004c: if (r0 != 0) goto L_0x0137; L_0x004e: if (r9 == 0) goto L_0x0011; L_0x0050: r0 = r8.currentMessageObject; if (r0 == 0) goto L_0x00da; L_0x0054: r0 = org.telegram.messenger.FileLoader.getInstance(); r1 = r8.currentFileNames; r1 = r1[r6]; r0 = r0.isLoadingFile(r1); if (r0 != 0) goto L_0x00cb; L_0x0062: r0 = org.telegram.messenger.FileLoader.getInstance(); r1 = r8.currentMessageObject; r1 = r1.getDocument(); r0.loadFile(r1, r7, r6); goto L_0x0011; L_0x0070: r1 = r8.currentBotInlineResult; if (r1 == 0) goto L_0x004c; L_0x0074: r1 = r8.currentBotInlineResult; r1 = r1.document; if (r1 == 0) goto L_0x008a; L_0x007a: r1 = r8.currentBotInlineResult; r1 = r1.document; r1 = org.telegram.messenger.FileLoader.getPathToAttach(r1); r2 = r1.exists(); if (r2 == 0) goto L_0x004c; L_0x0088: r0 = r1; goto L_0x004c; L_0x008a: r1 = new java.io.File; r2 = org.telegram.messenger.FileLoader.getInstance(); r3 = 4; r2 = r2.getDirectory(r3); r3 = new java.lang.StringBuilder; r3.<init>(); r4 = r8.currentBotInlineResult; r4 = r4.content_url; r4 = org.telegram.messenger.Utilities.MD5(r4); r3 = r3.append(r4); r4 = "."; r3 = r3.append(r4); r4 = r8.currentBotInlineResult; r4 = r4.content_url; r5 = "mp4"; r4 = org.telegram.messenger.ImageLoader.getHttpUrlExtension(r4, r5); r3 = r3.append(r4); r3 = r3.toString(); r1.<init>(r2, r3); r2 = r1.exists(); if (r2 == 0) goto L_0x004c; L_0x00c9: r0 = r1; goto L_0x004c; L_0x00cb: r0 = org.telegram.messenger.FileLoader.getInstance(); r1 = r8.currentMessageObject; r1 = r1.getDocument(); r0.cancelLoadFile(r1); goto L_0x0011; L_0x00da: r0 = r8.currentBotInlineResult; if (r0 == 0) goto L_0x0011; L_0x00de: r0 = r8.currentBotInlineResult; r0 = r0.document; if (r0 == 0) goto L_0x010c; L_0x00e4: r0 = org.telegram.messenger.FileLoader.getInstance(); r1 = r8.currentFileNames; r1 = r1[r6]; r0 = r0.isLoadingFile(r1); if (r0 != 0) goto L_0x00ff; L_0x00f2: r0 = org.telegram.messenger.FileLoader.getInstance(); r1 = r8.currentBotInlineResult; r1 = r1.document; r0.loadFile(r1, r7, r6); goto L_0x0011; L_0x00ff: r0 = org.telegram.messenger.FileLoader.getInstance(); r1 = r8.currentBotInlineResult; r1 = r1.document; r0.cancelLoadFile(r1); goto L_0x0011; L_0x010c: r0 = org.telegram.messenger.ImageLoader.getInstance(); r1 = r8.currentBotInlineResult; r1 = r1.content_url; r0 = r0.isLoadingHttpFile(r1); if (r0 != 0) goto L_0x012a; L_0x011a: r0 = org.telegram.messenger.ImageLoader.getInstance(); r1 = r8.currentBotInlineResult; r1 = r1.content_url; r2 = "mp4"; r0.loadHttpFile(r1, r2); goto L_0x0011; L_0x012a: r0 = org.telegram.messenger.ImageLoader.getInstance(); r1 = r8.currentBotInlineResult; r1 = r1.content_url; r0.cancelLoadHttpFile(r1); goto L_0x0011; L_0x0137: r8.preparePlayer(r0, r7, r6); goto L_0x0011; L_0x013c: r0 = r1; goto L_0x004c; L_0x013f: r1 = r0; goto L_0x003c; */ throw new UnsupportedOperationException("Method not decompiled: org.telegram.ui.PhotoViewer.onActionClick(boolean):void"); } @SuppressLint({"NewApi", "DrawAllocation"}) private void onDraw(Canvas canvas) { if (this.animationInProgress == 1) { return; } if (this.isVisible || this.animationInProgress == 2) { float f; float f2; float f3; float containerViewHeight; float f4; float f5; int bitmapWidth; int i; int i2; float f6 = -1.0f; if (this.imageMoveAnimation != null) { if (!this.scroller.isFinished()) { this.scroller.abortAnimation(); } f = ((this.animateToScale - this.scale) * this.animationValue) + this.scale; f2 = ((this.animateToX - this.translationX) * this.animationValue) + this.translationX; f3 = this.translationY + ((this.animateToY - this.translationY) * this.animationValue); if (this.currentEditMode == 1) { this.photoCropView.setAnimationProgress(this.animationValue); } if (this.animateToScale == 1.0f && this.scale == 1.0f && this.translationX == BitmapDescriptorFactory.HUE_RED) { f6 = f3; } this.containerView.invalidate(); float f7 = f; f = f2; f2 = f3; f3 = f7; } else { if (this.animationStartTime != 0) { this.translationX = this.animateToX; this.translationY = this.animateToY; this.scale = this.animateToScale; this.animationStartTime = 0; if (this.currentEditMode == 1) { this.photoCropView.setAnimationProgress(1.0f); } updateMinMax(this.scale); this.zoomAnimation = false; } if (!this.scroller.isFinished() && this.scroller.computeScrollOffset()) { if (((float) this.scroller.getStartX()) < this.maxX && ((float) this.scroller.getStartX()) > this.minX) { this.translationX = (float) this.scroller.getCurrX(); } if (((float) this.scroller.getStartY()) < this.maxY && ((float) this.scroller.getStartY()) > this.minY) { this.translationY = (float) this.scroller.getCurrY(); } this.containerView.invalidate(); } if (this.switchImageAfterAnimation != 0) { if (this.switchImageAfterAnimation == 1) { AndroidUtilities.runOnUIThread(new Runnable() { public void run() { PhotoViewer.this.setImageIndex(PhotoViewer.this.currentIndex + 1, false); } }); } else if (this.switchImageAfterAnimation == 2) { AndroidUtilities.runOnUIThread(new Runnable() { public void run() { PhotoViewer.this.setImageIndex(PhotoViewer.this.currentIndex - 1, false); } }); } this.switchImageAfterAnimation = 0; } f3 = this.scale; f2 = this.translationY; f = this.translationX; if (!this.moving) { f6 = this.translationY; } } if (this.animationInProgress != 2) { if (this.currentEditMode != 0 || this.scale != 1.0f || f6 == -1.0f || this.zoomAnimation) { this.backgroundDrawable.setAlpha(255); } else { containerViewHeight = ((float) getContainerViewHeight()) / 4.0f; this.backgroundDrawable.setAlpha((int) Math.max(127.0f, (1.0f - (Math.min(Math.abs(f6), containerViewHeight) / containerViewHeight)) * 255.0f)); } } ImageReceiver imageReceiver = null; if (this.currentEditMode == 0) { ImageReceiver imageReceiver2; if (!(this.scale < 1.0f || this.zoomAnimation || this.zooming)) { if (f > this.maxX + ((float) AndroidUtilities.dp(5.0f))) { imageReceiver2 = this.leftImage; } else if (f < this.minX - ((float) AndroidUtilities.dp(5.0f))) { imageReceiver2 = this.rightImage; } else { this.groupedPhotosListView.setMoveProgress(BitmapDescriptorFactory.HUE_RED); } this.changingPage = imageReceiver2 == null; imageReceiver = imageReceiver2; } imageReceiver2 = null; if (imageReceiver2 == null) { } this.changingPage = imageReceiver2 == null; imageReceiver = imageReceiver2; } if (imageReceiver == this.rightImage) { f4 = BitmapDescriptorFactory.HUE_RED; containerViewHeight = 1.0f; if (this.zoomAnimation || f >= this.minX) { f5 = f; } else { containerViewHeight = Math.min(1.0f, (this.minX - f) / ((float) canvas.getWidth())); f4 = (1.0f - containerViewHeight) * 0.3f; f5 = (float) ((-canvas.getWidth()) - (AndroidUtilities.dp(30.0f) / 2)); } if (imageReceiver.hasBitmapImage()) { canvas.save(); canvas.translate((float) (getContainerViewWidth() / 2), (float) (getContainerViewHeight() / 2)); canvas.translate(((float) (canvas.getWidth() + (AndroidUtilities.dp(30.0f) / 2))) + f5, BitmapDescriptorFactory.HUE_RED); canvas.scale(1.0f - f4, 1.0f - f4); bitmapWidth = imageReceiver.getBitmapWidth(); int bitmapHeight = imageReceiver.getBitmapHeight(); float containerViewWidth = ((float) getContainerViewWidth()) / ((float) bitmapWidth); float containerViewHeight2 = ((float) getContainerViewHeight()) / ((float) bitmapHeight); if (containerViewWidth <= containerViewHeight2) { containerViewHeight2 = containerViewWidth; } i = (int) (((float) bitmapWidth) * containerViewHeight2); i2 = (int) (containerViewHeight2 * ((float) bitmapHeight)); imageReceiver.setAlpha(containerViewHeight); imageReceiver.setImageCoords((-i) / 2, (-i2) / 2, i, i2); imageReceiver.draw(canvas); canvas.restore(); } this.groupedPhotosListView.setMoveProgress(-containerViewHeight); canvas.save(); canvas.translate(f5, f2 / f3); canvas.translate(((((float) canvas.getWidth()) * (this.scale + 1.0f)) + ((float) AndroidUtilities.dp(30.0f))) / 2.0f, (-f2) / f3); this.photoProgressViews[1].setScale(1.0f - f4); this.photoProgressViews[1].setAlpha(containerViewHeight); this.photoProgressViews[1].onDraw(canvas); canvas.restore(); } f4 = BitmapDescriptorFactory.HUE_RED; containerViewHeight = 1.0f; if (this.zoomAnimation || f <= this.maxX || this.currentEditMode != 0) { f5 = f; } else { containerViewHeight = Math.min(1.0f, (f - this.maxX) / ((float) canvas.getWidth())); f4 = 0.3f * containerViewHeight; containerViewHeight = 1.0f - containerViewHeight; f5 = this.maxX; } Object obj = (this.aspectRatioFrameLayout == null || this.aspectRatioFrameLayout.getVisibility() != 0) ? null : 1; if (this.centerImage.hasBitmapImage()) { canvas.save(); canvas.translate((float) ((getContainerViewWidth() / 2) + getAdditionX()), (float) ((getContainerViewHeight() / 2) + getAdditionY())); canvas.translate(f5, f2); canvas.scale(f3 - f4, f3 - f4); if (this.currentEditMode == 1) { this.photoCropView.setBitmapParams(f3, f5, f2); } bitmapWidth = this.centerImage.getBitmapWidth(); i = this.centerImage.getBitmapHeight(); if (obj != null && this.textureUploaded && Math.abs((((float) bitmapWidth) / ((float) i)) - (((float) this.videoTextureView.getMeasuredWidth()) / ((float) this.videoTextureView.getMeasuredHeight()))) > 0.01f) { bitmapWidth = this.videoTextureView.getMeasuredWidth(); i = this.videoTextureView.getMeasuredHeight(); } float containerViewWidth2 = ((float) getContainerViewWidth()) / ((float) bitmapWidth); float containerViewHeight3 = ((float) getContainerViewHeight()) / ((float) i); if (containerViewWidth2 <= containerViewHeight3) { containerViewHeight3 = containerViewWidth2; } bitmapWidth = (int) (((float) bitmapWidth) * containerViewHeight3); i = (int) (((float) i) * containerViewHeight3); if (!(obj != null && this.textureUploaded && this.videoCrossfadeStarted && this.videoCrossfadeAlpha == 1.0f)) { this.centerImage.setAlpha(containerViewHeight); this.centerImage.setImageCoords((-bitmapWidth) / 2, (-i) / 2, bitmapWidth, i); this.centerImage.draw(canvas); } if (obj != null) { if (!this.videoCrossfadeStarted && this.textureUploaded) { this.videoCrossfadeStarted = true; this.videoCrossfadeAlpha = BitmapDescriptorFactory.HUE_RED; this.videoCrossfadeAlphaLastTime = System.currentTimeMillis(); } canvas.translate((float) ((-bitmapWidth) / 2), (float) ((-i) / 2)); this.videoTextureView.setAlpha(this.videoCrossfadeAlpha * containerViewHeight); this.aspectRatioFrameLayout.draw(canvas); if (this.videoCrossfadeStarted && this.videoCrossfadeAlpha < 1.0f) { long currentTimeMillis = System.currentTimeMillis(); long j = currentTimeMillis - this.videoCrossfadeAlphaLastTime; this.videoCrossfadeAlphaLastTime = currentTimeMillis; this.videoCrossfadeAlpha += ((float) j) / 200.0f; this.containerView.invalidate(); if (this.videoCrossfadeAlpha > 1.0f) { this.videoCrossfadeAlpha = 1.0f; } } } canvas.restore(); } obj = this.isCurrentVideo ? (this.progressView.getVisibility() == 0 || (this.videoPlayer != null && this.videoPlayer.isPlaying())) ? null : 1 : (obj != null || this.videoPlayerControlFrameLayout.getVisibility() == 0) ? null : 1; if (obj != null) { canvas.save(); canvas.translate(f5, f2 / f3); this.photoProgressViews[0].setScale(1.0f - f4); this.photoProgressViews[0].setAlpha(containerViewHeight); this.photoProgressViews[0].onDraw(canvas); canvas.restore(); } if (imageReceiver == this.leftImage) { if (imageReceiver.hasBitmapImage()) { canvas.save(); canvas.translate((float) (getContainerViewWidth() / 2), (float) (getContainerViewHeight() / 2)); canvas.translate(((-((((float) canvas.getWidth()) * (this.scale + 1.0f)) + ((float) AndroidUtilities.dp(30.0f)))) / 2.0f) + f, BitmapDescriptorFactory.HUE_RED); i2 = imageReceiver.getBitmapWidth(); i = imageReceiver.getBitmapHeight(); f5 = ((float) getContainerViewWidth()) / ((float) i2); f4 = ((float) getContainerViewHeight()) / ((float) i); if (f5 <= f4) { f4 = f5; } int i3 = (int) (((float) i2) * f4); int i4 = (int) (f4 * ((float) i)); imageReceiver.setAlpha(1.0f); imageReceiver.setImageCoords((-i3) / 2, (-i4) / 2, i3, i4); imageReceiver.draw(canvas); canvas.restore(); } this.groupedPhotosListView.setMoveProgress(1.0f - containerViewHeight); canvas.save(); canvas.translate(f, f2 / f3); canvas.translate((-((((float) canvas.getWidth()) * (this.scale + 1.0f)) + ((float) AndroidUtilities.dp(30.0f)))) / 2.0f, (-f2) / f3); this.photoProgressViews[2].setScale(1.0f); this.photoProgressViews[2].setAlpha(1.0f); this.photoProgressViews[2].onDraw(canvas); canvas.restore(); } } } private void onPhotoClosed(PlaceProviderObject placeProviderObject) { this.isVisible = false; this.disableShowCheck = true; this.currentMessageObject = null; this.currentBotInlineResult = null; this.currentFileLocation = null; this.currentPathObject = null; this.currentThumb = null; this.parentAlert = null; if (this.currentAnimation != null) { this.currentAnimation.setSecondParentView(null); this.currentAnimation = null; } for (int i = 0; i < 3; i++) { if (this.photoProgressViews[i] != null) { this.photoProgressViews[i].setBackgroundState(-1, false); } } requestVideoPreview(0); if (this.videoTimelineView != null) { this.videoTimelineView.destroy(); } this.centerImage.setImageBitmap((Bitmap) null); this.leftImage.setImageBitmap((Bitmap) null); this.rightImage.setImageBitmap((Bitmap) null); this.containerView.post(new Runnable() { public void run() { PhotoViewer.this.animatingImageView.setImageBitmap(null); try { if (PhotoViewer.this.windowView.getParent() != null) { ((WindowManager) PhotoViewer.this.parentActivity.getSystemService("window")).removeView(PhotoViewer.this.windowView); } } catch (Throwable e) { FileLog.e(e); } } }); if (this.placeProvider != null) { this.placeProvider.willHidePhotoViewer(); } this.groupedPhotosListView.clear(); this.placeProvider = null; this.selectedPhotosAdapter.notifyDataSetChanged(); this.disableShowCheck = false; if (placeProviderObject != null) { placeProviderObject.imageReceiver.setVisible(true, true); } } private void onPhotoShow(MessageObject messageObject, FileLocation fileLocation, ArrayList<MessageObject> arrayList, ArrayList<Object> arrayList2, int i, PlaceProviderObject placeProviderObject) { int i2; Object obj; this.classGuid = ConnectionsManager.getInstance().generateClassGuid(); this.currentMessageObject = null; this.currentFileLocation = null; this.currentPathObject = null; this.fromCamera = false; this.currentBotInlineResult = null; this.currentIndex = -1; this.currentFileNames[0] = null; this.currentFileNames[1] = null; this.currentFileNames[2] = null; this.avatarsDialogId = 0; this.totalImagesCount = 0; this.totalImagesCountMerge = 0; this.currentEditMode = 0; this.isFirstLoading = true; this.needSearchImageInArr = false; this.loadingMoreImages = false; this.endReached[0] = false; this.endReached[1] = this.mergeDialogId == 0; this.opennedFromMedia = false; this.needCaptionLayout = false; this.canShowBottom = true; this.isCurrentVideo = false; this.imagesArr.clear(); this.imagesArrLocations.clear(); this.imagesArrLocationsSizes.clear(); this.avatarsArr.clear(); this.imagesArrLocals.clear(); for (i2 = 0; i2 < 2; i2++) { this.imagesByIds[i2].clear(); this.imagesByIdsTemp[i2].clear(); } this.imagesArrTemp.clear(); this.currentUserAvatarLocation = null; this.containerView.setPadding(0, 0, 0, 0); this.currentThumb = placeProviderObject != null ? placeProviderObject.thumb : null; boolean z = placeProviderObject != null && placeProviderObject.isEvent; this.isEvent = z; this.menuItem.setVisibility(0); this.sendItem.setVisibility(8); this.bottomLayout.setVisibility(0); this.bottomLayout.setTranslationY(BitmapDescriptorFactory.HUE_RED); this.captionTextView.setTranslationY(BitmapDescriptorFactory.HUE_RED); this.shareButton.setVisibility(8); if (this.qualityChooseView != null) { this.qualityChooseView.setVisibility(4); this.qualityPicker.setVisibility(4); this.qualityChooseView.setTag(null); } if (this.qualityChooseViewAnimation != null) { this.qualityChooseViewAnimation.cancel(); this.qualityChooseViewAnimation = null; } this.allowShare = false; this.slideshowMessageId = 0; this.nameOverride = null; this.dateOverride = 0; this.menuItem.hideSubItem(2); this.menuItem.hideSubItem(4); this.menuItem.hideSubItem(10); this.menuItem.hideSubItem(11); this.actionBar.setTranslationY(BitmapDescriptorFactory.HUE_RED); this.checkImageView.setAlpha(1.0f); this.checkImageView.setVisibility(8); this.actionBar.setTitleRightMargin(0); this.photosCounterView.setAlpha(1.0f); this.photosCounterView.setVisibility(8); this.pickerView.setVisibility(8); this.pickerView.setAlpha(1.0f); this.pickerView.setTranslationY(BitmapDescriptorFactory.HUE_RED); this.paintItem.setVisibility(8); this.cropItem.setVisibility(8); this.tuneItem.setVisibility(8); this.timeItem.setVisibility(8); this.videoTimelineView.setVisibility(8); this.compressItem.setVisibility(8); this.captionEditText.setVisibility(8); this.mentionListView.setVisibility(8); this.muteItem.setVisibility(8); this.actionBar.setSubtitle(null); this.masksItem.setVisibility(8); this.muteVideo = false; this.muteItem.setImageResource(R.drawable.volume_on); this.editorDoneLayout.setVisibility(8); this.captionTextView.setTag(null); this.captionTextView.setVisibility(4); if (this.photoCropView != null) { this.photoCropView.setVisibility(8); } if (this.photoFilterView != null) { this.photoFilterView.setVisibility(8); } for (i2 = 0; i2 < 3; i2++) { if (this.photoProgressViews[i2] != null) { this.photoProgressViews[i2].setBackgroundState(-1, false); } } int i3; if (messageObject != null && arrayList == null) { if ((messageObject.messageOwner.media instanceof TLRPC$TL_messageMediaWebPage) && messageObject.messageOwner.media.webpage != null) { TLRPC$WebPage tLRPC$WebPage = messageObject.messageOwner.media.webpage; String str = tLRPC$WebPage.site_name; if (str != null) { str = str.toLowerCase(); if (str.equals("instagram") || str.equals("twitter")) { if (!TextUtils.isEmpty(tLRPC$WebPage.author)) { this.nameOverride = tLRPC$WebPage.author; } if (tLRPC$WebPage.cached_page instanceof TLRPC$TL_pageFull) { for (i3 = 0; i3 < tLRPC$WebPage.cached_page.blocks.size(); i3++) { PageBlock pageBlock = (PageBlock) tLRPC$WebPage.cached_page.blocks.get(i3); if (pageBlock instanceof TLRPC$TL_pageBlockAuthorDate) { this.dateOverride = ((TLRPC$TL_pageBlockAuthorDate) pageBlock).published_date; break; } } } Collection webPagePhotos = messageObject.getWebPagePhotos(null, null); if (!webPagePhotos.isEmpty()) { this.slideshowMessageId = messageObject.getId(); this.needSearchImageInArr = false; this.imagesArr.addAll(webPagePhotos); this.totalImagesCount = this.imagesArr.size(); setImageIndex(this.imagesArr.indexOf(messageObject), true); } } } } if (this.slideshowMessageId == 0) { this.imagesArr.add(messageObject); if (this.currentAnimation != null || messageObject.eventId != 0) { this.needSearchImageInArr = false; } else if (!((messageObject.messageOwner.media instanceof TLRPC$TL_messageMediaInvoice) || (messageObject.messageOwner.media instanceof TLRPC$TL_messageMediaWebPage) || (messageObject.messageOwner.action != null && !(messageObject.messageOwner.action instanceof TLRPC$TL_messageActionEmpty)))) { this.needSearchImageInArr = true; this.imagesByIds[0].put(Integer.valueOf(messageObject.getId()), messageObject); this.menuItem.showSubItem(2); this.sendItem.setVisibility(0); } setImageIndex(0, true); } } else if (fileLocation != null) { this.avatarsDialogId = placeProviderObject.dialogId; this.imagesArrLocations.add(fileLocation); this.imagesArrLocationsSizes.add(Integer.valueOf(placeProviderObject.size)); this.avatarsArr.add(new TLRPC$TL_photoEmpty()); this.shareButton.setVisibility(this.videoPlayerControlFrameLayout.getVisibility() != 0 ? 0 : 8); this.allowShare = true; this.menuItem.hideSubItem(2); if (this.shareButton.getVisibility() == 0) { this.menuItem.hideSubItem(10); } else { this.menuItem.showSubItem(10); } setImageIndex(0, true); this.currentUserAvatarLocation = fileLocation; } else if (arrayList != null) { this.opennedFromMedia = true; this.menuItem.showSubItem(4); this.sendItem.setVisibility(0); this.imagesArr.addAll(arrayList); for (i3 = 0; i3 < this.imagesArr.size(); i3++) { MessageObject messageObject2 = (MessageObject) this.imagesArr.get(i3); this.imagesByIds[messageObject2.getDialogId() == this.currentDialogId ? 0 : 1].put(Integer.valueOf(messageObject2.getId()), messageObject2); } setImageIndex(i, true); } else if (arrayList2 != null) { if (this.sendPhotoType == 0) { this.checkImageView.setVisibility(0); this.photosCounterView.setVisibility(0); this.actionBar.setTitleRightMargin(AndroidUtilities.dp(100.0f)); } this.menuItem.setVisibility(8); this.imagesArrLocals.addAll(arrayList2); obj = this.imagesArrLocals.get(i); if (obj instanceof PhotoEntry) { if (((PhotoEntry) obj).isVideo) { this.cropItem.setVisibility(8); this.bottomLayout.setVisibility(0); this.bottomLayout.setTranslationY((float) (-AndroidUtilities.dp(48.0f))); } else { this.cropItem.setVisibility(0); } obj = 1; } else if (obj instanceof BotInlineResult) { this.cropItem.setVisibility(8); obj = null; } else { ImageView imageView = this.cropItem; i2 = ((obj instanceof SearchImage) && ((SearchImage) obj).type == 0) ? 0 : 8; imageView.setVisibility(i2); obj = this.cropItem.getVisibility() == 0 ? 1 : null; } if (this.parentChatActivity != null && (this.parentChatActivity.currentEncryptedChat == null || AndroidUtilities.getPeerLayerVersion(this.parentChatActivity.currentEncryptedChat.layer) >= 46)) { this.mentionsAdapter.setChatInfo(this.parentChatActivity.info); this.mentionsAdapter.setNeedUsernames(this.parentChatActivity.currentChat != null); this.mentionsAdapter.setNeedBotContext(false); z = obj != null && (this.placeProvider == null || (this.placeProvider != null && this.placeProvider.allowCaption())); this.needCaptionLayout = z; this.captionEditText.setVisibility(this.needCaptionLayout ? 0 : 8); if (this.needCaptionLayout) { this.captionEditText.onCreate(); } } this.pickerView.setVisibility(0); this.bottomLayout.setVisibility(8); this.canShowBottom = false; setImageIndex(i, true); this.paintItem.setVisibility(this.cropItem.getVisibility()); this.tuneItem.setVisibility(this.cropItem.getVisibility()); updateSelectedCount(); } if (this.currentAnimation == null && !this.isEvent) { if (this.currentDialogId != 0 && this.totalImagesCount == 0) { SharedMediaQuery.getMediaCount(this.currentDialogId, 0, this.classGuid, true); if (this.mergeDialogId != 0) { SharedMediaQuery.getMediaCount(this.mergeDialogId, 0, this.classGuid, true); } } else if (this.avatarsDialogId != 0) { MessagesController.getInstance().loadDialogPhotos(this.avatarsDialogId, 80, 0, true, this.classGuid); } } if ((this.currentMessageObject != null && this.currentMessageObject.isVideo()) || (this.currentBotInlineResult != null && (this.currentBotInlineResult.type.equals(MimeTypes.BASE_TYPE_VIDEO) || MessageObject.isVideoDocument(this.currentBotInlineResult.document)))) { onActionClick(false); } else if (!this.imagesArrLocals.isEmpty()) { obj = this.imagesArrLocals.get(i); User currentUser = this.parentChatActivity != null ? this.parentChatActivity.getCurrentUser() : null; Object obj2 = (this.parentChatActivity == null || this.parentChatActivity.isSecretChat() || currentUser == null || currentUser.bot) ? null : 1; if (obj instanceof PhotoEntry) { PhotoEntry photoEntry = (PhotoEntry) obj; if (photoEntry.isVideo) { preparePlayer(new File(photoEntry.path), false, false); } } else if (obj2 != null && (obj instanceof SearchImage)) { obj2 = ((SearchImage) obj).type == 0 ? 1 : null; } if (obj2 != null) { this.timeItem.setVisibility(0); } } } private void onSharePressed() { boolean z = false; File file = null; if (this.parentActivity != null && this.allowShare) { try { if (this.currentMessageObject != null) { z = this.currentMessageObject.isVideo(); if (!TextUtils.isEmpty(this.currentMessageObject.messageOwner.attachPath)) { File file2 = new File(this.currentMessageObject.messageOwner.attachPath); if (file2.exists()) { file = file2; } } if (file == null) { file = FileLoader.getPathToMessage(this.currentMessageObject.messageOwner); } } else if (this.currentFileLocation != null) { TLObject tLObject = this.currentFileLocation; boolean z2 = this.avatarsDialogId != 0 || this.isEvent; file = FileLoader.getPathToAttach(tLObject, z2); } if (file.exists()) { Intent intent = new Intent("android.intent.action.SEND"); if (z) { intent.setType(MimeTypes.VIDEO_MP4); } else if (this.currentMessageObject != null) { intent.setType(this.currentMessageObject.getMimeType()); } else { intent.setType("image/jpeg"); } if (VERSION.SDK_INT >= 24) { try { intent.putExtra("android.intent.extra.STREAM", FileProvider.a(this.parentActivity, "org.ir.talaeii.provider", file)); intent.setFlags(1); } catch (Exception e) { intent.putExtra("android.intent.extra.STREAM", Uri.fromFile(file)); } } else { intent.putExtra("android.intent.extra.STREAM", Uri.fromFile(file)); } this.parentActivity.startActivityForResult(Intent.createChooser(intent, LocaleController.getString("ShareFile", R.string.ShareFile)), ChatActivity.startAllServices); return; } Builder builder = new Builder(this.parentActivity); builder.setTitle(LocaleController.getString("AppName", R.string.AppName)); builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null); builder.setMessage(LocaleController.getString("PleaseDownload", R.string.PleaseDownload)); showAlertDialog(builder); } catch (Throwable e2) { FileLog.e(e2); } } } private boolean onTouchEvent(MotionEvent motionEvent) { float f = BitmapDescriptorFactory.HUE_RED; if (this.animationInProgress != 0 || this.animationStartTime != 0) { return false; } if (this.currentEditMode == 2) { this.photoFilterView.onTouch(motionEvent); return true; } else if (this.currentEditMode == 1) { return true; } else { if (this.captionEditText.isPopupShowing() || this.captionEditText.isKeyboardVisible()) { if (motionEvent.getAction() == 1) { closeCaptionEnter(true); } return true; } else if (this.currentEditMode == 0 && motionEvent.getPointerCount() == 1 && this.gestureDetector.onTouchEvent(motionEvent) && this.doubleTap) { this.doubleTap = false; this.moving = false; this.zooming = false; checkMinMax(false); return true; } else { float y; if (motionEvent.getActionMasked() == 0 || motionEvent.getActionMasked() == 5) { if (this.currentEditMode == 1) { this.photoCropView.cancelAnimationRunnable(); } this.discardTap = false; if (!this.scroller.isFinished()) { this.scroller.abortAnimation(); } if (!(this.draggingDown || this.changingPage)) { if (this.canZoom && motionEvent.getPointerCount() == 2) { this.pinchStartDistance = (float) Math.hypot((double) (motionEvent.getX(1) - motionEvent.getX(0)), (double) (motionEvent.getY(1) - motionEvent.getY(0))); this.pinchStartScale = this.scale; this.pinchCenterX = (motionEvent.getX(0) + motionEvent.getX(1)) / 2.0f; this.pinchCenterY = (motionEvent.getY(0) + motionEvent.getY(1)) / 2.0f; this.pinchStartX = this.translationX; this.pinchStartY = this.translationY; this.zooming = true; this.moving = false; if (this.velocityTracker != null) { this.velocityTracker.clear(); } } else if (motionEvent.getPointerCount() == 1) { this.moveStartX = motionEvent.getX(); y = motionEvent.getY(); this.moveStartY = y; this.dragY = y; this.draggingDown = false; this.canDragDown = true; if (this.velocityTracker != null) { this.velocityTracker.clear(); } } } } else if (motionEvent.getActionMasked() == 2) { if (this.currentEditMode == 1) { this.photoCropView.cancelAnimationRunnable(); } if (this.canZoom && motionEvent.getPointerCount() == 2 && !this.draggingDown && this.zooming && !this.changingPage) { this.discardTap = true; this.scale = (((float) Math.hypot((double) (motionEvent.getX(1) - motionEvent.getX(0)), (double) (motionEvent.getY(1) - motionEvent.getY(0)))) / this.pinchStartDistance) * this.pinchStartScale; this.translationX = (this.pinchCenterX - ((float) (getContainerViewWidth() / 2))) - (((this.pinchCenterX - ((float) (getContainerViewWidth() / 2))) - this.pinchStartX) * (this.scale / this.pinchStartScale)); this.translationY = (this.pinchCenterY - ((float) (getContainerViewHeight() / 2))) - (((this.pinchCenterY - ((float) (getContainerViewHeight() / 2))) - this.pinchStartY) * (this.scale / this.pinchStartScale)); updateMinMax(this.scale); this.containerView.invalidate(); } else if (motionEvent.getPointerCount() == 1) { if (this.velocityTracker != null) { this.velocityTracker.addMovement(motionEvent); } y = Math.abs(motionEvent.getX() - this.moveStartX); r2 = Math.abs(motionEvent.getY() - this.dragY); if (y > ((float) AndroidUtilities.dp(3.0f)) || r2 > ((float) AndroidUtilities.dp(3.0f))) { this.discardTap = true; if (this.qualityChooseView != null && this.qualityChooseView.getVisibility() == 0) { return true; } } if (this.placeProvider.canScrollAway() && this.currentEditMode == 0 && this.canDragDown && !this.draggingDown && this.scale == 1.0f && r2 >= ((float) AndroidUtilities.dp(30.0f)) && r2 / 2.0f > y) { this.draggingDown = true; this.moving = false; this.dragY = motionEvent.getY(); if (this.isActionBarVisible && this.canShowBottom) { toggleActionBar(false, true); } else if (this.pickerView.getVisibility() == 0) { toggleActionBar(false, true); togglePhotosListView(false, true); toggleCheckImageView(false); } return true; } else if (this.draggingDown) { this.translationY = motionEvent.getY() - this.dragY; this.containerView.invalidate(); } else if (this.invalidCoords || this.animationStartTime != 0) { this.invalidCoords = false; this.moveStartX = motionEvent.getX(); this.moveStartY = motionEvent.getY(); } else { r2 = this.moveStartX - motionEvent.getX(); y = this.moveStartY - motionEvent.getY(); if (this.moving || this.currentEditMode != 0 || ((this.scale == 1.0f && Math.abs(y) + ((float) AndroidUtilities.dp(12.0f)) < Math.abs(r2)) || this.scale != 1.0f)) { if (!this.moving) { this.moving = true; this.canDragDown = false; y = BitmapDescriptorFactory.HUE_RED; r2 = BitmapDescriptorFactory.HUE_RED; } this.moveStartX = motionEvent.getX(); this.moveStartY = motionEvent.getY(); updateMinMax(this.scale); if ((this.translationX < this.minX && !(this.currentEditMode == 0 && this.rightImage.hasImage())) || (this.translationX > this.maxX && !(this.currentEditMode == 0 && this.leftImage.hasImage()))) { r2 /= 3.0f; } if (this.maxY != BitmapDescriptorFactory.HUE_RED || this.minY != BitmapDescriptorFactory.HUE_RED || this.currentEditMode != 0) { if (this.translationY < this.minY || this.translationY > this.maxY) { f = y / 3.0f; } f = y; } else if (this.translationY - y < this.minY) { this.translationY = this.minY; } else { if (this.translationY - y > this.maxY) { this.translationY = this.maxY; } f = y; } this.translationX -= r2; if (!(this.scale == 1.0f && this.currentEditMode == 0)) { this.translationY -= f; } this.containerView.invalidate(); } } } } else if (motionEvent.getActionMasked() == 3 || motionEvent.getActionMasked() == 1 || motionEvent.getActionMasked() == 6) { if (this.currentEditMode == 1) { this.photoCropView.startAnimationRunnable(); } if (this.zooming) { this.invalidCoords = true; if (this.scale < 1.0f) { updateMinMax(1.0f); animateTo(1.0f, BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED, true); } else if (this.scale > 3.0f) { y = (this.pinchCenterX - ((float) (getContainerViewWidth() / 2))) - (((this.pinchCenterX - ((float) (getContainerViewWidth() / 2))) - this.pinchStartX) * (3.0f / this.pinchStartScale)); f = (this.pinchCenterY - ((float) (getContainerViewHeight() / 2))) - (((this.pinchCenterY - ((float) (getContainerViewHeight() / 2))) - this.pinchStartY) * (3.0f / this.pinchStartScale)); updateMinMax(3.0f); if (y < this.minX) { y = this.minX; } else if (y > this.maxX) { y = this.maxX; } if (f < this.minY) { f = this.minY; } else if (f > this.maxY) { f = this.maxY; } animateTo(3.0f, y, f, true); } else { checkMinMax(true); } this.zooming = false; } else if (this.draggingDown) { if (Math.abs(this.dragY - motionEvent.getY()) > ((float) getContainerViewHeight()) / 6.0f) { closePhoto(true, false); } else { if (this.pickerView.getVisibility() == 0) { toggleActionBar(true, true); toggleCheckImageView(true); } animateTo(1.0f, BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED, false); } this.draggingDown = false; } else if (this.moving) { y = this.translationX; r2 = this.translationY; updateMinMax(this.scale); this.moving = false; this.canDragDown = true; if (this.velocityTracker != null && this.scale == 1.0f) { this.velocityTracker.computeCurrentVelocity(1000); f = this.velocityTracker.getXVelocity(); } if (this.currentEditMode == 0) { if ((this.translationX < this.minX - ((float) (getContainerViewWidth() / 3)) || r1 < ((float) (-AndroidUtilities.dp(650.0f)))) && this.rightImage.hasImage()) { goToNext(); return true; } else if ((this.translationX > this.maxX + ((float) (getContainerViewWidth() / 3)) || r1 > ((float) AndroidUtilities.dp(650.0f))) && this.leftImage.hasImage()) { goToPrev(); return true; } } if (this.translationX < this.minX) { y = this.minX; } else if (this.translationX > this.maxX) { y = this.maxX; } f = this.translationY < this.minY ? this.minY : this.translationY > this.maxY ? this.maxY : r2; animateTo(this.scale, y, f, false); } } return false; } } } private void openCaptionEnter() { if (this.imageMoveAnimation == null && this.changeModeAnimation == null && this.currentEditMode == 0) { this.selectedPhotosListView.setVisibility(8); this.selectedPhotosListView.setEnabled(false); this.selectedPhotosListView.setAlpha(BitmapDescriptorFactory.HUE_RED); this.selectedPhotosListView.setTranslationY((float) (-AndroidUtilities.dp(10.0f))); this.photosCounterView.setRotationX(BitmapDescriptorFactory.HUE_RED); this.isPhotosListViewVisible = false; this.captionEditText.setTag(Integer.valueOf(1)); this.captionEditText.openKeyboard(); this.lastTitle = this.actionBar.getTitle(); if (this.isCurrentVideo) { this.actionBar.setTitle(this.muteVideo ? LocaleController.getString("GifCaption", R.string.GifCaption) : LocaleController.getString("VideoCaption", R.string.VideoCaption)); this.actionBar.setSubtitle(null); return; } this.actionBar.setTitle(LocaleController.getString("PhotoCaption", R.string.PhotoCaption)); } } private void preparePlayer(File file, boolean z, boolean z2) { C3791b.a(C3791b.h() + 1); if (!z2) { this.currentPlayingVideoFile = file; } if (this.parentActivity != null) { this.inPreview = z2; releasePlayer(); if (this.videoTextureView == null) { this.aspectRatioFrameLayout = new AspectRatioFrameLayout(this.parentActivity); this.aspectRatioFrameLayout.setVisibility(4); this.containerView.addView(this.aspectRatioFrameLayout, 0, LayoutHelper.createFrame(-1, -1, 17)); this.videoTextureView = new TextureView(this.parentActivity); this.videoTextureView.setOpaque(false); this.aspectRatioFrameLayout.addView(this.videoTextureView, LayoutHelper.createFrame(-1, -1, 17)); } this.textureUploaded = false; this.videoCrossfadeStarted = false; TextureView textureView = this.videoTextureView; this.videoCrossfadeAlpha = BitmapDescriptorFactory.HUE_RED; textureView.setAlpha(BitmapDescriptorFactory.HUE_RED); this.videoPlayButton.setImageResource(R.drawable.inline_video_play); if (this.videoPlayer == null) { long duration; this.videoPlayer = new VideoPlayer(); this.videoPlayer.setTextureView(this.videoTextureView); this.videoPlayer.setDelegate(new VideoPlayerDelegate() { public void onError(Exception exception) { FileLog.e(exception); } public void onRenderedFirstFrame() { if (!PhotoViewer.this.textureUploaded) { PhotoViewer.this.textureUploaded = true; PhotoViewer.this.containerView.invalidate(); } } public void onStateChanged(boolean z, int i) { if (PhotoViewer.this.videoPlayer != null) { if (i == 4 || i == 1) { try { PhotoViewer.this.parentActivity.getWindow().clearFlags(128); } catch (Throwable e) { FileLog.e(e); } } else { try { PhotoViewer.this.parentActivity.getWindow().addFlags(128); } catch (Throwable e2) { FileLog.e(e2); } } if (i == 3 && PhotoViewer.this.aspectRatioFrameLayout.getVisibility() != 0) { PhotoViewer.this.aspectRatioFrameLayout.setVisibility(0); } if (!PhotoViewer.this.videoPlayer.isPlaying() || i == 4) { if (PhotoViewer.this.isPlaying) { PhotoViewer.this.isPlaying = false; PhotoViewer.this.videoPlayButton.setImageResource(R.drawable.inline_video_play); AndroidUtilities.cancelRunOnUIThread(PhotoViewer.this.updateProgressRunnable); if (i == 4) { if (PhotoViewer.this.isCurrentVideo) { if (!PhotoViewer.this.videoTimelineView.isDragging()) { PhotoViewer.this.videoTimelineView.setProgress(BitmapDescriptorFactory.HUE_RED); if (PhotoViewer.this.inPreview || PhotoViewer.this.videoTimelineView.getVisibility() != 0) { PhotoViewer.this.videoPlayer.seekTo(0); } else { PhotoViewer.this.videoPlayer.seekTo((long) ((int) (PhotoViewer.this.videoTimelineView.getLeftProgress() * ((float) PhotoViewer.this.videoPlayer.getDuration())))); } PhotoViewer.this.videoPlayer.pause(); PhotoViewer.this.containerView.invalidate(); } } else if (!PhotoViewer.this.videoPlayerSeekbar.isDragging()) { PhotoViewer.this.videoPlayerSeekbar.setProgress(BitmapDescriptorFactory.HUE_RED); PhotoViewer.this.videoPlayerControlFrameLayout.invalidate(); if (PhotoViewer.this.inPreview || PhotoViewer.this.videoTimelineView.getVisibility() != 0) { PhotoViewer.this.videoPlayer.seekTo(0); } else { PhotoViewer.this.videoPlayer.seekTo((long) ((int) (PhotoViewer.this.videoTimelineView.getLeftProgress() * ((float) PhotoViewer.this.videoPlayer.getDuration())))); } PhotoViewer.this.videoPlayer.pause(); } } } } else if (!PhotoViewer.this.isPlaying) { PhotoViewer.this.isPlaying = true; PhotoViewer.this.videoPlayButton.setImageResource(R.drawable.inline_video_pause); AndroidUtilities.runOnUIThread(PhotoViewer.this.updateProgressRunnable); } PhotoViewer.this.updateVideoPlayerTime(); } } public boolean onSurfaceDestroyed(SurfaceTexture surfaceTexture) { return false; } public void onSurfaceTextureUpdated(SurfaceTexture surfaceTexture) { } public void onVideoSizeChanged(int i, int i2, int i3, float f) { if (PhotoViewer.this.aspectRatioFrameLayout != null) { if (i3 == 90 || i3 == 270) { int i4 = i; i = i2; i2 = i4; } PhotoViewer.this.aspectRatioFrameLayout.setAspectRatio(i2 == 0 ? 1.0f : (((float) i) * f) / ((float) i2), i3); } } }); if (this.videoPlayer != null) { duration = this.videoPlayer.getDuration(); if (duration == C3446C.TIME_UNSET) { duration = 0; } } else { duration = 0; } duration /= 1000; int ceil = (int) Math.ceil((double) this.videoPlayerTime.getPaint().measureText(String.format("%02d:%02d / %02d:%02d", new Object[]{Long.valueOf(duration / 60), Long.valueOf(duration % 60), Long.valueOf(duration / 60), Long.valueOf(duration % 60)}))); } this.videoPlayer.preparePlayer(Uri.fromFile(file), "other"); this.videoPlayerSeekbar.setProgress(BitmapDescriptorFactory.HUE_RED); this.videoTimelineView.setProgress(BitmapDescriptorFactory.HUE_RED); if (this.currentBotInlineResult != null && (this.currentBotInlineResult.type.equals(MimeTypes.BASE_TYPE_VIDEO) || MessageObject.isVideoDocument(this.currentBotInlineResult.document))) { this.bottomLayout.setVisibility(0); this.bottomLayout.setTranslationY((float) (-AndroidUtilities.dp(48.0f))); } this.videoPlayerControlFrameLayout.setVisibility(this.isCurrentVideo ? 8 : 0); this.dateTextView.setVisibility(8); this.nameTextView.setVisibility(8); if (this.allowShare) { this.shareButton.setVisibility(8); this.menuItem.showSubItem(10); } this.videoPlayer.setPlayWhenReady(z); this.inPreview = z2; } } private void processOpenVideo(final String str, boolean z) { if (this.currentLoadingVideoRunnable != null) { Utilities.globalQueue.cancelRunnable(this.currentLoadingVideoRunnable); this.currentLoadingVideoRunnable = null; } this.videoPreviewMessageObject = null; setCompressItemEnabled(false, true); this.muteVideo = z; this.videoTimelineView.setVideoPath(str); this.compressionsCount = -1; this.rotationValue = 0; this.originalSize = new File(str).length(); DispatchQueue dispatchQueue = Utilities.globalQueue; Runnable anonymousClass69 = new Runnable() { public void run() { Throwable th; boolean z; C1285z c1285z; if (PhotoViewer.this.currentLoadingVideoRunnable == this) { c1285z = null; boolean z2 = true; C1246e c1289d = new C1289d(str); List b = C1321h.b(c1289d, "/moov/trak/"); if (C1321h.a(c1289d, "/moov/trak/mdia/minf/stbl/stsd/mp4a/") == null) { FileLog.d("video hasn't mp4a atom"); } if (C1321h.a(c1289d, "/moov/trak/mdia/minf/stbl/stsd/avc1/") == null) { FileLog.d("video hasn't avc1 atom"); z2 = false; } PhotoViewer.this.audioFramesSize = 0; PhotoViewer.this.videoFramesSize = 0; int i = 0; while (i < b.size()) { if (PhotoViewer.this.currentLoadingVideoRunnable == this) { long j; C1284y c1284y = (C1284y) ((C1248b) b.get(i)); long j2 = 0; try { C1269l c = c1284y.c(); C1270m c2 = c.c(); long[] d = c.b().b().b().d(); int i2 = 0; while (i2 < d.length) { if (PhotoViewer.this.currentLoadingVideoRunnable == this) { j2 += d[i2]; i2++; } else { return; } } PhotoViewer.this.videoDuration = ((float) c2.e()) / ((float) c2.d()); j = j2; j2 = (long) ((int) (((float) (8 * j2)) / PhotoViewer.this.videoDuration)); } catch (Throwable e) { FileLog.e(e); j = 0; j2 = 0; } try { if (PhotoViewer.this.currentLoadingVideoRunnable == this) { C1285z b2 = c1284y.b(); if (b2.j() == 0.0d || b2.k() == 0.0d) { PhotoViewer.this.audioFramesSize = PhotoViewer.this.audioFramesSize + j; b2 = c1285z; } else { if (c1285z == null || c1285z.j() < b2.j() || c1285z.k() < b2.k()) { try { PhotoViewer.this.originalBitrate = PhotoViewer.this.bitrate = (int) ((j2 / 100000) * 100000); if (PhotoViewer.this.bitrate > 900000) { PhotoViewer.this.bitrate = 900000; } PhotoViewer.this.videoFramesSize = PhotoViewer.this.videoFramesSize + j; } catch (Throwable e2) { Throwable th2 = e2; c1285z = b2; th = th2; } } b2 = c1285z; } i++; c1285z = b2; } else { return; } } catch (Exception e3) { th = e3; } } else { return; } } z = z2; if (c1285z == null) { FileLog.d("video hasn't trackHeaderBox atom"); z = false; } if (PhotoViewer.this.currentLoadingVideoRunnable == this) { PhotoViewer.this.currentLoadingVideoRunnable = null; AndroidUtilities.runOnUIThread(new Runnable() { public void run() { if (PhotoViewer.this.parentActivity != null) { PhotoViewer.this.videoHasAudio = z; if (z) { C1320g i = c1285z.i(); if (i.equals(C1320g.f3986k)) { PhotoViewer.this.rotationValue = 90; } else if (i.equals(C1320g.f3987l)) { PhotoViewer.this.rotationValue = 180; } else if (i.equals(C1320g.f3988m)) { PhotoViewer.this.rotationValue = 270; } else { PhotoViewer.this.rotationValue = 0; } PhotoViewer.this.resultWidth = PhotoViewer.this.originalWidth = (int) c1285z.j(); PhotoViewer.this.resultHeight = PhotoViewer.this.originalHeight = (int) c1285z.k(); PhotoViewer.this.videoDuration = PhotoViewer.this.videoDuration * 1000.0f; PhotoViewer.this.selectedCompression = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", 0).getInt("compress_video2", 1); if (PhotoViewer.this.originalWidth > 1280 || PhotoViewer.this.originalHeight > 1280) { PhotoViewer.this.compressionsCount = 5; } else if (PhotoViewer.this.originalWidth > 848 || PhotoViewer.this.originalHeight > 848) { PhotoViewer.this.compressionsCount = 4; } else if (PhotoViewer.this.originalWidth > 640 || PhotoViewer.this.originalHeight > 640) { PhotoViewer.this.compressionsCount = 3; } else if (PhotoViewer.this.originalWidth > 480 || PhotoViewer.this.originalHeight > 480) { PhotoViewer.this.compressionsCount = 2; } else { PhotoViewer.this.compressionsCount = 1; } PhotoViewer.this.updateWidthHeightBitrateForCompression(); PhotoViewer.this.setCompressItemEnabled(PhotoViewer.this.compressionsCount > 1, true); FileLog.d("compressionsCount = " + PhotoViewer.this.compressionsCount + " w = " + PhotoViewer.this.originalWidth + " h = " + PhotoViewer.this.originalHeight); if (VERSION.SDK_INT < 18 && PhotoViewer.this.compressItem.getTag() != null) { try { MediaCodecInfo selectCodec = MediaController.selectCodec("video/avc"); if (selectCodec == null) { FileLog.d("no codec info for video/avc"); PhotoViewer.this.setCompressItemEnabled(false, true); } else { String name = selectCodec.getName(); if (name.equals("OMX.google.h264.encoder") || name.equals("OMX.ST.VFM.H264Enc") || name.equals("OMX.Exynos.avc.enc") || name.equals("OMX.MARVELL.VIDEO.HW.CODA7542ENCODER") || name.equals("OMX.MARVELL.VIDEO.H264ENCODER") || name.equals("OMX.k3.video.encoder.avc") || name.equals("OMX.TI.DUCATI1.VIDEO.H264E")) { FileLog.d("unsupported encoder = " + name); PhotoViewer.this.setCompressItemEnabled(false, true); } else if (MediaController.selectColorFormat(selectCodec, "video/avc") == 0) { FileLog.d("no color format for video/avc"); PhotoViewer.this.setCompressItemEnabled(false, true); } } } catch (Throwable e) { PhotoViewer.this.setCompressItemEnabled(false, true); FileLog.e(e); } } PhotoViewer.this.qualityChooseView.invalidate(); } else { PhotoViewer.this.compressionsCount = 0; } PhotoViewer.this.updateVideoInfo(); PhotoViewer.this.updateMuteButton(); } } }); } } return; FileLog.e(th); z = false; if (c1285z == null) { FileLog.d("video hasn't trackHeaderBox atom"); z = false; } if (PhotoViewer.this.currentLoadingVideoRunnable == this) { PhotoViewer.this.currentLoadingVideoRunnable = null; AndroidUtilities.runOnUIThread(/* anonymous class already generated */); } } }; this.currentLoadingVideoRunnable = anonymousClass69; dispatchQueue.postRunnable(anonymousClass69); } private void redraw(final int i) { if (i < 6 && this.containerView != null) { this.containerView.invalidate(); AndroidUtilities.runOnUIThread(new Runnable() { public void run() { PhotoViewer.this.redraw(i + 1); } }, 100); } } private void releasePlayer() { if (this.videoPlayer != null) { this.videoPlayer.releasePlayer(); this.videoPlayer = null; } try { this.parentActivity.getWindow().clearFlags(128); } catch (Throwable e) { FileLog.e(e); } if (this.aspectRatioFrameLayout != null) { this.containerView.removeView(this.aspectRatioFrameLayout); this.aspectRatioFrameLayout = null; } if (this.videoTextureView != null) { this.videoTextureView = null; } if (this.isPlaying) { this.isPlaying = false; this.videoPlayButton.setImageResource(R.drawable.inline_video_play); AndroidUtilities.cancelRunOnUIThread(this.updateProgressRunnable); } if (!this.inPreview && !this.requestingPreview) { this.videoPlayerControlFrameLayout.setVisibility(8); this.dateTextView.setVisibility(0); this.nameTextView.setVisibility(0); if (this.allowShare) { this.shareButton.setVisibility(0); this.menuItem.hideSubItem(10); } } } private void requestVideoPreview(int i) { if (this.videoPreviewMessageObject != null) { MediaController.getInstance().cancelVideoConvert(this.videoPreviewMessageObject); } boolean z = this.requestingPreview && !this.tryStartRequestPreviewOnFinish; this.requestingPreview = false; this.loadInitialVideo = false; this.progressView.setVisibility(4); if (i != 1) { this.tryStartRequestPreviewOnFinish = false; if (i == 2) { preparePlayer(this.currentPlayingVideoFile, false, false); } } else if (this.selectedCompression == this.compressionsCount - 1) { this.tryStartRequestPreviewOnFinish = false; if (z) { this.progressView.setVisibility(0); this.loadInitialVideo = true; } else { preparePlayer(this.currentPlayingVideoFile, false, false); } } else { this.requestingPreview = true; releasePlayer(); if (this.videoPreviewMessageObject == null) { Message tLRPC$TL_message = new TLRPC$TL_message(); tLRPC$TL_message.id = 0; tLRPC$TL_message.message = TtmlNode.ANONYMOUS_REGION_ID; tLRPC$TL_message.media = new TLRPC$TL_messageMediaEmpty(); tLRPC$TL_message.action = new TLRPC$TL_messageActionEmpty(); this.videoPreviewMessageObject = new MessageObject(tLRPC$TL_message, null, false); this.videoPreviewMessageObject.messageOwner.attachPath = new File(FileLoader.getInstance().getDirectory(4), "video_preview.mp4").getAbsolutePath(); this.videoPreviewMessageObject.videoEditedInfo = new VideoEditedInfo(); this.videoPreviewMessageObject.videoEditedInfo.rotationValue = this.rotationValue; this.videoPreviewMessageObject.videoEditedInfo.originalWidth = this.originalWidth; this.videoPreviewMessageObject.videoEditedInfo.originalHeight = this.originalHeight; this.videoPreviewMessageObject.videoEditedInfo.originalPath = this.currentPlayingVideoFile.getAbsolutePath(); } VideoEditedInfo videoEditedInfo = this.videoPreviewMessageObject.videoEditedInfo; long j = this.startTime; videoEditedInfo.startTime = j; videoEditedInfo = this.videoPreviewMessageObject.videoEditedInfo; long j2 = this.endTime; videoEditedInfo.endTime = j2; if (j == -1) { j = 0; } if (j2 == -1) { j2 = (long) (this.videoDuration * 1000.0f); } if (j2 - j > 5000000) { this.videoPreviewMessageObject.videoEditedInfo.endTime = j + 5000000; } this.videoPreviewMessageObject.videoEditedInfo.bitrate = this.bitrate; this.videoPreviewMessageObject.videoEditedInfo.resultWidth = this.resultWidth; this.videoPreviewMessageObject.videoEditedInfo.resultHeight = this.resultHeight; if (!MediaController.getInstance().scheduleVideoConvert(this.videoPreviewMessageObject, true)) { this.tryStartRequestPreviewOnFinish = true; } this.requestingPreview = true; this.progressView.setVisibility(0); } this.containerView.invalidate(); } private void setCompressItemEnabled(boolean z, boolean z2) { float f = 1.0f; if (this.compressItem != null) { if (z && this.compressItem.getTag() != null) { return; } if (z || this.compressItem.getTag() != null) { this.compressItem.setTag(z ? Integer.valueOf(1) : null); this.compressItem.setEnabled(z); this.compressItem.setClickable(z); if (this.compressItemAnimation != null) { this.compressItemAnimation.cancel(); this.compressItemAnimation = null; } if (z2) { this.compressItemAnimation = new AnimatorSet(); AnimatorSet animatorSet = this.compressItemAnimation; Animator[] animatorArr = new Animator[1]; ImageView imageView = this.compressItem; String str = "alpha"; float[] fArr = new float[1]; fArr[0] = z ? 1.0f : 0.5f; animatorArr[0] = ObjectAnimator.ofFloat(imageView, str, fArr); animatorSet.playTogether(animatorArr); this.compressItemAnimation.setDuration(180); this.compressItemAnimation.setInterpolator(decelerateInterpolator); this.compressItemAnimation.start(); return; } ImageView imageView2 = this.compressItem; if (!z) { f = 0.5f; } imageView2.setAlpha(f); } } } private void setCurrentCaption(CharSequence charSequence) { float f = BitmapDescriptorFactory.HUE_RED; if (this.needCaptionLayout) { if (this.captionTextView.getParent() != this.pickerView) { this.captionTextView.setBackgroundDrawable(null); this.containerView.removeView(this.captionTextView); this.pickerView.addView(this.captionTextView, LayoutHelper.createFrame(-1, -2.0f, 83, BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED, 76.0f, 48.0f)); } } else if (this.captionTextView.getParent() != this.containerView) { this.captionTextView.setBackgroundColor(Theme.ACTION_BAR_PHOTO_VIEWER_COLOR); this.pickerView.removeView(this.captionTextView); this.containerView.addView(this.captionTextView, LayoutHelper.createFrame(-1, -2.0f, 83, BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED, 48.0f)); } if (this.isCurrentVideo) { this.captionTextView.setMaxLines(1); this.captionTextView.setSingleLine(true); } else { this.captionTextView.setSingleLine(false); this.captionTextView.setMaxLines(10); } if (!TextUtils.isEmpty(charSequence)) { Theme.createChatResources(null, true); CharSequence replaceEmoji = Emoji.replaceEmoji(new SpannableStringBuilder(charSequence.toString()), this.captionTextView.getPaint().getFontMetricsInt(), AndroidUtilities.dp(20.0f), false); this.captionTextView.setTag(replaceEmoji); try { this.captionTextView.setText(replaceEmoji); } catch (Throwable e) { FileLog.e(e); } this.captionTextView.setTextColor(-1); TextView textView = this.captionTextView; if (this.bottomLayout.getVisibility() == 0 || this.pickerView.getVisibility() == 0) { f = 1.0f; } textView.setAlpha(f); TextView textView2 = this.captionTextView; int i = (this.bottomLayout.getVisibility() == 0 || this.pickerView.getVisibility() == 0) ? 0 : 4; textView2.setVisibility(i); } else if (this.needCaptionLayout) { this.captionTextView.setText(LocaleController.getString("AddCaption", R.string.AddCaption)); this.captionTextView.setTag("empty"); this.captionTextView.setVisibility(0); this.captionTextView.setTextColor(-1291845633); } else { this.captionTextView.setTextColor(-1); this.captionTextView.setTag(null); this.captionTextView.setVisibility(4); } } private void setImageIndex(int i, boolean z) { if (this.currentIndex != i && this.placeProvider != null) { boolean z2; int i2; if (!z) { this.currentThumb = null; } this.currentFileNames[0] = getFileName(i); this.currentFileNames[1] = getFileName(i + 1); this.currentFileNames[2] = getFileName(i - 1); this.placeProvider.willSwitchFromPhoto(this.currentMessageObject, this.currentFileLocation, this.currentIndex); int i3 = this.currentIndex; this.currentIndex = i; boolean z3 = false; Object obj = null; String str = null; boolean z4; if (this.imagesArr.isEmpty()) { Object obj2; if (!this.imagesArrLocations.isEmpty()) { this.nameTextView.setText(TtmlNode.ANONYMOUS_REGION_ID); this.dateTextView.setText(TtmlNode.ANONYMOUS_REGION_ID); if (this.avatarsDialogId != UserConfig.getClientUserId() || this.avatarsArr.isEmpty()) { this.menuItem.hideSubItem(6); } else { this.menuItem.showSubItem(6); } FileLocation fileLocation = this.currentFileLocation; if (i < 0 || i >= this.imagesArrLocations.size()) { closePhoto(false, false); return; } this.currentFileLocation = (FileLocation) this.imagesArrLocations.get(i); obj2 = (fileLocation == null || this.currentFileLocation == null || fileLocation.local_id != this.currentFileLocation.local_id || fileLocation.volume_id != this.currentFileLocation.volume_id) ? null : 1; if (this.isEvent) { this.actionBar.setTitle(LocaleController.getString("AttachPhoto", R.string.AttachPhoto)); } else { this.actionBar.setTitle(LocaleController.formatString("Of", R.string.Of, new Object[]{Integer.valueOf(this.currentIndex + 1), Integer.valueOf(this.imagesArrLocations.size())})); } this.menuItem.showSubItem(1); this.allowShare = true; this.shareButton.setVisibility(this.videoPlayerControlFrameLayout.getVisibility() != 0 ? 0 : 8); if (this.shareButton.getVisibility() == 0) { this.menuItem.hideSubItem(10); } else { this.menuItem.showSubItem(10); } this.groupedPhotosListView.fillList(); obj = obj2; } else if (!this.imagesArrLocals.isEmpty()) { if (i < 0 || i >= this.imagesArrLocals.size()) { closePhoto(false, false); return; } int i4; String str2; boolean z5; CharSequence charSequence; Object obj3 = this.imagesArrLocals.get(i); if (obj3 instanceof BotInlineResult) { BotInlineResult botInlineResult = (BotInlineResult) obj3; this.currentBotInlineResult = botInlineResult; if (botInlineResult.document != null) { z3 = MessageObject.isVideoDocument(botInlineResult.document); this.currentPathObject = FileLoader.getPathToAttach(botInlineResult.document).getAbsolutePath(); z2 = z3; } else if (botInlineResult.photo != null) { this.currentPathObject = FileLoader.getPathToAttach(FileLoader.getClosestPhotoSizeWithSize(botInlineResult.photo.sizes, AndroidUtilities.getPhotoSize())).getAbsolutePath(); z2 = false; } else if (botInlineResult.content_url != null) { this.currentPathObject = botInlineResult.content_url; z2 = botInlineResult.type.equals(MimeTypes.BASE_TYPE_VIDEO); } else { z2 = false; } this.pickerView.setPadding(0, AndroidUtilities.dp(14.0f), 0, 0); z3 = false; i4 = 0; str2 = null; z5 = false; charSequence = null; z4 = z2; z2 = false; } else { PhotoEntry photoEntry; boolean z6; SearchImage searchImage; if (obj3 instanceof PhotoEntry) { photoEntry = (PhotoEntry) obj3; this.currentPathObject = photoEntry.path; z3 = photoEntry.isVideo; obj2 = null; z6 = z3; } else { if (obj3 instanceof SearchImage) { searchImage = (SearchImage) obj3; if (searchImage.document != null) { this.currentPathObject = FileLoader.getPathToAttach(searchImage.document, true).getAbsolutePath(); } else { this.currentPathObject = searchImage.imageUrl; } if (searchImage.type == 1) { obj2 = 1; z6 = false; } } obj2 = null; z6 = false; } if (z6) { this.muteItem.setVisibility(0); this.compressItem.setVisibility(0); this.isCurrentVideo = true; z2 = false; if (obj3 instanceof PhotoEntry) { photoEntry = (PhotoEntry) obj3; z2 = photoEntry.editedInfo != null && photoEntry.editedInfo.muted; } processOpenVideo(this.currentPathObject, z2); this.videoTimelineView.setVisibility(0); this.paintItem.setVisibility(8); this.cropItem.setVisibility(8); this.tuneItem.setVisibility(8); } else { this.videoTimelineView.setVisibility(8); this.muteItem.setVisibility(8); this.isCurrentVideo = false; this.compressItem.setVisibility(8); if (obj2 != null) { this.pickerView.setPadding(0, AndroidUtilities.dp(14.0f), 0, 0); this.paintItem.setVisibility(8); this.cropItem.setVisibility(8); this.tuneItem.setVisibility(8); } else { if (this.sendPhotoType != 1) { this.pickerView.setPadding(0, 0, 0, 0); } this.paintItem.setVisibility(0); this.cropItem.setVisibility(0); this.tuneItem.setVisibility(0); } this.actionBar.setSubtitle(null); } if (obj3 instanceof PhotoEntry) { photoEntry = (PhotoEntry) obj3; z3 = photoEntry.bucketId == 0 && photoEntry.dateTaken == 0 && this.imagesArrLocals.size() == 1; this.fromCamera = z3; charSequence = photoEntry.caption; str2 = photoEntry.path; i4 = photoEntry.ttl; z5 = photoEntry.isFiltered; z3 = photoEntry.isPainted; z2 = photoEntry.isCropped; z4 = z6; } else if (obj3 instanceof SearchImage) { searchImage = (SearchImage) obj3; charSequence = searchImage.caption; i4 = searchImage.ttl; z5 = searchImage.isFiltered; z3 = searchImage.isPainted; z2 = searchImage.isCropped; str2 = null; z4 = z6; } else { z2 = false; z3 = false; z5 = false; i4 = 0; charSequence = null; str2 = null; z4 = z6; } } this.bottomLayout.setVisibility(8); if (!this.fromCamera) { this.actionBar.setTitle(LocaleController.formatString("Of", R.string.Of, new Object[]{Integer.valueOf(this.currentIndex + 1), Integer.valueOf(this.imagesArrLocals.size())})); } else if (z4) { this.actionBar.setTitle(LocaleController.getString("AttachVideo", R.string.AttachVideo)); } else { this.actionBar.setTitle(LocaleController.getString("AttachPhoto", R.string.AttachPhoto)); } if (this.parentChatActivity != null) { Chat currentChat = this.parentChatActivity.getCurrentChat(); if (currentChat != null) { this.actionBar.setTitle(currentChat.title); } else { User currentUser = this.parentChatActivity.getCurrentUser(); if (currentUser != null) { this.actionBar.setTitle(ContactsController.formatName(currentUser.first_name, currentUser.last_name)); } } } if (this.sendPhotoType == 0) { this.checkImageView.setChecked(this.placeProvider.isPhotoChecked(this.currentIndex), false); } setCurrentCaption(charSequence); updateCaptionTextForCurrentPhoto(obj3); this.timeItem.setColorFilter(i4 != 0 ? new PorterDuffColorFilter(-12734994, Mode.MULTIPLY) : null); this.paintItem.setColorFilter(z3 ? new PorterDuffColorFilter(-12734994, Mode.MULTIPLY) : null); this.cropItem.setColorFilter(z2 ? new PorterDuffColorFilter(-12734994, Mode.MULTIPLY) : null); this.tuneItem.setColorFilter(z5 ? new PorterDuffColorFilter(-12734994, Mode.MULTIPLY) : null); str = str2; z3 = z4; } } else if (this.currentIndex < 0 || this.currentIndex >= this.imagesArr.size()) { closePhoto(false, false); return; } else { MessageObject messageObject = (MessageObject) this.imagesArr.get(this.currentIndex); Object obj4 = (this.currentMessageObject == null || this.currentMessageObject.getId() != messageObject.getId()) ? null : 1; this.currentMessageObject = messageObject; z4 = this.currentMessageObject.isVideo(); boolean isInvoice = this.currentMessageObject.isInvoice(); if (isInvoice) { this.masksItem.setVisibility(8); this.menuItem.hideSubItem(6); this.menuItem.hideSubItem(11); setCurrentCaption(this.currentMessageObject.messageOwner.media.description); this.allowShare = false; this.bottomLayout.setTranslationY((float) AndroidUtilities.dp(48.0f)); this.captionTextView.setTranslationY((float) AndroidUtilities.dp(48.0f)); } else { ActionBarMenuItem actionBarMenuItem = this.masksItem; i2 = (!this.currentMessageObject.hasPhotoStickers() || ((int) this.currentMessageObject.getDialogId()) == 0) ? 8 : 0; actionBarMenuItem.setVisibility(i2); if (this.currentMessageObject.canDeleteMessage(null) && this.slideshowMessageId == 0) { this.menuItem.showSubItem(6); } else { this.menuItem.hideSubItem(6); } if (z4) { this.menuItem.showSubItem(11); } else { this.menuItem.hideSubItem(11); } if (this.nameOverride != null) { this.nameTextView.setText(this.nameOverride); } else if (this.currentMessageObject.isFromUser()) { User user = MessagesController.getInstance().getUser(Integer.valueOf(this.currentMessageObject.messageOwner.from_id)); if (user != null) { this.nameTextView.setText(UserObject.getUserName(user)); } else { this.nameTextView.setText(TtmlNode.ANONYMOUS_REGION_ID); } } else { Chat chat = MessagesController.getInstance().getChat(Integer.valueOf(this.currentMessageObject.messageOwner.to_id.channel_id)); if (chat != null) { this.nameTextView.setText(chat.title); } else { this.nameTextView.setText(TtmlNode.ANONYMOUS_REGION_ID); } } long j = this.dateOverride != 0 ? ((long) this.dateOverride) * 1000 : ((long) this.currentMessageObject.messageOwner.date) * 1000; CharSequence formatString = LocaleController.formatString("formatDateAtTime", R.string.formatDateAtTime, new Object[]{LocaleController.getInstance().formatterYear.format(new Date(j)), LocaleController.getInstance().formatterDay.format(new Date(j))}); if (this.currentFileNames[0] == null || !z4) { this.dateTextView.setText(formatString); } else { this.dateTextView.setText(String.format("%s (%s)", new Object[]{formatString, AndroidUtilities.formatFileSize((long) this.currentMessageObject.getDocument().size)})); } setCurrentCaption(this.currentMessageObject.caption); } if (this.currentAnimation != null) { this.menuItem.hideSubItem(1); this.menuItem.hideSubItem(10); if (!this.currentMessageObject.canDeleteMessage(null)) { this.menuItem.setVisibility(8); } this.allowShare = true; this.shareButton.setVisibility(0); this.actionBar.setTitle(LocaleController.getString("AttachGif", R.string.AttachGif)); } else { if (this.totalImagesCount + this.totalImagesCountMerge == 0 || this.needSearchImageInArr) { if (this.slideshowMessageId == 0 && (this.currentMessageObject.messageOwner.media instanceof TLRPC$TL_messageMediaWebPage)) { if (this.currentMessageObject.isVideo()) { this.actionBar.setTitle(LocaleController.getString("AttachVideo", R.string.AttachVideo)); } else { this.actionBar.setTitle(LocaleController.getString("AttachPhoto", R.string.AttachPhoto)); } } else if (isInvoice) { this.actionBar.setTitle(this.currentMessageObject.messageOwner.media.title); } } else if (this.opennedFromMedia) { if (this.imagesArr.size() < this.totalImagesCount + this.totalImagesCountMerge && !this.loadingMoreImages && this.currentIndex > this.imagesArr.size() - 5) { r3 = this.imagesArr.isEmpty() ? 0 : ((MessageObject) this.imagesArr.get(this.imagesArr.size() - 1)).getId(); i2 = 0; if (!this.endReached[0] || this.mergeDialogId == 0) { r5 = r3; } else if (this.imagesArr.isEmpty() || ((MessageObject) this.imagesArr.get(this.imagesArr.size() - 1)).getDialogId() == this.mergeDialogId) { i2 = 1; r5 = r3; } else { i2 = 1; r5 = 0; } SharedMediaQuery.loadMedia(i2 == 0 ? this.currentDialogId : this.mergeDialogId, 80, r5, 0, true, this.classGuid); this.loadingMoreImages = true; } this.actionBar.setTitle(LocaleController.formatString("Of", R.string.Of, new Object[]{Integer.valueOf(this.currentIndex + 1), Integer.valueOf(this.totalImagesCount + this.totalImagesCountMerge)})); } else { if (this.imagesArr.size() < this.totalImagesCount + this.totalImagesCountMerge && !this.loadingMoreImages && this.currentIndex < 5) { r3 = this.imagesArr.isEmpty() ? 0 : ((MessageObject) this.imagesArr.get(0)).getId(); i2 = 0; if (!this.endReached[0] || this.mergeDialogId == 0) { r5 = r3; } else if (this.imagesArr.isEmpty() || ((MessageObject) this.imagesArr.get(0)).getDialogId() == this.mergeDialogId) { i2 = 1; r5 = r3; } else { i2 = 1; r5 = 0; } SharedMediaQuery.loadMedia(i2 == 0 ? this.currentDialogId : this.mergeDialogId, 80, r5, 0, true, this.classGuid); this.loadingMoreImages = true; } this.actionBar.setTitle(LocaleController.formatString("Of", R.string.Of, new Object[]{Integer.valueOf((((this.totalImagesCount + this.totalImagesCountMerge) - this.imagesArr.size()) + this.currentIndex) + 1), Integer.valueOf(this.totalImagesCount + this.totalImagesCountMerge)})); } if (((int) this.currentDialogId) == 0) { this.sendItem.setVisibility(8); } if (this.currentMessageObject.messageOwner.ttl == 0 || this.currentMessageObject.messageOwner.ttl >= 3600) { this.allowShare = true; this.menuItem.showSubItem(1); this.shareButton.setVisibility(this.videoPlayerControlFrameLayout.getVisibility() != 0 ? 0 : 8); if (this.shareButton.getVisibility() == 0) { this.menuItem.hideSubItem(10); } else { this.menuItem.showSubItem(10); } } else { this.allowShare = false; this.menuItem.hideSubItem(1); this.shareButton.setVisibility(8); this.menuItem.hideSubItem(10); } } this.groupedPhotosListView.fillList(); obj = obj4; z3 = z4; } if (this.currentPlaceObject != null) { if (this.animationInProgress == 0) { this.currentPlaceObject.imageReceiver.setVisible(true, true); } else { this.showAfterAnimation = this.currentPlaceObject; } } this.currentPlaceObject = this.placeProvider.getPlaceForPhoto(this.currentMessageObject, this.currentFileLocation, this.currentIndex); if (this.currentPlaceObject != null) { if (this.animationInProgress == 0) { this.currentPlaceObject.imageReceiver.setVisible(false, true); } else { this.hideAfterAnimation = this.currentPlaceObject; } } if (obj == null) { this.draggingDown = false; this.translationX = BitmapDescriptorFactory.HUE_RED; this.translationY = BitmapDescriptorFactory.HUE_RED; this.scale = 1.0f; this.animateToX = BitmapDescriptorFactory.HUE_RED; this.animateToY = BitmapDescriptorFactory.HUE_RED; this.animateToScale = 1.0f; this.animationStartTime = 0; this.imageMoveAnimation = null; this.changeModeAnimation = null; if (this.aspectRatioFrameLayout != null) { this.aspectRatioFrameLayout.setVisibility(4); } releasePlayer(); this.pinchStartDistance = BitmapDescriptorFactory.HUE_RED; this.pinchStartScale = 1.0f; this.pinchCenterX = BitmapDescriptorFactory.HUE_RED; this.pinchCenterY = BitmapDescriptorFactory.HUE_RED; this.pinchStartX = BitmapDescriptorFactory.HUE_RED; this.pinchStartY = BitmapDescriptorFactory.HUE_RED; this.moveStartX = BitmapDescriptorFactory.HUE_RED; this.moveStartY = BitmapDescriptorFactory.HUE_RED; this.zooming = false; this.moving = false; this.doubleTap = false; this.invalidCoords = false; this.canDragDown = true; this.changingPage = false; this.switchImageAfterAnimation = 0; z2 = (this.imagesArrLocals.isEmpty() && (this.currentFileNames[0] == null || z3 || this.photoProgressViews[0].backgroundState == 0)) ? false : true; this.canZoom = z2; updateMinMax(this.scale); } if (z3 && str != null) { preparePlayer(new File(str), false, false); } if (i3 == -1) { setImages(); for (i2 = 0; i2 < 3; i2++) { checkProgress(i2, false); } return; } checkProgress(0, false); ImageReceiver imageReceiver; PhotoProgressView photoProgressView; if (i3 > this.currentIndex) { imageReceiver = this.rightImage; this.rightImage = this.centerImage; this.centerImage = this.leftImage; this.leftImage = imageReceiver; photoProgressView = this.photoProgressViews[0]; this.photoProgressViews[0] = this.photoProgressViews[2]; this.photoProgressViews[2] = photoProgressView; setIndexToImage(this.leftImage, this.currentIndex - 1); checkProgress(1, false); checkProgress(2, false); } else if (i3 < this.currentIndex) { imageReceiver = this.leftImage; this.leftImage = this.centerImage; this.centerImage = this.rightImage; this.rightImage = imageReceiver; photoProgressView = this.photoProgressViews[0]; this.photoProgressViews[0] = this.photoProgressViews[1]; this.photoProgressViews[1] = photoProgressView; setIndexToImage(this.rightImage, this.currentIndex + 1); checkProgress(1, false); checkProgress(2, false); } } } private void setImages() { if (this.animationInProgress == 0) { setIndexToImage(this.centerImage, this.currentIndex); setIndexToImage(this.rightImage, this.currentIndex + 1); setIndexToImage(this.leftImage, this.currentIndex - 1); } } private void setIndexToImage(ImageReceiver imageReceiver, int i) { imageReceiver.setOrientation(0, false); TLObject fileLocation; if (this.imagesArrLocals.isEmpty()) { int[] iArr = new int[1]; fileLocation = getFileLocation(i, iArr); if (fileLocation != null) { MessageObject messageObject = null; if (!this.imagesArr.isEmpty()) { messageObject = (MessageObject) this.imagesArr.get(i); } imageReceiver.setParentMessageObject(messageObject); if (messageObject != null) { imageReceiver.setShouldGenerateQualityThumb(true); } Bitmap bitmap; if (messageObject != null && messageObject.isVideo()) { imageReceiver.setNeedsQualityThumb(true); if (messageObject.photoThumbs == null || messageObject.photoThumbs.isEmpty()) { imageReceiver.setImageBitmap(this.parentActivity.getResources().getDrawable(R.drawable.photoview_placeholder)); return; } bitmap = (this.currentThumb == null || imageReceiver != this.centerImage) ? null : this.currentThumb; imageReceiver.setImage(null, null, null, bitmap != null ? new BitmapDrawable(null, bitmap) : null, FileLoader.getClosestPhotoSizeWithSize(messageObject.photoThumbs, 100).location, "b", 0, null, 1); return; } else if (messageObject == null || this.currentAnimation == null) { imageReceiver.setNeedsQualityThumb(true); bitmap = (this.currentThumb == null || imageReceiver != this.centerImage) ? null : this.currentThumb; if (iArr[0] == 0) { iArr[0] = -1; } PhotoSize closestPhotoSizeWithSize = messageObject != null ? FileLoader.getClosestPhotoSizeWithSize(messageObject.photoThumbs, 100) : null; PhotoSize photoSize = (closestPhotoSizeWithSize == null || closestPhotoSizeWithSize.location != fileLocation) ? closestPhotoSizeWithSize : null; Drawable bitmapDrawable = bitmap != null ? new BitmapDrawable(null, bitmap) : null; FileLocation fileLocation2 = photoSize != null ? photoSize.location : null; String str = "b"; int i2 = iArr[0]; int i3 = (this.avatarsDialogId != 0 || this.isEvent) ? 1 : 0; imageReceiver.setImage(fileLocation, null, null, bitmapDrawable, fileLocation2, str, i2, null, i3); return; } else { imageReceiver.setImageBitmap(this.currentAnimation); this.currentAnimation.setSecondParentView(this.containerView); return; } } imageReceiver.setNeedsQualityThumb(true); imageReceiver.setParentMessageObject(null); if (iArr[0] == 0) { imageReceiver.setImageBitmap((Bitmap) null); return; } else { imageReceiver.setImageBitmap(this.parentActivity.getResources().getDrawable(R.drawable.photoview_placeholder)); return; } } imageReceiver.setParentMessageObject(null); if (i < 0 || i >= this.imagesArrLocals.size()) { imageReceiver.setImageBitmap((Bitmap) null); return; } TLObject tLObject; String str2; String str3; boolean z; Object obj = this.imagesArrLocals.get(i); int photoSize2 = (int) (((float) AndroidUtilities.getPhotoSize()) / AndroidUtilities.density); Bitmap bitmap2 = null; if (this.currentThumb != null && imageReceiver == this.centerImage) { bitmap2 = this.currentThumb; } Bitmap thumbForPhoto = bitmap2 == null ? this.placeProvider.getThumbForPhoto(null, null, i) : bitmap2; str = null; TLObject tLObject2 = null; int i4 = 0; String str4 = null; if (obj instanceof PhotoEntry) { String str5; PhotoEntry photoEntry = (PhotoEntry) obj; boolean z2 = photoEntry.isVideo; if (photoEntry.isVideo) { str4 = "vthumb://" + photoEntry.imageId + ":" + photoEntry.path; str5 = null; } else { if (photoEntry.imagePath != null) { str5 = photoEntry.imagePath; } else { imageReceiver.setOrientation(photoEntry.orientation, false); str5 = photoEntry.path; } str4 = str5; str5 = String.format(Locale.US, "%d_%d", new Object[]{Integer.valueOf(photoSize2), Integer.valueOf(photoSize2)}); } i2 = 0; tLObject = null; str2 = str5; str3 = str4; fileLocation = null; z = z2; } else if (obj instanceof BotInlineResult) { TLObject tLObject3; String str6; TLObject tLObject4; int i5; BotInlineResult botInlineResult = (BotInlineResult) obj; if (botInlineResult.type.equals(MimeTypes.BASE_TYPE_VIDEO) || MessageObject.isVideoDocument(botInlineResult.document)) { if (botInlineResult.document != null) { tLObject3 = null; str6 = null; tLObject4 = botInlineResult.document.thumb.location; i5 = 0; } else { tLObject4 = null; tLObject3 = null; str6 = botInlineResult.thumb_url; i5 = 0; } } else if (botInlineResult.type.equals("gif") && botInlineResult.document != null) { tLObject4 = botInlineResult.document; i5 = botInlineResult.document.size; str4 = "d"; str6 = null; TLObject tLObject5 = tLObject4; tLObject4 = null; tLObject3 = tLObject5; } else if (botInlineResult.photo != null) { closestPhotoSizeWithSize = FileLoader.getClosestPhotoSizeWithSize(botInlineResult.photo.sizes, AndroidUtilities.getPhotoSize()); tLObject4 = closestPhotoSizeWithSize.location; i5 = closestPhotoSizeWithSize.size; str4 = String.format(Locale.US, "%d_%d", new Object[]{Integer.valueOf(photoSize2), Integer.valueOf(photoSize2)}); tLObject3 = null; str6 = null; } else if (botInlineResult.content_url != null) { str4 = botInlineResult.type.equals("gif") ? "d" : String.format(Locale.US, "%d_%d", new Object[]{Integer.valueOf(photoSize2), Integer.valueOf(photoSize2)}); tLObject4 = null; tLObject3 = null; str6 = botInlineResult.content_url; i5 = 0; } else { i5 = 0; tLObject4 = null; tLObject3 = null; str6 = null; } tLObject = tLObject4; str3 = str6; int i6 = i5; z = false; i2 = i6; TLObject tLObject6 = tLObject3; str2 = str4; fileLocation = tLObject6; } else if (obj instanceof SearchImage) { SearchImage searchImage = (SearchImage) obj; if (searchImage.imagePath != null) { str = searchImage.imagePath; } else if (searchImage.document != null) { tLObject2 = searchImage.document; i4 = searchImage.document.size; } else { str = searchImage.imageUrl; i4 = searchImage.size; } z = false; tLObject = null; i2 = i4; str2 = "d"; fileLocation = tLObject2; str3 = str; } else { z = false; tLObject = null; i2 = 0; str2 = null; fileLocation = null; str3 = null; } if (fileLocation != null) { imageReceiver.setImage(fileLocation, null, "d", thumbForPhoto != null ? new BitmapDrawable(null, thumbForPhoto) : null, thumbForPhoto == null ? fileLocation.thumb.location : null, String.format(Locale.US, "%d_%d", new Object[]{Integer.valueOf(photoSize2), Integer.valueOf(photoSize2)}), i2, null, 0); } else if (tLObject != null) { imageReceiver.setImage(tLObject, null, str2, thumbForPhoto != null ? new BitmapDrawable(null, thumbForPhoto) : null, null, String.format(Locale.US, "%d_%d", new Object[]{Integer.valueOf(photoSize2), Integer.valueOf(photoSize2)}), i2, null, 0); } else { bitmapDrawable = thumbForPhoto != null ? new BitmapDrawable(null, thumbForPhoto) : (!z || this.parentActivity == null) ? null : this.parentActivity.getResources().getDrawable(R.drawable.nophotos); imageReceiver.setImage(str3, str2, bitmapDrawable, null, i2); } } private void setPhotoChecked() { if (this.placeProvider != null) { int photoChecked = this.placeProvider.setPhotoChecked(this.currentIndex, getCurrentVideoEditedInfo()); boolean isPhotoChecked = this.placeProvider.isPhotoChecked(this.currentIndex); this.checkImageView.setChecked(isPhotoChecked, true); if (photoChecked >= 0) { if (this.placeProvider.allowGroupPhotos()) { photoChecked++; } if (isPhotoChecked) { this.selectedPhotosAdapter.notifyItemInserted(photoChecked); this.selectedPhotosListView.smoothScrollToPosition(photoChecked); } else { this.selectedPhotosAdapter.notifyItemRemoved(photoChecked); } } updateSelectedCount(); } } private void setScaleToFill() { float bitmapWidth = (float) this.centerImage.getBitmapWidth(); float containerViewWidth = (float) getContainerViewWidth(); float bitmapHeight = (float) this.centerImage.getBitmapHeight(); float containerViewHeight = (float) getContainerViewHeight(); float min = Math.min(containerViewHeight / bitmapHeight, containerViewWidth / bitmapWidth); this.scale = Math.max(containerViewWidth / ((float) ((int) (bitmapWidth * min))), containerViewHeight / ((float) ((int) (bitmapHeight * min)))); updateMinMax(this.scale); } private void showHint(boolean z, boolean z2) { if (this.containerView == null) { return; } if (!z || this.hintTextView != null) { if (this.hintTextView == null) { this.hintTextView = new TextView(this.containerView.getContext()); this.hintTextView.setBackgroundDrawable(Theme.createRoundRectDrawable(AndroidUtilities.dp(3.0f), Theme.getColor(Theme.key_chat_gifSaveHintBackground))); this.hintTextView.setTextColor(Theme.getColor(Theme.key_chat_gifSaveHintText)); this.hintTextView.setTextSize(1, 14.0f); this.hintTextView.setPadding(AndroidUtilities.dp(8.0f), AndroidUtilities.dp(7.0f), AndroidUtilities.dp(8.0f), AndroidUtilities.dp(7.0f)); this.hintTextView.setGravity(16); this.hintTextView.setAlpha(BitmapDescriptorFactory.HUE_RED); this.containerView.addView(this.hintTextView, LayoutHelper.createFrame(-2, -2.0f, 51, 5.0f, BitmapDescriptorFactory.HUE_RED, 5.0f, 3.0f)); } if (z) { if (this.hintAnimation != null) { this.hintAnimation.cancel(); this.hintAnimation = null; } AndroidUtilities.cancelRunOnUIThread(this.hintHideRunnable); this.hintHideRunnable = null; hideHint(); return; } this.hintTextView.setText(z2 ? LocaleController.getString("GroupPhotosHelp", R.string.GroupPhotosHelp) : LocaleController.getString("SinglePhotosHelp", R.string.SinglePhotosHelp)); if (this.hintHideRunnable != null) { if (this.hintAnimation != null) { this.hintAnimation.cancel(); this.hintAnimation = null; } else { AndroidUtilities.cancelRunOnUIThread(this.hintHideRunnable); Runnable anonymousClass64 = new Runnable() { public void run() { PhotoViewer.this.hideHint(); } }; this.hintHideRunnable = anonymousClass64; AndroidUtilities.runOnUIThread(anonymousClass64, 2000); return; } } else if (this.hintAnimation != null) { return; } this.hintTextView.setVisibility(0); this.hintAnimation = new AnimatorSet(); AnimatorSet animatorSet = this.hintAnimation; Animator[] animatorArr = new Animator[1]; animatorArr[0] = ObjectAnimator.ofFloat(this.hintTextView, "alpha", new float[]{1.0f}); animatorSet.playTogether(animatorArr); this.hintAnimation.addListener(new AnimatorListenerAdapter() { /* renamed from: org.telegram.ui.PhotoViewer$65$1 */ class C50711 implements Runnable { C50711() { } public void run() { PhotoViewer.this.hideHint(); } } public void onAnimationCancel(Animator animator) { if (animator.equals(PhotoViewer.this.hintAnimation)) { PhotoViewer.this.hintAnimation = null; } } public void onAnimationEnd(Animator animator) { if (animator.equals(PhotoViewer.this.hintAnimation)) { PhotoViewer.this.hintAnimation = null; AndroidUtilities.runOnUIThread(PhotoViewer.this.hintHideRunnable = new C50711(), 2000); } } }); this.hintAnimation.setDuration(300); this.hintAnimation.start(); } } private void showQualityView(final boolean z) { if (z) { this.previousCompression = this.selectedCompression; } if (this.qualityChooseViewAnimation != null) { this.qualityChooseViewAnimation.cancel(); } this.qualityChooseViewAnimation = new AnimatorSet(); AnimatorSet animatorSet; Animator[] animatorArr; if (z) { this.qualityChooseView.setTag(Integer.valueOf(1)); animatorSet = this.qualityChooseViewAnimation; animatorArr = new Animator[2]; animatorArr[0] = ObjectAnimator.ofFloat(this.pickerView, "translationY", new float[]{BitmapDescriptorFactory.HUE_RED, (float) AndroidUtilities.dp(152.0f)}); animatorArr[1] = ObjectAnimator.ofFloat(this.bottomLayout, "translationY", new float[]{(float) (-AndroidUtilities.dp(48.0f)), (float) AndroidUtilities.dp(104.0f)}); animatorSet.playTogether(animatorArr); } else { this.qualityChooseView.setTag(null); animatorSet = this.qualityChooseViewAnimation; animatorArr = new Animator[3]; animatorArr[0] = ObjectAnimator.ofFloat(this.qualityChooseView, "translationY", new float[]{BitmapDescriptorFactory.HUE_RED, (float) AndroidUtilities.dp(166.0f)}); animatorArr[1] = ObjectAnimator.ofFloat(this.qualityPicker, "translationY", new float[]{BitmapDescriptorFactory.HUE_RED, (float) AndroidUtilities.dp(166.0f)}); animatorArr[2] = ObjectAnimator.ofFloat(this.bottomLayout, "translationY", new float[]{(float) (-AndroidUtilities.dp(48.0f)), (float) AndroidUtilities.dp(118.0f)}); animatorSet.playTogether(animatorArr); } this.qualityChooseViewAnimation.addListener(new AnimatorListenerAdapter() { /* renamed from: org.telegram.ui.PhotoViewer$68$1 */ class C50721 extends AnimatorListenerAdapter { C50721() { } public void onAnimationEnd(Animator animator) { if (animator.equals(PhotoViewer.this.qualityChooseViewAnimation)) { PhotoViewer.this.qualityChooseViewAnimation = null; } } } public void onAnimationCancel(Animator animator) { PhotoViewer.this.qualityChooseViewAnimation = null; } public void onAnimationEnd(Animator animator) { if (animator.equals(PhotoViewer.this.qualityChooseViewAnimation)) { PhotoViewer.this.qualityChooseViewAnimation = new AnimatorSet(); AnimatorSet access$13300; Animator[] animatorArr; if (z) { PhotoViewer.this.qualityChooseView.setVisibility(0); PhotoViewer.this.qualityPicker.setVisibility(0); access$13300 = PhotoViewer.this.qualityChooseViewAnimation; animatorArr = new Animator[3]; animatorArr[0] = ObjectAnimator.ofFloat(PhotoViewer.this.qualityChooseView, "translationY", new float[]{BitmapDescriptorFactory.HUE_RED}); animatorArr[1] = ObjectAnimator.ofFloat(PhotoViewer.this.qualityPicker, "translationY", new float[]{BitmapDescriptorFactory.HUE_RED}); animatorArr[2] = ObjectAnimator.ofFloat(PhotoViewer.this.bottomLayout, "translationY", new float[]{(float) (-AndroidUtilities.dp(48.0f))}); access$13300.playTogether(animatorArr); } else { PhotoViewer.this.qualityChooseView.setVisibility(4); PhotoViewer.this.qualityPicker.setVisibility(4); access$13300 = PhotoViewer.this.qualityChooseViewAnimation; animatorArr = new Animator[2]; animatorArr[0] = ObjectAnimator.ofFloat(PhotoViewer.this.pickerView, "translationY", new float[]{BitmapDescriptorFactory.HUE_RED}); animatorArr[1] = ObjectAnimator.ofFloat(PhotoViewer.this.bottomLayout, "translationY", new float[]{(float) (-AndroidUtilities.dp(48.0f))}); access$13300.playTogether(animatorArr); } PhotoViewer.this.qualityChooseViewAnimation.addListener(new C50721()); PhotoViewer.this.qualityChooseViewAnimation.setDuration(200); PhotoViewer.this.qualityChooseViewAnimation.setInterpolator(new AccelerateInterpolator()); PhotoViewer.this.qualityChooseViewAnimation.start(); } } }); this.qualityChooseViewAnimation.setDuration(200); this.qualityChooseViewAnimation.setInterpolator(new DecelerateInterpolator()); this.qualityChooseViewAnimation.start(); } private void toggleActionBar(boolean z, boolean z2) { float f = 1.0f; if (z) { this.actionBar.setVisibility(0); if (this.canShowBottom) { this.bottomLayout.setVisibility(0); if (this.captionTextView.getTag() != null) { this.captionTextView.setVisibility(0); } } } this.isActionBarVisible = z; this.actionBar.setEnabled(z); this.bottomLayout.setEnabled(z); if (z2) { Collection arrayList = new ArrayList(); ActionBar actionBar = this.actionBar; String str = "alpha"; float[] fArr = new float[1]; fArr[0] = z ? 1.0f : 0.0f; arrayList.add(ObjectAnimator.ofFloat(actionBar, str, fArr)); FrameLayout frameLayout = this.bottomLayout; str = "alpha"; fArr = new float[1]; fArr[0] = z ? 1.0f : 0.0f; arrayList.add(ObjectAnimator.ofFloat(frameLayout, str, fArr)); GroupedPhotosListView groupedPhotosListView = this.groupedPhotosListView; str = "alpha"; fArr = new float[1]; fArr[0] = z ? 1.0f : 0.0f; arrayList.add(ObjectAnimator.ofFloat(groupedPhotosListView, str, fArr)); if (this.captionTextView.getTag() != null) { TextView textView = this.captionTextView; String str2 = "alpha"; float[] fArr2 = new float[1]; if (!z) { f = BitmapDescriptorFactory.HUE_RED; } fArr2[0] = f; arrayList.add(ObjectAnimator.ofFloat(textView, str2, fArr2)); } this.currentActionBarAnimation = new AnimatorSet(); this.currentActionBarAnimation.playTogether(arrayList); if (!z) { this.currentActionBarAnimation.addListener(new AnimatorListenerAdapter() { public void onAnimationEnd(Animator animator) { if (PhotoViewer.this.currentActionBarAnimation != null && PhotoViewer.this.currentActionBarAnimation.equals(animator)) { PhotoViewer.this.actionBar.setVisibility(8); if (PhotoViewer.this.canShowBottom) { PhotoViewer.this.bottomLayout.setVisibility(8); if (PhotoViewer.this.captionTextView.getTag() != null) { PhotoViewer.this.captionTextView.setVisibility(4); } } PhotoViewer.this.currentActionBarAnimation = null; } } }); } this.currentActionBarAnimation.setDuration(200); this.currentActionBarAnimation.start(); return; } this.actionBar.setAlpha(z ? 1.0f : BitmapDescriptorFactory.HUE_RED); this.bottomLayout.setAlpha(z ? 1.0f : BitmapDescriptorFactory.HUE_RED); this.groupedPhotosListView.setAlpha(z ? 1.0f : BitmapDescriptorFactory.HUE_RED); if (this.captionTextView.getTag() != null) { textView = this.captionTextView; if (!z) { f = BitmapDescriptorFactory.HUE_RED; } textView.setAlpha(f); } if (!z) { this.actionBar.setVisibility(8); if (this.canShowBottom) { this.bottomLayout.setVisibility(8); if (this.captionTextView.getTag() != null) { this.captionTextView.setVisibility(4); } } } } private void toggleCheckImageView(boolean z) { float f = 1.0f; AnimatorSet animatorSet = new AnimatorSet(); Collection arrayList = new ArrayList(); FrameLayout frameLayout = this.pickerView; String str = "alpha"; float[] fArr = new float[1]; fArr[0] = z ? 1.0f : 0.0f; arrayList.add(ObjectAnimator.ofFloat(frameLayout, str, fArr)); if (this.needCaptionLayout) { TextView textView = this.captionTextView; str = "alpha"; fArr = new float[1]; fArr[0] = z ? 1.0f : 0.0f; arrayList.add(ObjectAnimator.ofFloat(textView, str, fArr)); } if (this.sendPhotoType == 0) { CheckBox checkBox = this.checkImageView; str = "alpha"; fArr = new float[1]; fArr[0] = z ? 1.0f : 0.0f; arrayList.add(ObjectAnimator.ofFloat(checkBox, str, fArr)); CounterView counterView = this.photosCounterView; String str2 = "alpha"; float[] fArr2 = new float[1]; if (!z) { f = 0.0f; } fArr2[0] = f; arrayList.add(ObjectAnimator.ofFloat(counterView, str2, fArr2)); } animatorSet.playTogether(arrayList); animatorSet.setDuration(200); animatorSet.start(); } private void togglePhotosListView(boolean z, boolean z2) { float f = 1.0f; if (z != this.isPhotosListViewVisible) { if (z) { this.selectedPhotosListView.setVisibility(0); } this.isPhotosListViewVisible = z; this.selectedPhotosListView.setEnabled(z); CounterView counterView; if (z2) { Collection arrayList = new ArrayList(); RecyclerListView recyclerListView = this.selectedPhotosListView; String str = "alpha"; float[] fArr = new float[1]; fArr[0] = z ? 1.0f : 0.0f; arrayList.add(ObjectAnimator.ofFloat(recyclerListView, str, fArr)); recyclerListView = this.selectedPhotosListView; str = "translationY"; fArr = new float[1]; fArr[0] = z ? BitmapDescriptorFactory.HUE_RED : (float) (-AndroidUtilities.dp(10.0f)); arrayList.add(ObjectAnimator.ofFloat(recyclerListView, str, fArr)); counterView = this.photosCounterView; String str2 = "rotationX"; float[] fArr2 = new float[1]; if (!z) { f = BitmapDescriptorFactory.HUE_RED; } fArr2[0] = f; arrayList.add(ObjectAnimator.ofFloat(counterView, str2, fArr2)); this.currentListViewAnimation = new AnimatorSet(); this.currentListViewAnimation.playTogether(arrayList); if (!z) { this.currentListViewAnimation.addListener(new AnimatorListenerAdapter() { public void onAnimationEnd(Animator animator) { if (PhotoViewer.this.currentListViewAnimation != null && PhotoViewer.this.currentListViewAnimation.equals(animator)) { PhotoViewer.this.selectedPhotosListView.setVisibility(8); PhotoViewer.this.currentListViewAnimation = null; } } }); } this.currentListViewAnimation.setDuration(200); this.currentListViewAnimation.start(); return; } this.selectedPhotosListView.setAlpha(z ? 1.0f : BitmapDescriptorFactory.HUE_RED); this.selectedPhotosListView.setTranslationY(z ? BitmapDescriptorFactory.HUE_RED : (float) (-AndroidUtilities.dp(10.0f))); counterView = this.photosCounterView; if (!z) { f = BitmapDescriptorFactory.HUE_RED; } counterView.setRotationX(f); if (!z) { this.selectedPhotosListView.setVisibility(8); } } } private void updateCaptionTextForCurrentPhoto(Object obj) { CharSequence charSequence = null; if (obj instanceof PhotoEntry) { charSequence = ((PhotoEntry) obj).caption; } else if (!(obj instanceof BotInlineResult) && (obj instanceof SearchImage)) { charSequence = ((SearchImage) obj).caption; } if (charSequence == null || charSequence.length() == 0) { this.captionEditText.setFieldText(TtmlNode.ANONYMOUS_REGION_ID); } else { this.captionEditText.setFieldText(charSequence); } } private void updateMinMax(float f) { int imageWidth = ((int) ((((float) this.centerImage.getImageWidth()) * f) - ((float) getContainerViewWidth()))) / 2; int imageHeight = ((int) ((((float) this.centerImage.getImageHeight()) * f) - ((float) getContainerViewHeight()))) / 2; if (imageWidth > 0) { this.minX = (float) (-imageWidth); this.maxX = (float) imageWidth; } else { this.maxX = BitmapDescriptorFactory.HUE_RED; this.minX = BitmapDescriptorFactory.HUE_RED; } if (imageHeight > 0) { this.minY = (float) (-imageHeight); this.maxY = (float) imageHeight; } else { this.maxY = BitmapDescriptorFactory.HUE_RED; this.minY = BitmapDescriptorFactory.HUE_RED; } if (this.currentEditMode == 1) { this.maxX += this.photoCropView.getLimitX(); this.maxY += this.photoCropView.getLimitY(); this.minX -= this.photoCropView.getLimitWidth(); this.minY -= this.photoCropView.getLimitHeight(); } } private void updateSelectedCount() { if (this.placeProvider != null) { int selectedCount = this.placeProvider.getSelectedCount(); this.photosCounterView.setCount(selectedCount); if (selectedCount == 0) { togglePhotosListView(false, true); } } } private void updateVideoInfo() { if (this.actionBar != null) { if (this.compressionsCount == 0) { this.actionBar.setSubtitle(null); return; } int i; int i2; if (this.selectedCompression == 0) { this.compressItem.setImageResource(R.drawable.video_240); } else if (this.selectedCompression == 1) { this.compressItem.setImageResource(R.drawable.video_360); } else if (this.selectedCompression == 2) { this.compressItem.setImageResource(R.drawable.video_480); } else if (this.selectedCompression == 3) { this.compressItem.setImageResource(R.drawable.video_720); } else if (this.selectedCompression == 4) { this.compressItem.setImageResource(R.drawable.video_1080); } this.estimatedDuration = (long) Math.ceil((double) ((this.videoTimelineView.getRightProgress() - this.videoTimelineView.getLeftProgress()) * this.videoDuration)); if (this.compressItem.getTag() == null || this.selectedCompression == this.compressionsCount - 1) { i = (this.rotationValue == 90 || this.rotationValue == 270) ? this.originalHeight : this.originalWidth; i2 = (this.rotationValue == 90 || this.rotationValue == 270) ? this.originalWidth : this.originalHeight; this.estimatedSize = (int) (((float) this.originalSize) * (((float) this.estimatedDuration) / this.videoDuration)); } else { i = (this.rotationValue == 90 || this.rotationValue == 270) ? this.resultHeight : this.resultWidth; i2 = (this.rotationValue == 90 || this.rotationValue == 270) ? this.resultWidth : this.resultHeight; this.estimatedSize = (int) (((float) (this.audioFramesSize + this.videoFramesSize)) * (((float) this.estimatedDuration) / this.videoDuration)); this.estimatedSize += (this.estimatedSize / TLRPC.MESSAGE_FLAG_EDITED) * 16; } if (this.videoTimelineView.getLeftProgress() == BitmapDescriptorFactory.HUE_RED) { this.startTime = -1; } else { this.startTime = ((long) (this.videoTimelineView.getLeftProgress() * this.videoDuration)) * 1000; } if (this.videoTimelineView.getRightProgress() == 1.0f) { this.endTime = -1; } else { this.endTime = ((long) (this.videoTimelineView.getRightProgress() * this.videoDuration)) * 1000; } String format = String.format("%dx%d", new Object[]{Integer.valueOf(i), Integer.valueOf(i2)}); int ceil = ((int) Math.ceil((double) (this.estimatedDuration / 1000))) - (((int) ((this.estimatedDuration / 1000) / 60)) * 60); String format2 = String.format("%d:%02d, ~%s", new Object[]{Integer.valueOf((int) ((this.estimatedDuration / 1000) / 60)), Integer.valueOf(ceil), AndroidUtilities.formatFileSize((long) this.estimatedSize)}); this.currentSubtitle = String.format("%s, %s", new Object[]{format, format2}); this.actionBar.setSubtitle(this.muteVideo ? null : this.currentSubtitle); } } private void updateVideoPlayerTime() { CharSequence format; if (this.videoPlayer == null) { format = String.format("%02d:%02d / %02d:%02d", new Object[]{Integer.valueOf(0), Integer.valueOf(0), Integer.valueOf(0), Integer.valueOf(0)}); } else { long currentPosition = this.videoPlayer.getCurrentPosition(); long duration = this.videoPlayer.getDuration(); if (duration == C3446C.TIME_UNSET || currentPosition == C3446C.TIME_UNSET) { format = String.format("%02d:%02d / %02d:%02d", new Object[]{Integer.valueOf(0), Integer.valueOf(0), Integer.valueOf(0), Integer.valueOf(0)}); } else { if (!this.inPreview && this.videoTimelineView.getVisibility() == 0) { duration = (long) (((float) duration) * (this.videoTimelineView.getRightProgress() - this.videoTimelineView.getLeftProgress())); currentPosition = (long) (((float) currentPosition) - (this.videoTimelineView.getLeftProgress() * ((float) duration))); if (currentPosition > duration) { currentPosition = duration; } } currentPosition /= 1000; duration /= 1000; format = String.format("%02d:%02d / %02d:%02d", new Object[]{Long.valueOf(currentPosition / 60), Long.valueOf(currentPosition % 60), Long.valueOf(duration / 60), Long.valueOf(duration % 60)}); } } if (!TextUtils.equals(this.videoPlayerTime.getText(), format)) { this.videoPlayerTime.setText(format); } } private void updateWidthHeightBitrateForCompression() { if (this.compressionsCount > 0) { if (this.selectedCompression >= this.compressionsCount) { this.selectedCompression = this.compressionsCount - 1; } if (this.selectedCompression != this.compressionsCount - 1) { float f; int i; switch (this.selectedCompression) { case 0: f = 432.0f; i = 400000; break; case 1: f = 640.0f; i = 900000; break; case 2: f = 848.0f; i = 1100000; break; default: i = 2500000; f = 1280.0f; break; } f = this.originalWidth > this.originalHeight ? f / ((float) this.originalWidth) : f / ((float) this.originalHeight); this.resultWidth = Math.round((((float) this.originalWidth) * f) / 2.0f) * 2; this.resultHeight = Math.round((((float) this.originalHeight) * f) / 2.0f) * 2; if (this.bitrate != 0) { this.bitrate = Math.min(i, (int) (((float) this.originalBitrate) / f)); this.videoFramesSize = (long) ((((float) (this.bitrate / 8)) * this.videoDuration) / 1000.0f); } } } } public void closePhoto(boolean z, boolean z2) { if (z2 || this.currentEditMode == 0) { if (this.qualityChooseView == null || this.qualityChooseView.getTag() == null) { try { if (this.visibleDialog != null) { this.visibleDialog.dismiss(); this.visibleDialog = null; } } catch (Throwable e) { FileLog.e(e); } if (this.currentEditMode != 0) { if (this.currentEditMode == 2) { this.photoFilterView.shutdown(); this.containerView.removeView(this.photoFilterView); this.photoFilterView = null; } else if (this.currentEditMode == 1) { this.editorDoneLayout.setVisibility(8); this.photoCropView.setVisibility(8); } this.currentEditMode = 0; } if (this.parentActivity != null && this.isVisible && !checkAnimation() && this.placeProvider != null) { if (!this.captionEditText.hideActionMode() || z2) { releasePlayer(); this.captionEditText.onDestroy(); this.parentChatActivity = null; NotificationCenter.getInstance().removeObserver(this, NotificationCenter.FileDidFailedLoad); NotificationCenter.getInstance().removeObserver(this, NotificationCenter.FileDidLoaded); NotificationCenter.getInstance().removeObserver(this, NotificationCenter.FileLoadProgressChanged); NotificationCenter.getInstance().removeObserver(this, NotificationCenter.mediaCountDidLoaded); NotificationCenter.getInstance().removeObserver(this, NotificationCenter.mediaDidLoaded); NotificationCenter.getInstance().removeObserver(this, NotificationCenter.dialogPhotosLoaded); NotificationCenter.getInstance().removeObserver(this, NotificationCenter.emojiDidLoaded); NotificationCenter.getInstance().removeObserver(this, NotificationCenter.FilePreparingFailed); NotificationCenter.getInstance().removeObserver(this, NotificationCenter.FileNewChunkAvailable); ConnectionsManager.getInstance().cancelRequestsForGuid(this.classGuid); this.isActionBarVisible = false; if (this.velocityTracker != null) { this.velocityTracker.recycle(); this.velocityTracker = null; } ConnectionsManager.getInstance().cancelRequestsForGuid(this.classGuid); final PlaceProviderObject placeForPhoto = this.placeProvider.getPlaceForPhoto(this.currentMessageObject, this.currentFileLocation, this.currentIndex); Animator[] animatorArr; if (z) { Rect drawRegion; this.animationInProgress = 1; this.animatingImageView.setVisibility(0); this.containerView.invalidate(); AnimatorSet animatorSet = new AnimatorSet(); ViewGroup.LayoutParams layoutParams = this.animatingImageView.getLayoutParams(); int orientation = this.centerImage.getOrientation(); int i = 0; if (!(placeForPhoto == null || placeForPhoto.imageReceiver == null)) { i = placeForPhoto.imageReceiver.getAnimatedOrientation(); } if (i == 0) { i = orientation; } this.animatingImageView.setOrientation(i); if (placeForPhoto != null) { this.animatingImageView.setNeedRadius(placeForPhoto.radius != 0); drawRegion = placeForPhoto.imageReceiver.getDrawRegion(); layoutParams.width = drawRegion.right - drawRegion.left; layoutParams.height = drawRegion.bottom - drawRegion.top; this.animatingImageView.setImageBitmap(placeForPhoto.thumb); } else { this.animatingImageView.setNeedRadius(false); layoutParams.width = this.centerImage.getImageWidth(); layoutParams.height = this.centerImage.getImageHeight(); this.animatingImageView.setImageBitmap(this.centerImage.getBitmap()); drawRegion = null; } this.animatingImageView.setLayoutParams(layoutParams); float f = ((float) AndroidUtilities.displaySize.x) / ((float) layoutParams.width); float f2 = ((float) ((VERSION.SDK_INT >= 21 ? AndroidUtilities.statusBarHeight : 0) + AndroidUtilities.displaySize.y)) / ((float) layoutParams.height); if (f <= f2) { f2 = f; } f = (((float) ((VERSION.SDK_INT >= 21 ? AndroidUtilities.statusBarHeight : 0) + AndroidUtilities.displaySize.y)) - ((((float) layoutParams.height) * this.scale) * f2)) / 2.0f; this.animatingImageView.setTranslationX(((((float) AndroidUtilities.displaySize.x) - ((((float) layoutParams.width) * this.scale) * f2)) / 2.0f) + this.translationX); this.animatingImageView.setTranslationY(f + this.translationY); this.animatingImageView.setScaleX(this.scale * f2); this.animatingImageView.setScaleY(f2 * this.scale); if (placeForPhoto != null) { placeForPhoto.imageReceiver.setVisible(false, true); int abs = Math.abs(drawRegion.left - placeForPhoto.imageReceiver.getImageX()); int abs2 = Math.abs(drawRegion.top - placeForPhoto.imageReceiver.getImageY()); int[] iArr = new int[2]; placeForPhoto.parentView.getLocationInWindow(iArr); orientation = ((iArr[1] - (VERSION.SDK_INT >= 21 ? 0 : AndroidUtilities.statusBarHeight)) - (placeForPhoto.viewY + drawRegion.top)) + placeForPhoto.clipTopAddition; if (orientation < 0) { orientation = 0; } int height = (((placeForPhoto.viewY + drawRegion.top) + (drawRegion.bottom - drawRegion.top)) - ((placeForPhoto.parentView.getHeight() + iArr[1]) - (VERSION.SDK_INT >= 21 ? 0 : AndroidUtilities.statusBarHeight))) + placeForPhoto.clipBottomAddition; if (height < 0) { height = 0; } orientation = Math.max(orientation, abs2); height = Math.max(height, abs2); this.animationValues[0][0] = this.animatingImageView.getScaleX(); this.animationValues[0][1] = this.animatingImageView.getScaleY(); this.animationValues[0][2] = this.animatingImageView.getTranslationX(); this.animationValues[0][3] = this.animatingImageView.getTranslationY(); this.animationValues[0][4] = BitmapDescriptorFactory.HUE_RED; this.animationValues[0][5] = BitmapDescriptorFactory.HUE_RED; this.animationValues[0][6] = BitmapDescriptorFactory.HUE_RED; this.animationValues[0][7] = BitmapDescriptorFactory.HUE_RED; this.animationValues[1][0] = placeForPhoto.scale; this.animationValues[1][1] = placeForPhoto.scale; this.animationValues[1][2] = ((float) placeForPhoto.viewX) + (((float) drawRegion.left) * placeForPhoto.scale); this.animationValues[1][3] = (((float) drawRegion.top) * placeForPhoto.scale) + ((float) placeForPhoto.viewY); this.animationValues[1][4] = ((float) abs) * placeForPhoto.scale; this.animationValues[1][5] = ((float) orientation) * placeForPhoto.scale; this.animationValues[1][6] = ((float) height) * placeForPhoto.scale; this.animationValues[1][7] = (float) placeForPhoto.radius; r0 = new Animator[3]; r0[1] = ObjectAnimator.ofInt(this.backgroundDrawable, "alpha", new int[]{0}); r0[2] = ObjectAnimator.ofFloat(this.containerView, "alpha", new float[]{BitmapDescriptorFactory.HUE_RED}); animatorSet.playTogether(r0); } else { i = (VERSION.SDK_INT >= 21 ? AndroidUtilities.statusBarHeight : 0) + AndroidUtilities.displaySize.y; animatorArr = new Animator[4]; animatorArr[0] = ObjectAnimator.ofInt(this.backgroundDrawable, "alpha", new int[]{0}); animatorArr[1] = ObjectAnimator.ofFloat(this.animatingImageView, "alpha", new float[]{BitmapDescriptorFactory.HUE_RED}); ClippingImageView clippingImageView = this.animatingImageView; String str = "translationY"; float[] fArr = new float[1]; fArr[0] = this.translationY >= BitmapDescriptorFactory.HUE_RED ? (float) i : (float) (-i); animatorArr[2] = ObjectAnimator.ofFloat(clippingImageView, str, fArr); animatorArr[3] = ObjectAnimator.ofFloat(this.containerView, "alpha", new float[]{BitmapDescriptorFactory.HUE_RED}); animatorSet.playTogether(animatorArr); } this.animationEndRunnable = new Runnable() { public void run() { if (VERSION.SDK_INT >= 18) { PhotoViewer.this.containerView.setLayerType(0, null); } PhotoViewer.this.animationInProgress = 0; PhotoViewer.this.onPhotoClosed(placeForPhoto); } }; animatorSet.setDuration(200); animatorSet.addListener(new AnimatorListenerAdapter() { /* renamed from: org.telegram.ui.PhotoViewer$57$1 */ class C50691 implements Runnable { C50691() { } public void run() { if (PhotoViewer.this.animationEndRunnable != null) { PhotoViewer.this.animationEndRunnable.run(); PhotoViewer.this.animationEndRunnable = null; } } } public void onAnimationEnd(Animator animator) { AndroidUtilities.runOnUIThread(new C50691()); } }); this.transitionAnimationStartTime = System.currentTimeMillis(); if (VERSION.SDK_INT >= 18) { this.containerView.setLayerType(2, null); } animatorSet.start(); } else { AnimatorSet animatorSet2 = new AnimatorSet(); animatorArr = new Animator[4]; animatorArr[0] = ObjectAnimator.ofFloat(this.containerView, "scaleX", new float[]{0.9f}); animatorArr[1] = ObjectAnimator.ofFloat(this.containerView, "scaleY", new float[]{0.9f}); animatorArr[2] = ObjectAnimator.ofInt(this.backgroundDrawable, "alpha", new int[]{0}); animatorArr[3] = ObjectAnimator.ofFloat(this.containerView, "alpha", new float[]{BitmapDescriptorFactory.HUE_RED}); animatorSet2.playTogether(animatorArr); this.animationInProgress = 2; this.animationEndRunnable = new Runnable() { public void run() { if (PhotoViewer.this.containerView != null) { if (VERSION.SDK_INT >= 18) { PhotoViewer.this.containerView.setLayerType(0, null); } PhotoViewer.this.animationInProgress = 0; PhotoViewer.this.onPhotoClosed(placeForPhoto); PhotoViewer.this.containerView.setScaleX(1.0f); PhotoViewer.this.containerView.setScaleY(1.0f); } } }; animatorSet2.setDuration(200); animatorSet2.addListener(new AnimatorListenerAdapter() { public void onAnimationEnd(Animator animator) { if (PhotoViewer.this.animationEndRunnable != null) { PhotoViewer.this.animationEndRunnable.run(); PhotoViewer.this.animationEndRunnable = null; } } }); this.transitionAnimationStartTime = System.currentTimeMillis(); if (VERSION.SDK_INT >= 18) { this.containerView.setLayerType(2, null); } animatorSet2.start(); } if (this.currentAnimation != null) { this.currentAnimation.setSecondParentView(null); this.currentAnimation = null; this.centerImage.setImageBitmap((Drawable) null); } if (!this.placeProvider.canScrollAway()) { this.placeProvider.cancelButtonPressed(); return; } return; } return; } return; } this.qualityPicker.cancelButton.callOnClick(); } else if (this.currentEditMode != 3 || this.photoPaintView == null) { if (this.currentEditMode == 1) { this.photoCropView.cancelAnimationRunnable(); } switchToEditMode(0); } else { this.photoPaintView.maybeShowDismissalAlert(this, this.parentActivity, new Runnable() { public void run() { PhotoViewer.this.switchToEditMode(0); } }); } } public void destroyPhotoViewer() { if (this.parentActivity != null && this.windowView != null) { releasePlayer(); try { if (this.windowView.getParent() != null) { ((WindowManager) this.parentActivity.getSystemService("window")).removeViewImmediate(this.windowView); } this.windowView = null; } catch (Throwable e) { FileLog.e(e); } if (this.captionEditText != null) { this.captionEditText.onDestroy(); } Instance = null; } } public void didReceivedNotification(int i, Object... objArr) { String str; int i2; if (i == NotificationCenter.FileDidFailedLoad) { str = (String) objArr[0]; i2 = 0; while (i2 < 3) { if (this.currentFileNames[i2] == null || !this.currentFileNames[i2].equals(str)) { i2++; } else { this.photoProgressViews[i2].setProgress(1.0f, true); checkProgress(i2, true); return; } } } else if (i == NotificationCenter.FileDidLoaded) { str = (String) objArr[0]; i2 = 0; while (i2 < 3) { if (this.currentFileNames[i2] == null || !this.currentFileNames[i2].equals(str)) { i2++; } else { this.photoProgressViews[i2].setProgress(1.0f, true); checkProgress(i2, true); if (i2 == 0) { if (this.currentMessageObject == null || !this.currentMessageObject.isVideo()) { if (this.currentBotInlineResult == null) { return; } if (!(this.currentBotInlineResult.type.equals(MimeTypes.BASE_TYPE_VIDEO) || MessageObject.isVideoDocument(this.currentBotInlineResult.document))) { return; } } onActionClick(false); return; } return; } } } else if (i == NotificationCenter.FileLoadProgressChanged) { str = (String) objArr[0]; r2 = 0; while (r2 < 3) { if (this.currentFileNames[r2] != null && this.currentFileNames[r2].equals(str)) { this.photoProgressViews[r2].setProgress(((Float) objArr[1]).floatValue(), true); } r2++; } } else if (i == NotificationCenter.dialogPhotosLoaded) { i2 = ((Integer) objArr[3]).intValue(); if (this.avatarsDialogId == ((Integer) objArr[0]).intValue() && this.classGuid == i2) { boolean booleanValue = ((Boolean) objArr[2]).booleanValue(); r0 = (ArrayList) objArr[4]; if (!r0.isEmpty()) { this.imagesArrLocations.clear(); this.imagesArrLocationsSizes.clear(); this.avatarsArr.clear(); r3 = 0; r4 = -1; while (r3 < r0.size()) { Photo photo = (Photo) r0.get(r3); if (!(photo == null || (photo instanceof TLRPC$TL_photoEmpty))) { if (photo.sizes == null) { r2 = r4; r3++; r4 = r2; } else { PhotoSize closestPhotoSizeWithSize = FileLoader.getClosestPhotoSizeWithSize(photo.sizes, 640); if (closestPhotoSizeWithSize != null) { if (r4 == -1 && this.currentFileLocation != null) { for (r5 = 0; r5 < photo.sizes.size(); r5++) { PhotoSize photoSize = (PhotoSize) photo.sizes.get(r5); if (photoSize.location.local_id == this.currentFileLocation.local_id && photoSize.location.volume_id == this.currentFileLocation.volume_id) { r4 = this.imagesArrLocations.size(); break; } } } this.imagesArrLocations.add(closestPhotoSizeWithSize.location); this.imagesArrLocationsSizes.add(Integer.valueOf(closestPhotoSizeWithSize.size)); this.avatarsArr.add(photo); } } } r2 = r4; r3++; r4 = r2; } if (this.avatarsArr.isEmpty()) { this.menuItem.hideSubItem(6); } else { this.menuItem.showSubItem(6); } this.needSearchImageInArr = false; this.currentIndex = -1; if (r4 != -1) { setImageIndex(r4, true); } else { this.avatarsArr.add(0, new TLRPC$TL_photoEmpty()); this.imagesArrLocations.add(0, this.currentFileLocation); this.imagesArrLocationsSizes.add(0, Integer.valueOf(0)); setImageIndex(0, true); } if (booleanValue) { MessagesController.getInstance().loadDialogPhotos(this.avatarsDialogId, 80, 0, false, this.classGuid); } } } } else if (i == NotificationCenter.mediaCountDidLoaded) { long longValue = ((Long) objArr[0]).longValue(); if (longValue == this.currentDialogId || longValue == this.mergeDialogId) { if (longValue == this.currentDialogId) { this.totalImagesCount = ((Integer) objArr[1]).intValue(); } else if (longValue == this.mergeDialogId) { this.totalImagesCountMerge = ((Integer) objArr[1]).intValue(); } if (this.needSearchImageInArr && this.isFirstLoading) { this.isFirstLoading = false; this.loadingMoreImages = true; SharedMediaQuery.loadMedia(this.currentDialogId, 80, 0, 0, true, this.classGuid); } else if (!this.imagesArr.isEmpty()) { if (this.opennedFromMedia) { this.actionBar.setTitle(LocaleController.formatString("Of", R.string.Of, new Object[]{Integer.valueOf(this.currentIndex + 1), Integer.valueOf(this.totalImagesCount + this.totalImagesCountMerge)})); } else { this.actionBar.setTitle(LocaleController.formatString("Of", R.string.Of, new Object[]{Integer.valueOf((((this.totalImagesCount + this.totalImagesCountMerge) - this.imagesArr.size()) + this.currentIndex) + 1), Integer.valueOf(this.totalImagesCount + this.totalImagesCountMerge)})); } } } } else if (i == NotificationCenter.mediaDidLoaded) { long longValue2 = ((Long) objArr[0]).longValue(); int intValue = ((Integer) objArr[3]).intValue(); if ((longValue2 == this.currentDialogId || longValue2 == this.mergeDialogId) && intValue == this.classGuid) { this.loadingMoreImages = false; r3 = longValue2 == this.currentDialogId ? 0 : 1; r0 = (ArrayList) objArr[2]; this.endReached[r3] = ((Boolean) objArr[5]).booleanValue(); if (!this.needSearchImageInArr) { i2 = 0; Iterator it = r0.iterator(); while (it.hasNext()) { r0 = (MessageObject) it.next(); if (!this.imagesByIds[r3].containsKey(Integer.valueOf(r0.getId()))) { i2++; if (this.opennedFromMedia) { this.imagesArr.add(r0); } else { this.imagesArr.add(0, r0); } this.imagesByIds[r3].put(Integer.valueOf(r0.getId()), r0); } i2 = i2; } if (this.opennedFromMedia) { if (i2 == 0) { this.totalImagesCount = this.imagesArr.size(); this.totalImagesCountMerge = 0; } } else if (i2 != 0) { intValue = this.currentIndex; this.currentIndex = -1; setImageIndex(intValue + i2, true); } else { this.totalImagesCount = this.imagesArr.size(); this.totalImagesCountMerge = 0; } } else if (!r0.isEmpty() || (r3 == 0 && this.mergeDialogId != 0)) { MessageObject messageObject = (MessageObject) this.imagesArr.get(this.currentIndex); int i3 = -1; r5 = 0; for (r4 = 0; r4 < r0.size(); r4++) { MessageObject messageObject2 = (MessageObject) r0.get(r4); if (!this.imagesByIdsTemp[r3].containsKey(Integer.valueOf(messageObject2.getId()))) { this.imagesByIdsTemp[r3].put(Integer.valueOf(messageObject2.getId()), messageObject2); if (this.opennedFromMedia) { this.imagesArrTemp.add(messageObject2); if (messageObject2.getId() == messageObject.getId()) { i3 = r5; } r5++; } else { r5++; this.imagesArrTemp.add(0, messageObject2); if (messageObject2.getId() == messageObject.getId()) { i3 = r0.size() - r5; } } } } if (r5 == 0 && (r3 != 0 || this.mergeDialogId == 0)) { this.totalImagesCount = this.imagesArr.size(); this.totalImagesCountMerge = 0; } if (i3 != -1) { this.imagesArr.clear(); this.imagesArr.addAll(this.imagesArrTemp); for (intValue = 0; intValue < 2; intValue++) { this.imagesByIds[intValue].clear(); this.imagesByIds[intValue].putAll(this.imagesByIdsTemp[intValue]); this.imagesByIdsTemp[intValue].clear(); } this.imagesArrTemp.clear(); this.needSearchImageInArr = false; this.currentIndex = -1; if (i3 >= this.imagesArr.size()) { i3 = this.imagesArr.size() - 1; } setImageIndex(i3, true); return; } if (this.opennedFromMedia) { i2 = this.imagesArrTemp.isEmpty() ? 0 : ((MessageObject) this.imagesArrTemp.get(this.imagesArrTemp.size() - 1)).getId(); if (r3 == 0 && this.endReached[r3] && this.mergeDialogId != 0) { r2 = 1; if (!(this.imagesArrTemp.isEmpty() || ((MessageObject) this.imagesArrTemp.get(this.imagesArrTemp.size() - 1)).getDialogId() == this.mergeDialogId)) { r3 = 0; intValue = 1; } r3 = i2; intValue = r2; } intValue = r3; r3 = i2; } else { i2 = this.imagesArrTemp.isEmpty() ? 0 : ((MessageObject) this.imagesArrTemp.get(0)).getId(); if (r3 == 0 && this.endReached[r3] && this.mergeDialogId != 0) { r2 = 1; if (!(this.imagesArrTemp.isEmpty() || ((MessageObject) this.imagesArrTemp.get(0)).getDialogId() == this.mergeDialogId)) { r3 = 0; intValue = 1; } r3 = i2; intValue = r2; } intValue = r3; r3 = i2; } if (!this.endReached[intValue]) { this.loadingMoreImages = true; if (this.opennedFromMedia) { SharedMediaQuery.loadMedia(intValue == 0 ? this.currentDialogId : this.mergeDialogId, 80, r3, 0, true, this.classGuid); } else { SharedMediaQuery.loadMedia(intValue == 0 ? this.currentDialogId : this.mergeDialogId, 80, r3, 0, true, this.classGuid); } } } else { this.needSearchImageInArr = false; } } } else if (i == NotificationCenter.emojiDidLoaded) { if (this.captionTextView != null) { this.captionTextView.invalidate(); } } else if (i == NotificationCenter.FilePreparingFailed) { r0 = (MessageObject) objArr[0]; if (this.loadInitialVideo) { this.loadInitialVideo = false; this.progressView.setVisibility(4); preparePlayer(this.currentPlayingVideoFile, false, false); } else if (this.tryStartRequestPreviewOnFinish) { releasePlayer(); this.tryStartRequestPreviewOnFinish = !MediaController.getInstance().scheduleVideoConvert(this.videoPreviewMessageObject, true); } else if (r0 == this.videoPreviewMessageObject) { this.requestingPreview = false; this.progressView.setVisibility(4); } } else if (i == NotificationCenter.FileNewChunkAvailable && ((MessageObject) objArr[0]) == this.videoPreviewMessageObject) { str = (String) objArr[1]; if (((Long) objArr[2]).longValue() != 0) { this.requestingPreview = false; this.progressView.setVisibility(4); preparePlayer(new File(str), false, true); } } } public float getAnimationValue() { return this.animationValue; } public boolean isMuteVideo() { return this.muteVideo; } public boolean isShowingImage(String str) { return (!this.isVisible || this.disableShowCheck || str == null || this.currentPathObject == null || !str.equals(this.currentPathObject)) ? false : true; } public boolean isShowingImage(MessageObject messageObject) { return (!this.isVisible || this.disableShowCheck || messageObject == null || this.currentMessageObject == null || this.currentMessageObject.getId() != messageObject.getId()) ? false : true; } public boolean isShowingImage(BotInlineResult botInlineResult) { return (!this.isVisible || this.disableShowCheck || botInlineResult == null || this.currentBotInlineResult == null || botInlineResult.id != this.currentBotInlineResult.id) ? false : true; } public boolean isShowingImage(FileLocation fileLocation) { return this.isVisible && !this.disableShowCheck && fileLocation != null && this.currentFileLocation != null && fileLocation.local_id == this.currentFileLocation.local_id && fileLocation.volume_id == this.currentFileLocation.volume_id && fileLocation.dc_id == this.currentFileLocation.dc_id; } public boolean isVisible() { return this.isVisible && this.placeProvider != null; } public boolean onDoubleTap(MotionEvent motionEvent) { if (!this.canZoom) { return false; } if ((this.scale == 1.0f && (this.translationY != BitmapDescriptorFactory.HUE_RED || this.translationX != BitmapDescriptorFactory.HUE_RED)) || this.animationStartTime != 0 || this.animationInProgress != 0) { return false; } if (this.scale == 1.0f) { float x = (motionEvent.getX() - ((float) (getContainerViewWidth() / 2))) - (((motionEvent.getX() - ((float) (getContainerViewWidth() / 2))) - this.translationX) * (3.0f / this.scale)); float y = (motionEvent.getY() - ((float) (getContainerViewHeight() / 2))) - (((motionEvent.getY() - ((float) (getContainerViewHeight() / 2))) - this.translationY) * (3.0f / this.scale)); updateMinMax(3.0f); if (x < this.minX) { x = this.minX; } else if (x > this.maxX) { x = this.maxX; } if (y < this.minY) { y = this.minY; } else if (y > this.maxY) { y = this.maxY; } animateTo(3.0f, x, y, true); } else { animateTo(1.0f, BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED, true); } this.doubleTap = true; return true; } public boolean onDoubleTapEvent(MotionEvent motionEvent) { return false; } public boolean onDown(MotionEvent motionEvent) { return false; } public boolean onFling(MotionEvent motionEvent, MotionEvent motionEvent2, float f, float f2) { if (this.scale != 1.0f) { this.scroller.abortAnimation(); this.scroller.fling(Math.round(this.translationX), Math.round(this.translationY), Math.round(f), Math.round(f2), (int) this.minX, (int) this.maxX, (int) this.minY, (int) this.maxY); this.containerView.postInvalidate(); } return false; } public void onLongPress(MotionEvent motionEvent) { } public void onPause() { if (this.currentAnimation != null) { closePhoto(false, false); } else if (this.lastTitle != null) { closeCaptionEnter(true); } } public void onResume() { redraw(0); if (this.videoPlayer != null) { this.videoPlayer.seekTo(this.videoPlayer.getCurrentPosition() + 1); } } public boolean onScroll(MotionEvent motionEvent, MotionEvent motionEvent2, float f, float f2) { return false; } public void onShowPress(MotionEvent motionEvent) { } public boolean onSingleTapConfirmed(MotionEvent motionEvent) { boolean z = false; if (this.discardTap) { return false; } int access$9800; float x; float y; if (this.canShowBottom) { boolean z2 = this.aspectRatioFrameLayout != null && this.aspectRatioFrameLayout.getVisibility() == 0; if (!(this.photoProgressViews[0] == null || this.containerView == null || z2)) { access$9800 = this.photoProgressViews[0].backgroundState; if (access$9800 > 0 && access$9800 <= 3) { x = motionEvent.getX(); y = motionEvent.getY(); if (x >= ((float) (getContainerViewWidth() - AndroidUtilities.dp(100.0f))) / 2.0f && x <= ((float) (getContainerViewWidth() + AndroidUtilities.dp(100.0f))) / 2.0f && y >= ((float) (getContainerViewHeight() - AndroidUtilities.dp(100.0f))) / 2.0f && y <= ((float) (getContainerViewHeight() + AndroidUtilities.dp(100.0f))) / 2.0f) { onActionClick(true); checkProgress(0, true); return true; } } } if (!this.isActionBarVisible) { z = true; } toggleActionBar(z, true); return true; } else if (this.sendPhotoType == 0) { if (this.isCurrentVideo) { this.videoPlayButton.callOnClick(); return true; } this.checkImageView.performClick(); return true; } else if (this.currentBotInlineResult != null && (this.currentBotInlineResult.type.equals(MimeTypes.BASE_TYPE_VIDEO) || MessageObject.isVideoDocument(this.currentBotInlineResult.document))) { access$9800 = this.photoProgressViews[0].backgroundState; if (access$9800 <= 0 || access$9800 > 3) { return true; } x = motionEvent.getX(); y = motionEvent.getY(); if (x < ((float) (getContainerViewWidth() - AndroidUtilities.dp(100.0f))) / 2.0f || x > ((float) (getContainerViewWidth() + AndroidUtilities.dp(100.0f))) / 2.0f || y < ((float) (getContainerViewHeight() - AndroidUtilities.dp(100.0f))) / 2.0f || y > ((float) (getContainerViewHeight() + AndroidUtilities.dp(100.0f))) / 2.0f) { return true; } onActionClick(true); checkProgress(0, true); return true; } else if (this.sendPhotoType != 2 || !this.isCurrentVideo) { return true; } else { this.videoPlayButton.callOnClick(); return true; } } public boolean onSingleTapUp(MotionEvent motionEvent) { return false; } public boolean openPhoto(ArrayList<MessageObject> arrayList, int i, long j, long j2, PhotoViewerProvider photoViewerProvider) { return openPhoto((MessageObject) arrayList.get(i), null, arrayList, null, i, photoViewerProvider, null, j, j2); } public boolean openPhoto(MessageObject messageObject, long j, long j2, PhotoViewerProvider photoViewerProvider) { return openPhoto(messageObject, null, null, null, 0, photoViewerProvider, null, j, j2); } public boolean openPhoto(MessageObject messageObject, FileLocation fileLocation, ArrayList<MessageObject> arrayList, ArrayList<Object> arrayList2, int i, PhotoViewerProvider photoViewerProvider, ChatActivity chatActivity, long j, long j2) { if (this.parentActivity == null || this.isVisible || ((photoViewerProvider == null && checkAnimation()) || (messageObject == null && fileLocation == null && arrayList == null && arrayList2 == null))) { return false; } final PlaceProviderObject placeForPhoto = photoViewerProvider.getPlaceForPhoto(messageObject, fileLocation, i); if (placeForPhoto == null && arrayList2 == null) { return false; } this.lastInsets = null; WindowManager windowManager = (WindowManager) this.parentActivity.getSystemService("window"); if (this.attachedToWindow) { try { windowManager.removeView(this.windowView); } catch (Exception e) { } } try { this.windowLayoutParams.type = 99; if (VERSION.SDK_INT >= 21) { this.windowLayoutParams.flags = -2147417848; } else { this.windowLayoutParams.flags = 8; } this.windowLayoutParams.softInputMode = 272; this.windowView.setFocusable(false); this.containerView.setFocusable(false); windowManager.addView(this.windowView, this.windowLayoutParams); this.doneButtonPressed = false; this.parentChatActivity = chatActivity; this.actionBar.setTitle(LocaleController.formatString("Of", R.string.Of, new Object[]{Integer.valueOf(1), Integer.valueOf(1)})); NotificationCenter.getInstance().addObserver(this, NotificationCenter.FileDidFailedLoad); NotificationCenter.getInstance().addObserver(this, NotificationCenter.FileDidLoaded); NotificationCenter.getInstance().addObserver(this, NotificationCenter.FileLoadProgressChanged); NotificationCenter.getInstance().addObserver(this, NotificationCenter.mediaCountDidLoaded); NotificationCenter.getInstance().addObserver(this, NotificationCenter.mediaDidLoaded); NotificationCenter.getInstance().addObserver(this, NotificationCenter.dialogPhotosLoaded); NotificationCenter.getInstance().addObserver(this, NotificationCenter.emojiDidLoaded); NotificationCenter.getInstance().addObserver(this, NotificationCenter.FilePreparingFailed); NotificationCenter.getInstance().addObserver(this, NotificationCenter.FileNewChunkAvailable); this.placeProvider = photoViewerProvider; this.mergeDialogId = j2; this.currentDialogId = j; this.selectedPhotosAdapter.notifyDataSetChanged(); if (this.velocityTracker == null) { this.velocityTracker = VelocityTracker.obtain(); } this.isVisible = true; toggleActionBar(true, false); togglePhotosListView(false, false); if (placeForPhoto != null) { this.disableShowCheck = true; this.animationInProgress = 1; if (messageObject != null) { this.currentAnimation = placeForPhoto.imageReceiver.getAnimation(); } onPhotoShow(messageObject, fileLocation, arrayList, arrayList2, i, placeForPhoto); Rect drawRegion = placeForPhoto.imageReceiver.getDrawRegion(); int orientation = placeForPhoto.imageReceiver.getOrientation(); int animatedOrientation = placeForPhoto.imageReceiver.getAnimatedOrientation(); if (animatedOrientation == 0) { animatedOrientation = orientation; } this.animatingImageView.setVisibility(0); this.animatingImageView.setRadius(placeForPhoto.radius); this.animatingImageView.setOrientation(animatedOrientation); this.animatingImageView.setNeedRadius(placeForPhoto.radius != 0); this.animatingImageView.setImageBitmap(placeForPhoto.thumb); this.animatingImageView.setAlpha(1.0f); this.animatingImageView.setPivotX(BitmapDescriptorFactory.HUE_RED); this.animatingImageView.setPivotY(BitmapDescriptorFactory.HUE_RED); this.animatingImageView.setScaleX(placeForPhoto.scale); this.animatingImageView.setScaleY(placeForPhoto.scale); this.animatingImageView.setTranslationX(((float) placeForPhoto.viewX) + (((float) drawRegion.left) * placeForPhoto.scale)); this.animatingImageView.setTranslationY(((float) placeForPhoto.viewY) + (((float) drawRegion.top) * placeForPhoto.scale)); ViewGroup.LayoutParams layoutParams = this.animatingImageView.getLayoutParams(); layoutParams.width = drawRegion.right - drawRegion.left; layoutParams.height = drawRegion.bottom - drawRegion.top; this.animatingImageView.setLayoutParams(layoutParams); float f = ((float) AndroidUtilities.displaySize.x) / ((float) layoutParams.width); float f2 = ((float) ((VERSION.SDK_INT >= 21 ? AndroidUtilities.statusBarHeight : 0) + AndroidUtilities.displaySize.y)) / ((float) layoutParams.height); if (f <= f2) { f2 = f; } float f3 = (((float) AndroidUtilities.displaySize.x) - (((float) layoutParams.width) * f2)) / 2.0f; float f4 = (((float) ((VERSION.SDK_INT >= 21 ? AndroidUtilities.statusBarHeight : 0) + AndroidUtilities.displaySize.y)) - (((float) layoutParams.height) * f2)) / 2.0f; int abs = Math.abs(drawRegion.left - placeForPhoto.imageReceiver.getImageX()); int abs2 = Math.abs(drawRegion.top - placeForPhoto.imageReceiver.getImageY()); int[] iArr = new int[2]; placeForPhoto.parentView.getLocationInWindow(iArr); orientation = ((iArr[1] - (VERSION.SDK_INT >= 21 ? 0 : AndroidUtilities.statusBarHeight)) - (placeForPhoto.viewY + drawRegion.top)) + placeForPhoto.clipTopAddition; if (orientation < 0) { orientation = 0; } int height = ((layoutParams.height + (drawRegion.top + placeForPhoto.viewY)) - ((placeForPhoto.parentView.getHeight() + iArr[1]) - (VERSION.SDK_INT >= 21 ? 0 : AndroidUtilities.statusBarHeight))) + placeForPhoto.clipBottomAddition; if (height < 0) { height = 0; } orientation = Math.max(orientation, abs2); height = Math.max(height, abs2); this.animationValues[0][0] = this.animatingImageView.getScaleX(); this.animationValues[0][1] = this.animatingImageView.getScaleY(); this.animationValues[0][2] = this.animatingImageView.getTranslationX(); this.animationValues[0][3] = this.animatingImageView.getTranslationY(); this.animationValues[0][4] = ((float) abs) * placeForPhoto.scale; this.animationValues[0][5] = ((float) orientation) * placeForPhoto.scale; this.animationValues[0][6] = ((float) height) * placeForPhoto.scale; this.animationValues[0][7] = (float) this.animatingImageView.getRadius(); this.animationValues[1][0] = f2; this.animationValues[1][1] = f2; this.animationValues[1][2] = f3; this.animationValues[1][3] = f4; this.animationValues[1][4] = BitmapDescriptorFactory.HUE_RED; this.animationValues[1][5] = BitmapDescriptorFactory.HUE_RED; this.animationValues[1][6] = BitmapDescriptorFactory.HUE_RED; this.animationValues[1][7] = BitmapDescriptorFactory.HUE_RED; this.animatingImageView.setAnimationProgress(BitmapDescriptorFactory.HUE_RED); this.backgroundDrawable.setAlpha(0); this.containerView.setAlpha(BitmapDescriptorFactory.HUE_RED); final AnimatorSet animatorSet = new AnimatorSet(); animatorSet.playTogether(new Animator[]{ObjectAnimator.ofFloat(this.animatingImageView, "animationProgress", new float[]{BitmapDescriptorFactory.HUE_RED, 1.0f}), ObjectAnimator.ofInt(this.backgroundDrawable, "alpha", new int[]{0, 255}), ObjectAnimator.ofFloat(this.containerView, "alpha", new float[]{BitmapDescriptorFactory.HUE_RED, 1.0f})}); final ArrayList<Object> arrayList3 = arrayList2; this.animationEndRunnable = new Runnable() { public void run() { if (PhotoViewer.this.containerView != null && PhotoViewer.this.windowView != null) { if (VERSION.SDK_INT >= 18) { PhotoViewer.this.containerView.setLayerType(0, null); } PhotoViewer.this.animationInProgress = 0; PhotoViewer.this.transitionAnimationStartTime = 0; PhotoViewer.this.setImages(); PhotoViewer.this.containerView.invalidate(); PhotoViewer.this.animatingImageView.setVisibility(8); if (PhotoViewer.this.showAfterAnimation != null) { PhotoViewer.this.showAfterAnimation.imageReceiver.setVisible(true, true); } if (PhotoViewer.this.hideAfterAnimation != null) { PhotoViewer.this.hideAfterAnimation.imageReceiver.setVisible(false, true); } if (arrayList3 != null && PhotoViewer.this.sendPhotoType != 3) { if (VERSION.SDK_INT >= 21) { PhotoViewer.this.windowLayoutParams.flags = -2147417856; } else { PhotoViewer.this.windowLayoutParams.flags = 0; } PhotoViewer.this.windowLayoutParams.softInputMode = 272; ((WindowManager) PhotoViewer.this.parentActivity.getSystemService("window")).updateViewLayout(PhotoViewer.this.windowView, PhotoViewer.this.windowLayoutParams); PhotoViewer.this.windowView.setFocusable(true); PhotoViewer.this.containerView.setFocusable(true); } } } }; animatorSet.setDuration(200); animatorSet.addListener(new AnimatorListenerAdapter() { /* renamed from: org.telegram.ui.PhotoViewer$52$1 */ class C50681 implements Runnable { C50681() { } public void run() { NotificationCenter.getInstance().setAnimationInProgress(false); if (PhotoViewer.this.animationEndRunnable != null) { PhotoViewer.this.animationEndRunnable.run(); PhotoViewer.this.animationEndRunnable = null; } } } public void onAnimationEnd(Animator animator) { AndroidUtilities.runOnUIThread(new C50681()); } }); this.transitionAnimationStartTime = System.currentTimeMillis(); AndroidUtilities.runOnUIThread(new Runnable() { public void run() { NotificationCenter.getInstance().setAllowedNotificationsDutingAnimation(new int[]{NotificationCenter.dialogsNeedReload, NotificationCenter.closeChats, NotificationCenter.mediaCountDidLoaded, NotificationCenter.mediaDidLoaded, NotificationCenter.dialogPhotosLoaded}); NotificationCenter.getInstance().setAnimationInProgress(true); animatorSet.start(); } }); if (VERSION.SDK_INT >= 18) { this.containerView.setLayerType(2, null); } this.backgroundDrawable.drawRunnable = new Runnable() { public void run() { PhotoViewer.this.disableShowCheck = false; placeForPhoto.imageReceiver.setVisible(false, true); } }; } else { if (!(arrayList2 == null || this.sendPhotoType == 3)) { if (VERSION.SDK_INT >= 21) { this.windowLayoutParams.flags = -2147417856; } else { this.windowLayoutParams.flags = 0; } this.windowLayoutParams.softInputMode = 272; windowManager.updateViewLayout(this.windowView, this.windowLayoutParams); this.windowView.setFocusable(true); this.containerView.setFocusable(true); } this.backgroundDrawable.setAlpha(255); this.containerView.setAlpha(1.0f); onPhotoShow(messageObject, fileLocation, arrayList, arrayList2, i, placeForPhoto); } return true; } catch (Throwable e2) { FileLog.e(e2); return false; } } public boolean openPhoto(FileLocation fileLocation, PhotoViewerProvider photoViewerProvider) { return openPhoto(null, fileLocation, null, null, 0, photoViewerProvider, null, 0, 0); } public boolean openPhotoForSelect(ArrayList<Object> arrayList, int i, int i2, PhotoViewerProvider photoViewerProvider, ChatActivity chatActivity) { this.sendPhotoType = i2; if (this.pickerViewSendButton != null) { FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) this.itemsLayout.getLayoutParams(); if (this.sendPhotoType == 1) { this.pickerView.setPadding(0, AndroidUtilities.dp(14.0f), 0, 0); this.pickerViewSendButton.setImageResource(R.drawable.bigcheck); this.pickerViewSendButton.setPadding(0, AndroidUtilities.dp(1.0f), 0, 0); layoutParams.bottomMargin = AndroidUtilities.dp(16.0f); } else { this.pickerView.setPadding(0, 0, 0, 0); this.pickerViewSendButton.setImageResource(R.drawable.ic_send); this.pickerViewSendButton.setPadding(AndroidUtilities.dp(4.0f), 0, 0, 0); layoutParams.bottomMargin = 0; } this.itemsLayout.setLayoutParams(layoutParams); } return openPhoto(null, null, null, arrayList, i, photoViewerProvider, chatActivity, 0, 0); } public void setAnimationValue(float f) { this.animationValue = f; this.containerView.invalidate(); } public void setParentActivity(Activity activity) { if (this.parentActivity != activity) { FrameLayout.LayoutParams layoutParams; this.parentActivity = activity; this.actvityContext = new ContextThemeWrapper(this.parentActivity, R.style.Theme.TMessages); if (progressDrawables == null) { progressDrawables = new Drawable[4]; progressDrawables[0] = this.parentActivity.getResources().getDrawable(R.drawable.circle_big); progressDrawables[1] = this.parentActivity.getResources().getDrawable(R.drawable.cancel_big); progressDrawables[2] = this.parentActivity.getResources().getDrawable(R.drawable.load_big); progressDrawables[3] = this.parentActivity.getResources().getDrawable(R.drawable.play_big); } this.scroller = new Scroller(activity); this.windowView = new FrameLayout(activity) { private Runnable attachRunnable; /* renamed from: org.telegram.ui.PhotoViewer$2$1 */ class C50461 implements Runnable { C50461() { } public void run() { int i = 0; FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) PhotoViewer.this.checkImageView.getLayoutParams(); ((WindowManager) ApplicationLoader.applicationContext.getSystemService("window")).getDefaultDisplay().getRotation(); layoutParams.topMargin = (VERSION.SDK_INT >= 21 ? AndroidUtilities.statusBarHeight : 0) + ((ActionBar.getCurrentActionBarHeight() - AndroidUtilities.dp(40.0f)) / 2); PhotoViewer.this.checkImageView.setLayoutParams(layoutParams); layoutParams = (FrameLayout.LayoutParams) PhotoViewer.this.photosCounterView.getLayoutParams(); int currentActionBarHeight = (ActionBar.getCurrentActionBarHeight() - AndroidUtilities.dp(40.0f)) / 2; if (VERSION.SDK_INT >= 21) { i = AndroidUtilities.statusBarHeight; } layoutParams.topMargin = currentActionBarHeight + i; PhotoViewer.this.photosCounterView.setLayoutParams(layoutParams); } } public boolean dispatchKeyEventPreIme(KeyEvent keyEvent) { if (keyEvent == null || keyEvent.getKeyCode() != 4 || keyEvent.getAction() != 1) { return super.dispatchKeyEventPreIme(keyEvent); } if (PhotoViewer.this.captionEditText.isPopupShowing() || PhotoViewer.this.captionEditText.isKeyboardVisible()) { PhotoViewer.this.closeCaptionEnter(false); return false; } PhotoViewer.getInstance().closePhoto(true, false); return true; } protected boolean drawChild(Canvas canvas, View view, long j) { boolean drawChild = super.drawChild(canvas, view, j); if (VERSION.SDK_INT >= 21 && view == PhotoViewer.this.animatingImageView && PhotoViewer.this.lastInsets != null) { WindowInsets windowInsets = (WindowInsets) PhotoViewer.this.lastInsets; canvas.drawRect(BitmapDescriptorFactory.HUE_RED, (float) getMeasuredHeight(), (float) getMeasuredWidth(), (float) (windowInsets.getSystemWindowInsetBottom() + getMeasuredHeight()), PhotoViewer.this.blackPaint); } return drawChild; } protected void onAttachedToWindow() { super.onAttachedToWindow(); PhotoViewer.this.attachedToWindow = true; } protected void onDetachedFromWindow() { super.onDetachedFromWindow(); PhotoViewer.this.attachedToWindow = false; PhotoViewer.this.wasLayout = false; } public boolean onInterceptTouchEvent(MotionEvent motionEvent) { return PhotoViewer.this.isVisible && super.onInterceptTouchEvent(motionEvent); } protected void onLayout(boolean z, int i, int i2, int i3, int i4) { int systemWindowInsetLeft = (VERSION.SDK_INT < 21 || PhotoViewer.this.lastInsets == null) ? 0 : ((WindowInsets) PhotoViewer.this.lastInsets).getSystemWindowInsetLeft() + 0; PhotoViewer.this.animatingImageView.layout(systemWindowInsetLeft, 0, PhotoViewer.this.animatingImageView.getMeasuredWidth() + systemWindowInsetLeft, PhotoViewer.this.animatingImageView.getMeasuredHeight()); PhotoViewer.this.containerView.layout(systemWindowInsetLeft, 0, PhotoViewer.this.containerView.getMeasuredWidth() + systemWindowInsetLeft, PhotoViewer.this.containerView.getMeasuredHeight()); PhotoViewer.this.wasLayout = true; if (z) { if (!PhotoViewer.this.dontResetZoomOnFirstLayout) { PhotoViewer.this.scale = 1.0f; PhotoViewer.this.translationX = BitmapDescriptorFactory.HUE_RED; PhotoViewer.this.translationY = BitmapDescriptorFactory.HUE_RED; PhotoViewer.this.updateMinMax(PhotoViewer.this.scale); } if (PhotoViewer.this.checkImageView != null) { PhotoViewer.this.checkImageView.post(new C50461()); } } if (PhotoViewer.this.dontResetZoomOnFirstLayout) { PhotoViewer.this.setScaleToFill(); PhotoViewer.this.dontResetZoomOnFirstLayout = false; } } protected void onMeasure(int i, int i2) { int size = MeasureSpec.getSize(i); int size2 = MeasureSpec.getSize(i2); if (VERSION.SDK_INT >= 21 && PhotoViewer.this.lastInsets != null) { WindowInsets windowInsets = (WindowInsets) PhotoViewer.this.lastInsets; if (AndroidUtilities.incorrectDisplaySizeFix) { if (size2 > AndroidUtilities.displaySize.y) { size2 = AndroidUtilities.displaySize.y; } size2 += AndroidUtilities.statusBarHeight; } size2 -= windowInsets.getSystemWindowInsetBottom(); size -= windowInsets.getSystemWindowInsetRight(); } else if (size2 > AndroidUtilities.displaySize.y) { size2 = AndroidUtilities.displaySize.y; } setMeasuredDimension(size, size2); if (VERSION.SDK_INT >= 21 && PhotoViewer.this.lastInsets != null) { size -= ((WindowInsets) PhotoViewer.this.lastInsets).getSystemWindowInsetLeft(); } ViewGroup.LayoutParams layoutParams = PhotoViewer.this.animatingImageView.getLayoutParams(); PhotoViewer.this.animatingImageView.measure(MeasureSpec.makeMeasureSpec(layoutParams.width, Integer.MIN_VALUE), MeasureSpec.makeMeasureSpec(layoutParams.height, Integer.MIN_VALUE)); PhotoViewer.this.containerView.measure(MeasureSpec.makeMeasureSpec(size, 1073741824), MeasureSpec.makeMeasureSpec(size2, 1073741824)); } public boolean onTouchEvent(MotionEvent motionEvent) { return PhotoViewer.this.isVisible && PhotoViewer.this.onTouchEvent(motionEvent); } public ActionMode startActionModeForChild(View view, ActionMode.Callback callback, int i) { if (VERSION.SDK_INT >= 23) { View findViewById = PhotoViewer.this.parentActivity.findViewById(16908290); if (findViewById instanceof ViewGroup) { try { return ((ViewGroup) findViewById).startActionModeForChild(view, callback, i); } catch (Throwable th) { FileLog.e(th); } } } return super.startActionModeForChild(view, callback, i); } }; this.windowView.setBackgroundDrawable(this.backgroundDrawable); this.windowView.setClipChildren(true); this.windowView.setFocusable(false); this.animatingImageView = new ClippingImageView(activity); this.animatingImageView.setAnimationValues(this.animationValues); this.windowView.addView(this.animatingImageView, LayoutHelper.createFrame(40, 40.0f)); this.containerView = new FrameLayoutDrawer(activity); this.containerView.setFocusable(false); this.windowView.addView(this.containerView, LayoutHelper.createFrame(-1, -1, 51)); if (VERSION.SDK_INT >= 21) { this.containerView.setFitsSystemWindows(true); this.containerView.setOnApplyWindowInsetsListener(new C50573()); this.containerView.setSystemUiVisibility(1280); } this.windowLayoutParams = new LayoutParams(); this.windowLayoutParams.height = -1; this.windowLayoutParams.format = -3; this.windowLayoutParams.width = -1; this.windowLayoutParams.gravity = 51; this.windowLayoutParams.type = 99; if (VERSION.SDK_INT >= 21) { this.windowLayoutParams.flags = -2147417848; } else { this.windowLayoutParams.flags = 8; } this.actionBar = new ActionBar(activity); this.actionBar.setTitleColor(-1); this.actionBar.setSubtitleColor(-1); this.actionBar.setBackgroundColor(Theme.ACTION_BAR_PHOTO_VIEWER_COLOR); this.actionBar.setOccupyStatusBar(VERSION.SDK_INT >= 21); this.actionBar.setItemsBackgroundColor(Theme.ACTION_BAR_WHITE_SELECTOR_COLOR, false); this.actionBar.setBackButtonImage(R.drawable.ic_ab_back); this.actionBar.setTitle(LocaleController.formatString("Of", R.string.Of, new Object[]{Integer.valueOf(1), Integer.valueOf(1)})); this.containerView.addView(this.actionBar, LayoutHelper.createFrame(-1, -2.0f)); this.actionBar.setActionBarMenuOnItemClick(new C50674()); ActionBarMenu createMenu = this.actionBar.createMenu(); this.masksItem = createMenu.addItem(13, (int) R.drawable.ic_masks_msk1); this.sendItem = createMenu.addItem(3, (int) R.drawable.msg_panel_reply); this.menuItem = createMenu.addItem(0, (int) R.drawable.ic_ab_other); this.menuItem.addSubItem(11, LocaleController.getString("OpenInExternalApp", R.string.OpenInExternalApp)).setTextColor(-328966); this.menuItem.addSubItem(2, LocaleController.getString("ShowAllMedia", R.string.ShowAllMedia)).setTextColor(-328966); this.menuItem.addSubItem(4, LocaleController.getString("ShowInChat", R.string.ShowInChat)).setTextColor(-328966); this.menuItem.addSubItem(10, LocaleController.getString("ShareFile", R.string.ShareFile)).setTextColor(-328966); this.menuItem.addSubItem(1, LocaleController.getString("SaveToGallery", R.string.SaveToGallery)).setTextColor(-328966); this.menuItem.addSubItem(6, LocaleController.getString("Delete", R.string.Delete)).setTextColor(-328966); this.menuItem.redrawPopup(-115203550); this.bottomLayout = new FrameLayout(this.actvityContext); this.bottomLayout.setBackgroundColor(Theme.ACTION_BAR_PHOTO_VIEWER_COLOR); this.containerView.addView(this.bottomLayout, LayoutHelper.createFrame(-1, 48, 83)); this.groupedPhotosListView = new GroupedPhotosListView(this.actvityContext); this.containerView.addView(this.groupedPhotosListView, LayoutHelper.createFrame(-1, 62.0f, 83, BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED, 48.0f)); this.captionTextView = new TextView(this.actvityContext) { public boolean onTouchEvent(MotionEvent motionEvent) { return PhotoViewer.this.bottomTouchEnabled && super.onTouchEvent(motionEvent); } }; this.captionTextView.setPadding(AndroidUtilities.dp(20.0f), AndroidUtilities.dp(8.0f), AndroidUtilities.dp(20.0f), AndroidUtilities.dp(8.0f)); this.captionTextView.setLinkTextColor(-1); this.captionTextView.setTextColor(-1); this.captionTextView.setEllipsize(TruncateAt.END); this.captionTextView.setGravity(19); this.captionTextView.setTextSize(1, 16.0f); this.captionTextView.setVisibility(4); this.captionTextView.setOnClickListener(new C50746()); this.photoProgressViews[0] = new PhotoProgressView(this.containerView.getContext(), this.containerView); this.photoProgressViews[0].setBackgroundState(0, false); this.photoProgressViews[1] = new PhotoProgressView(this.containerView.getContext(), this.containerView); this.photoProgressViews[1].setBackgroundState(0, false); this.photoProgressViews[2] = new PhotoProgressView(this.containerView.getContext(), this.containerView); this.photoProgressViews[2].setBackgroundState(0, false); this.shareButton = new ImageView(this.containerView.getContext()); this.shareButton.setImageResource(R.drawable.share); this.shareButton.setScaleType(ScaleType.CENTER); this.shareButton.setBackgroundDrawable(Theme.createSelectorDrawable(Theme.ACTION_BAR_WHITE_SELECTOR_COLOR)); this.bottomLayout.addView(this.shareButton, LayoutHelper.createFrame(50, -1, 53)); this.shareButton.setOnClickListener(new C50757()); this.nameTextView = new TextView(this.containerView.getContext()); this.nameTextView.setTextSize(1, 14.0f); this.nameTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); this.nameTextView.setSingleLine(true); this.nameTextView.setMaxLines(1); this.nameTextView.setEllipsize(TruncateAt.END); this.nameTextView.setTextColor(-1); this.nameTextView.setGravity(3); this.bottomLayout.addView(this.nameTextView, LayoutHelper.createFrame(-1, -2.0f, 51, 16.0f, 5.0f, 60.0f, BitmapDescriptorFactory.HUE_RED)); this.dateTextView = new TextView(this.containerView.getContext()); this.dateTextView.setTextSize(1, 13.0f); this.dateTextView.setSingleLine(true); this.dateTextView.setMaxLines(1); this.dateTextView.setEllipsize(TruncateAt.END); this.dateTextView.setTextColor(-1); this.dateTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); this.dateTextView.setGravity(3); this.bottomLayout.addView(this.dateTextView, LayoutHelper.createFrame(-1, -2.0f, 51, 16.0f, 25.0f, 50.0f, BitmapDescriptorFactory.HUE_RED)); this.videoPlayerSeekbar = new SeekBar(this.containerView.getContext()); this.videoPlayerSeekbar.setColors(1728053247, -1, -1); this.videoPlayerSeekbar.setDelegate(new C50768()); this.videoPlayerControlFrameLayout = new FrameLayout(this.containerView.getContext()) { protected void onDraw(Canvas canvas) { canvas.save(); canvas.translate((float) AndroidUtilities.dp(48.0f), BitmapDescriptorFactory.HUE_RED); PhotoViewer.this.videoPlayerSeekbar.draw(canvas); canvas.restore(); } protected void onLayout(boolean z, int i, int i2, int i3, int i4) { float f = BitmapDescriptorFactory.HUE_RED; super.onLayout(z, i, i2, i3, i4); if (PhotoViewer.this.videoPlayer != null) { float currentPosition = ((float) PhotoViewer.this.videoPlayer.getCurrentPosition()) / ((float) PhotoViewer.this.videoPlayer.getDuration()); if (PhotoViewer.this.inPreview || PhotoViewer.this.videoTimelineView.getVisibility() != 0) { f = currentPosition; } else { currentPosition -= PhotoViewer.this.videoTimelineView.getLeftProgress(); if (currentPosition >= BitmapDescriptorFactory.HUE_RED) { f = currentPosition; } f /= PhotoViewer.this.videoTimelineView.getRightProgress() - PhotoViewer.this.videoTimelineView.getLeftProgress(); if (f > 1.0f) { f = 1.0f; } } } PhotoViewer.this.videoPlayerSeekbar.setProgress(f); PhotoViewer.this.videoTimelineView.setProgress(f); } protected void onMeasure(int i, int i2) { long j = 0; super.onMeasure(i, i2); if (PhotoViewer.this.videoPlayer != null) { long duration = PhotoViewer.this.videoPlayer.getDuration(); if (duration != C3446C.TIME_UNSET) { j = duration; } } j /= 1000; PhotoViewer.this.videoPlayerSeekbar.setSize((getMeasuredWidth() - AndroidUtilities.dp(64.0f)) - ((int) Math.ceil((double) PhotoViewer.this.videoPlayerTime.getPaint().measureText(String.format("%02d:%02d / %02d:%02d", new Object[]{Long.valueOf(j / 60), Long.valueOf(j % 60), Long.valueOf(j / 60), Long.valueOf(j % 60)})))), getMeasuredHeight()); } public boolean onTouchEvent(MotionEvent motionEvent) { int x = (int) motionEvent.getX(); x = (int) motionEvent.getY(); if (!PhotoViewer.this.videoPlayerSeekbar.onTouch(motionEvent.getAction(), motionEvent.getX() - ((float) AndroidUtilities.dp(48.0f)), motionEvent.getY())) { return super.onTouchEvent(motionEvent); } getParent().requestDisallowInterceptTouchEvent(true); invalidate(); return true; } }; this.videoPlayerControlFrameLayout.setWillNotDraw(false); this.bottomLayout.addView(this.videoPlayerControlFrameLayout, LayoutHelper.createFrame(-1, -1, 51)); this.videoPlayButton = new ImageView(this.containerView.getContext()); this.videoPlayButton.setScaleType(ScaleType.CENTER); this.videoPlayerControlFrameLayout.addView(this.videoPlayButton, LayoutHelper.createFrame(48, 48, 51)); this.videoPlayButton.setOnClickListener(new OnClickListener() { public void onClick(View view) { if (PhotoViewer.this.videoPlayer != null) { if (PhotoViewer.this.isPlaying) { PhotoViewer.this.videoPlayer.pause(); } else { if (PhotoViewer.this.isCurrentVideo) { if (Math.abs(PhotoViewer.this.videoTimelineView.getProgress() - 1.0f) < 0.01f || PhotoViewer.this.videoPlayer.getCurrentPosition() == PhotoViewer.this.videoPlayer.getDuration()) { PhotoViewer.this.videoPlayer.seekTo(0); } } else if (Math.abs(PhotoViewer.this.videoPlayerSeekbar.getProgress() - 1.0f) < 0.01f || PhotoViewer.this.videoPlayer.getCurrentPosition() == PhotoViewer.this.videoPlayer.getDuration()) { PhotoViewer.this.videoPlayer.seekTo(0); } PhotoViewer.this.videoPlayer.play(); } PhotoViewer.this.containerView.invalidate(); } } }); this.videoPlayerTime = new TextView(this.containerView.getContext()); this.videoPlayerTime.setTextColor(-1); this.videoPlayerTime.setGravity(16); this.videoPlayerTime.setTextSize(1, 13.0f); this.videoPlayerControlFrameLayout.addView(this.videoPlayerTime, LayoutHelper.createFrame(-2, -1.0f, 53, BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED, 8.0f, BitmapDescriptorFactory.HUE_RED)); this.progressView = new RadialProgressView(this.parentActivity); this.progressView.setProgressColor(-1); this.progressView.setBackgroundResource(R.drawable.circle_big); this.progressView.setVisibility(4); this.containerView.addView(this.progressView, LayoutHelper.createFrame(54, 54, 17)); this.qualityPicker = new PickerBottomLayoutViewer(this.parentActivity); this.qualityPicker.setBackgroundColor(Theme.ACTION_BAR_PHOTO_VIEWER_COLOR); this.qualityPicker.updateSelectedCount(0, false); this.qualityPicker.setTranslationY((float) AndroidUtilities.dp(120.0f)); this.qualityPicker.doneButton.setText(LocaleController.getString("Done", R.string.Done).toUpperCase()); this.containerView.addView(this.qualityPicker, LayoutHelper.createFrame(-1, 48, 83)); this.qualityPicker.cancelButton.setOnClickListener(new OnClickListener() { public void onClick(View view) { PhotoViewer.this.selectedCompression = PhotoViewer.this.previousCompression; PhotoViewer.this.didChangedCompressionLevel(false); PhotoViewer.this.showQualityView(false); PhotoViewer.this.requestVideoPreview(2); } }); this.qualityPicker.doneButton.setOnClickListener(new OnClickListener() { public void onClick(View view) { PhotoViewer.this.showQualityView(false); PhotoViewer.this.requestVideoPreview(2); } }); this.qualityChooseView = new QualityChooseView(this.parentActivity); this.qualityChooseView.setTranslationY((float) AndroidUtilities.dp(120.0f)); this.qualityChooseView.setVisibility(4); this.qualityChooseView.setBackgroundColor(Theme.ACTION_BAR_PHOTO_VIEWER_COLOR); this.containerView.addView(this.qualityChooseView, LayoutHelper.createFrame(-1, 70.0f, 83, BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED, 48.0f)); this.pickerView = new FrameLayout(this.actvityContext) { public boolean dispatchTouchEvent(MotionEvent motionEvent) { return PhotoViewer.this.bottomTouchEnabled && super.dispatchTouchEvent(motionEvent); } public boolean onInterceptTouchEvent(MotionEvent motionEvent) { return PhotoViewer.this.bottomTouchEnabled && super.onInterceptTouchEvent(motionEvent); } public boolean onTouchEvent(MotionEvent motionEvent) { return PhotoViewer.this.bottomTouchEnabled && super.onTouchEvent(motionEvent); } }; this.pickerView.setBackgroundColor(Theme.ACTION_BAR_PHOTO_VIEWER_COLOR); this.containerView.addView(this.pickerView, LayoutHelper.createFrame(-1, -2, 83)); this.videoTimelineView = new VideoTimelinePlayView(this.parentActivity); this.videoTimelineView.setDelegate(new VideoTimelineViewDelegate() { public void didStartDragging() { } public void didStopDragging() { } public void onLeftProgressChanged(float f) { if (PhotoViewer.this.videoPlayer != null) { if (PhotoViewer.this.videoPlayer.isPlaying()) { PhotoViewer.this.videoPlayer.pause(); PhotoViewer.this.containerView.invalidate(); } PhotoViewer.this.videoPlayer.seekTo((long) ((int) (PhotoViewer.this.videoDuration * f))); PhotoViewer.this.videoPlayerSeekbar.setProgress(BitmapDescriptorFactory.HUE_RED); PhotoViewer.this.videoTimelineView.setProgress(BitmapDescriptorFactory.HUE_RED); PhotoViewer.this.updateVideoInfo(); } } public void onPlayProgressChanged(float f) { if (PhotoViewer.this.videoPlayer != null) { PhotoViewer.this.videoPlayer.seekTo((long) ((int) (PhotoViewer.this.videoDuration * f))); } } public void onRightProgressChanged(float f) { if (PhotoViewer.this.videoPlayer != null) { if (PhotoViewer.this.videoPlayer.isPlaying()) { PhotoViewer.this.videoPlayer.pause(); PhotoViewer.this.containerView.invalidate(); } PhotoViewer.this.videoPlayer.seekTo((long) ((int) (PhotoViewer.this.videoDuration * f))); PhotoViewer.this.videoPlayerSeekbar.setProgress(BitmapDescriptorFactory.HUE_RED); PhotoViewer.this.videoTimelineView.setProgress(BitmapDescriptorFactory.HUE_RED); PhotoViewer.this.updateVideoInfo(); } } }); this.pickerView.addView(this.videoTimelineView, LayoutHelper.createFrame(-1, 58.0f, 51, BitmapDescriptorFactory.HUE_RED, 8.0f, BitmapDescriptorFactory.HUE_RED, 88.0f)); this.pickerViewSendButton = new ImageView(this.parentActivity); this.pickerViewSendButton.setScaleType(ScaleType.CENTER); this.pickerViewSendButton.setBackgroundDrawable(Theme.createSimpleSelectorCircleDrawable(AndroidUtilities.dp(56.0f), -10043398, -10043398)); this.pickerViewSendButton.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chats_actionIcon), Mode.MULTIPLY)); this.pickerViewSendButton.setPadding(AndroidUtilities.dp(4.0f), 0, 0, 0); this.pickerViewSendButton.setImageResource(R.drawable.ic_send); this.pickerView.addView(this.pickerViewSendButton, LayoutHelper.createFrame(56, 56.0f, 85, BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED, 14.0f, 14.0f)); this.pickerViewSendButton.setOnClickListener(new OnClickListener() { public void onClick(View view) { if (PhotoViewer.this.placeProvider != null && !PhotoViewer.this.doneButtonPressed) { PhotoViewer.this.placeProvider.sendButtonPressed(PhotoViewer.this.currentIndex, PhotoViewer.this.getCurrentVideoEditedInfo()); PhotoViewer.this.doneButtonPressed = true; PhotoViewer.this.closePhoto(false, false); } } }); this.itemsLayout = new LinearLayout(this.parentActivity); this.itemsLayout.setOrientation(0); this.pickerView.addView(this.itemsLayout, LayoutHelper.createFrame(-2, 48.0f, 81, BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED, 34.0f, BitmapDescriptorFactory.HUE_RED)); this.cropItem = new ImageView(this.parentActivity); this.cropItem.setScaleType(ScaleType.CENTER); this.cropItem.setImageResource(R.drawable.photo_crop); this.cropItem.setBackgroundDrawable(Theme.createSelectorDrawable(Theme.ACTION_BAR_WHITE_SELECTOR_COLOR)); this.itemsLayout.addView(this.cropItem, LayoutHelper.createLinear(70, 48)); this.cropItem.setOnClickListener(new OnClickListener() { public void onClick(View view) { PhotoViewer.this.switchToEditMode(1); } }); this.paintItem = new ImageView(this.parentActivity); this.paintItem.setScaleType(ScaleType.CENTER); this.paintItem.setImageResource(R.drawable.photo_paint); this.paintItem.setBackgroundDrawable(Theme.createSelectorDrawable(Theme.ACTION_BAR_WHITE_SELECTOR_COLOR)); this.itemsLayout.addView(this.paintItem, LayoutHelper.createLinear(70, 48)); this.paintItem.setOnClickListener(new OnClickListener() { public void onClick(View view) { PhotoViewer.this.switchToEditMode(3); } }); this.tuneItem = new ImageView(this.parentActivity); this.tuneItem.setScaleType(ScaleType.CENTER); this.tuneItem.setImageResource(R.drawable.photo_tools); this.tuneItem.setBackgroundDrawable(Theme.createSelectorDrawable(Theme.ACTION_BAR_WHITE_SELECTOR_COLOR)); this.itemsLayout.addView(this.tuneItem, LayoutHelper.createLinear(70, 48)); this.tuneItem.setOnClickListener(new OnClickListener() { public void onClick(View view) { PhotoViewer.this.switchToEditMode(2); } }); this.compressItem = new ImageView(this.parentActivity); this.compressItem.setTag(Integer.valueOf(1)); this.compressItem.setScaleType(ScaleType.CENTER); this.compressItem.setBackgroundDrawable(Theme.createSelectorDrawable(Theme.ACTION_BAR_WHITE_SELECTOR_COLOR)); this.selectedCompression = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", 0).getInt("compress_video2", 1); if (this.selectedCompression <= 0) { this.compressItem.setImageResource(R.drawable.video_240); } else if (this.selectedCompression == 1) { this.compressItem.setImageResource(R.drawable.video_360); } else if (this.selectedCompression == 2) { this.compressItem.setImageResource(R.drawable.video_480); } else if (this.selectedCompression == 3) { this.compressItem.setImageResource(R.drawable.video_720); } else if (this.selectedCompression == 4) { this.compressItem.setImageResource(R.drawable.video_1080); } this.itemsLayout.addView(this.compressItem, LayoutHelper.createLinear(70, 48)); this.compressItem.setOnClickListener(new OnClickListener() { public void onClick(View view) { PhotoViewer.this.showQualityView(true); PhotoViewer.this.requestVideoPreview(1); } }); this.muteItem = new ImageView(this.parentActivity); this.muteItem.setScaleType(ScaleType.CENTER); this.muteItem.setBackgroundDrawable(Theme.createSelectorDrawable(Theme.ACTION_BAR_WHITE_SELECTOR_COLOR)); this.itemsLayout.addView(this.muteItem, LayoutHelper.createLinear(70, 48)); this.muteItem.setOnClickListener(new OnClickListener() { public void onClick(View view) { PhotoViewer.this.muteVideo = !PhotoViewer.this.muteVideo; if (!PhotoViewer.this.muteVideo || PhotoViewer.this.checkImageView.isChecked()) { Object obj = PhotoViewer.this.imagesArrLocals.get(PhotoViewer.this.currentIndex); if (obj instanceof PhotoEntry) { ((PhotoEntry) obj).editedInfo = PhotoViewer.this.getCurrentVideoEditedInfo(); } } else { PhotoViewer.this.checkImageView.callOnClick(); } PhotoViewer.this.updateMuteButton(); } }); this.timeItem = new ImageView(this.parentActivity); this.timeItem.setScaleType(ScaleType.CENTER); this.timeItem.setImageResource(R.drawable.photo_timer); this.timeItem.setBackgroundDrawable(Theme.createSelectorDrawable(Theme.ACTION_BAR_WHITE_SELECTOR_COLOR)); this.itemsLayout.addView(this.timeItem, LayoutHelper.createLinear(70, 48)); this.timeItem.setOnClickListener(new OnClickListener() { /* renamed from: org.telegram.ui.PhotoViewer$21$1 */ class C50471 implements OnTouchListener { C50471() { } public boolean onTouch(View view, MotionEvent motionEvent) { return true; } } /* renamed from: org.telegram.ui.PhotoViewer$21$2 */ class C50482 implements OnTouchListener { C50482() { } public boolean onTouch(View view, MotionEvent motionEvent) { return true; } } /* renamed from: org.telegram.ui.PhotoViewer$21$3 */ class C50493 implements Formatter { C50493() { } public String format(int i) { return i == 0 ? LocaleController.getString("ShortMessageLifetimeForever", R.string.ShortMessageLifetimeForever) : (i < 1 || i >= 21) ? LocaleController.formatTTLString((i - 16) * 5) : LocaleController.formatTTLString(i); } } public void onClick(View view) { if (PhotoViewer.this.parentActivity != null) { BottomSheet.Builder builder = new BottomSheet.Builder(PhotoViewer.this.parentActivity); builder.setUseHardwareLayer(false); View linearLayout = new LinearLayout(PhotoViewer.this.parentActivity); linearLayout.setOrientation(1); builder.setCustomView(linearLayout); View textView = new TextView(PhotoViewer.this.parentActivity); textView.setLines(1); textView.setSingleLine(true); textView.setText(LocaleController.getString("MessageLifetime", R.string.MessageLifetime)); textView.setTextColor(-1); textView.setTextSize(1, 16.0f); textView.setEllipsize(TruncateAt.MIDDLE); textView.setPadding(AndroidUtilities.dp(21.0f), AndroidUtilities.dp(8.0f), AndroidUtilities.dp(21.0f), AndroidUtilities.dp(4.0f)); textView.setGravity(16); linearLayout.addView(textView, LayoutHelper.createFrame(-1, -2.0f)); textView.setOnTouchListener(new C50471()); View textView2 = new TextView(PhotoViewer.this.parentActivity); textView2.setText(PhotoViewer.this.isCurrentVideo ? LocaleController.getString("MessageLifetimeVideo", R.string.MessageLifetimeVideo) : LocaleController.getString("MessageLifetimePhoto", R.string.MessageLifetimePhoto)); textView2.setTextColor(-8355712); textView2.setTextSize(1, 14.0f); textView2.setEllipsize(TruncateAt.MIDDLE); textView2.setPadding(AndroidUtilities.dp(21.0f), 0, AndroidUtilities.dp(21.0f), AndroidUtilities.dp(8.0f)); textView2.setGravity(16); linearLayout.addView(textView2, LayoutHelper.createFrame(-1, -2.0f)); textView2.setOnTouchListener(new C50482()); final BottomSheet create = builder.create(); textView2 = new NumberPicker(PhotoViewer.this.parentActivity); textView2.setMinValue(0); textView2.setMaxValue(28); Object obj = PhotoViewer.this.imagesArrLocals.get(PhotoViewer.this.currentIndex); int i = obj instanceof PhotoEntry ? ((PhotoEntry) obj).ttl : obj instanceof SearchImage ? ((SearchImage) obj).ttl : 0; if (i == 0) { textView2.setValue(ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", 0).getInt("self_destruct", 7)); } else if (i < 0 || i >= 21) { textView2.setValue(((i / 5) + 21) - 5); } else { textView2.setValue(i); } textView2.setTextColor(-1); textView2.setSelectorColor(-11711155); textView2.setFormatter(new C50493()); linearLayout.addView(textView2, LayoutHelper.createLinear(-1, -2)); textView = new FrameLayout(PhotoViewer.this.parentActivity) { protected void onLayout(boolean z, int i, int i2, int i3, int i4) { int childCount = getChildCount(); View view = null; int i5 = i3 - i; int i6 = 0; while (i6 < childCount) { View view2; View childAt = getChildAt(i6); if (((Integer) childAt.getTag()).intValue() == -1) { childAt.layout((i5 - getPaddingRight()) - childAt.getMeasuredWidth(), getPaddingTop(), (i5 - getPaddingRight()) + childAt.getMeasuredWidth(), getPaddingTop() + childAt.getMeasuredHeight()); view2 = childAt; } else if (((Integer) childAt.getTag()).intValue() == -2) { int paddingRight = (i5 - getPaddingRight()) - childAt.getMeasuredWidth(); if (view != null) { paddingRight -= view.getMeasuredWidth() + AndroidUtilities.dp(8.0f); } childAt.layout(paddingRight, getPaddingTop(), childAt.getMeasuredWidth() + paddingRight, getPaddingTop() + childAt.getMeasuredHeight()); view2 = view; } else { childAt.layout(getPaddingLeft(), getPaddingTop(), getPaddingLeft() + childAt.getMeasuredWidth(), getPaddingTop() + childAt.getMeasuredHeight()); view2 = view; } i6++; view = view2; } } }; textView.setPadding(AndroidUtilities.dp(8.0f), AndroidUtilities.dp(8.0f), AndroidUtilities.dp(8.0f), AndroidUtilities.dp(8.0f)); linearLayout.addView(textView, LayoutHelper.createLinear(-1, 52)); linearLayout = new TextView(PhotoViewer.this.parentActivity); linearLayout.setMinWidth(AndroidUtilities.dp(64.0f)); linearLayout.setTag(Integer.valueOf(-1)); linearLayout.setTextSize(1, 14.0f); linearLayout.setTextColor(-11944718); linearLayout.setGravity(17); linearLayout.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); linearLayout.setText(LocaleController.getString("Done", R.string.Done).toUpperCase()); linearLayout.setBackgroundDrawable(Theme.getRoundRectSelectorDrawable()); linearLayout.setPadding(AndroidUtilities.dp(10.0f), 0, AndroidUtilities.dp(10.0f), 0); textView.addView(linearLayout, LayoutHelper.createFrame(-2, 36, 53)); linearLayout.setOnClickListener(new OnClickListener() { public void onClick(View view) { int value = textView2.getValue(); Editor edit = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", 0).edit(); edit.putInt("self_destruct", value); edit.commit(); create.dismiss(); int i = (value < 0 || value >= 21) ? (value - 16) * 5 : value; Object obj = PhotoViewer.this.imagesArrLocals.get(PhotoViewer.this.currentIndex); if (obj instanceof PhotoEntry) { ((PhotoEntry) obj).ttl = i; } else if (obj instanceof SearchImage) { ((SearchImage) obj).ttl = i; } PhotoViewer.this.timeItem.setColorFilter(i != 0 ? new PorterDuffColorFilter(-12734994, Mode.MULTIPLY) : null); if (!PhotoViewer.this.checkImageView.isChecked()) { PhotoViewer.this.checkImageView.callOnClick(); } } }); linearLayout = new TextView(PhotoViewer.this.parentActivity); linearLayout.setMinWidth(AndroidUtilities.dp(64.0f)); linearLayout.setTag(Integer.valueOf(-2)); linearLayout.setTextSize(1, 14.0f); linearLayout.setTextColor(-11944718); linearLayout.setGravity(17); linearLayout.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); linearLayout.setText(LocaleController.getString("Cancel", R.string.Cancel).toUpperCase()); linearLayout.setBackgroundDrawable(Theme.getRoundRectSelectorDrawable()); linearLayout.setPadding(AndroidUtilities.dp(10.0f), 0, AndroidUtilities.dp(10.0f), 0); textView.addView(linearLayout, LayoutHelper.createFrame(-2, 36, 53)); linearLayout.setOnClickListener(new OnClickListener() { public void onClick(View view) { create.dismiss(); } }); create.show(); create.setBackgroundColor(Theme.ACTION_BAR_VIDEO_EDIT_COLOR); } } }); this.editorDoneLayout = new PickerBottomLayoutViewer(this.actvityContext); this.editorDoneLayout.setBackgroundColor(Theme.ACTION_BAR_PHOTO_VIEWER_COLOR); this.editorDoneLayout.updateSelectedCount(0, false); this.editorDoneLayout.setVisibility(8); this.containerView.addView(this.editorDoneLayout, LayoutHelper.createFrame(-1, 48, 83)); this.editorDoneLayout.cancelButton.setOnClickListener(new OnClickListener() { public void onClick(View view) { if (PhotoViewer.this.currentEditMode == 1) { PhotoViewer.this.photoCropView.cancelAnimationRunnable(); } PhotoViewer.this.switchToEditMode(0); } }); this.editorDoneLayout.doneButton.setOnClickListener(new OnClickListener() { public void onClick(View view) { if (PhotoViewer.this.currentEditMode != 1 || PhotoViewer.this.photoCropView.isReady()) { PhotoViewer.this.applyCurrentEditMode(); PhotoViewer.this.switchToEditMode(0); } } }); this.resetButton = new TextView(this.actvityContext); this.resetButton.setVisibility(8); this.resetButton.setTextSize(1, 14.0f); this.resetButton.setTextColor(-1); this.resetButton.setGravity(17); this.resetButton.setBackgroundDrawable(Theme.createSelectorDrawable(Theme.ACTION_BAR_PICKER_SELECTOR_COLOR, 0)); this.resetButton.setPadding(AndroidUtilities.dp(20.0f), 0, AndroidUtilities.dp(20.0f), 0); this.resetButton.setText(LocaleController.getString("Reset", R.string.CropReset).toUpperCase()); this.resetButton.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); this.editorDoneLayout.addView(this.resetButton, LayoutHelper.createFrame(-2, -1, 49)); this.resetButton.setOnClickListener(new OnClickListener() { public void onClick(View view) { PhotoViewer.this.photoCropView.reset(); } }); this.gestureDetector = new GestureDetector(this.containerView.getContext(), this); this.gestureDetector.setOnDoubleTapListener(this); ImageReceiverDelegate anonymousClass25 = new ImageReceiverDelegate() { public void didSetImage(ImageReceiver imageReceiver, boolean z, boolean z2) { if (imageReceiver == PhotoViewer.this.centerImage && z && !z2 && PhotoViewer.this.currentEditMode == 1 && PhotoViewer.this.photoCropView != null) { Bitmap bitmap = imageReceiver.getBitmap(); if (bitmap != null) { PhotoViewer.this.photoCropView.setBitmap(bitmap, imageReceiver.getOrientation(), PhotoViewer.this.sendPhotoType != 1); } } if (imageReceiver != PhotoViewer.this.centerImage || !z || PhotoViewer.this.placeProvider == null || !PhotoViewer.this.placeProvider.scaleToFill() || PhotoViewer.this.ignoreDidSetImage) { return; } if (PhotoViewer.this.wasLayout) { PhotoViewer.this.setScaleToFill(); } else { PhotoViewer.this.dontResetZoomOnFirstLayout = true; } } }; this.centerImage.setParentView(this.containerView); this.centerImage.setCrossfadeAlpha((byte) 2); this.centerImage.setInvalidateAll(true); this.centerImage.setDelegate(anonymousClass25); this.leftImage.setParentView(this.containerView); this.leftImage.setCrossfadeAlpha((byte) 2); this.leftImage.setInvalidateAll(true); this.leftImage.setDelegate(anonymousClass25); this.rightImage.setParentView(this.containerView); this.rightImage.setCrossfadeAlpha((byte) 2); this.rightImage.setInvalidateAll(true); this.rightImage.setDelegate(anonymousClass25); int rotation = ((WindowManager) ApplicationLoader.applicationContext.getSystemService("window")).getDefaultDisplay().getRotation(); this.checkImageView = new CheckBox(this.containerView.getContext(), R.drawable.selectphoto_large) { public boolean onTouchEvent(MotionEvent motionEvent) { return PhotoViewer.this.bottomTouchEnabled && super.onTouchEvent(motionEvent); } }; this.checkImageView.setDrawBackground(true); this.checkImageView.setHasBorder(true); this.checkImageView.setSize(40); this.checkImageView.setCheckOffset(AndroidUtilities.dp(1.0f)); this.checkImageView.setColor(-10043398, -1); this.checkImageView.setVisibility(8); FrameLayoutDrawer frameLayoutDrawer = this.containerView; View view = this.checkImageView; float f = (rotation == 3 || rotation == 1) ? 58.0f : 68.0f; frameLayoutDrawer.addView(view, LayoutHelper.createFrame(40, 40.0f, 53, BitmapDescriptorFactory.HUE_RED, f, 10.0f, BitmapDescriptorFactory.HUE_RED)); if (VERSION.SDK_INT >= 21) { layoutParams = (FrameLayout.LayoutParams) this.checkImageView.getLayoutParams(); layoutParams.topMargin += AndroidUtilities.statusBarHeight; } this.checkImageView.setOnClickListener(new OnClickListener() { public void onClick(View view) { PhotoViewer.this.setPhotoChecked(); } }); this.photosCounterView = new CounterView(this.parentActivity); frameLayoutDrawer = this.containerView; view = this.photosCounterView; f = (rotation == 3 || rotation == 1) ? 58.0f : 68.0f; frameLayoutDrawer.addView(view, LayoutHelper.createFrame(40, 40.0f, 53, BitmapDescriptorFactory.HUE_RED, f, 66.0f, BitmapDescriptorFactory.HUE_RED)); if (VERSION.SDK_INT >= 21) { layoutParams = (FrameLayout.LayoutParams) this.photosCounterView.getLayoutParams(); layoutParams.topMargin += AndroidUtilities.statusBarHeight; } this.photosCounterView.setOnClickListener(new OnClickListener() { public void onClick(View view) { if (PhotoViewer.this.placeProvider != null && PhotoViewer.this.placeProvider.getSelectedPhotosOrder() != null && !PhotoViewer.this.placeProvider.getSelectedPhotosOrder().isEmpty()) { PhotoViewer.this.togglePhotosListView(!PhotoViewer.this.isPhotosListViewVisible, true); } } }); this.selectedPhotosListView = new RecyclerListView(this.parentActivity); this.selectedPhotosListView.setVisibility(8); this.selectedPhotosListView.setAlpha(BitmapDescriptorFactory.HUE_RED); this.selectedPhotosListView.setTranslationY((float) (-AndroidUtilities.dp(10.0f))); this.selectedPhotosListView.addItemDecoration(new ItemDecoration() { public void getItemOffsets(Rect rect, View view, RecyclerView recyclerView, State state) { int childAdapterPosition = recyclerView.getChildAdapterPosition(view); if ((view instanceof PhotoPickerPhotoCell) && childAdapterPosition == 0) { rect.left = AndroidUtilities.dp(3.0f); } else { rect.left = 0; } rect.right = AndroidUtilities.dp(3.0f); } }); this.selectedPhotosListView.setBackgroundColor(Theme.ACTION_BAR_PHOTO_VIEWER_COLOR); this.selectedPhotosListView.setPadding(0, AndroidUtilities.dp(3.0f), 0, AndroidUtilities.dp(3.0f)); this.selectedPhotosListView.setLayoutManager(new LinearLayoutManager(this.parentActivity, 0, false)); RecyclerListView recyclerListView = this.selectedPhotosListView; Adapter listAdapter = new ListAdapter(this.parentActivity); this.selectedPhotosAdapter = listAdapter; recyclerListView.setAdapter(listAdapter); this.containerView.addView(this.selectedPhotosListView, LayoutHelper.createFrame(-1, 88, 51)); this.selectedPhotosListView.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(View view, int i) { if (i == 0 && PhotoViewer.this.placeProvider.allowGroupPhotos()) { boolean isGroupPhotosEnabled = MediaController.getInstance().isGroupPhotosEnabled(); MediaController.getInstance().toggleGroupPhotosEnabled(); PhotoViewer.this.placeProvider.toggleGroupPhotosEnabled(); ((ImageView) view).setColorFilter(!isGroupPhotosEnabled ? new PorterDuffColorFilter(-10043398, Mode.MULTIPLY) : null); PhotoViewer.this.showHint(false, !isGroupPhotosEnabled); return; } int indexOf = PhotoViewer.this.imagesArrLocals.indexOf(view.getTag()); if (indexOf >= 0) { PhotoViewer.this.currentIndex = -1; PhotoViewer.this.setImageIndex(indexOf, false); } } }); this.captionEditText = new PhotoViewerCaptionEnterView(this.actvityContext, this.containerView, this.windowView) { public boolean dispatchTouchEvent(MotionEvent motionEvent) { try { return !PhotoViewer.this.bottomTouchEnabled && super.dispatchTouchEvent(motionEvent); } catch (Throwable e) { FileLog.e(e); return false; } } public boolean onInterceptTouchEvent(MotionEvent motionEvent) { try { return !PhotoViewer.this.bottomTouchEnabled && super.onInterceptTouchEvent(motionEvent); } catch (Throwable e) { FileLog.e(e); return false; } } public boolean onTouchEvent(MotionEvent motionEvent) { return !PhotoViewer.this.bottomTouchEnabled && super.onTouchEvent(motionEvent); } }; this.captionEditText.setDelegate(new PhotoViewerCaptionEnterViewDelegate() { public void onCaptionEnter() { PhotoViewer.this.closeCaptionEnter(true); } public void onTextChanged(CharSequence charSequence) { if (PhotoViewer.this.mentionsAdapter != null && PhotoViewer.this.captionEditText != null && PhotoViewer.this.parentChatActivity != null && charSequence != null) { PhotoViewer.this.mentionsAdapter.searchUsernameOrHashtag(charSequence.toString(), PhotoViewer.this.captionEditText.getCursorPosition(), PhotoViewer.this.parentChatActivity.messages, false); } } public void onWindowSizeChanged(int i) { if (i - (ActionBar.getCurrentActionBarHeight() * 2) < AndroidUtilities.dp((float) ((PhotoViewer.this.mentionsAdapter.getItemCount() > 3 ? 18 : 0) + (Math.min(3, PhotoViewer.this.mentionsAdapter.getItemCount()) * 36)))) { PhotoViewer.this.allowMentions = false; if (PhotoViewer.this.mentionListView != null && PhotoViewer.this.mentionListView.getVisibility() == 0) { PhotoViewer.this.mentionListView.setVisibility(4); return; } return; } PhotoViewer.this.allowMentions = true; if (PhotoViewer.this.mentionListView != null && PhotoViewer.this.mentionListView.getVisibility() == 4) { PhotoViewer.this.mentionListView.setVisibility(0); } } }); this.containerView.addView(this.captionEditText, LayoutHelper.createFrame(-1, -2, 83)); this.mentionListView = new RecyclerListView(this.actvityContext) { public boolean dispatchTouchEvent(MotionEvent motionEvent) { return !PhotoViewer.this.bottomTouchEnabled && super.dispatchTouchEvent(motionEvent); } public boolean onInterceptTouchEvent(MotionEvent motionEvent) { return !PhotoViewer.this.bottomTouchEnabled && super.onInterceptTouchEvent(motionEvent); } public boolean onTouchEvent(MotionEvent motionEvent) { return !PhotoViewer.this.bottomTouchEnabled && super.onTouchEvent(motionEvent); } }; this.mentionListView.setTag(Integer.valueOf(5)); this.mentionLayoutManager = new LinearLayoutManager(this.actvityContext) { public boolean supportsPredictiveItemAnimations() { return false; } }; this.mentionLayoutManager.setOrientation(1); this.mentionListView.setLayoutManager(this.mentionLayoutManager); this.mentionListView.setBackgroundColor(Theme.ACTION_BAR_PHOTO_VIEWER_COLOR); this.mentionListView.setVisibility(8); this.mentionListView.setClipToPadding(true); this.mentionListView.setOverScrollMode(2); this.containerView.addView(this.mentionListView, LayoutHelper.createFrame(-1, 110, 83)); RecyclerListView recyclerListView2 = this.mentionListView; Adapter mentionsAdapter = new MentionsAdapter(this.actvityContext, true, 0, new MentionsAdapterDelegate() { /* renamed from: org.telegram.ui.PhotoViewer$35$1 */ class C50541 extends AnimatorListenerAdapter { C50541() { } public void onAnimationEnd(Animator animator) { if (PhotoViewer.this.mentionListAnimation != null && PhotoViewer.this.mentionListAnimation.equals(animator)) { PhotoViewer.this.mentionListAnimation = null; } } } /* renamed from: org.telegram.ui.PhotoViewer$35$2 */ class C50552 extends AnimatorListenerAdapter { C50552() { } public void onAnimationEnd(Animator animator) { if (PhotoViewer.this.mentionListAnimation != null && PhotoViewer.this.mentionListAnimation.equals(animator)) { PhotoViewer.this.mentionListView.setVisibility(8); PhotoViewer.this.mentionListAnimation = null; } } } public void needChangePanelVisibility(boolean z) { if (z) { FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) PhotoViewer.this.mentionListView.getLayoutParams(); int min = (PhotoViewer.this.mentionsAdapter.getItemCount() > 3 ? 18 : 0) + (Math.min(3, PhotoViewer.this.mentionsAdapter.getItemCount()) * 36); layoutParams.height = AndroidUtilities.dp((float) min); layoutParams.topMargin = -AndroidUtilities.dp((float) min); PhotoViewer.this.mentionListView.setLayoutParams(layoutParams); if (PhotoViewer.this.mentionListAnimation != null) { PhotoViewer.this.mentionListAnimation.cancel(); PhotoViewer.this.mentionListAnimation = null; } if (PhotoViewer.this.mentionListView.getVisibility() == 0) { PhotoViewer.this.mentionListView.setAlpha(1.0f); return; } PhotoViewer.this.mentionLayoutManager.scrollToPositionWithOffset(0, 10000); if (PhotoViewer.this.allowMentions) { PhotoViewer.this.mentionListView.setVisibility(0); PhotoViewer.this.mentionListAnimation = new AnimatorSet(); PhotoViewer.this.mentionListAnimation.playTogether(new Animator[]{ObjectAnimator.ofFloat(PhotoViewer.this.mentionListView, "alpha", new float[]{BitmapDescriptorFactory.HUE_RED, 1.0f})}); PhotoViewer.this.mentionListAnimation.addListener(new C50541()); PhotoViewer.this.mentionListAnimation.setDuration(200); PhotoViewer.this.mentionListAnimation.start(); return; } PhotoViewer.this.mentionListView.setAlpha(1.0f); PhotoViewer.this.mentionListView.setVisibility(4); return; } if (PhotoViewer.this.mentionListAnimation != null) { PhotoViewer.this.mentionListAnimation.cancel(); PhotoViewer.this.mentionListAnimation = null; } if (PhotoViewer.this.mentionListView.getVisibility() == 8) { return; } if (PhotoViewer.this.allowMentions) { PhotoViewer.this.mentionListAnimation = new AnimatorSet(); AnimatorSet access$9300 = PhotoViewer.this.mentionListAnimation; Animator[] animatorArr = new Animator[1]; animatorArr[0] = ObjectAnimator.ofFloat(PhotoViewer.this.mentionListView, "alpha", new float[]{BitmapDescriptorFactory.HUE_RED}); access$9300.playTogether(animatorArr); PhotoViewer.this.mentionListAnimation.addListener(new C50552()); PhotoViewer.this.mentionListAnimation.setDuration(200); PhotoViewer.this.mentionListAnimation.start(); return; } PhotoViewer.this.mentionListView.setVisibility(8); } public void onContextClick(BotInlineResult botInlineResult) { } public void onContextSearch(boolean z) { } }); this.mentionsAdapter = mentionsAdapter; recyclerListView2.setAdapter(mentionsAdapter); this.mentionsAdapter.setAllowNewMentions(false); this.mentionListView.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(View view, int i) { Object item = PhotoViewer.this.mentionsAdapter.getItem(i); int resultStartPosition = PhotoViewer.this.mentionsAdapter.getResultStartPosition(); int resultLength = PhotoViewer.this.mentionsAdapter.getResultLength(); if (item instanceof User) { User user = (User) item; if (user != null) { PhotoViewer.this.captionEditText.replaceWithText(resultStartPosition, resultLength, "@" + user.username + " ", false); } } else if (item instanceof String) { PhotoViewer.this.captionEditText.replaceWithText(resultStartPosition, resultLength, item + " ", false); } else if (item instanceof EmojiSuggestion) { CharSequence charSequence = ((EmojiSuggestion) item).emoji; PhotoViewer.this.captionEditText.addEmojiToRecent(charSequence); PhotoViewer.this.captionEditText.replaceWithText(resultStartPosition, resultLength, charSequence, true); } } }); this.mentionListView.setOnItemLongClickListener(new OnItemLongClickListener() { /* renamed from: org.telegram.ui.PhotoViewer$37$1 */ class C50561 implements DialogInterface.OnClickListener { C50561() { } public void onClick(DialogInterface dialogInterface, int i) { PhotoViewer.this.mentionsAdapter.clearRecentHashtags(); } } public boolean onItemClick(View view, int i) { if (!(PhotoViewer.this.mentionsAdapter.getItem(i) instanceof String)) { return false; } Builder builder = new Builder(PhotoViewer.this.parentActivity); builder.setTitle(LocaleController.getString("AppName", R.string.AppName)); builder.setMessage(LocaleController.getString("ClearSearch", R.string.ClearSearch)); builder.setPositiveButton(LocaleController.getString("ClearButton", R.string.ClearButton).toUpperCase(), new C50561()); builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null); PhotoViewer.this.showAlertDialog(builder); return true; } }); } } public void setParentAlert(ChatAttachAlert chatAttachAlert) { this.parentAlert = chatAttachAlert; } public void setParentChatActivity(ChatActivity chatActivity) { this.parentChatActivity = chatActivity; } public void showAlertDialog(Builder builder) { if (this.parentActivity != null) { try { if (this.visibleDialog != null) { this.visibleDialog.dismiss(); this.visibleDialog = null; } } catch (Throwable e) { FileLog.e(e); } try { this.visibleDialog = builder.show(); this.visibleDialog.setCanceledOnTouchOutside(true); this.visibleDialog.setOnDismissListener(new OnDismissListener() { public void onDismiss(DialogInterface dialogInterface) { PhotoViewer.this.visibleDialog = null; } }); } catch (Throwable e2) { FileLog.e(e2); } } } public void switchToEditMode(final int i) { if (this.currentEditMode == i || this.centerImage.getBitmap() == null || this.changeModeAnimation != null || this.imageMoveAnimation != null || this.photoProgressViews[0].backgroundState != -1 || this.captionEditText.getTag() != null) { return; } if (i == 0) { if (this.centerImage.getBitmap() != null) { int bitmapWidth = this.centerImage.getBitmapWidth(); int bitmapHeight = this.centerImage.getBitmapHeight(); float containerViewWidth = ((float) getContainerViewWidth()) / ((float) bitmapWidth); float containerViewHeight = ((float) getContainerViewHeight()) / ((float) bitmapHeight); float containerViewWidth2 = ((float) getContainerViewWidth(0)) / ((float) bitmapWidth); float containerViewHeight2 = ((float) getContainerViewHeight(0)) / ((float) bitmapHeight); if (containerViewWidth > containerViewHeight) { containerViewWidth = containerViewHeight; } if (containerViewWidth2 <= containerViewHeight2) { containerViewHeight2 = containerViewWidth2; } if (this.sendPhotoType != 1 || this.applying) { this.animateToScale = containerViewHeight2 / containerViewWidth; } else { containerViewHeight = (float) Math.min(getContainerViewWidth(), getContainerViewHeight()); containerViewWidth2 = containerViewHeight / ((float) bitmapWidth); containerViewHeight /= (float) bitmapHeight; if (containerViewWidth2 <= containerViewHeight) { containerViewWidth2 = containerViewHeight; } this.scale = containerViewWidth2 / containerViewWidth; this.animateToScale = (containerViewHeight2 * this.scale) / containerViewWidth2; } this.animateToX = BitmapDescriptorFactory.HUE_RED; if (this.currentEditMode == 1) { this.animateToY = (float) AndroidUtilities.dp(58.0f); } else if (this.currentEditMode == 2) { this.animateToY = (float) AndroidUtilities.dp(92.0f); } else if (this.currentEditMode == 3) { this.animateToY = (float) AndroidUtilities.dp(44.0f); } if (VERSION.SDK_INT >= 21) { this.animateToY -= (float) (AndroidUtilities.statusBarHeight / 2); } this.animationStartTime = System.currentTimeMillis(); this.zoomAnimation = true; } this.imageMoveAnimation = new AnimatorSet(); AnimatorSet animatorSet; Animator[] animatorArr; if (this.currentEditMode == 1) { animatorSet = this.imageMoveAnimation; animatorArr = new Animator[3]; animatorArr[0] = ObjectAnimator.ofFloat(this.editorDoneLayout, "translationY", new float[]{(float) AndroidUtilities.dp(48.0f)}); animatorArr[1] = ObjectAnimator.ofFloat(this, "animationValue", new float[]{BitmapDescriptorFactory.HUE_RED, 1.0f}); animatorArr[2] = ObjectAnimator.ofFloat(this.photoCropView, "alpha", new float[]{BitmapDescriptorFactory.HUE_RED}); animatorSet.playTogether(animatorArr); } else if (this.currentEditMode == 2) { this.photoFilterView.shutdown(); animatorSet = this.imageMoveAnimation; animatorArr = new Animator[2]; animatorArr[0] = ObjectAnimator.ofFloat(this.photoFilterView.getToolsView(), "translationY", new float[]{(float) AndroidUtilities.dp(186.0f)}); animatorArr[1] = ObjectAnimator.ofFloat(this, "animationValue", new float[]{BitmapDescriptorFactory.HUE_RED, 1.0f}); animatorSet.playTogether(animatorArr); } else if (this.currentEditMode == 3) { this.photoPaintView.shutdown(); animatorSet = this.imageMoveAnimation; animatorArr = new Animator[3]; animatorArr[0] = ObjectAnimator.ofFloat(this.photoPaintView.getToolsView(), "translationY", new float[]{(float) AndroidUtilities.dp(126.0f)}); animatorArr[1] = ObjectAnimator.ofFloat(this.photoPaintView.getColorPicker(), "translationY", new float[]{(float) AndroidUtilities.dp(126.0f)}); animatorArr[2] = ObjectAnimator.ofFloat(this, "animationValue", new float[]{BitmapDescriptorFactory.HUE_RED, 1.0f}); animatorSet.playTogether(animatorArr); } this.imageMoveAnimation.setDuration(200); this.imageMoveAnimation.addListener(new AnimatorListenerAdapter() { /* renamed from: org.telegram.ui.PhotoViewer$40$1 */ class C50611 extends AnimatorListenerAdapter { C50611() { } public void onAnimationStart(Animator animator) { PhotoViewer.this.pickerView.setVisibility(0); PhotoViewer.this.actionBar.setVisibility(0); if (PhotoViewer.this.needCaptionLayout) { PhotoViewer.this.captionTextView.setVisibility(PhotoViewer.this.captionTextView.getTag() != null ? 0 : 4); } if (PhotoViewer.this.sendPhotoType == 0) { PhotoViewer.this.checkImageView.setVisibility(0); PhotoViewer.this.photosCounterView.setVisibility(0); } } } public void onAnimationEnd(Animator animator) { if (PhotoViewer.this.currentEditMode == 1) { PhotoViewer.this.editorDoneLayout.setVisibility(8); PhotoViewer.this.photoCropView.setVisibility(8); } else if (PhotoViewer.this.currentEditMode == 2) { PhotoViewer.this.containerView.removeView(PhotoViewer.this.photoFilterView); PhotoViewer.this.photoFilterView = null; } else if (PhotoViewer.this.currentEditMode == 3) { PhotoViewer.this.containerView.removeView(PhotoViewer.this.photoPaintView); PhotoViewer.this.photoPaintView = null; } PhotoViewer.this.imageMoveAnimation = null; PhotoViewer.this.currentEditMode = i; PhotoViewer.this.applying = false; PhotoViewer.this.animateToScale = 1.0f; PhotoViewer.this.animateToX = BitmapDescriptorFactory.HUE_RED; PhotoViewer.this.animateToY = BitmapDescriptorFactory.HUE_RED; PhotoViewer.this.scale = 1.0f; PhotoViewer.this.updateMinMax(PhotoViewer.this.scale); PhotoViewer.this.containerView.invalidate(); AnimatorSet animatorSet = new AnimatorSet(); Collection arrayList = new ArrayList(); arrayList.add(ObjectAnimator.ofFloat(PhotoViewer.this.pickerView, "translationY", new float[]{BitmapDescriptorFactory.HUE_RED})); arrayList.add(ObjectAnimator.ofFloat(PhotoViewer.this.actionBar, "translationY", new float[]{BitmapDescriptorFactory.HUE_RED})); if (PhotoViewer.this.needCaptionLayout) { arrayList.add(ObjectAnimator.ofFloat(PhotoViewer.this.captionTextView, "translationY", new float[]{BitmapDescriptorFactory.HUE_RED})); } if (PhotoViewer.this.sendPhotoType == 0) { arrayList.add(ObjectAnimator.ofFloat(PhotoViewer.this.checkImageView, "alpha", new float[]{1.0f})); arrayList.add(ObjectAnimator.ofFloat(PhotoViewer.this.photosCounterView, "alpha", new float[]{1.0f})); } animatorSet.playTogether(arrayList); animatorSet.setDuration(200); animatorSet.addListener(new C50611()); animatorSet.start(); } }); this.imageMoveAnimation.start(); } else if (i == 1) { if (this.photoCropView == null) { this.photoCropView = new PhotoCropView(this.actvityContext); this.photoCropView.setVisibility(8); this.containerView.addView(this.photoCropView, LayoutHelper.createFrame(-1, -1.0f, 51, BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED, 48.0f)); this.photoCropView.setDelegate(new PhotoCropViewDelegate() { public Bitmap getBitmap() { return PhotoViewer.this.centerImage.getBitmap(); } public void needMoveImageTo(float f, float f2, float f3, boolean z) { if (z) { PhotoViewer.this.animateTo(f3, f, f2, true); return; } PhotoViewer.this.translationX = f; PhotoViewer.this.translationY = f2; PhotoViewer.this.scale = f3; PhotoViewer.this.containerView.invalidate(); } public void onChange(boolean z) { PhotoViewer.this.resetButton.setVisibility(z ? 8 : 0); } }); } this.photoCropView.onAppear(); this.editorDoneLayout.doneButton.setText(LocaleController.getString("Crop", R.string.Crop)); this.editorDoneLayout.doneButton.setTextColor(-11420173); this.changeModeAnimation = new AnimatorSet(); r0 = new ArrayList(); r0.add(ObjectAnimator.ofFloat(this.pickerView, "translationY", new float[]{BitmapDescriptorFactory.HUE_RED, (float) AndroidUtilities.dp(96.0f)})); r0.add(ObjectAnimator.ofFloat(this.actionBar, "translationY", new float[]{BitmapDescriptorFactory.HUE_RED, (float) (-this.actionBar.getHeight())})); if (this.needCaptionLayout) { r0.add(ObjectAnimator.ofFloat(this.captionTextView, "translationY", new float[]{BitmapDescriptorFactory.HUE_RED, (float) AndroidUtilities.dp(96.0f)})); } if (this.sendPhotoType == 0) { r0.add(ObjectAnimator.ofFloat(this.checkImageView, "alpha", new float[]{1.0f, BitmapDescriptorFactory.HUE_RED})); r0.add(ObjectAnimator.ofFloat(this.photosCounterView, "alpha", new float[]{1.0f, BitmapDescriptorFactory.HUE_RED})); } if (this.selectedPhotosListView.getVisibility() == 0) { r0.add(ObjectAnimator.ofFloat(this.selectedPhotosListView, "alpha", new float[]{1.0f, BitmapDescriptorFactory.HUE_RED})); } this.changeModeAnimation.playTogether(r0); this.changeModeAnimation.setDuration(200); this.changeModeAnimation.addListener(new AnimatorListenerAdapter() { /* renamed from: org.telegram.ui.PhotoViewer$42$1 */ class C50621 extends AnimatorListenerAdapter { C50621() { } public void onAnimationEnd(Animator animator) { PhotoViewer.this.photoCropView.onAppeared(); PhotoViewer.this.imageMoveAnimation = null; PhotoViewer.this.currentEditMode = i; PhotoViewer.this.animateToScale = 1.0f; PhotoViewer.this.animateToX = BitmapDescriptorFactory.HUE_RED; PhotoViewer.this.animateToY = BitmapDescriptorFactory.HUE_RED; PhotoViewer.this.scale = 1.0f; PhotoViewer.this.updateMinMax(PhotoViewer.this.scale); PhotoViewer.this.containerView.invalidate(); } public void onAnimationStart(Animator animator) { PhotoViewer.this.editorDoneLayout.setVisibility(0); PhotoViewer.this.photoCropView.setVisibility(0); } } public void onAnimationEnd(Animator animator) { PhotoViewer.this.changeModeAnimation = null; PhotoViewer.this.pickerView.setVisibility(8); PhotoViewer.this.selectedPhotosListView.setVisibility(8); PhotoViewer.this.selectedPhotosListView.setAlpha(BitmapDescriptorFactory.HUE_RED); PhotoViewer.this.selectedPhotosListView.setTranslationY((float) (-AndroidUtilities.dp(10.0f))); PhotoViewer.this.photosCounterView.setRotationX(BitmapDescriptorFactory.HUE_RED); PhotoViewer.this.selectedPhotosListView.setEnabled(false); PhotoViewer.this.isPhotosListViewVisible = false; if (PhotoViewer.this.needCaptionLayout) { PhotoViewer.this.captionTextView.setVisibility(4); } if (PhotoViewer.this.sendPhotoType == 0) { PhotoViewer.this.checkImageView.setVisibility(8); PhotoViewer.this.photosCounterView.setVisibility(8); } Bitmap bitmap = PhotoViewer.this.centerImage.getBitmap(); if (bitmap != null) { PhotoViewer.this.photoCropView.setBitmap(bitmap, PhotoViewer.this.centerImage.getOrientation(), PhotoViewer.this.sendPhotoType != 1); int bitmapWidth = PhotoViewer.this.centerImage.getBitmapWidth(); int bitmapHeight = PhotoViewer.this.centerImage.getBitmapHeight(); float access$2100 = ((float) PhotoViewer.this.getContainerViewWidth()) / ((float) bitmapWidth); float access$2200 = ((float) PhotoViewer.this.getContainerViewHeight()) / ((float) bitmapHeight); float access$11000 = ((float) PhotoViewer.this.getContainerViewWidth(1)) / ((float) bitmapWidth); float access$11100 = ((float) PhotoViewer.this.getContainerViewHeight(1)) / ((float) bitmapHeight); if (access$2100 <= access$2200) { access$2200 = access$2100; } if (access$11000 <= access$11100) { access$11100 = access$11000; } if (PhotoViewer.this.sendPhotoType == 1) { access$11000 = (float) Math.min(PhotoViewer.this.getContainerViewWidth(1), PhotoViewer.this.getContainerViewHeight(1)); access$11100 = access$11000 / ((float) bitmapWidth); access$11000 /= (float) bitmapHeight; if (access$11100 <= access$11000) { access$11100 = access$11000; } } PhotoViewer.this.animateToScale = access$11100 / access$2200; PhotoViewer.this.animateToX = BitmapDescriptorFactory.HUE_RED; PhotoViewer.this.animateToY = (float) ((VERSION.SDK_INT >= 21 ? AndroidUtilities.statusBarHeight / 2 : 0) + (-AndroidUtilities.dp(56.0f))); PhotoViewer.this.animationStartTime = System.currentTimeMillis(); PhotoViewer.this.zoomAnimation = true; } PhotoViewer.this.imageMoveAnimation = new AnimatorSet(); AnimatorSet access$10200 = PhotoViewer.this.imageMoveAnimation; r3 = new Animator[3]; r3[0] = ObjectAnimator.ofFloat(PhotoViewer.this.editorDoneLayout, "translationY", new float[]{(float) AndroidUtilities.dp(48.0f), BitmapDescriptorFactory.HUE_RED}); r3[1] = ObjectAnimator.ofFloat(PhotoViewer.this, "animationValue", new float[]{BitmapDescriptorFactory.HUE_RED, 1.0f}); r3[2] = ObjectAnimator.ofFloat(PhotoViewer.this.photoCropView, "alpha", new float[]{BitmapDescriptorFactory.HUE_RED, 1.0f}); access$10200.playTogether(r3); PhotoViewer.this.imageMoveAnimation.setDuration(200); PhotoViewer.this.imageMoveAnimation.addListener(new C50621()); PhotoViewer.this.imageMoveAnimation.start(); } }); this.changeModeAnimation.start(); } else if (i == 2) { if (this.photoFilterView == null) { int i2; Bitmap bitmap; SavedFilterState savedFilterState = null; String str = null; if (!this.imagesArrLocals.isEmpty()) { Object obj = this.imagesArrLocals.get(this.currentIndex); if (obj instanceof PhotoEntry) { PhotoEntry photoEntry = (PhotoEntry) obj; if (photoEntry.imagePath == null) { str = photoEntry.path; savedFilterState = photoEntry.savedFilterState; } i2 = photoEntry.orientation; } else if (obj instanceof SearchImage) { SearchImage searchImage = (SearchImage) obj; savedFilterState = searchImage.savedFilterState; str = searchImage.imageUrl; i2 = 0; } if (savedFilterState != null) { bitmap = this.centerImage.getBitmap(); i2 = this.centerImage.getOrientation(); } else { bitmap = BitmapFactory.decodeFile(str); } this.photoFilterView = new PhotoFilterView(this.parentActivity, bitmap, i2, savedFilterState); this.containerView.addView(this.photoFilterView, LayoutHelper.createFrame(-1, -1.0f)); this.photoFilterView.getDoneTextView().setOnClickListener(new OnClickListener() { public void onClick(View view) { PhotoViewer.this.applyCurrentEditMode(); PhotoViewer.this.switchToEditMode(0); } }); this.photoFilterView.getCancelTextView().setOnClickListener(new OnClickListener() { /* renamed from: org.telegram.ui.PhotoViewer$44$1 */ class C50631 implements DialogInterface.OnClickListener { C50631() { } public void onClick(DialogInterface dialogInterface, int i) { PhotoViewer.this.switchToEditMode(0); } } public void onClick(View view) { if (!PhotoViewer.this.photoFilterView.hasChanges()) { PhotoViewer.this.switchToEditMode(0); } else if (PhotoViewer.this.parentActivity != null) { Builder builder = new Builder(PhotoViewer.this.parentActivity); builder.setMessage(LocaleController.getString("DiscardChanges", R.string.DiscardChanges)); builder.setTitle(LocaleController.getString("AppName", R.string.AppName)); builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new C50631()); builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null); PhotoViewer.this.showAlertDialog(builder); } } }); this.photoFilterView.getToolsView().setTranslationY((float) AndroidUtilities.dp(186.0f)); } i2 = 0; if (savedFilterState != null) { bitmap = BitmapFactory.decodeFile(str); } else { bitmap = this.centerImage.getBitmap(); i2 = this.centerImage.getOrientation(); } this.photoFilterView = new PhotoFilterView(this.parentActivity, bitmap, i2, savedFilterState); this.containerView.addView(this.photoFilterView, LayoutHelper.createFrame(-1, -1.0f)); this.photoFilterView.getDoneTextView().setOnClickListener(/* anonymous class already generated */); this.photoFilterView.getCancelTextView().setOnClickListener(/* anonymous class already generated */); this.photoFilterView.getToolsView().setTranslationY((float) AndroidUtilities.dp(186.0f)); } this.changeModeAnimation = new AnimatorSet(); r0 = new ArrayList(); r0.add(ObjectAnimator.ofFloat(this.pickerView, "translationY", new float[]{BitmapDescriptorFactory.HUE_RED, (float) AndroidUtilities.dp(96.0f)})); r0.add(ObjectAnimator.ofFloat(this.actionBar, "translationY", new float[]{BitmapDescriptorFactory.HUE_RED, (float) (-this.actionBar.getHeight())})); if (this.sendPhotoType == 0) { r0.add(ObjectAnimator.ofFloat(this.checkImageView, "alpha", new float[]{1.0f, BitmapDescriptorFactory.HUE_RED})); r0.add(ObjectAnimator.ofFloat(this.photosCounterView, "alpha", new float[]{1.0f, BitmapDescriptorFactory.HUE_RED})); } if (this.selectedPhotosListView.getVisibility() == 0) { r0.add(ObjectAnimator.ofFloat(this.selectedPhotosListView, "alpha", new float[]{1.0f, BitmapDescriptorFactory.HUE_RED})); } this.changeModeAnimation.playTogether(r0); this.changeModeAnimation.setDuration(200); this.changeModeAnimation.addListener(new AnimatorListenerAdapter() { /* renamed from: org.telegram.ui.PhotoViewer$45$1 */ class C50641 extends AnimatorListenerAdapter { C50641() { } public void onAnimationEnd(Animator animator) { PhotoViewer.this.photoFilterView.init(); PhotoViewer.this.imageMoveAnimation = null; PhotoViewer.this.currentEditMode = i; PhotoViewer.this.animateToScale = 1.0f; PhotoViewer.this.animateToX = BitmapDescriptorFactory.HUE_RED; PhotoViewer.this.animateToY = BitmapDescriptorFactory.HUE_RED; PhotoViewer.this.scale = 1.0f; PhotoViewer.this.updateMinMax(PhotoViewer.this.scale); PhotoViewer.this.containerView.invalidate(); } public void onAnimationStart(Animator animator) { } } public void onAnimationEnd(Animator animator) { PhotoViewer.this.changeModeAnimation = null; PhotoViewer.this.pickerView.setVisibility(8); PhotoViewer.this.actionBar.setVisibility(8); PhotoViewer.this.selectedPhotosListView.setVisibility(8); PhotoViewer.this.selectedPhotosListView.setAlpha(BitmapDescriptorFactory.HUE_RED); PhotoViewer.this.selectedPhotosListView.setTranslationY((float) (-AndroidUtilities.dp(10.0f))); PhotoViewer.this.photosCounterView.setRotationX(BitmapDescriptorFactory.HUE_RED); PhotoViewer.this.selectedPhotosListView.setEnabled(false); PhotoViewer.this.isPhotosListViewVisible = false; if (PhotoViewer.this.needCaptionLayout) { PhotoViewer.this.captionTextView.setVisibility(4); } if (PhotoViewer.this.sendPhotoType == 0) { PhotoViewer.this.checkImageView.setVisibility(8); PhotoViewer.this.photosCounterView.setVisibility(8); } if (PhotoViewer.this.centerImage.getBitmap() != null) { int bitmapWidth = PhotoViewer.this.centerImage.getBitmapWidth(); int bitmapHeight = PhotoViewer.this.centerImage.getBitmapHeight(); float access$2100 = ((float) PhotoViewer.this.getContainerViewWidth()) / ((float) bitmapWidth); float access$2200 = ((float) PhotoViewer.this.getContainerViewHeight()) / ((float) bitmapHeight); float access$11000 = ((float) PhotoViewer.this.getContainerViewWidth(2)) / ((float) bitmapWidth); float access$11100 = ((float) PhotoViewer.this.getContainerViewHeight(2)) / ((float) bitmapHeight); if (access$2100 <= access$2200) { access$2200 = access$2100; } if (access$11000 <= access$11100) { access$11100 = access$11000; } PhotoViewer.this.animateToScale = access$11100 / access$2200; PhotoViewer.this.animateToX = BitmapDescriptorFactory.HUE_RED; PhotoViewer.this.animateToY = (float) ((VERSION.SDK_INT >= 21 ? AndroidUtilities.statusBarHeight / 2 : 0) + (-AndroidUtilities.dp(92.0f))); PhotoViewer.this.animationStartTime = System.currentTimeMillis(); PhotoViewer.this.zoomAnimation = true; } PhotoViewer.this.imageMoveAnimation = new AnimatorSet(); AnimatorSet access$10200 = PhotoViewer.this.imageMoveAnimation; Animator[] animatorArr = new Animator[2]; animatorArr[0] = ObjectAnimator.ofFloat(PhotoViewer.this, "animationValue", new float[]{BitmapDescriptorFactory.HUE_RED, 1.0f}); animatorArr[1] = ObjectAnimator.ofFloat(PhotoViewer.this.photoFilterView.getToolsView(), "translationY", new float[]{(float) AndroidUtilities.dp(186.0f), BitmapDescriptorFactory.HUE_RED}); access$10200.playTogether(animatorArr); PhotoViewer.this.imageMoveAnimation.setDuration(200); PhotoViewer.this.imageMoveAnimation.addListener(new C50641()); PhotoViewer.this.imageMoveAnimation.start(); } }); this.changeModeAnimation.start(); } else if (i == 3) { if (this.photoPaintView == null) { this.photoPaintView = new PhotoPaintView(this.parentActivity, this.centerImage.getBitmap(), this.centerImage.getOrientation()); this.containerView.addView(this.photoPaintView, LayoutHelper.createFrame(-1, -1.0f)); this.photoPaintView.getDoneTextView().setOnClickListener(new OnClickListener() { public void onClick(View view) { PhotoViewer.this.applyCurrentEditMode(); PhotoViewer.this.switchToEditMode(0); } }); this.photoPaintView.getCancelTextView().setOnClickListener(new OnClickListener() { /* renamed from: org.telegram.ui.PhotoViewer$47$1 */ class C50651 implements Runnable { C50651() { } public void run() { PhotoViewer.this.switchToEditMode(0); } } public void onClick(View view) { PhotoViewer.this.photoPaintView.maybeShowDismissalAlert(PhotoViewer.this, PhotoViewer.this.parentActivity, new C50651()); } }); this.photoPaintView.getColorPicker().setTranslationY((float) AndroidUtilities.dp(126.0f)); this.photoPaintView.getToolsView().setTranslationY((float) AndroidUtilities.dp(126.0f)); } this.changeModeAnimation = new AnimatorSet(); r0 = new ArrayList(); r0.add(ObjectAnimator.ofFloat(this.pickerView, "translationY", new float[]{BitmapDescriptorFactory.HUE_RED, (float) AndroidUtilities.dp(96.0f)})); r0.add(ObjectAnimator.ofFloat(this.actionBar, "translationY", new float[]{BitmapDescriptorFactory.HUE_RED, (float) (-this.actionBar.getHeight())})); if (this.needCaptionLayout) { r0.add(ObjectAnimator.ofFloat(this.captionTextView, "translationY", new float[]{BitmapDescriptorFactory.HUE_RED, (float) AndroidUtilities.dp(96.0f)})); } if (this.sendPhotoType == 0) { r0.add(ObjectAnimator.ofFloat(this.checkImageView, "alpha", new float[]{1.0f, BitmapDescriptorFactory.HUE_RED})); r0.add(ObjectAnimator.ofFloat(this.photosCounterView, "alpha", new float[]{1.0f, BitmapDescriptorFactory.HUE_RED})); } if (this.selectedPhotosListView.getVisibility() == 0) { r0.add(ObjectAnimator.ofFloat(this.selectedPhotosListView, "alpha", new float[]{1.0f, BitmapDescriptorFactory.HUE_RED})); } this.changeModeAnimation.playTogether(r0); this.changeModeAnimation.setDuration(200); this.changeModeAnimation.addListener(new AnimatorListenerAdapter() { /* renamed from: org.telegram.ui.PhotoViewer$48$1 */ class C50661 extends AnimatorListenerAdapter { C50661() { } public void onAnimationEnd(Animator animator) { PhotoViewer.this.photoPaintView.init(); PhotoViewer.this.imageMoveAnimation = null; PhotoViewer.this.currentEditMode = i; PhotoViewer.this.animateToScale = 1.0f; PhotoViewer.this.animateToX = BitmapDescriptorFactory.HUE_RED; PhotoViewer.this.animateToY = BitmapDescriptorFactory.HUE_RED; PhotoViewer.this.scale = 1.0f; PhotoViewer.this.updateMinMax(PhotoViewer.this.scale); PhotoViewer.this.containerView.invalidate(); } public void onAnimationStart(Animator animator) { } } public void onAnimationEnd(Animator animator) { PhotoViewer.this.changeModeAnimation = null; PhotoViewer.this.pickerView.setVisibility(8); PhotoViewer.this.selectedPhotosListView.setVisibility(8); PhotoViewer.this.selectedPhotosListView.setAlpha(BitmapDescriptorFactory.HUE_RED); PhotoViewer.this.selectedPhotosListView.setTranslationY((float) (-AndroidUtilities.dp(10.0f))); PhotoViewer.this.photosCounterView.setRotationX(BitmapDescriptorFactory.HUE_RED); PhotoViewer.this.selectedPhotosListView.setEnabled(false); PhotoViewer.this.isPhotosListViewVisible = false; if (PhotoViewer.this.needCaptionLayout) { PhotoViewer.this.captionTextView.setVisibility(4); } if (PhotoViewer.this.sendPhotoType == 0) { PhotoViewer.this.checkImageView.setVisibility(8); PhotoViewer.this.photosCounterView.setVisibility(8); } if (PhotoViewer.this.centerImage.getBitmap() != null) { int bitmapWidth = PhotoViewer.this.centerImage.getBitmapWidth(); int bitmapHeight = PhotoViewer.this.centerImage.getBitmapHeight(); float access$2100 = ((float) PhotoViewer.this.getContainerViewWidth()) / ((float) bitmapWidth); float access$2200 = ((float) PhotoViewer.this.getContainerViewHeight()) / ((float) bitmapHeight); float access$11000 = ((float) PhotoViewer.this.getContainerViewWidth(3)) / ((float) bitmapWidth); float access$11100 = ((float) PhotoViewer.this.getContainerViewHeight(3)) / ((float) bitmapHeight); if (access$2100 <= access$2200) { access$2200 = access$2100; } if (access$11000 <= access$11100) { access$11100 = access$11000; } PhotoViewer.this.animateToScale = access$11100 / access$2200; PhotoViewer.this.animateToX = BitmapDescriptorFactory.HUE_RED; PhotoViewer.this.animateToY = (float) ((VERSION.SDK_INT >= 21 ? AndroidUtilities.statusBarHeight / 2 : 0) + (-AndroidUtilities.dp(44.0f))); PhotoViewer.this.animationStartTime = System.currentTimeMillis(); PhotoViewer.this.zoomAnimation = true; } PhotoViewer.this.imageMoveAnimation = new AnimatorSet(); AnimatorSet access$10200 = PhotoViewer.this.imageMoveAnimation; r1 = new Animator[3]; r1[1] = ObjectAnimator.ofFloat(PhotoViewer.this.photoPaintView.getColorPicker(), "translationY", new float[]{(float) AndroidUtilities.dp(126.0f), BitmapDescriptorFactory.HUE_RED}); r1[2] = ObjectAnimator.ofFloat(PhotoViewer.this.photoPaintView.getToolsView(), "translationY", new float[]{(float) AndroidUtilities.dp(126.0f), BitmapDescriptorFactory.HUE_RED}); access$10200.playTogether(r1); PhotoViewer.this.imageMoveAnimation.setDuration(200); PhotoViewer.this.imageMoveAnimation.addListener(new C50661()); PhotoViewer.this.imageMoveAnimation.start(); } }); this.changeModeAnimation.start(); } } public void updateMuteButton() { if (this.videoPlayer != null) { this.videoPlayer.setMute(this.muteVideo); } if (this.videoHasAudio) { this.muteItem.setEnabled(true); this.muteItem.setClickable(true); this.muteItem.setAlpha(1.0f); if (this.muteVideo) { this.actionBar.setSubtitle(null); this.muteItem.setImageResource(R.drawable.volume_off); this.muteItem.setColorFilter(new PorterDuffColorFilter(-12734994, Mode.MULTIPLY)); if (this.compressItem.getTag() != null) { this.compressItem.setClickable(false); this.compressItem.setAlpha(0.5f); this.compressItem.setEnabled(false); } this.videoTimelineView.setMaxProgressDiff(30000.0f / this.videoDuration); return; } this.muteItem.setColorFilter(null); this.actionBar.setSubtitle(this.currentSubtitle); this.muteItem.setImageResource(R.drawable.volume_on); if (this.compressItem.getTag() != null) { this.compressItem.setClickable(true); this.compressItem.setAlpha(1.0f); this.compressItem.setEnabled(true); } this.videoTimelineView.setMaxProgressDiff(1.0f); return; } this.muteItem.setEnabled(false); this.muteItem.setClickable(false); this.muteItem.setAlpha(0.5f); } }
[ "alireza.ebrahimi2006@gmail.com" ]
alireza.ebrahimi2006@gmail.com
8dd22f6b78d84963e4882e31083b9d90d40a7ce0
d528fe4f3aa3a7eca7c5ba4e0aee43421e60857f
/src/common/newp/ArrayUtil.java
59a2221cb85ce42e6f6f54c386f8e54875d8449a
[]
no_license
gxlioper/xajd
81bd19a7c4b9f2d1a41a23295497b6de0dae4169
b7d4237acf7d6ffeca1c4a5a6717594ca55f1673
refs/heads/master
2022-03-06T15:49:34.004924
2019-11-19T07:43:25
2019-11-19T07:43:25
null
0
0
null
null
null
null
GB18030
Java
false
false
4,203
java
package common.newp; import java.util.ArrayList; import java.util.HashMap; import java.util.List; public class ArrayUtil { private static final String BZ = "bz";//备注字段 /** * 判断一个数组是否为null,如果数组为null或数组长度为0,则返回true, * 否则返回false * @param str * */ public static boolean isNull(Object[] array) { return (array == null || (array != null && array.length == 0)); } /** * 数据组反转操作 * @param array 数组源 * @param begin 要反转的开始位置 * @param end 要反转的结束位置 * @throws Exception */ public static void Reverse(String[] array, int begin, int end) throws Exception { if (isNull(array)) { throw new NullPointerException("数组为空");// 没有找到数组为空的异常 } if (begin < 0) { throw new ArrayIndexOutOfBoundsException("begin 不能小于0"); } if (end < begin) { throw new ArrayIndexOutOfBoundsException("begin 不能大于 end "); } if (end >= array.length) { throw new ArrayIndexOutOfBoundsException("end 不能超过数组长度"); } while (begin < end) { String temp = array[begin]; array[begin] = array[end]; array[end] = temp; begin++; end--; } } /** * 将两个数组和为一个数组 * @param array1 * @param array2 */ public String[] unionArray(String[] array1, String[] array2) { if (!isNull(array1)) { if (!isNull(array2)) { String array[] = new String[array1.length + array2.length]; copyArray(array1, array); for (int i = 0; i < array2.length; i++) { array[array1.length + i] = array2[i]; } return array; } else { return array1; } } else { return array2; } } /** * 将一个数组copy到另一数组中 * @param fromArray 源数组 * @param toArray2 目标数组 */ public String[] copyArray(String[] fromArray, String[] toArray2) { if (!isNull(fromArray) && !isNull(toArray2)) { int min = fromArray.length <= toArray2.length ? fromArray.length : toArray2.length; for (int i = 0; i < min; i++) { toArray2[i] = fromArray[i]; } return toArray2; } else { if (isNull(toArray2)) { return fromArray; } else { return toArray2; } } } /** * 如果输出字段列表中有BZ这个字段则将备注换到最后,备注后面的向前移一位 * @param zdList example: []=a b c bz d >> a b c d bz * @return */ public static String[] changeBzAfter(String[] zdList) throws Exception { if (zdList != null) { int j=-1; for (int i=0;i<zdList.length;i++) { if (BZ.equalsIgnoreCase(zdList[i])) { j=i; break; } } if (j > -1) { for (int k=j;k<zdList.length;k++) { if (k<zdList.length-1) { zdList[k] = zdList[k+1]; } } zdList[zdList.length-1] = BZ; } } return zdList; } public static List<HashMap<String, String>> arrayToList(String[] arr1, String[] arr2) { // 将两个数组合并到一个List,两个数组大小一致,通常为中英文对照。参数要求英文在前,中文在后。 ArrayList<HashMap<String, String>> list = new ArrayList<HashMap<String, String>>(); int len = (arr1.length > arr2.length) ? arr2.length : arr1.length; HashMap<String, String> map = null; for (int i = 0; i < len; i++) { map = new HashMap<String, String>(); map.put("en", arr1[i]); map.put("cn", arr2[i]); list.add(map); } return list; } /** * * @描述: 数组去重 * @作者:喻鑫源[工号:1206] * @日期:2017-4-24 下午02:57:37 * @修改记录: 修改者名字-修改日期-修改内容 * @return * String[] 返回类型 * @throws */ public static String[] removeRepeatElementInArray(String[] originals){ List<String> list = new ArrayList<String>(); list.add(originals[0]); for(int i=1;i<originals.length;i++){ //originals[i] if(!list.contains(originals[i])){ list.add(originals[i]); } } return list.toArray(new String[]{}); } }
[ "1398796456@qq.com" ]
1398796456@qq.com
c76f092d4cef4168a4c6f0409cc757e2303391d7
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/19/19_bc9795591eeb7f6de618617ff1e6af4b38394fac/Label/19_bc9795591eeb7f6de618617ff1e6af4b38394fac_Label_s.java
2806914b16b6c873d1b597fe45a6847b88db978c
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
1,046
java
package com.indivisible.tortidy.database; /** class to represent a torrent's label **/ public class Label { //// data private long id; private String title; private boolean isExistingLabel; //// constructors /* create a new label */ public Label(long id, String labelTitle, boolean exists) { this.id = id; title = labelTitle; isExistingLabel = exists; } //// gets and sets /** get the label's db id **/ public long getId() { return id; } /** set the label's db id **/ public void setId(long id) { this.id = id; } /* returns a label's title */ public String getTitle() { return title; } /* sets a label's title */ public void setTitle(String labelTitle) { title = labelTitle; } /* check if a label already exists */ public Boolean exists() { return isExistingLabel; } /* set if a label exists */ public void setExists(Boolean exists) { isExistingLabel = exists; } //// methods @Override public String toString() { return title; } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
d2a1fedb72c77ce4cae237f75786a0fe08db112b
ba0adff3a7c8ff147096ae615fd6b0e53727362a
/kodilla-patterns2/src/test/java/com/kodilla/patterns2/observer/homework/MentorTestSuite.java
ac9e2186570950711f48cedfd579ad96251f20d6
[]
no_license
silverltheone/Adrian-Siwy-kodilla-java
a92a6c39dffdc655bd1b3bb12ea64ae2939141ad
7657d189d79f666294551d7f7a52f3dc28e279e3
refs/heads/master
2020-09-24T05:43:44.956395
2020-06-18T16:37:41
2020-06-18T16:37:41
225,677,302
0
0
null
null
null
null
UTF-8
Java
false
false
1,280
java
package com.kodilla.patterns2.observer.homework; import org.junit.Assert; import org.junit.Test; public class MentorTestSuite { @Test public void testUpdate() { //Given TaskQueue adrianTaskQueue = new TaskQueue("Adrian Siwy tasks"); TaskQueue zbigniewTaskQueue = new TaskQueue("Zbigniew Kowalski tasks"); TaskQueue karolinaTaskQueue = new TaskQueue("Karolina Nowak tasks"); TaskQueue marcinTaskQueue = new TaskQueue("Marcin Mierzwa tasks"); Mentor andrzejMentor = new Mentor("Andrzej Jaromin"); Mentor marcinMentor = new Mentor("Marcin Szuppe"); adrianTaskQueue.registerObserver(andrzejMentor); zbigniewTaskQueue.registerObserver(andrzejMentor); karolinaTaskQueue.registerObserver(andrzejMentor); marcinTaskQueue.registerObserver(marcinMentor); //When adrianTaskQueue.addTask("Task 19"); adrianTaskQueue.addTask("Task 20"); adrianTaskQueue.addTask("Task 21"); zbigniewTaskQueue.addTask("Task 21"); karolinaTaskQueue.addTask("Task 21"); marcinTaskQueue.addTask("Task21"); //Then Assert.assertEquals(5, andrzejMentor.getUpdateCount()); Assert.assertEquals(1, marcinMentor.getUpdateCount()); } }
[ "adeksiwy@gmail.com" ]
adeksiwy@gmail.com
99ba6a129c1eaeb3679d7e5dd0569a29cbcf520d
31e16717f082a37e66ad3771760f4280bfc31b89
/ImplementarShapeInterface/src/application/Program.java
9a6ddc309ef56f0646af110ed7404b6213b37702
[]
no_license
abelrufino/eclipse-workspace
84c0456908108e974f3080cb244e6fc1130bff48
ced3a922b48debbb9194e0eb037c9c6780de74b4
refs/heads/master
2022-12-01T04:17:03.157869
2020-08-21T13:15:26
2020-08-21T13:15:26
265,421,367
0
0
null
null
null
null
UTF-8
Java
false
false
666
java
package application; import model.entities.AbstractShape; import model.entities.Circle; import model.entities.Rectangle; import model.enums.Color; public class Program { public static void main(String[] args) { // TODO Auto-generated method stub AbstractShape s1 = new Circle(Color.BLUE, 3.0); AbstractShape s2 = new Rectangle(Color.BLACK, 3.0, 4.0); System.out.println("Circle color: " + s1.getColor()); System.out.println("Circle area: " + String.format("%.3f", s1.area())); System.out.println(); System.out.println("Rectangle color: " + s2.getColor()); System.out.println("Rectangle area: " + String.format("%.3f", s2.area())); } }
[ "anetosib@hotmail.com" ]
anetosib@hotmail.com
12147d70ee70a852a8632a3ab4c8bfacf4871bc4
5d642a5aadfbcf5d876c3d22d6e9d16835ac91f6
/Sample0473wAYqUICK/src/Test.java
68be6bda1f007546fed2075fa776e3f8d77c080b
[]
no_license
theeverlastingconcubine/ooOooOoo
704f9ac4d156057fd22877d9d1b1b13333366cf5
40330fd5a2453286de7001bd79de558890317893
refs/heads/master
2021-01-11T09:16:36.834406
2017-06-19T16:37:37
2017-06-19T16:37:37
77,223,365
0
1
null
2017-01-09T21:23:59
2016-12-23T12:13:25
Java
UTF-8
Java
false
false
1,115
java
import java.util.Arrays; import java.util.Random; public class Test { public static void main(String[] args){ String[] a = {"who","cAn","it","bee","now","short","zux","kuzmya","mazY","flux","vortex", "kopol","plot","frog"}; System.out.println(Arrays.toString(a)); Qwick.sort(a, String.CASE_INSENSITIVE_ORDER); System.out.println(Arrays.toString(a)); System.out.println(Qwick.isSorted(a, String.CASE_INSENSITIVE_ORDER)); Random rnd = new Random(); /*for(int q = 0; q<10000; q++){ String[] b = new String[rnd.nextInt(20)]; for(int i = 0; i<b.length; i++){ int len = rnd.nextInt(8); char[] sb = new char[len]; for(int w = 0; w<len; w++){ char c = (char) (65 + rnd.nextInt(26)); sb[i] = c; } a[i] = new String(sb); } boolean flag = true; Qwick.sort(b, String.CASE_INSENSITIVE_ORDER); flag = Qwick.isSorted(b, String.CASE_INSENSITIVE_ORDER); if (flag==false){ System.out.println("YourSortIsNotwOrkingException"); break; }*/ } }
[ "woodennoise@yandex.ru" ]
woodennoise@yandex.ru
2cfb216df5f48d231a84078295b23cdb06890180
a4b23d2774c5f88dd084485a83fc9fb45572ea98
/src/main/java/ru/job4j/bank/BankService.java
b049be6e29d8a37ef6df29fa90779ed3db80425a
[]
no_license
MarkAvilin1/job4j_tracker
91897d88966d29deca58b7b3e3c7ed01b941d804
061bc83604aef3325de52072ef201bf2a1202407
refs/heads/master
2022-11-07T12:15:28.696533
2020-06-20T11:16:39
2020-06-20T11:16:39
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,139
java
package ru.job4j.bank; import java.util.*; public class BankService { private Map<User, List<Account>> users = new HashMap<>(); public void addUser(User user) { this.users.putIfAbsent(user, new ArrayList<>()); } public void addAccount(String passport, Account account) { Optional<User> user = this.findByPassport(passport); if (user.isPresent()) { List<Account> rsl = this.users.get(user.get()); Optional<Account> findAccount = rsl.stream().filter(a -> a.equals(account)).findAny(); if (findAccount.isEmpty()) { rsl.add(account); } } } public Optional<User> findByPassport(String passport) { return this.users.keySet().stream() .filter(u -> u.getPassport().equals(passport)) .findFirst(); } public Optional<Account> findByRequisite(String passport, String requisite) { Optional<User> user = this.findByPassport(passport); Optional<Account> account = Optional.empty(); if (user.isPresent()) { account = this.users.get(user.get()).stream() .filter(a -> a.getRequisite() .equals(requisite)) .findFirst(); } return account; } public boolean transferMoney(String srcPassport, String srcRequisite, String destPassport, String destRequisite, double amount) { Optional<Account> srcAccount = this.findByRequisite(srcPassport, srcRequisite); Optional<Account> destAccount = this.findByRequisite(destPassport, destRequisite); boolean rsl = srcAccount.isPresent() && destAccount.isPresent() && srcAccount.get().getBalance() - amount >= 0; if (rsl) { srcAccount.get().setBalance( srcAccount.get().getBalance() - amount ); destAccount.get().setBalance( destAccount.get().getBalance() + amount ); } return rsl; } }
[ "avilin1@outlook.com" ]
avilin1@outlook.com
91309f15afa3169b66f9f2d0c81510c312892fde
0d30bd538a868655a2d466d9c98b21502276dd85
/app/src/main/java/com/mgtv/qxx/ttsdemo/LangUtils.java
cd494528045d95eb4fc00dedacb049132fcf4271
[]
no_license
qxs820624/TtsDemo
4ef34e9827144554552554ac68c4857159e6512b
de109c9731e81c143a3cbea12f4a543fdbe3ed75
refs/heads/master
2021-01-21T14:39:41.118627
2016-06-18T05:47:07
2016-06-18T05:47:07
58,014,916
0
0
null
null
null
null
UTF-8
Java
false
false
7,526
java
package com.mgtv.qxx.ttsdemo; /** * Created by Administrator on 2016/5/16. * 判断文本的语言 */ import java.lang.Character.UnicodeBlock; import java.util.Locale; public class LangUtils { private static final String JAPANESE_LANGUAGE = Locale.JAPANESE.getLanguage().toLowerCase(); private static final String KOREAN_LANGUAGE = Locale.KOREAN.getLanguage().toLowerCase(); // This includes simplified and traditional Chinese private static final String CHINESE_LANGUAGE = Locale.CHINESE.getLanguage().toLowerCase(); /** * @return true if the text contains Chinese characters */ public static boolean isChinese(String text) { int fullNameStyle = guessFullNameStyle(text); if (fullNameStyle == FullNameStyle.CJK) { fullNameStyle = getAdjustedFullNameStyle(fullNameStyle); } return (fullNameStyle == FullNameStyle.CHINESE) ? true : false; } public static boolean isJapanese(String text) { int fullNameStyle = guessFullNameStyle(text); if (fullNameStyle == FullNameStyle.CJK) { fullNameStyle = getAdjustedFullNameStyle(fullNameStyle); } return (fullNameStyle == FullNameStyle.JAPANESE) ? true : false; } public static boolean isKorean(String text) { int fullNameStyle = guessFullNameStyle(text); if (fullNameStyle == FullNameStyle.CJK) { fullNameStyle = getAdjustedFullNameStyle(fullNameStyle); } return (fullNameStyle == FullNameStyle.KOREAN) ? true : false; } public static int guessFullNameStyle(String name) { if (name == null) { return FullNameStyle.UNDEFINED; } int nameStyle = FullNameStyle.UNDEFINED; int length = name.length(); int offset = 0; while (offset < length) { int codePoint = Character.codePointAt(name, offset); if (Character.isLetter(codePoint)) { UnicodeBlock unicodeBlock = UnicodeBlock.of(codePoint); if (!isLatinUnicodeBlock(unicodeBlock)) { if (isCJKUnicodeBlock(unicodeBlock)) { // We don't know if this is Chinese, Japanese or Korean - // trying to figure out by looking at other characters in the name return guessCJKNameStyle(name, offset + Character.charCount(codePoint)); } if (isJapanesePhoneticUnicodeBlock(unicodeBlock)) { return FullNameStyle.JAPANESE; } if (isKoreanUnicodeBlock(unicodeBlock)) { return FullNameStyle.KOREAN; } } nameStyle = FullNameStyle.WESTERN; } offset += Character.charCount(codePoint); } return nameStyle; } /** * If the supplied name style is undefined, returns a default based on the * language, otherwise returns the supplied name style itself. * * @param nameStyle See {@link FullNameStyle}. */ public static int getAdjustedFullNameStyle(int nameStyle) { String mLanguage = Locale.getDefault().getLanguage().toLowerCase(); if (nameStyle == FullNameStyle.UNDEFINED) { if (JAPANESE_LANGUAGE.equals(mLanguage)) { return FullNameStyle.JAPANESE; } else if (KOREAN_LANGUAGE.equals(mLanguage)) { return FullNameStyle.KOREAN; } else if (CHINESE_LANGUAGE.equals(mLanguage)) { return FullNameStyle.CHINESE; } else { return FullNameStyle.WESTERN; } } else if (nameStyle == FullNameStyle.CJK) { if (JAPANESE_LANGUAGE.equals(mLanguage)) { return FullNameStyle.JAPANESE; } else if (KOREAN_LANGUAGE.equals(mLanguage)) { return FullNameStyle.KOREAN; } else { return FullNameStyle.CHINESE; } } return nameStyle; } private static boolean isLatinUnicodeBlock(UnicodeBlock unicodeBlock) { return unicodeBlock == UnicodeBlock.BASIC_LATIN || unicodeBlock == UnicodeBlock.LATIN_1_SUPPLEMENT || unicodeBlock == UnicodeBlock.LATIN_EXTENDED_A || unicodeBlock == UnicodeBlock.LATIN_EXTENDED_B || unicodeBlock == UnicodeBlock.LATIN_EXTENDED_ADDITIONAL; } private static boolean isCJKUnicodeBlock(UnicodeBlock block) { return block == UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS || block == UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A || block == UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_B || block == UnicodeBlock.CJK_SYMBOLS_AND_PUNCTUATION || block == UnicodeBlock.CJK_RADICALS_SUPPLEMENT || block == UnicodeBlock.CJK_COMPATIBILITY || block == UnicodeBlock.CJK_COMPATIBILITY_FORMS || block == UnicodeBlock.CJK_COMPATIBILITY_IDEOGRAPHS || block == UnicodeBlock.CJK_COMPATIBILITY_IDEOGRAPHS_SUPPLEMENT; } private static boolean isKoreanUnicodeBlock(UnicodeBlock unicodeBlock) { return unicodeBlock == UnicodeBlock.HANGUL_SYLLABLES || unicodeBlock == UnicodeBlock.HANGUL_JAMO || unicodeBlock == UnicodeBlock.HANGUL_COMPATIBILITY_JAMO; } private static boolean isJapanesePhoneticUnicodeBlock(UnicodeBlock unicodeBlock) { return unicodeBlock == UnicodeBlock.KATAKANA || unicodeBlock == UnicodeBlock.KATAKANA_PHONETIC_EXTENSIONS || unicodeBlock == UnicodeBlock.HALFWIDTH_AND_FULLWIDTH_FORMS || unicodeBlock == UnicodeBlock.HIRAGANA; } private static int guessCJKNameStyle(String name, int offset) { int length = name.length(); while (offset < length) { int codePoint = Character.codePointAt(name, offset); if (Character.isLetter(codePoint)) { UnicodeBlock unicodeBlock = UnicodeBlock.of(codePoint); if (isJapanesePhoneticUnicodeBlock(unicodeBlock)) { return FullNameStyle.JAPANESE; } if (isKoreanUnicodeBlock(unicodeBlock)) { return FullNameStyle.KOREAN; } } offset += Character.charCount(codePoint); } return FullNameStyle.CJK; } /** * Constants for various styles of combining given name, family name etc * into a full name. For example, the western tradition follows the pattern * 'given name' 'middle name' 'family name' with the alternative pattern * being 'family name', 'given name' 'middle name'. The CJK tradition is * 'family name' 'middle name' 'given name', with Japanese favoring a space * between the names and Chinese omitting the space. */ public interface FullNameStyle { public static final int UNDEFINED = 0; public static final int WESTERN = 1; /** * Used if the name is written in Hanzi/Kanji/Hanja and we could not * determine which specific language it belongs to: Chinese, Japanese or * Korean. */ public static final int CJK = 2; public static final int CHINESE = 3; public static final int JAPANESE = 4; public static final int KOREAN = 5; } }
[ "qxx@e.hunantv.com" ]
qxx@e.hunantv.com
b6079e0ad4c4e2d2b4a2eb40deb2fd4a05999f1f
b271697910b6cce103ad0154c687fa5ab85434a2
/ssm-maven/src/main/java/com/yeelight/util/Page.java
4d266f1e5c243140e7683856801e6b769fcfad07
[ "MIT" ]
permissive
axdlee/java-study
63639f325f0a69240f66cf93d0b65737520a055f
f5142ee6c33840aec79581eb26b4ee0171f90d94
refs/heads/master
2020-03-24T02:28:08.699594
2018-08-07T07:05:32
2018-08-07T07:05:32
142,376,896
0
0
null
null
null
null
UTF-8
Java
false
false
733
java
package com.yeelight.util; public class Page { int start=0; int count = 5; int last = 0; public int getStart() { return start; } public void setStart(int start) { this.start = start; } public int getCount() { return count; } public void setCount(int count) { this.count = count; } public int getLast() { return last; } public void setLast(int last) { this.last = last; } public void caculateLast(int total) { // 假设总数是50,是能够被5整除的,那么最后一页的开始就是45 if (0 == total % count) { last = total - count; } else { // 假设总数是51,不能够被5整除的,那么最后一页的开始就是50 last = total - total % count; } } }
[ "lixiaodong@yeelight.com" ]
lixiaodong@yeelight.com
202958cad68ccc885b4a004de153d122eab71451
3bbcd1e912d41ae0e27cf3006b8367df414bf73c
/Code/API/src/com/example/giao_dien/BmiEdit.java
793892c33670d7ea754f51a5ed4af6a76ccb0490
[]
no_license
thiennguyenduc/nhom-B-chuyen-de-2
76f82376f71106f3bd1671984376aacb02b82684
8e2c8fc5a47fc42b8b4f75344091ccd865dc04f6
refs/heads/master
2021-06-23T21:48:35.267224
2017-09-01T16:22:12
2017-09-01T16:22:12
86,062,537
2
0
null
null
null
null
UTF-8
Java
false
false
8,652
java
package com.example.giao_dien; import java.text.DecimalFormat; import android.app.ActionBar; import android.app.Activity; import android.app.AlertDialog; import android.app.Fragment; import android.app.FragmentManager; import android.content.DialogInterface; import android.content.Intent; import android.database.Cursor; import android.os.Bundle; import android.support.v4.widget.DrawerLayout; import android.util.Log; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; public class BmiEdit extends Activity implements NavigationDrawerFragment.NavigationDrawerCallbacks { private NavigationDrawerFragment mNavigationDrawerFragment; private CharSequence mTitle; public static int numTitle = 1; private EditText mchieucText; private EditText mcannText; private EditText mketqText; private EditText mchuandText; private Button tinhbmi; private Button thulai; private Button luu; private Button lichsu; private Long mRowId; private Cursor BMI; private DbAdapter mDbHelper; String NULL = ""; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mDbHelper = new DbAdapter(this); mDbHelper.open(); setContentView(R.layout.giaodien_bmi_edit); mchieucText = (EditText) findViewById(R.id.editChieucao); mcannText = (EditText) findViewById(R.id.editCannang); mketqText = (EditText) findViewById(R.id.editBMI); mchuandText = (EditText) findViewById(R.id.editChuanDoan); thulai = (Button) findViewById(R.id.btnThulai); lichsu = (Button) findViewById(R.id.btnlichsu); tinhbmi = (Button) findViewById(R.id.btnTinhBMI); luu = (Button) findViewById(R.id.btnluu); mRowId = (savedInstanceState == null) ? null : (Long) savedInstanceState.getSerializable(DbAdapter.KEY_ROWID); if (mRowId == null) { Bundle extras = getIntent().getExtras(); mRowId = extras != null ? extras.getLong(DbAdapter.KEY_ROWID) : null; } populateFields(); tinhbmi.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (kiemtra() == true) { double C = Double.parseDouble(mchieucText.getText() + ""); double N = Double.parseDouble(mcannText.getText() + ""); double bmi = N / Math.pow(C, 2); String chuandoan = ""; if (bmi < 18) { chuandoan = "Bạn gầy"; } else if (bmi <= 24.9) { chuandoan = "bạn bình thường"; } else if (bmi <= 29.9) { chuandoan = "bạn béo phì cấp độ 1"; } else if (bmi <= 34.9) { chuandoan = "bạn béo phì cấp độ 2"; } else { chuandoan = "bạn béo phì cấp độ 3"; } DecimalFormat dcm = new DecimalFormat("#.0"); mketqText.setText(dcm.format(bmi)); mchuandText.setText(chuandoan); } else { kiemtra(); } } }); thulai.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Xoa(); } }); luu.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { String chieuc = mchieucText.getText().toString(); String cann = mcannText.getText().toString(); String ketq = mketqText.getText().toString(); String chuand = mchuandText.getText().toString(); if (mRowId == null) { long id = mDbHelper.create(chieuc, cann, ketq, chuand); Toast.makeText(BmiEdit.this,"Đã lưu",Toast.LENGTH_SHORT).show(); if (id > 0) { mRowId = id; } else { Log.e("saveState", "failed to create BMI"); } } else { if (!mDbHelper.update(mRowId, chieuc, cann, ketq, chuand)) { Log.e("saveState", "failed to update BMI"); } } } }); lichsu.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(BmiEdit.this, BmiList.class); startActivity(intent); } }); mNavigationDrawerFragment = (NavigationDrawerFragment) getFragmentManager() .findFragmentById(R.id.navigation_drawer); mTitle = getTitle(); mNavigationDrawerFragment.setUp(R.id.navigation_drawer, (DrawerLayout) findViewById(R.id.drawer_layout)); } @Override protected void onResume() { super.onResume(); populateFields(); } public void Xoa() { AlertDialog.Builder xoa = new AlertDialog.Builder(BmiEdit.this); xoa.setTitle("Xóa thông tin "); xoa.setMessage("Bạn muốn xóa thông tin ? "); xoa.setNegativeButton("Không", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); xoa.setPositiveButton("Xóa thông tin ", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { mchieucText.setText(""); mcannText.setText(""); mketqText.setText(""); mchuandText.setText(""); mcannText.requestFocus(); Toast t = Toast.makeText(BmiEdit.this, "Xóa thành công ", Toast.LENGTH_SHORT); t.show(); } }); xoa.create().show(); } public boolean kiemtra() { String strchieucao = mchieucText.getText() + ""; String strcannang = mcannText.getText() + ""; if (strchieucao == NULL) { mchieucText.setError("Bạn chưa nhập chiều cao!"); mchieucText.requestFocus(); return false; } else if (strcannang == NULL) { mcannText.setError("Bạn chưa nhập cân nặng!"); mcannText.requestFocus(); return false; } return true; } private void populateFields() { if (mRowId != null) { BMI = mDbHelper.fetch(mRowId); startManagingCursor(BMI); mchieucText.setText(BMI.getString(BMI.getColumnIndexOrThrow(DbAdapter.KEY_TITLE))); mcannText.setText(BMI.getString(BMI.getColumnIndexOrThrow(DbAdapter.KEY_HEGHT))); mketqText.setText(BMI.getString(BMI.getColumnIndexOrThrow(DbAdapter.KEY_RESUT))); mchuandText.setText(BMI.getString(BMI.getColumnIndexOrThrow(DbAdapter.KEY_GUEST))); } } public void onNavigationDrawerItemSelected(int position) { // update the main content by replacing fragments FragmentManager fragmentManager = getFragmentManager(); fragmentManager.beginTransaction().replace(R.id.container, PlaceholderFragment.newInstance(position + 1)) .commit(); } public void onSectionAttached(int number) { switch (number) { case 1: mTitle = getString(R.string.title_section1); break; case 2: mTitle = getString(R.string.title_section2); Intent i2 = new Intent(BmiEdit.this, NoteEdit.class); startActivity(i2); break; case 3: mTitle = getString(R.string.title_section3); Intent i3 = new Intent(BmiEdit.this, Home.class); startActivity(i3); break; case 4: mTitle = getString(R.string.title_section4); Intent i4 = new Intent(BmiEdit.this, Nguoi_Beo.class); startActivity(i4); break; case 5: mTitle = getString(R.string.title_section5); Intent i5 = new Intent(BmiEdit.this, Nguoi_Gay.class); startActivity(i5); break; case 6: mTitle = getString(R.string.title_section6); Intent i6 = new Intent(BmiEdit.this, Nguoi_Benh.class); startActivity(i6); break; case 7: mTitle = getString(R.string.title_section7); Intent i7 = new Intent(BmiEdit.this, BmiEdit.class); startActivity(i7); break; case 8: mTitle = getString(R.string.title_section8); Intent i8 = new Intent(BmiEdit.this, nguyen_lieu.class); startActivity(i8); break; } } public void restoreActionBar() { ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); actionBar.setDisplayShowTitleEnabled(true); actionBar.setTitle(mTitle); } public static class PlaceholderFragment extends Fragment { private static final String ARG_SECTION_NUMBER = "section_number"; public static PlaceholderFragment newInstance(int sectionNumber) { PlaceholderFragment fragment = new PlaceholderFragment(); Bundle args = new Bundle(); args.putInt(ARG_SECTION_NUMBER, sectionNumber); fragment.setArguments(args); return fragment; } public PlaceholderFragment() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_main, container, false); return rootView; } @Override public void onAttach(Activity activity) { super.onAttach(activity); ((BmiEdit) activity).onSectionAttached(getArguments().getInt(ARG_SECTION_NUMBER)); } } }
[ "thiennguyenduc1999@gmail.com" ]
thiennguyenduc1999@gmail.com
c56804e2eb080accb54269916e15eb9fb6d1bab6
3e3922fc6057d1880579dfe10224710908fe157c
/src/main/java/com/bouncycastle/crypto/modes/gcm/BasicGCMExponentiator.java
0b644ed91dfa53a3797e1292c151fe331d27bba0
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
firmboy/sm
5392cdb4010676ca759176411ee592d4008e78f1
631ca9a5b0e980058def2973b9c43a8096c271ed
refs/heads/master
2021-07-21T08:35:36.160136
2020-11-02T01:11:58
2020-11-02T01:11:58
226,500,889
2
0
null
null
null
null
UTF-8
Java
false
false
801
java
package com.bouncycastle.crypto.modes.gcm; import com.bouncycastle.util.Arrays; public class BasicGCMExponentiator implements GCMExponentiator { private byte[] x; public void init(byte[] x) { this.x = Arrays.clone(x); } public void exponentiateX(long pow, byte[] output) { // Initial value is little-endian 1 byte[] y = GCMUtil.oneAsBytes(); if (pow > 0) { byte[] powX = Arrays.clone(x); do { if ((pow & 1L) != 0) { GCMUtil.multiply(y, powX); } GCMUtil.multiply(powX, powX); pow >>>= 1; } while (pow > 0); } System.arraycopy(y, 0, output, 0, 16); } }
[ "yangjian5268@gmail.com" ]
yangjian5268@gmail.com
c9aa0fb2f4f64a0c999c68ac2c08515103dd8161
81146891e0a0f421e66cab48221f0f6209b36584
/src/main/java/guru/qa/Application.java
db5fcab3ab620baf9e5ad6e46fbbb5524371aaa8
[]
no_license
Tohtig/QA_GURU_Calculator
a5adc8aaf1f156bde5c626a7cc086ba31ab3db63
188d6d7205d47a4e0357a09e6d3e80b4b1d7c494
refs/heads/master
2023-06-06T10:01:31.706292
2021-06-21T17:39:22
2021-06-21T17:39:22
381,447,009
0
0
null
2021-06-29T17:38:50
2021-06-29T17:33:33
null
UTF-8
Java
false
false
361
java
package guru.qa; import guru.qa.service.Calculator; import guru.qa.service.impl.ConsoleReader; import guru.qa.service.impl.ConsoleWriter; public class Application { public static void main(String[] args) { String result = new Calculator(new ConsoleReader(), new ConsoleWriter()).start(); new ConsoleWriter().handleString(result); } }
[ "egormuratov@yahoo.com" ]
egormuratov@yahoo.com
919b32d2777b6725e79cc3a25ebee6f86bc55807
7dfa64e0ac7bdf7343faf73ffa78ae95da6e76c2
/src/main/java/ee/lagunemine/locatorapi/validator/StationMobileExists.java
bd6655a081bf9cf278b46377cad96a3fbb0a052c
[]
no_license
hanspaerna/locatorapi
ae9ef2f08a0eaa04fd9dc3c2d67417f76949ed6f
afdce170fe382f9e3ce807a851bc74db6f3bca8b
refs/heads/master
2022-08-24T10:10:33.870346
2018-07-01T21:41:03
2018-07-01T21:41:03
null
0
0
null
null
null
null
UTF-8
Java
false
false
512
java
package ee.lagunemine.locatorapi.validator; import javax.validation.Constraint; import javax.validation.Payload; import java.lang.annotation.*; @Documented @Constraint(validatedBy = {StationMobileExistsValidator.class}) @Target({ ElementType.PARAMETER }) @Retention(RetentionPolicy.RUNTIME) public @interface StationMobileExists { String message() default "The requested mobile station does not exist in database!"; Class<?>[] groups() default {}; Class<? extends Payload>[] payload() default {}; }
[ "artemy@evercodelab.com" ]
artemy@evercodelab.com
11ed9f950950985ca5221a2e2ba386fcf13f5d72
400791a98bcc3e578611a2d11b251deb67eb23d5
/servertest/src/test/java/com/shy/servertest/ExampleUnitTest.java
23cef4fa111ef98aa39568b9f4cbc70c47b5484f
[]
no_license
NoAndroids/AppModuleDemo
6d6f8b1a2309792fe2098cb83eb031461cbd60e4
42fff03b7882890b4387a763c90fdfedc2d49589
refs/heads/master
2021-04-30T23:29:47.604622
2018-08-16T12:03:34
2018-08-16T12:03:34
79,777,659
0
1
null
null
null
null
UTF-8
Java
false
false
396
java
package com.shy.servertest; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
[ "398488376@qq.com" ]
398488376@qq.com
5a4cc541fd3d2d5d4a148a94696f1ad1d32ef5fb
2d389567e3af191fd84964f8222313efa11be73a
/src/main/java/RioCuartoViaja/Cuota.java
707189aa7886aff5fb0429bad85758b144e71e7e
[ "MIT" ]
permissive
cuestalvaro/ProyectoAyDS
aa168d20d23410ba98e0684ea35f906498b5a57b
5c004d9388f86440f3f54342cb57e4f09b3671ed
refs/heads/master
2022-07-14T17:42:59.158361
2019-08-05T19:46:01
2019-08-05T19:46:01
195,479,461
0
0
MIT
2022-06-21T01:26:36
2019-07-06T00:08:29
Java
UTF-8
Java
false
false
1,211
java
package RioCuartoViaja; import org.javalite.activejdbc.Model; /** * Clase que modela la tabla cuotas de la base datos RioCuartoViaja * que representa una cuota de la forma de pago plan_cuotas * @author Álvaor Cuesta */ public class Cuota extends Model { public Cuota() {} public Cuota(int nro_plan,float monto,String fecha,String estado ){ set("nro_plan",nro_plan,"monto",monto,"fecha",fecha,"estado",estado); } public String getNroPlan(){ return getString("nro_plan"); } public void setNroPlan(int nro_plan){ set("nro_plan",nro_plan); } public String getMonto(){ return getString("monto"); } public void setMonto(float monto){ set("monto",monto); } public String getFecha(){ return getString("fecha"); } public void setFecha(String fecha){ set("fecha",fecha); } public String getEstado(){ return getString("estado"); } public void setEstado(String estado){ set("estado",estado); } public void setCuota(int nro_plan,float monto,String fecha,String estado ){ set("nro_plan",nro_plan,"monto",monto,"fecha",fecha,"estado",estado); } }
[ "alvarosergiocuesta@gmail.com" ]
alvarosergiocuesta@gmail.com
ac2f4444ec84cb683b61225db1b22d648c1dd815
6c0c12e13ede3b466abd8ed91cf9318d03bb1346
/src/com/orange/students/andries/felix/Tema2/Exercitiu_7.java
c7994adcb4a10e0a4d3deaac97b5b5b08e9df70a
[]
no_license
IstrateCostelIulian/internship_java_2020
b6c35871ec4c9c68e0293e05314cde1699f67dd3
734dc803580105a797b30001686ff12c0d5f08d2
refs/heads/master
2021-07-25T11:39:09.221147
2021-03-31T07:16:56
2021-03-31T07:16:56
246,516,421
0
3
null
null
null
null
UTF-8
Java
false
false
569
java
package com.orange.students.andries.felix.Tema2; import java.util.Locale; public class Exercitiu_7 { /* Se da array-ul de String-uri : "ab", "cc", "gg", "a" , "kg", "ert" Afisati doar elementele cu 2 caractere. indicatii : folositi loop si metoda din obiectul String */ public static void main(String[] args) { String myStrings [] = {"ab", "cc", "gg", "a" , "kg", "ert"}; for(String strings : myStrings) { if(strings.length() == 2) { System.out.println(strings); } } } }
[ "efix66@gmail.com" ]
efix66@gmail.com
b7bef35b297ef33835bcb11c843804003282b975
dfc61e58169f84d0bb9e9f7c516a71441054cb26
/dating-system-rest-web/src/test/java/de/alpharogroup/dating/system/ApplicationJettyRunner.java
6184882f832e73ccfb2babb8b34832dd3cf43358
[]
no_license
lightblueseas/dating-system-data
b67b38b6f223eb87694c1e66ab7266eef9c7a316
6a1c58879e53b64c0ffd9f7bb29391f69f00c867
refs/heads/master
2023-03-15T11:08:57.937997
2016-03-10T16:07:36
2016-03-10T16:07:36
45,294,373
1
1
null
2016-03-10T16:07:36
2015-10-31T08:21:51
Java
UTF-8
Java
false
false
4,438
java
package de.alpharogroup.dating.system; import java.io.File; import java.io.IOException; import java.sql.SQLException; import java.util.Properties; import org.apache.cxf.transport.servlet.CXFServlet; import org.apache.log4j.Logger; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.servlet.ServletContextHandler; import org.springframework.web.context.ContextLoaderListener; import de.alpharogroup.file.delete.DeleteFileExtensions; import de.alpharogroup.file.search.PathFinder; import de.alpharogroup.jdbc.ConnectionsExtensions; import de.alpharogroup.jetty9.runner.Jetty9Runner; import de.alpharogroup.jetty9.runner.config.Jetty9RunConfiguration; import de.alpharogroup.jetty9.runner.config.ServletContextHandlerConfiguration; import de.alpharogroup.jetty9.runner.config.ServletHolderConfiguration; import de.alpharogroup.jetty9.runner.factories.ServletContextHandlerFactory; import de.alpharogroup.log.LoggerExtensions; import de.alpharogroup.resourcebundle.properties.PropertiesExtensions; /** * The Class {@link ApplicationJettyRunner} holds the main method that starts a jetty server with the rest services for the resource-bundle-data. */ public class ApplicationJettyRunner { /** * The main method starts a jetty server with the rest services for the resource-bundle-data. * * @param args the arguments * @throws Exception the exception */ public static void main(final String[] args) throws Exception { final int sessionTimeout = 1800;// set timeout to 30min(60sec * 30min=1800sec)... final String projectname = getProjectName(); final File projectDirectory = PathFinder.getProjectDirectory(); final File webapp = PathFinder.getRelativePath(projectDirectory, projectname, "src", "main", "webapp"); final String filterPath = "/*"; final File logfile = new File(projectDirectory, "application.log"); if(logfile.exists()) { try { DeleteFileExtensions.delete(logfile); } catch (final IOException e) { Logger.getRootLogger().error("logfile could not deleted.", e); } } // Add a file appender to the logger programatically LoggerExtensions.addFileAppender(Logger.getRootLogger(), LoggerExtensions.newFileAppender(logfile.getAbsolutePath())); final ServletContextHandler servletContextHandler = ServletContextHandlerFactory.getNewServletContextHandler( ServletContextHandlerConfiguration.builder() .servletHolderConfiguration( ServletHolderConfiguration.builder() .servletClass(CXFServlet.class) .pathSpec(filterPath) .build()) .contextPath("/") .webapp(webapp) .maxInactiveInterval(sessionTimeout) .filterPath(filterPath) .initParameter("contextConfigLocation", "classpath:application-context.xml") .build()); servletContextHandler.addEventListener(new ContextLoaderListener()); final Jetty9RunConfiguration configuration = Jetty9RunConfiguration.builder() .servletContextHandler(servletContextHandler) .httpPort(8080) .httpsPort(8443) .build(); final Server server = new Server(); Jetty9Runner.runServletContextHandler(server, configuration); } /** * Gets the project name. * * @return the project name * @throws IOException Signals that an I/O exception has occurred. */ protected static String getProjectName() throws IOException { final Properties projectProperties = PropertiesExtensions.loadProperties("project.properties"); final String projectName = projectProperties.getProperty("artifactId"); return projectName; } /** * Checks if a postgresql database exists. * * @return true, if successful * @throws IOException Signals that an I/O exception has occurred. * @throws ClassNotFoundException the class not found exception * @throws SQLException the SQL exception */ protected static boolean existsPostgreSQLDatabase() throws IOException, ClassNotFoundException, SQLException { final Properties databaseProperties = PropertiesExtensions.loadProperties("jdbc.properties"); final String hostname = databaseProperties.getProperty("jdbc.host"); final String databaseName = databaseProperties.getProperty("jdbc.db.name"); final String databaseUser = databaseProperties.getProperty("jdbc.user"); final String databasePassword = databaseProperties.getProperty("jdbc.password"); final boolean dbExists = ConnectionsExtensions.existsPostgreSQLDatabase(hostname, databaseName, databaseUser, databasePassword); return dbExists; } }
[ "asterios.raptis@gmx.net" ]
asterios.raptis@gmx.net
a5328a75f9828558871b96898d6d894543f483d2
c54455dcccd897ce407ac6a0ab0bc6956da05820
/pattern/src/main/java/com/gupao/pattern/singleton/lazy/LazyDoubleCheckSingleton.java
7273a2bc33a8479f7b2b9290aa548ffe4d5c8340
[]
no_license
maoenqi/gupao-study
605930e72494e4f9942d2c3dcd2b8f5e64b390af
f3b6d28863ab48b4bddb196395a9d33a1516881f
refs/heads/master
2022-11-26T10:00:10.268887
2020-08-05T16:05:00
2020-08-05T16:05:00
281,802,878
0
0
null
null
null
null
UTF-8
Java
false
false
1,090
java
package com.gupao.pattern.singleton.lazy; import java.io.Serializable; /** * com.gupao.pattern.singleton.lazy * * @author maoenqi * @date 2020/7/29 */ public class LazyDoubleCheckSingleton implements Serializable { private static final long serialVersionUID = -9175701145545131988L; private static LazyDoubleCheckSingleton lazyDoubleCheckSingleton; private LazyDoubleCheckSingleton() { if (lazyDoubleCheckSingleton != null) { throw new RuntimeException("不允许创建多个实例"); } } public static LazyDoubleCheckSingleton getInstance() { if (lazyDoubleCheckSingleton == null) { synchronized (LazyDoubleCheckSingleton.class) { if (lazyDoubleCheckSingleton == null) { lazyDoubleCheckSingleton = new LazyDoubleCheckSingleton(); } } } return lazyDoubleCheckSingleton; } /** * 防止序列化破解单例 * * @return */ private Object readResolve() { return lazyDoubleCheckSingleton; } }
[ "maoenqi@beadwallet.com" ]
maoenqi@beadwallet.com
5d0f653977d3d430afdba2c4c19a08cec0ee82a1
8af8d4d0362210499866e6c311387589d8c78010
/src/main/java/com/phicomm/smarthome/statusmgr/controller/BaseController.java
600b7f0d9b2ade695131b2cc5c3a7f8f5ffe8874
[]
no_license
landsharkd/device-status-mgr
b80e48fcc48be468e551f2f0f3e66f8ebcac9744
c38ae4f08f376d0d5ddf0d582350ae7005e5e134
refs/heads/master
2020-03-23T23:52:44.683071
2018-07-25T07:08:09
2018-07-25T07:08:09
142,260,866
0
0
null
null
null
null
UTF-8
Java
false
false
3,363
java
package com.phicomm.smarthome.statusmgr.controller; import javax.servlet.http.HttpServletRequest; import org.apache.commons.lang.StringUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import com.phicomm.smarthome.consts.PhihomeConst.ResponseStatus; import com.phicomm.smarthome.phihome.model.PhiHomeBaseResponse; import com.phicomm.smarthome.util.MyResponseutils; import com.phicomm.smarthome.util.StringUtil; /** * * package: com.phicomm.smarthome.statusmgr.controller * class: BaseController.java * date: 2018年6月28日 上午11:15:58 * author: wen.xia * description: */ public abstract class BaseController { protected final Logger LOGGER = LogManager.getLogger(this.getClass()); public static PhiHomeBaseResponse<Object> geResponse(Object result) { PhiHomeBaseResponse<Object> smartHomeResponseT = new PhiHomeBaseResponse<Object>(); smartHomeResponseT.setResult(result); return smartHomeResponseT; } protected PhiHomeBaseResponse<Object> errorResponse(int errCode) { String errMsg = MyResponseutils.parseMsg(errCode); return errorResponse(errCode, errMsg); } protected PhiHomeBaseResponse<Object> errorResponse(int errCode, String errMsg) { PhiHomeBaseResponse<Object> response = geResponse(null); response.setCode(errCode); if (StringUtil.isNullOrEmpty(errMsg)) { response.setMessage(MyResponseutils.parseMsg(errCode)); } else { response.setMessage(errMsg); } return response; } @SuppressWarnings("unchecked") protected PhiHomeBaseResponse<Object> successResponse(Object obj) { PhiHomeBaseResponse<Object> response = (PhiHomeBaseResponse<Object>) obj; response.setCode(ResponseStatus.STATUS_OK); response.setMessage(MyResponseutils.parseMsg(ResponseStatus.STATUS_OK)); return response; } protected String getIpAdrress(HttpServletRequest request) { String Xip = request.getHeader("X-Real-IP"); String XFor = request.getHeader("X-Forwarded-For"); if(StringUtils.isNotEmpty(XFor) && !"unKnown".equalsIgnoreCase(XFor)){ //多次反向代理后会有多个ip值,第一个ip才是真实ip int index = XFor.indexOf(","); if(index != -1){ return XFor.substring(0,index); }else{ return XFor; } } XFor = Xip; if(StringUtils.isNotEmpty(XFor) && !"unKnown".equalsIgnoreCase(XFor)){ return XFor; } if (StringUtils.isBlank(XFor) || "unknown".equalsIgnoreCase(XFor)) { XFor = request.getHeader("Proxy-Client-IP"); } if (StringUtils.isBlank(XFor) || "unknown".equalsIgnoreCase(XFor)) { XFor = request.getHeader("WL-Proxy-Client-IP"); } if (StringUtils.isBlank(XFor) || "unknown".equalsIgnoreCase(XFor)) { XFor = request.getHeader("HTTP_CLIENT_IP"); } if (StringUtils.isBlank(XFor) || "unknown".equalsIgnoreCase(XFor)) { XFor = request.getHeader("HTTP_X_FORWARDED_FOR"); } if (StringUtils.isBlank(XFor) || "unknown".equalsIgnoreCase(XFor)) { XFor = request.getRemoteAddr(); } return XFor; } }
[ "lei.du@phicomm.com" ]
lei.du@phicomm.com
ec8f0ddfa0b79d3b4aa8eb996f210c0c1061e395
95ea92360a655265240a0da03f777a87861992c6
/jOOQ-test/src/org/jooq/test/mysql/generatedclasses/tables/TBooleans.java
ce69426400cb432b0fa4a8ba39af16962a3f08b1
[ "Apache-2.0", "BSD-3-Clause" ]
permissive
hekar/jOOQ
886bd8579d6d1069d477f8d1322a51b6f4acfce0
d5945b9ee37ac92949fa6f5e9cd229046923c2e0
refs/heads/master
2021-01-17T21:58:21.141951
2012-09-03T02:11:51
2012-09-03T02:11:51
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,400
java
/** * This class is generated by jOOQ */ package org.jooq.test.mysql.generatedclasses.tables; /** * This class is generated by jOOQ. */ public class TBooleans extends org.jooq.impl.UpdatableTableImpl<org.jooq.test.mysql.generatedclasses.tables.records.TBooleansRecord> { private static final long serialVersionUID = -1195915207; /** * The singleton instance of test.t_booleans */ public static final org.jooq.test.mysql.generatedclasses.tables.TBooleans T_BOOLEANS = new org.jooq.test.mysql.generatedclasses.tables.TBooleans(); /** * The class holding records for this type */ @Override public java.lang.Class<org.jooq.test.mysql.generatedclasses.tables.records.TBooleansRecord> getRecordType() { return org.jooq.test.mysql.generatedclasses.tables.records.TBooleansRecord.class; } /** * The table column <code>test.t_booleans.id</code> * <p> * This column is part of the table's PRIMARY KEY */ public static final org.jooq.TableField<org.jooq.test.mysql.generatedclasses.tables.records.TBooleansRecord, java.lang.Integer> ID = createField("id", org.jooq.impl.SQLDataType.INTEGER, T_BOOLEANS); /** * The table column <code>test.t_booleans.one_zero</code> */ public static final org.jooq.TableField<org.jooq.test.mysql.generatedclasses.tables.records.TBooleansRecord, org.jooq.test._.converters.Boolean_10> ONE_ZERO = createField("one_zero", org.jooq.impl.SQLDataType.INTEGER.asConvertedDataType(new org.jooq.test._.converters.Boolean_10_Converter()), T_BOOLEANS); /** * The table column <code>test.t_booleans.true_false_lc</code> */ public static final org.jooq.TableField<org.jooq.test.mysql.generatedclasses.tables.records.TBooleansRecord, org.jooq.test._.converters.Boolean_TF_LC> TRUE_FALSE_LC = createField("true_false_lc", org.jooq.impl.SQLDataType.VARCHAR.asConvertedDataType(new org.jooq.test._.converters.Boolean_TF_LC_Converter()), T_BOOLEANS); /** * The table column <code>test.t_booleans.true_false_uc</code> */ public static final org.jooq.TableField<org.jooq.test.mysql.generatedclasses.tables.records.TBooleansRecord, org.jooq.test._.converters.Boolean_TF_UC> TRUE_FALSE_UC = createField("true_false_uc", org.jooq.impl.SQLDataType.VARCHAR.asConvertedDataType(new org.jooq.test._.converters.Boolean_TF_UC_Converter()), T_BOOLEANS); /** * The table column <code>test.t_booleans.yes_no_lc</code> */ public static final org.jooq.TableField<org.jooq.test.mysql.generatedclasses.tables.records.TBooleansRecord, org.jooq.test._.converters.Boolean_YES_NO_LC> YES_NO_LC = createField("yes_no_lc", org.jooq.impl.SQLDataType.VARCHAR.asConvertedDataType(new org.jooq.test._.converters.Boolean_YES_NO_LC_Converter()), T_BOOLEANS); /** * The table column <code>test.t_booleans.yes_no_uc</code> */ public static final org.jooq.TableField<org.jooq.test.mysql.generatedclasses.tables.records.TBooleansRecord, org.jooq.test._.converters.Boolean_YES_NO_UC> YES_NO_UC = createField("yes_no_uc", org.jooq.impl.SQLDataType.VARCHAR.asConvertedDataType(new org.jooq.test._.converters.Boolean_YES_NO_UC_Converter()), T_BOOLEANS); /** * The table column <code>test.t_booleans.y_n_lc</code> */ public static final org.jooq.TableField<org.jooq.test.mysql.generatedclasses.tables.records.TBooleansRecord, org.jooq.test._.converters.Boolean_YN_LC> Y_N_LC = createField("y_n_lc", org.jooq.impl.SQLDataType.CHAR.asConvertedDataType(new org.jooq.test._.converters.Boolean_YN_LC_Converter()), T_BOOLEANS); /** * The table column <code>test.t_booleans.y_n_uc</code> */ public static final org.jooq.TableField<org.jooq.test.mysql.generatedclasses.tables.records.TBooleansRecord, org.jooq.test._.converters.Boolean_YN_UC> Y_N_UC = createField("y_n_uc", org.jooq.impl.SQLDataType.CHAR.asConvertedDataType(new org.jooq.test._.converters.Boolean_YN_UC_Converter()), T_BOOLEANS); /** * The table column <code>test.t_booleans.vc_boolean</code> */ public static final org.jooq.TableField<org.jooq.test.mysql.generatedclasses.tables.records.TBooleansRecord, java.lang.Boolean> VC_BOOLEAN = createField("vc_boolean", org.jooq.impl.SQLDataType.BOOLEAN, T_BOOLEANS); /** * The table column <code>test.t_booleans.c_boolean</code> */ public static final org.jooq.TableField<org.jooq.test.mysql.generatedclasses.tables.records.TBooleansRecord, java.lang.Boolean> C_BOOLEAN = createField("c_boolean", org.jooq.impl.SQLDataType.BOOLEAN, T_BOOLEANS); /** * The table column <code>test.t_booleans.n_boolean</code> */ public static final org.jooq.TableField<org.jooq.test.mysql.generatedclasses.tables.records.TBooleansRecord, java.lang.Boolean> N_BOOLEAN = createField("n_boolean", org.jooq.impl.SQLDataType.BOOLEAN, T_BOOLEANS); /** * No further instances allowed */ private TBooleans() { super("t_booleans", org.jooq.test.mysql.generatedclasses.Test.TEST); } @Override public org.jooq.UniqueKey<org.jooq.test.mysql.generatedclasses.tables.records.TBooleansRecord> getMainKey() { return org.jooq.test.mysql.generatedclasses.Keys.KEY_T_BOOLEANS_PRIMARY; } @Override @SuppressWarnings("unchecked") public java.util.List<org.jooq.UniqueKey<org.jooq.test.mysql.generatedclasses.tables.records.TBooleansRecord>> getKeys() { return java.util.Arrays.<org.jooq.UniqueKey<org.jooq.test.mysql.generatedclasses.tables.records.TBooleansRecord>>asList(org.jooq.test.mysql.generatedclasses.Keys.KEY_T_BOOLEANS_PRIMARY); } }
[ "lukas.eder@gmail.com" ]
lukas.eder@gmail.com
3afdd68973647d0103c2527cb15b3a4c6b3ebccb
0d50af0833b20cd08fb21ad67306cb05671e2ffa
/projet_info/src/structure/StructureStockage.java
14ee1f4bd32064d50f16eb5e575ab4ebd6bb0a36
[]
no_license
arthurarg/Desktop-search
071d0436b4719b8ed86f904835d8a3b5f27c5878
2fb62cc604b3f9f1e37c68a6cdab3f0f23b2babe
refs/heads/master
2016-09-06T07:16:25.402443
2013-05-23T12:01:00
2013-05-23T12:01:00
29,942,680
0
0
null
null
null
null
UTF-8
Java
false
false
1,420
java
package structure; public class StructureStockage { class Bloc{ Stockage c; Bloc p, n; public Bloc(){ c=new Stockage(); p=null; n=null; } } Bloc start, current; public StructureStockage(){ start=new Bloc(); current=start; } public void add(Triplet tr){ if(!current.c.add(tr)){ current.n=new Bloc(); current.n.p=current; current=current.n; if(start.n==null) start.n=current; current.c.add(tr); } } public void add(int t, int d, int f){ if(!current.c.add(t, d, f)){ current.n=new Bloc(); current.n.p=current; current=current.n; if(start.n==null) start.n=current; current.c.add(t, d, f); } } public Triplet get(){ if(start==null) return null; Triplet t=start.c.get(); if(t!=null) return t; if(start.n==null) return null; start=start.n; return get(); } public boolean isEmpty(){ if(start==null) return true; boolean isStartEmpty=start.c.isEmpty(); if(!isStartEmpty) return false; if(start.n==null) return true; return start.n.c.isEmpty(); } public String toString(){ String s=""; int n=1; Bloc c=start; while(c!=null){ s=s+"Bloc "+n+" :\n"+c.c.toString()+"\n"; c=c.n; n++; } return s; } public void aff(){ System.out.print(this); } }
[ "Arthur@Arthur-HP" ]
Arthur@Arthur-HP
d17b5120888b430d26e2978350e378afbc734312
efb6418ead50c8bb2f9299be77ed1e4e5bb0aa6b
/AgileRepo/src/java/com/cci/model/horarioCompleto.java
43e873b1cf5bf57bfe0e0f01aef73e04377f9002
[]
no_license
WesMena/agileRepo
5a4252d352a66f9fe9b3e3088f50bf789feb8647
64f8b2347b486e55a9ba9a2bf2b8229401d648b5
refs/heads/master
2021-01-07T19:10:45.472198
2020-04-23T22:05:34
2020-04-23T22:05:34
241,787,733
0
1
null
2020-04-23T03:34:52
2020-02-20T03:51:51
HTML
UTF-8
Java
false
false
901
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.cci.model; import javax.faces.bean.ManagedBean; import javax.faces.bean.SessionScoped; /** * * @author Daniel */ @ManagedBean(name="horarioCompleto") @SessionScoped public class horarioCompleto { private String horarioStr; public horarioCompleto(String horarioStr) { this.horarioStr = horarioStr; } public horarioCompleto() { //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } public String getHorarioStr() { return horarioStr; } public void setHorarioStr(String horarioStr) { this.horarioStr = horarioStr; } }
[ "47802332+LinuxPingu@users.noreply.github.com" ]
47802332+LinuxPingu@users.noreply.github.com
271e8621e5f68e5c5a378af8f24a991c9453a774
4b19ec2bc4ca139401595a05d7d3a147e33ea5c7
/src/main/java/com/example/xyzreader/ui/ArticleDetailActivity.java
2c44a404eeefc50e57edf4b58983b60d2897efc6
[]
no_license
matvidako/BaconReader
fd8f0b2f667f73c4f4ecf02358fae9f3369328d2
7f87a6fa3d8dee6b19970508af572e040bfca914
refs/heads/master
2020-05-17T17:29:08.714391
2015-08-23T07:52:12
2015-08-23T07:52:12
37,614,386
0
0
null
null
null
null
UTF-8
Java
false
false
5,124
java
package com.example.xyzreader.ui; import android.app.Fragment; import android.app.FragmentManager; import android.app.LoaderManager; import android.content.Intent; import android.content.Loader; import android.database.Cursor; import android.graphics.drawable.ColorDrawable; import android.os.Build; import android.os.Bundle; import android.support.v13.app.FragmentStatePagerAdapter; import android.support.v4.app.ShareCompat; import android.support.v4.view.ViewPager; import android.support.v7.app.ActionBarActivity; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.util.TypedValue; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.view.WindowInsets; import com.example.xyzreader.R; import com.example.xyzreader.data.ArticleLoader; import com.example.xyzreader.data.ItemsContract; /** * An activity representing a single Article detail screen, letting you swipe between articles. */ public class ArticleDetailActivity extends AppCompatActivity implements LoaderManager.LoaderCallbacks<Cursor> { private Cursor mCursor; private long mStartId; private ViewPager mPager; private MyPagerAdapter mPagerAdapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_article_detail); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getLoaderManager().initLoader(0, null, this); mPagerAdapter = new MyPagerAdapter(getFragmentManager()); mPager = (ViewPager) findViewById(R.id.pager); mPager.setAdapter(mPagerAdapter); mPager.setPageMargin((int) TypedValue .applyDimension(TypedValue.COMPLEX_UNIT_DIP, 1, getResources().getDisplayMetrics())); mPager.setPageMarginDrawable(new ColorDrawable(0x22000000)); mPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageScrollStateChanged(int state) { super.onPageScrollStateChanged(state); } @Override public void onPageSelected(int position) { if (mCursor != null) { mCursor.moveToPosition(position); } } }); if (savedInstanceState == null) { if (getIntent() != null && getIntent().getData() != null) { mStartId = ItemsContract.Items.getItemId(getIntent().getData()); } } findViewById(R.id.share_fab).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { startActivity(Intent.createChooser(ShareCompat.IntentBuilder.from(ArticleDetailActivity.this) .setType("text/plain") .setText("Some sample text") .getIntent(), getString(R.string.action_share))); } }); } @Override public boolean onOptionsItemSelected(MenuItem item) { if(item.getItemId() == android.R.id.home) { onSupportNavigateUp(); } return super.onOptionsItemSelected(item); } @Override public Loader<Cursor> onCreateLoader(int i, Bundle bundle) { return ArticleLoader.newAllArticlesInstance(this); } @Override public void onLoadFinished(Loader<Cursor> cursorLoader, Cursor cursor) { mCursor = cursor; mPagerAdapter.notifyDataSetChanged(); // Select the start ID if (mStartId > 0) { mCursor.moveToFirst(); // TODO: optimize while (!mCursor.isAfterLast()) { if (mCursor.getLong(ArticleLoader.Query._ID) == mStartId) { final int position = mCursor.getPosition(); mPager.setCurrentItem(position, false); break; } mCursor.moveToNext(); } mStartId = 0; } } @Override public void onLoaderReset(Loader<Cursor> cursorLoader) { mCursor = null; mPagerAdapter.notifyDataSetChanged(); } private class MyPagerAdapter extends FragmentStatePagerAdapter { public MyPagerAdapter(FragmentManager fm) { super(fm); } @Override public void setPrimaryItem(ViewGroup container, int position, Object object) { super.setPrimaryItem(container, position, object); ArticleDetailFragment fragment = (ArticleDetailFragment) object; } @Override public Fragment getItem(int position) { mCursor.moveToPosition(position); return ArticleDetailFragment.newInstance(mCursor.getLong(ArticleLoader.Query._ID)); } @Override public int getCount() { return (mCursor != null) ? mCursor.getCount() : 0; } } }
[ "matej.vidakovic@fiveminutes.eu" ]
matej.vidakovic@fiveminutes.eu
a12531acce758a3db40a31839f6c5cc03374f1ca
7ce8b1169faf3af091644c2673758cf4ed6b567b
/src/FabricaCarro/Gol.java
72ae490f3f528cf3b48cce8359d4c9ae0513cf4f
[]
no_license
samuelneto27/padraoFactory
a52ce23addfc6df5e440f6c1381c97613b6789af
4828d7833a8f6a38405e9f75ff71090ca4c88d97
refs/heads/master
2020-05-23T10:42:07.772358
2019-05-15T01:03:56
2019-05-15T01:03:56
186,723,869
0
0
null
null
null
null
UTF-8
Java
false
false
180
java
package FabricaCarro; public class Gol implements Carro { @Override public void exibirInfo() { System.out.println("Modelo: Gol \n Fabricante: Volkswagen"); } }
[ "Usuario@MQNLAB1126" ]
Usuario@MQNLAB1126
89afb31121ddc36bd10277e90bdede6379c2e506
6dfc9f3c823541a4d7474b1445007c41dec3ea3f
/ch04_pr2_FactorialCalculator/src/FactorialCalcApp.java
e23cab1927e0d0cafa8398f6c902459e17163732
[]
no_license
jmotts17/java-instruction
2705c9cf1ae7a48835fa109f3baeefbfc7f239fe
49bdb3a0973b0ad637fb65ec661230fea5986dde
refs/heads/master
2023-03-13T20:08:14.434782
2021-03-07T23:56:20
2021-03-07T23:56:20
291,838,059
0
1
null
null
null
null
UTF-8
Java
false
false
854
java
import java.util.Scanner; public class FactorialCalcApp { public static void main(String[] args) { // Create Scanner Object Scanner scanner = new Scanner(System.in); // Variable Declaration String choice = ""; // Output Welcome Message System.out.println("Welcome to the Factorial Calculator"); do { // Prompt user for input System.out.print("\nEnter an integer that's greater than 0 and less than 10: "); int num = scanner.nextInt(); // Declare factorial variable long factorial = 1; // Calculate factorial for (int i = 1; i <= num; i++) { factorial *= i; } // Output results System.out.println("The factorial of " + num + " is " + factorial); // Prompt user to continue System.out.print("\nContinue? (y/n): "); choice = scanner.next(); } while (choice.equalsIgnoreCase("y")); } }
[ "joshua.a.motta@gmail.com" ]
joshua.a.motta@gmail.com
40e58df8c6f19845ed6ace52b4b87432201e746d
60bd246d57a42ea797cbd38410b0745270a016b8
/src/main/java/com/ljz/ssh/security/SecurityConfiguration.java
3b9fc5bdf07b22bf96a6a2b9633c23fcf358a46a
[]
no_license
WuYunWangYue/ssh-ljz
fe69431b90fe27233388e0dfc64d5b0a5b03039e
9f53a09f7fcc809bc414ca94600f9cf9bfdf36b7
refs/heads/master
2020-03-07T13:12:04.270207
2018-04-18T10:00:30
2018-04-18T10:00:30
127,494,746
0
0
null
null
null
null
UTF-8
Java
false
false
3,544
java
package com.ljz.ssh.security; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.security.authentication.AuthenticationTrustResolver; import org.springframework.security.authentication.AuthenticationTrustResolverImpl; import org.springframework.security.authentication.dao.DaoAuthenticationProvider; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.security.web.authentication.rememberme.PersistentTokenBasedRememberMeServices; import org.springframework.security.web.authentication.rememberme.PersistentTokenRepository; @Configuration @EnableWebSecurity public class SecurityConfiguration extends WebSecurityConfigurerAdapter { @Autowired @Qualifier("customUserDetailsService") UserDetailsService userDetailsService; @Autowired PersistentTokenRepository tokenRepository; @Autowired public void configureGlobalSecurity(AuthenticationManagerBuilder auth) throws Exception { auth.userDetailsService(userDetailsService); auth.authenticationProvider(authenticationProvider()); } @Override protected void configure(HttpSecurity http) throws Exception { http.authorizeRequests() .antMatchers("/", "/list").access("hasRole('USER') or hasRole('ADMIN') or hasRole('DBA')") .antMatchers("/newUser/**", "/delete-user-*").access("hasRole('ADMIN')") .antMatchers("/edit-user-*").access("hasRole('ADMIN') or hasRole('DBA')") .and().formLogin().loginPage("/login").loginProcessingUrl("/login").usernameParameter("ssoId").passwordParameter("password") .and().rememberMe().rememberMeParameter("remember-me").tokenRepository(tokenRepository).tokenValiditySeconds(86400) .and().csrf() .and().exceptionHandling().accessDeniedPage("/AccessDenied"); } @Bean public PasswordEncoder passwordEncoder() { return new BCryptPasswordEncoder(); } @Bean public DaoAuthenticationProvider authenticationProvider() { DaoAuthenticationProvider authenticationProvider = new DaoAuthenticationProvider(); authenticationProvider.setUserDetailsService(userDetailsService); authenticationProvider.setPasswordEncoder(passwordEncoder()); return authenticationProvider; } @Bean public PersistentTokenBasedRememberMeServices getPersistentTokenBasedRememberMeServices() { PersistentTokenBasedRememberMeServices tokenBasedService = new PersistentTokenBasedRememberMeServices( "remember-me", userDetailsService, tokenRepository); return tokenBasedService; } @Bean public AuthenticationTrustResolver getAuthenticationTrustResolver() { return new AuthenticationTrustResolverImpl(); } }
[ "1120573031@qq.com" ]
1120573031@qq.com
066fd310cd91273968c8b5bab8966ade22bf6aa4
f33516ffd4ac82b741f936ae2f7ef974b5f7e2f9
/changedPlugins/org.emftext.language.java.resource.java/src-gen/org/emftext/language/java/resource/java/debug/JavaLineBreakpoint.java
1a10f95180260f068706853955126f71ad385cdd
[]
no_license
ichupakhin/sdq
e8328d5fdc30482c2f356da6abdb154e948eba77
32cc990e32b761aa37420f9a6d0eede330af50e2
refs/heads/master
2023-01-06T13:33:20.184959
2020-11-01T13:29:04
2020-11-01T13:29:04
246,244,334
0
0
null
null
null
null
UTF-8
Java
false
false
914
java
/******************************************************************************* * Copyright (c) 2006-2015 * Software Technology Group, Dresden University of Technology * DevBoost GmbH, Dresden, Amtsgericht Dresden, HRB 34001 * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Software Technology Group - TU Dresden, Germany; * DevBoost GmbH - Dresden, Germany * - initial API and implementation ******************************************************************************/ package org.emftext.language.java.resource.java.debug; public class JavaLineBreakpoint { // The generator for this class is currently disabled by option // 'disableDebugSupport' in the .cs file. }
[ "bla@mail.com" ]
bla@mail.com
a4ddccc1871487fca06bf10e0ccb4ff9dded79c2
3b754c85d598a9d4eb60a02a409789642a017e1f
/Lampada/src/Ponto.java
861a483c711f67178457910352f90fbc351b2a04
[]
no_license
laviniameds/Java-Projects
40076358038ab666dc0e415a78614fd704ca5184
0938d97bfde52388fbcd13dc5f45bf7991c63715
refs/heads/master
2021-07-08T20:54:34.544132
2017-09-29T00:54:33
2017-09-29T00:54:33
105,086,335
0
0
null
null
null
null
UTF-8
Java
false
false
512
java
public class Ponto { private int x, y; public int getY(){ return y; } public int getX(){ return x; } public void setY(int y){ this.y = y; } public void setX(int x){ this.x = x; } public double hipotenusa(){ return Math.sqrt(Math.pow(getX(), 2) + Math.pow(getY(),2)); } public double hipotenusa2(Ponto q){ double aux1 = getX() - q.getX(); double aux2 = getY() - q.getY(); double cat1 = Math.pow(aux1, 2); double cat2 = Math.pow(aux2, 2);; return Math.sqrt(cat1 + cat2); } }
[ "laviniameds@icloud.com" ]
laviniameds@icloud.com
9b12e216e805be0ba70bd4a1fc540a1815a1b584
1ca86d5d065372093c5f2eae3b1a146dc0ba4725
/spring-cloud/spring-cloud-functions/src/test/java/com/surya/spring/cloudfunction/aws/CloudFunctionApplicationUnitTest.java
c2518438ffc2e6f615002c424e0998d15c42cdc2
[]
no_license
Suryakanta97/DemoExample
1e05d7f13a9bc30f581a69ce811fc4c6c97f2a6e
5c6b831948e612bdc2d9d578a581df964ef89bfb
refs/heads/main
2023-08-10T17:30:32.397265
2021-09-22T16:18:42
2021-09-22T16:18:42
391,087,435
0
1
null
null
null
null
UTF-8
Java
false
false
1,306
java
package com.surya.spring.cloudfunction.aws; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.boot.web.server.LocalServerPort; import static org.assertj.core.api.Java6Assertions.assertThat; @RunWith(SpringRunner.class) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) public class CloudFunctionApplicationUnitTest { @LocalServerPort private int port; @Autowired private TestRestTemplate testRestTemplate; @Test public void givenAString_whenReverseStringCloudFunctionInvoked_thenStringIsReversed() { assertThat(this.testRestTemplate.getForObject("http://localhost:" + port + "/reverseString/HelloWorld", String.class)).isEqualTo("dlroWolleH"); } @Test public void givenAString_whenGreeterCloudFunctionInvoked_thenPrintsGreeting() { assertThat(this.testRestTemplate.getForObject("http://localhost:" + port + "/greeter/suryaUser", String.class)).isEqualTo("Hello suryaUser, and welcome to Spring Cloud Function!!!"); } }
[ "suryakanta97@github.com" ]
suryakanta97@github.com
925b4b5b5aef7b00deef9219ea6dfdbcb1af71b9
f04de1d586b4fac0c36e729de7ee8c0950c2fbda
/code/jyhProject-core/src/main/java/com/jyh/pattern/actionType/observer/jdk/ObserverClient.java
d5dd65de8b5adbad946ac386ce1d5bdf45f11474
[]
no_license
jiangyuhang1/jyhProject
f1cf5f7f7cedf16cd13d0a90dd7ff6fb056a610f
523710f38ad50ba875fecef2de27dc96407a674a
refs/heads/master
2023-03-17T05:35:26.009717
2021-03-10T10:37:09
2021-03-10T10:37:09
291,971,870
0
0
null
null
null
null
UTF-8
Java
false
false
432
java
package com.jyh.pattern.actionType.observer.jdk; import java.util.Observer; /** * 观察者客户端 * jdk自带的观察者模式是一种拉模型 */ public class ObserverClient { public static void main(String[] args) { Subject subject = new Subject(); Observer observer = new Watcher(subject); subject.setData("start"); subject.setData("run"); subject.setData("end"); } }
[ "jiang.yuhang2@iwhalecloud.com" ]
jiang.yuhang2@iwhalecloud.com
610342f98d188a8f19772256b7c0b9e7e9677c5d
092c76fcc6c411ee77deef508e725c1b8277a2fe
/hybris/bin/ext-accelerator/b2bacceleratorfacades/src/de/hybris/platform/b2bacceleratorfacades/order/populators/TriggerReversePopulator.java
672c33ca3ab23e9f9b4d6ead5b61c40f3f6958d7
[ "MIT" ]
permissive
BaggaShivanshu2/hybris-bookstore-tutorial
4de5d667bae82851fe4743025d9cf0a4f03c5e65
699ab7fd8514ac56792cb911ee9c1578d58fc0e3
refs/heads/master
2022-11-28T12:15:32.049256
2020-08-05T11:29:14
2020-08-05T11:29:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,500
java
/* * [y] hybris Platform * * Copyright (c) 2000-2016 hybris AG * All rights reserved. * * This software is the confidential and proprietary information of hybris * ("Confidential Information"). You shall not disclose such Confidential * Information and shall use it only in accordance with the terms of the * license agreement you entered into with hybris. * * */ package de.hybris.platform.b2bacceleratorfacades.order.populators; import de.hybris.platform.b2bacceleratorfacades.order.data.TriggerData; import de.hybris.platform.converters.Populator; import de.hybris.platform.cronjob.model.TriggerModel; import de.hybris.platform.servicelayer.dto.converter.ConversionException; /** * Populates {@link TriggerData} with {@link TriggerModel}. */ public class TriggerReversePopulator implements Populator<TriggerData, TriggerModel> { @Override public void populate(final TriggerData data, final TriggerModel model) throws ConversionException { model.setDay(data.getDay() == null ? Integer.valueOf(-1) : data.getDay()); model.setDaysOfWeek(data.getDaysOfWeek()); model.setRelative(data.getRelative() == null ? Boolean.FALSE : data.getRelative()); model.setWeekInterval(data.getWeekInterval() == null ? Integer.valueOf(-1) : data.getWeekInterval()); model.setActivationTime(data.getActivationTime()); model.setHour(data.getHour() == null ? Integer.valueOf(-1) : data.getHour()); model.setMinute(data.getMinute() == null ? Integer.valueOf(-1) : data.getMinute()); } }
[ "xelilim@hotmail.com" ]
xelilim@hotmail.com
03edd1c88d9022ab096558b070f117254c1d88ea
6f4dd10b7e6c1d497c66a244b31de5d57dc2da81
/kodilla-patterns-vol2/src/main/java/com/kodilla/patternsVol2/observer/forum/JavaHelpForumTopic.java
a401e629be6db897a220befdea0a34182a968df0
[]
no_license
LostFrequenci/Dominik-Odron-kodilla-java
b9e960a62a0eadd5423e7ec635c1517c22302131
6b5bfe19106aecdbedd35287638052d6410ee56d
refs/heads/master
2020-04-03T12:50:06.727281
2019-03-18T14:24:50
2019-03-18T14:24:50
155,265,586
0
0
null
null
null
null
UTF-8
Java
false
false
179
java
package com.kodilla.patternsVol2.observer.forum; public class JavaHelpForumTopic extends ForumTopic { public JavaHelpForumTopic() { super("Java Help Group"); } }
[ "dominik.odron@gmail.com" ]
dominik.odron@gmail.com
eb4a7867cd7a3c3cf7beffcafebb3ee93a0eba9f
7686cf6784d41f2eec893473965371121e0ade5e
/src/main/java/edu/princeton/cs/algs4/exercise/chapter4_3/EdgeWeightedGraph.java
e88c19e0bdfb641c5b673645858deca486a5151c
[]
no_license
chenjk/algs4
9cba9b59eb396b514ec5cb76c79f5674040e79bb
b98e38f20817b588824260fc10596e4957e4ebeb
refs/heads/master
2020-03-31T11:21:31.331182
2018-09-28T16:30:48
2018-09-28T16:30:48
152,173,531
0
0
null
null
null
null
UTF-8
Java
false
false
1,791
java
package edu.princeton.cs.algs4.exercise.chapter4_3; import com.jimmysun.algorithms.chapter1_3.Bag; import edu.princeton.cs.algs4.In; public class EdgeWeightedGraph { private final int V; private int E; private Bag<Edge>[] adj; public EdgeWeightedGraph(int V) { this.V = V; this.E = 0; adj = (Bag<Edge>[]) new Bag[V]; for (int v = 0; v < V; v++) { adj[v] = new Bag<Edge>(); } } /** * Exercise 4.3.9 * * @param in */ public EdgeWeightedGraph(In in) { this(in.readInt()); int E = in.readInt(); for (int i = 0; i < E; i++) { int v = in.readInt(); int w = in.readInt(); double weight = in.readDouble(); Edge edge = new Edge(v, w, weight); addEdge(edge); } } public int V() { return V; } public int E() { return E; } public void addEdge(Edge e) { int v = e.either(), w = e.other(v); adj[v].add(e); adj[w].add(e); E++; } public Iterable<Edge> adj(int v) { return adj[v]; } public Iterable<Edge> edges() { Bag<Edge> b = new Bag<Edge>(); for (int v = 0; v < V; v++) { for (Edge e : adj[v]) { if (e.other(v) > v) { b.add(e); } } } return b; } /** * Exercise 4.3.17 */ @Override public String toString() { String s = V + " vertices, " + E + " edges\n"; for (int v = 0; v < V; v++) { s += v + ": "; for (Edge w : this.adj(v)) { s += w + " "; } s += "\n"; } return s; } }
[ "18317333@qq.com" ]
18317333@qq.com
6a395ed4be3469897dfb155763c0c7c23b76f0ea
1244e9c0ad69e5a6f9f42af9b1a9c268a8f9c020
/src/main/java/com/capgemini/parkingApp/dao/impl/AbstractDao.java
5c49f5c128e5cab816f8d648d9935efb8459e62a
[]
no_license
GrzechPL/parking
39dbe1d0297c0fbe6b65d04f0e99e24a47b968df
f82686719ca6b8155fa106c36102e86e8a07af9f
refs/heads/master
2022-06-29T13:03:39.834018
2019-05-06T11:32:15
2019-05-06T11:32:15
178,868,699
1
1
null
2022-06-21T01:01:56
2019-04-01T13:24:51
Java
UTF-8
Java
false
false
1,435
java
package com.capgemini.parkingApp.dao.impl; import com.capgemini.parkingApp.dao.Dao; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import javax.persistence.TypedQuery; import javax.persistence.criteria.CriteriaBuilder; import javax.persistence.criteria.CriteriaQuery; import javax.transaction.Transactional; import java.io.Serializable; import java.lang.reflect.ParameterizedType; import java.util.List; @Transactional(Transactional.TxType.SUPPORTS) public abstract class AbstractDao<T, K extends Serializable> implements Dao<T, K> { @PersistenceContext protected EntityManager entityManager; private Class<T> domainClass; @Override public T getOne(K id) { return entityManager.getReference(getDomainClass(), id); } protected Class<T> getDomainClass() { if (domainClass == null) { ParameterizedType type = (ParameterizedType) getClass().getGenericSuperclass(); domainClass = (Class<T>) type.getActualTypeArguments()[0]; } return domainClass; } @Override public List<T> findAll() { CriteriaBuilder builder = entityManager.getCriteriaBuilder(); CriteriaQuery<T> criteriaQuery = builder.createQuery(getDomainClass()); criteriaQuery.from(getDomainClass()); TypedQuery<T> query = entityManager.createQuery(criteriaQuery); return query.getResultList(); } }
[ "grzegorzlastowski@camgemini.com" ]
grzegorzlastowski@camgemini.com
1ede974b47320309cc3e90f99d4f50dd0540e2c0
0af8b92686a58eb0b64e319b22411432aca7a8f3
/single-large-project/src/main/java/org/gradle/test/performancenull_51/Productionnull_5011.java
b749fac675bd3043cd3db0b79abd4ddf9482df11
[]
no_license
gradle/performance-comparisons
b0d38db37c326e0ce271abebdb3c91769b860799
e53dc7182fafcf9fedf07920cbbea8b40ee4eef4
refs/heads/master
2023-08-14T19:24:39.164276
2022-11-24T05:18:33
2022-11-24T05:18:33
80,121,268
17
15
null
2022-09-30T08:04:35
2017-01-26T14:25:33
null
UTF-8
Java
false
false
585
java
package org.gradle.test.performancenull_51; public class Productionnull_5011 { private final String property; public Productionnull_5011(String param) { this.property = param; } public String getProperty() { return property; } private String prop0; public String getProp0() { return prop0; } public void setProp0(String value) { prop0 = value; } private String prop1; public String getProp1() { return prop1; } public void setProp1(String value) { prop1 = value; } }
[ "cedric.champeau@gmail.com" ]
cedric.champeau@gmail.com
1e13a86e97b2a73bb065f4436cee365050fed015
b6a3f5316533eb0229db0842e73551d9c86d9818
/app/src/main/java/ba/sum/fpmoz/ednevnik/ui/a/fragments/classes/AddClassFragment.java
4d402a18ea468502bfda5da93e17c55d32e685e7
[]
no_license
srna1997/ednevnik-fpmoz
3afdadcb0c8926be9ba62737b5213cf8750bf4a4
e6d227f88c197db44220d01b87df01abacc33fd1
refs/heads/master
2023-02-23T00:30:25.555300
2021-01-24T19:46:35
2021-01-24T19:46:35
329,091,386
0
0
null
null
null
null
UTF-8
Java
false
false
1,573
java
package ba.sum.fpmoz.ednevnik.ui.a.fragments.classes; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.EditText; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import ba.sum.fpmoz.ednevnik.R; import ba.sum.fpmoz.ednevnik.model.Classes; public class AddClassFragment extends Fragment { FirebaseDatabase db; DatabaseReference ref; EditText classesName; EditText classesUid; Button addClassesBtn; @Nullable @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); final View userAdminView = inflater.inflate(R.layout.activity_add_class, container, false); this.db = FirebaseDatabase.getInstance(); this.ref = this.db.getReference("ednevnik/razredi"); this.classesName = userAdminView.findViewById(R.id.classesNameAddTxt); this.classesUid = userAdminView.findViewById(R.id.classesUidAddTxt); this.addClassesBtn = userAdminView.findViewById(R.id.addClassesBtn); this.addClassesBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { } }); return userAdminView; } }
[ "erminsrna17@gmail.com" ]
erminsrna17@gmail.com
bb2b0cb4cfa0fd749edc9eb3758ec3058c3b91b0
f06ca46b10b85c02ecdce7e2a1fc45b74b7d6509
/eyao_cms/src/com/mingsoft/cms/biz/impl/ArticleBizImpl.java
f68d12f115eb5691eb378623ed3d3e53ac49cc11
[]
no_license
hecj/android
97175435b66ed62464862accb88c9670c8d1d4a6
c89da787d600b2f5a5fe42dd619d7212240dddff
refs/heads/master
2021-01-17T11:18:31.937398
2016-07-26T05:54:03
2016-07-26T05:54:03
64,193,866
0
0
null
null
null
null
UTF-8
Java
false
false
17,967
java
package com.mingsoft.cms.biz.impl; import java.util.ArrayList; import java.util.Arrays; import java.util.Date; import java.util.List; import java.util.Map; import org.apache.ibatis.annotations.Param; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.mingsoft.base.dao.IBaseDao; import com.mingsoft.base.entity.BaseEntity; import com.mingsoft.basic.biz.IBasicCategoryBiz; import com.mingsoft.basic.biz.ICategoryBiz; import com.mingsoft.basic.biz.IModelBiz; import com.mingsoft.basic.biz.impl.BasicBizImpl; import com.mingsoft.basic.entity.BasicCategoryEntity; import com.mingsoft.cms.biz.IArticleBiz; import com.mingsoft.cms.biz.IColumnBiz; import com.mingsoft.cms.biz.IContentModelBiz; import com.mingsoft.cms.dao.IArticleDao; import com.mingsoft.cms.entity.ArticleEntity; import com.mingsoft.cms.entity.ColumnEntity; import com.mingsoft.cms.entity.ContentModelEntity; import com.mingsoft.base.constant.ModelCode; import com.mingsoft.util.PageUtil; import com.mingsoft.util.StringUtil; /** * * * <p> * <b>铭飞CMS-铭飞内容管理系统</b> * </p> * * <p> * Copyright: Copyright (c) 2014 - 2015 * </p> * * <p> * Company:景德镇铭飞科技有限公司 * </p> * * @author 姓名 郭鹏辉 * * @version 300-001-001 * * <p> * 版权所有 铭飞科技 * </p> * * <p> * Comments:文章管理业务层实现类 || 继承BasicBizImpl || 实现IArticleBiz * </p> * * <p> * Create Date:2014-7-14 * </p> * * <p> * Modification history: * </p> */ @Service("ArticleBizImpl") public class ArticleBizImpl extends BasicBizImpl implements IArticleBiz { /** * 文章持久化处理 */ private IArticleDao articleDao; /** * 栏目业务处理 */ @Autowired private ICategoryBiz categoryBiz; /** * 自定类型义业务处理 */ @Autowired private IColumnBiz columnBiz; /** * 自定义模型 */ @Autowired private IContentModelBiz contentModelBiz; /** * 模块管理业务层 */ @Autowired private IModelBiz modelBiz; /** * */ @Autowired private IBasicCategoryBiz basicCategoryBiz; /** * 获取Article的持久化层 * * @return 返回持Article的久化对象 */ public IArticleDao getArticleDao() { return articleDao; } /** * 设置Article的持久化层 * * @param articleDao */ @Autowired public void setArticleDao(IArticleDao articleDao) { this.articleDao = articleDao; } /** * 获取IBaseDao的持久化层 * * @return 返回持articleDao的久化对象 */ @Override protected IBaseDao getDao() { // TODO Auto-generated method stub return articleDao; } /** * 按照关键字分页查询 * * @param entity * 实体 <br/> * @param page * PageUtil对象,主要封装分页的方法 <br/> * @param orderBy * 排序字段 <br/> * @param order * 排序方式true:asc false:desc <br/> * @param keyword * 搜索关键字 * @param attribute * 搜索文章属性 * @param columnId * 文章所属栏目 * @param webId * 网站id * @return 返回所查询的文章集合 */ @Override public List<ArticleEntity> queryList(PageUtil page, String orderBy, boolean order, String keyword, String articleType, int basicCategoryId, int webId) { Integer modelId = modelBiz.getEntityByModelCode(ModelCode.CMS_COLUMN).getModelId(); // 查询当前模块编号 List<Integer> basicCategoryIds = categoryBiz.queryChildrenCategoryIds(basicCategoryId,webId,modelId); if(basicCategoryIds == null || !(basicCategoryIds.size() > 0)){ return articleDao.queryList(webId,null,articleType , null, page.getPageNo() * page.getPageSize(), page.getPageSize(), orderBy, order,keyword); } return articleDao.queryList(webId,basicCategoryIds, articleType, null, page.getPageNo() * page.getPageSize(), page.getPageSize(), orderBy, order,keyword); } /** * 查询本网站下文章列表数目 * * @param webId网站id * @return 文章条数 */ @Override public int getCountByWebsiteId(int webId) { // TODO Auto-generated method stub return articleDao.getCountByWebsiteId(webId); } /** * 显示本网站下文章列表 * * @param webId网站id * @param page * PageUtil对象,主要封装分页的方法 <br/> * @param orderBy * 排序字段 <br/> * @param order * 排序方式true:asc false:desc <br/> * @return 返回所查询的文章集合 */ @Override public List<ArticleEntity> queryPageListByWebsiteId(int webId, PageUtil page, String orderBy, boolean order) { // TODO Auto-generated method stub return articleDao.queryPageListByWebsiteId(webId, page.getPageNo(), page.getPageSize(), orderBy, order); } /** * 根据站点Id,栏目列表Id,栏目属性,和栏目不推荐属性查找栏目下的文章总数 * * @param webId * :站点id * @param basicCategoryIds * :栏目列表id * @param flag * :文章推荐属性 * @param noFlag * :文章不推荐属性 * @return 文章总数 */ @Override public int getCountByColumnId(int webId, List<Integer> basicCategoryIds, String flag, String noFlag) { return articleDao.getCountByColumnId(webId, basicCategoryIds.size() > 0 ? basicCategoryIds : null, flag, noFlag); } /** * 根据栏目ID,flag,等属性获取文章 * * @param basicCategoryIds * 栏目id * @param flag * 需要的文章属性 * @param NoFlag * 不需要的文章属性 * @param begin * 光标开始位置 * @param count * 每页显示条数 * @return 文章集合 */ @Override public List<ArticleEntity> queryList(int webId, List<Integer> basicCategoryIds, String flag, String noFlag, int begin, int count, String orderBy, boolean order) { if (orderBy!=null) { if (orderBy.equals("sort")) { orderBy = "basic_sort"; } else if (orderBy.equals("date")) { orderBy = "basic_datetime"; } else if (orderBy.equals("hit")) { orderBy = "basic_hit"; } else if (orderBy.equals("updatedate")) { orderBy = "basic_updatedate"; } else if (orderBy.equals("id")) { orderBy = "basic_id"; } } List<ArticleEntity> articleList = articleDao.queryList(webId, basicCategoryIds.size() > 0 ? basicCategoryIds : null, flag, noFlag, begin, count, orderBy, order,null); return articleList; } /** * 根据页面栏目的id获取与其绑定的文章实体 * * @param basicCategoryId * @return 文章实体 */ @Override public List<ArticleEntity> queryListByColumnId(int basicCategoryId) { // TODO Auto-generated method stub return articleDao.queryListByColumnId(basicCategoryId); } /** * 根据站点id获取文章列表 * * @param basicId * @return 文章集合 */ @Override public List<ArticleEntity> queryListByWebsiteId(int basicId) { // TODO Auto-generated method stub return articleDao.queryListByWebsiteId(basicId); } /** * 根据站点id和文章更新时间获取文章列表 * * @param basicCategoryId * @param UpdateArticleDate * @return 文章集合 */ @Override public List<ArticleEntity> queryListByTime(int basicId, Date UpdateArticleDate) { // TODO Auto-generated method stub List<ArticleEntity> articleList = queryListByWebsiteId(basicId); List<ArticleEntity> newArticle = new ArrayList<ArticleEntity>(); for (int i = 0; i < articleList.size(); i++) { // 如果UpdateArticleDate在文章时间之前 if (articleList.get(i).getBasicUpdateTime().before(UpdateArticleDate)) { newArticle.add(articleList.get(i)); } } return newArticle; } /** * 根据文章ID集合查询文章实体集合 * * @param articleIds * 文章ID集合 * @return 文章实体集合 */ @SuppressWarnings("rawtypes") public List<ArticleEntity> queryListByArticleIds(@Param("articleIds") String articleIds) { Integer[] articleIdsList = StringUtil.stringsToIntegers(articleIds.split(",")); List list = Arrays.asList(articleIdsList); return articleDao.queryListByArticleIds(list); } /** * 根据文章字段条件查询文章集合 * * @param articleFieldName * 文章字段 * @return 文章ID集合 */ public List<Integer> queryListByArticleField(Map<String, String> articleFieldName) { List<ArticleEntity> listArticle = articleDao.queryListByArticleField(articleFieldName); List<Integer> listArticleId = new ArrayList<Integer>(); for (int i = 0; i < listArticle.size(); i++) { listArticleId.add(listArticle.get(i).getBasicId()); } return listArticleId; } /** * 根据文章id查找文章的总数 * * @param webId * @param articleIds * :文章id * @param flag * 推荐属性 * @param NoFlag * 不推荐属性 * @return */ @Override public int getCountByArticleIds(int webId, List<Integer> articleIds, String flag, String NoFlag) { // TODO Auto-generated method stub return articleDao.getCountByArticleIds(webId, articleIds, flag, NoFlag); } /** * 根据文章id集合查找文章实体 * * @param webId * :站点id * @param articleIds * :文章id集合 * @param flag * :推荐属性 * @param NoFlag * :不推荐属性 * @param begin * :开始处 * @param count * :查询总数 * @param orderBy * :排序方式 * @param order * : * @return */ @Override public List<ArticleEntity> queryListByListArticleId(int webId, List<Integer> articleIds, String flag, String NoFlag, int begin, int count, String orderBy, String order) { // TODO Auto-generated method stub List<ArticleEntity> articleList = articleDao.queryListByListArticleId(webId, articleIds.size() > 0 ? articleIds : null, flag, NoFlag, begin, count, orderBy, (order == null || order != "false") ? true : false); return articleList; } public List<ArticleEntity> queryListForSearch(ContentModelEntity conntentModel, Map whereMap, PageUtil page, int websiteId,List ids,Map orders) { List<ArticleEntity> articleList = new ArrayList<ArticleEntity>(); String tableName = null; if (conntentModel!=null) { tableName = conntentModel.getCmTableName(); } // 查找所有符合条件的文章实体 articleList = articleDao.queryListForSearch(tableName, whereMap, page, websiteId,ids,orders); return articleList; } public int getSearchCount(ContentModelEntity contentModel,Map wherMap, int websiteId,List ids) { if (contentModel!=null) { return articleDao.getSearchCount(contentModel.getCmTableName(),wherMap, websiteId,ids); } return articleDao.getSearchCount(null,wherMap, websiteId,ids); } @Override public List<BaseEntity> queryPageByCategoryId(int categoryId,int appId, PageUtil page, boolean _isHasChilds) { // TODO Auto-generated method stub // return articleDao.queryByView(categoryId, page); Integer modelId = modelBiz.getEntityByModelCode(ModelCode.CMS_COLUMN).getModelId(); // 查询当前模块编号 List list = categoryBiz.queryChildrenCategory(categoryId,appId,modelId); // 分类不存在直接返回 if (list == null || list.size() == 0) { return null; } // 如果是最低级栏目需要查询该栏目是否存在自定义模型,如果存在需要再关联自定义模型查询 if (list.size() == 1) { // 最低级栏目 ColumnEntity column = (ColumnEntity) columnBiz.getEntity(categoryId); if (column.getColumnContentModelId() != 0) { // 存在自定义模型 ContentModelEntity contentModel = (ContentModelEntity) contentModelBiz.getEntity(column.getColumnContentModelId()); return articleDao.queryPageByCategoryId(categoryId, null, page, contentModel.getCmTableName()); } else { return articleDao.queryPageByCategoryId(categoryId, null, page, null); } } else { if (_isHasChilds) { return articleDao.queryPageByCategoryId(categoryId, list, page, null); } else { return articleDao.queryPageByCategoryId(categoryId, null, page, null); } } } @Override public int countByCategoryId(int categoryId) { // TODO Auto-generated method stub return articleDao.countByCategoryId(categoryId); } @Override public ArticleEntity getById(int basicId) { // TODO Auto-generated method stub ArticleEntity article = (ArticleEntity) articleDao.getEntity(basicId); String contentModelTableName = null; int ccmi = article.getColumn().getColumnContentModelId(); // 内容模型编号 if (ccmi > 0) { ContentModelEntity contentModel = (ContentModelEntity) contentModelBiz.getEntity(ccmi); contentModelTableName = contentModel.getCmTableName(); } List temp = articleDao.getById(basicId, contentModelTableName); if (temp != null && temp.size() > 0) { return (ArticleEntity) temp.get(0); } return null; } @Override public List queryByBasicIds(int basicId, Integer[] basicIds) { return articleDao.queryByBasicIds(basicId, basicIds); } @Override public List<ArticleEntity> queryList(int webId, int basicCategoryId, String flag, String noFlag, int start, int pageSize, String orderBy, boolean order) { return articleDao.query(webId, basicCategoryId, flag, noFlag, start, pageSize, orderBy, order); } @Override public int count(int webId, int basicCategoryId, String flag, String noFlag,String keyword) { return articleDao.count(webId, basicCategoryId, flag, noFlag,keyword); } /** * 根据文章标题查询文章 * * @param articleTitle * 文章标题 * @param webId * 应用Id * @param modelCode * 模块编号 * @return 文章集合 */ public List queryListByArticleTitle(String articleTitle, int webId, ModelCode modelCode) { // 将文章标题截断 String[] _articleTitle = articleTitle.split(","); if (_articleTitle.length > 1) { articleTitle = _articleTitle[1]; } else { articleTitle = _articleTitle[0]; } // 查询文章集合 List<ArticleEntity> articleList = this.articleDao.queryByArticleTitle(articleTitle, webId, modelCode.toString()); return articleList; } @Override public List<ArticleEntity> query(int categoryId, String dateTime,int appId) { return articleDao.queryListByTime(categoryId, dateTime,appId); } @Override public ArticleEntity getNext(int appId, int basicId,Integer categoryId) { // TODO Auto-generated method stub return articleDao.getNextOrPrevious(appId, basicId, true,categoryId); } @Override public ArticleEntity getPrevious(int appId, int basicId,Integer categoryId) { // TODO Auto-generated method stub return articleDao.getNextOrPrevious(appId, basicId, false,categoryId); } @Override public ArticleEntity getByCategoryId(int categoryId) { // TODO Auto-generated method stub List list = articleDao.getByCategoryId(categoryId); if (list != null && list.size() > 0) { return (ArticleEntity) list.get(0); } return null; } @Override public List queryByCategoryForBean(int appId,Integer categoryId, PageUtil page,boolean _isHasChilds) { Integer modelId = modelBiz.getEntityByModelCode(ModelCode.CMS_COLUMN).getModelId(); // 查询当前模块编号 //查询该分类下的所有子分类 List list = categoryBiz.queryChildrenCategory(categoryId,appId,modelId); // 分类不存在直接返回 if (list == null || list.size() == 0) { return null; } //如果没有子分类 if(list.size()==1){ ColumnEntity column = (ColumnEntity) columnBiz.getEntity(categoryId); if (column.getColumnContentModelId() != 0) { // 存在自定义模型 ContentModelEntity contentModel = (ContentModelEntity) contentModelBiz.getEntity(column.getColumnContentModelId()); return articleDao.queryByCategoryForBean(categoryId, null, page, contentModel.getCmTableName()); } else { return articleDao.queryByCategoryForBean(categoryId, null, page, null); } }else{ if (_isHasChilds) { return articleDao.queryByCategoryForBean(categoryId, list, page,null); } else { return articleDao.queryByCategoryForBean(categoryId, null, page,null); } } } @Override public int coutByCategoryAndChildsId(int appId,int categoryId, boolean isHasChilds) { // TODO Auto-generated method stub int count = 0; Integer modelId = modelBiz.getEntityByModelCode(ModelCode.CMS_COLUMN).getModelId(); // 查询当前模块编号 //查询该分类下的所有子分类 if(isHasChilds){ List<Integer> basicCategoryIds = categoryBiz.queryChildrenCategoryIds(categoryId, appId,modelId); count=this.getCountByColumnId(appId, basicCategoryIds, null, null); }else{ count=this.countByCategoryId(categoryId); } return count; } @Override public void saveArticle(ArticleEntity article, List<BasicCategoryEntity> basicCategoryList) { // TODO Auto-generated method stub this.saveBasic(article); List<BasicCategoryEntity> newBasicCategoryList = new ArrayList<BasicCategoryEntity>(); for(int i=0;i<basicCategoryList.size();i++){ BasicCategoryEntity basicCategory= basicCategoryList.get(i); basicCategory.setBcBasicId(article.getBasicId()); newBasicCategoryList.add(basicCategory); } if(newBasicCategoryList!=null &&newBasicCategoryList.size()>0){ this.basicCategoryBiz.deleteEntity(article.getBasicId()); this.basicCategoryBiz.saveBatch(newBasicCategoryList); } } @Override public void updateArticle(ArticleEntity article, List<BasicCategoryEntity> basicCategoryList) { // TODO Auto-generated method stub this.updateBasic(article); if(article!=null){ if(basicCategoryList!=null &&basicCategoryList.size()>0){ this.basicCategoryBiz.deleteEntity(article.getBasicId()); this.basicCategoryBiz.saveBatch(basicCategoryList); } } } }
[ "275070023@qq.com" ]
275070023@qq.com
3440026906a242c34e32b69a67696580ec03b385
727d06c30872d3e30d614ddac1cc19692aa3294b
/src/com/company/Main.java
15a51059c8edc6c16949081dbf2c6a8090232def
[]
no_license
gramsey1/sat
96dfb335d374676575f3166a1fd1d7de10ca436d
8bbe324ab87c5bf10dd147b345e2a0df4fdce4b0
refs/heads/master
2020-04-05T08:56:15.576759
2018-11-14T16:20:55
2018-11-14T16:20:55
156,735,389
0
0
null
null
null
null
UTF-8
Java
false
false
3,275
java
package com.company; import java.io.IOException; import java.util.*; import java.io.File; public class Main { public static void main(String[] args) throws IOException, NumberFormatException { Scanner sf = new Scanner(new File("scores.txt")); String array[] = new String[1000]; int maxIndx = 0; /*while (sf.hasNextLine()) { int i = 1; String s = sf.nextLine(); String dumbarray[] = s.split("\\t"); if (dumbarray.length == 22) { while (i % 22 != 0) { array[i - 1] = dumbarray[i - 1]; i++; } } } System.out.print(array[21]); String newArray[] = new String[10000];*/ sf.nextLine(); while (sf.hasNextLine()) { array[maxIndx] = sf.nextLine(); maxIndx++; } sf.close(); System.out.println(array[3]); String columns [] = new String[array.length]; System.out.println(columns[3]); String schoolName [] = new String[columns.length]; double averageArray [] = new double[columns.length]; int goUp = 0; for (int i = 0; i < maxIndx; i++, goUp++) { double num1, num2, num3; //PROBLEM----scanner system is reading the blank lines in the file try and fix it columns = array[i].split("\t"); if(columns.length == 22 && !columns[18].equals("")) { System.out.println(columns[18]); num1 = Double.parseDouble(columns[18]); num2 = Double.parseDouble(columns[19]); num3 = Double.parseDouble(columns[20]); double average = (num1 + num2 + num3) / 3; averageArray[goUp] = average; schoolName[goUp] = columns[1]; System.out.println(schoolName[goUp] + ": " + averageArray[goUp]); } else { int nothingHappens; } } double highestAverage = 0; double secondAverage = 0; double thirdAverage = 0; for (int i = 1; i < averageArray.length; i++) { if (averageArray[i] > thirdAverage) { if (averageArray[i] > secondAverage) { if (averageArray[i] > highestAverage) { thirdAverage = secondAverage; secondAverage = highestAverage; highestAverage = averageArray[i]; } else if (averageArray[i] == secondAverage) { } else { thirdAverage = secondAverage; averageArray[i] = secondAverage; } } else { averageArray[i] = thirdAverage; } } else { int donothing; } } System.out.println(highestAverage + secondAverage + thirdAverage); //READ ME ------- COMPARE THE INDICES IN THE AVERAGE ARRAY TO FIND THE AVERAGE AND PUT THE TEAM NAME THERE } }
[ "graceramsey312@yahoo.com" ]
graceramsey312@yahoo.com
7787941c6923b081296dfd6b8f9f63e83c8eb217
287d6d170530a04bff9f80460125993cb8c506b1
/tl/src/main/java/com/github/badoualy/telegram/tl/api/TLMessageMediaContact.java
5b165e4badbf4062a8a026117b06741fd71436f2
[ "LicenseRef-scancode-warranty-disclaimer", "MIT" ]
permissive
thecodrr/kotlogram
c72fb8f81a422d5c3d067ef194faab6e20861d30
dc692348229fed14b738f376f7a3af2c474e5737
refs/heads/master
2020-07-30T00:14:07.740929
2017-01-06T07:19:09
2017-01-06T07:19:09
210,013,661
0
0
MIT
2019-09-21T16:00:26
2019-09-21T16:00:25
null
UTF-8
Java
false
false
3,188
java
package com.github.badoualy.telegram.tl.api; import com.github.badoualy.telegram.tl.TLContext; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import static com.github.badoualy.telegram.tl.StreamUtils.readInt; import static com.github.badoualy.telegram.tl.StreamUtils.readTLString; import static com.github.badoualy.telegram.tl.StreamUtils.writeInt; import static com.github.badoualy.telegram.tl.StreamUtils.writeString; import static com.github.badoualy.telegram.tl.TLObjectUtils.SIZE_CONSTRUCTOR_ID; import static com.github.badoualy.telegram.tl.TLObjectUtils.SIZE_INT32; import static com.github.badoualy.telegram.tl.TLObjectUtils.computeTLStringSerializedSize; /** * @author Yannick Badoual yann.badoual@gmail.com * @see <a href="http://github.com/badoualy/kotlogram">http://github.com/badoualy/kotlogram</a> */ public class TLMessageMediaContact extends TLAbsMessageMedia { public static final int CONSTRUCTOR_ID = 0x5e7d2f39; protected String phoneNumber; protected String firstName; protected String lastName; protected int userId; private final String _constructor = "messageMediaContact#5e7d2f39"; public TLMessageMediaContact() { } public TLMessageMediaContact(String phoneNumber, String firstName, String lastName, int userId) { this.phoneNumber = phoneNumber; this.firstName = firstName; this.lastName = lastName; this.userId = userId; } @Override public void serializeBody(OutputStream stream) throws IOException { writeString(phoneNumber, stream); writeString(firstName, stream); writeString(lastName, stream); writeInt(userId, stream); } @Override @SuppressWarnings({"unchecked", "SimplifiableConditionalExpression"}) public void deserializeBody(InputStream stream, TLContext context) throws IOException { phoneNumber = readTLString(stream); firstName = readTLString(stream); lastName = readTLString(stream); userId = readInt(stream); } @Override public int computeSerializedSize() { int size = SIZE_CONSTRUCTOR_ID; size += computeTLStringSerializedSize(phoneNumber); size += computeTLStringSerializedSize(firstName); size += computeTLStringSerializedSize(lastName); size += SIZE_INT32; return size; } @Override public String toString() { return _constructor; } @Override public int getConstructorId() { return CONSTRUCTOR_ID; } public String getPhoneNumber() { return phoneNumber; } public void setPhoneNumber(String phoneNumber) { this.phoneNumber = phoneNumber; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public int getUserId() { return userId; } public void setUserId(int userId) { this.userId = userId; } }
[ "yann.badoual@gmail.com" ]
yann.badoual@gmail.com
d5c72d74c0a8c4262dc9276c93f0c6c9e2166716
e7a9e54d85b65b1bde16c2aceba8f730430384e7
/src/main/java/pipeline/PipelineGet.java
0939355a1eb18c94c174b339d5eeb7553470f585
[]
no_license
cjtclinsan/spring-jedis
9c84aca52b89656e2ee04c8f450ff9bcb0209441
bcdbf3195b09b025b31e1517a689e4413253f66b
refs/heads/master
2021-08-07T17:17:55.084663
2020-03-22T09:39:17
2020-03-22T09:39:17
249,150,790
1
0
null
2021-04-26T20:04:52
2020-03-22T09:28:51
Java
UTF-8
Java
false
false
1,675
java
package pipeline; import redis.clients.jedis.Jedis; import redis.clients.jedis.Pipeline; import java.util.ArrayList; import java.util.List; import java.util.Set; public class PipelineGet { public static void main(String[] args) { // new Thread(){ // public void run(){ // Jedis jedis = new Jedis("127.0.0.1", 6379); // Set<String> keys = jedis.keys("batch*"); // List<String> result = new ArrayList(); // long t1 = System.currentTimeMillis(); // for (String key : keys) { // result.add(jedis.get(key)); // } // for (String src : result) { // //System.out.println(src); // } // System.out.println("直接get耗时:"+(System.currentTimeMillis() - t1)); // } // }.start(); new Thread(){ public void run(){ Jedis jedis = new Jedis("127.0.0.1", 6379); //jedis.auth("Qingshan@gupao666"); Set<String> keys = jedis.keys("batch*"); List<Object> result = new ArrayList(); Pipeline pipelined = jedis.pipelined(); long t1 = System.currentTimeMillis(); for (String key : keys) { pipelined.get(key); } result = pipelined.syncAndReturnAll(); for (Object src : result) { //System.out.println(src); } System.out.println("Pipeline get耗时:"+(System.currentTimeMillis() - t1)); } }.start(); } }
[ "shent@163.com" ]
shent@163.com
7b7292d1e3bcce5ad592412afe02f7509e82f76a
70e8e27bf71ce18ac14862e0dab95ceb11bf3e8d
/app/src/main/java/com/hostelbasera/main/RatingViewActivity.java
53597db031b27a46cd7b7fbe6e6602cb3ef3bbe9
[]
no_license
chirag1243/HostelBasera
2af32226717add1fba09213666edec80b2ddbfff
d02273d12c7b6651998e06a9bb9fc2ccda200af8
refs/heads/master
2021-06-22T08:32:08.766767
2020-12-02T13:24:13
2020-12-02T13:24:13
141,924,329
0
1
null
null
null
null
UTF-8
Java
false
false
1,093
java
package com.hostelbasera.main; import android.os.Bundle; import com.hostelbasera.R; import com.hostelbasera.utility.BaseActivity; import butterknife.BindView; import butterknife.ButterKnife; public class RatingViewActivity extends BaseActivity { // @BindView(R.id.gradientBackgroundView) // GradientBackgroundView gradientBackgroundView; // @BindView(R.id.emotionView) // EmotionView emotionView; // @BindView(R.id.ratingView) // RatingView ratingView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_rating_view); ButterKnife.bind(this); // ratingView.setRatingChangeListener(new Function2<Integer, Integer, Unit>() { // @Override // public Unit invoke(Integer previousRating, Integer newRating) { // emotionView.setRating(previousRating, newRating); // gradientBackgroundView.changeBackground(previousRating, newRating); // return null; // } // }); } }
[ "chirag2291@gmail.com" ]
chirag2291@gmail.com
23545bf4e33049d6f81c865227a5ecf13dd05c63
211250c162f4662c11c16e5e76346cd23364a35e
/app/src/main/java/net/youlvke/yanyuke/network/SSLContextUtil.java
e2938429d985584015d63eb5bcc1e80c43efde74
[]
no_license
Scofield-Zhang/Net.YanYuKe2
beb1f832cb38b5686193250083f5c162a4a482f9
4b71be7860ed17e981a9b85d77ec7f9bb2060504
refs/heads/master
2021-06-27T08:43:17.485003
2017-07-14T02:57:42
2017-07-14T02:57:42
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,217
java
package net.youlvke.yanyuke.network; import android.annotation.SuppressLint; import net.youlvke.yanyuke.MyApplication; import java.io.InputStream; import java.security.KeyStore; import java.security.SecureRandom; import java.security.cert.Certificate; import java.security.cert.CertificateException; import java.security.cert.CertificateFactory; import java.security.cert.X509Certificate; import javax.net.ssl.HostnameVerifier; import javax.net.ssl.KeyManagerFactory; import javax.net.ssl.SSLContext; import javax.net.ssl.SSLSession; import javax.net.ssl.TrustManager; import javax.net.ssl.TrustManagerFactory; import javax.net.ssl.X509TrustManager; /** * Created in Jan 31, 2016 8:03:59 PM. * * @author Yan Zhenjie. */ public class SSLContextUtil { /** * 拿到https证书, SSLContext (NoHttp已经修补了系统的SecureRandom的bug)。 */ @SuppressLint("TrulyRandom") public static SSLContext getSSLContext() { SSLContext sslContext = null; try { sslContext = SSLContext.getInstance("TLS"); InputStream inputStream = MyApplication.getInstance().getAssets().open("srca.cer"); CertificateFactory cerFactory = CertificateFactory.getInstance("X.509"); Certificate cer = cerFactory.generateCertificate(inputStream); KeyStore keyStore = KeyStore.getInstance("PKCS12"); keyStore.load(null, null); keyStore.setCertificateEntry("trust", cer); KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); keyManagerFactory.init(keyStore, null); TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); trustManagerFactory.init(keyStore); sslContext.init(keyManagerFactory.getKeyManagers(), trustManagerFactory.getTrustManagers(), new SecureRandom()); } catch (Exception e) { e.printStackTrace(); } return sslContext; } /** * 如果不需要https证书.(NoHttp已经修补了系统的SecureRandom的bug)。 */ public static SSLContext getDefaultSLLContext() { SSLContext sslContext = null; try { sslContext = SSLContext.getInstance("TLS"); sslContext.init(null, new TrustManager[]{trustManagers}, new SecureRandom()); } catch (Exception e) { e.printStackTrace(); } return sslContext; } private static TrustManager trustManagers = new X509TrustManager() { @Override public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException { } @Override public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException { } @Override public X509Certificate[] getAcceptedIssuers() { return new X509Certificate[0]; } }; public static final HostnameVerifier HOSTNAME_VERIFIER = new HostnameVerifier() { public boolean verify(String hostname, SSLSession session) { return true; } }; }
[ "suifeng7319@163.com" ]
suifeng7319@163.com
2b7ec1e307f0cb5f599ae0a1255e2bba047d3849
330f87e486aee254026ef3c241fda358e475d655
/src/main/java/berlin/iconn/rbm/enhancements/WeightsSaver.java
1ab447fe85eeb4c7291b15b7d98290b745e2be16
[]
no_license
Gnork/rbmtoolbox
c79896988642dd927e4a8035891a09c0489616a8
93cfb8672e808fbd2f0265987925a574c46cae73
refs/heads/master
2021-01-15T13:01:50.699897
2014-07-23T13:16:50
2014-07-23T13:16:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,348
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package berlin.iconn.rbm.enhancements; import berlin.iconn.persistence.InOutOperations; import java.io.IOException; import java.util.Date; import java.util.logging.Level; import java.util.logging.Logger; /** * * @author christoph */ public class WeightsSaver implements IRBMTrainingEnhancement{ private final int updateInterval; private final Date date; private final String suffix; public WeightsSaver(int updateInterval) { this(new Date(), updateInterval, "weights"); } public WeightsSaver(Date date, int updateInterval, String suffix){ super(); this.date = date; this.updateInterval = updateInterval; this.suffix = suffix; } @Override public int getUpdateInterval() { return updateInterval; } @Override public void action(RBMInfoPackage info) { try { InOutOperations.saveSimpleWeights(info.getWeights(), date, suffix); System.out.println("Weights saved!"); } catch (IOException ex) { Logger.getLogger(WeightsSaver.class.getName()).log(Level.SEVERE, null, ex); } } }
[ "jansen.christoph@yahoo.de" ]
jansen.christoph@yahoo.de
8f5c36676e99bc2fddcffa1ca42d3f9ed588393c
b3bbeb315eb933ff0386761dc954b3e903a954e5
/src/main/java/Basic3/Consumer.java
730c6ff2673caf725e3b112873d8e61d18a53fce
[]
no_license
moontachi/Spring-08_Autowired
bbbc74e6b4a3f40ed88433c218b68c9645719562
0a668f6b508189a8b6e8343531a0404a02aaf4f7
refs/heads/master
2022-12-23T19:55:43.083493
2020-09-23T08:54:48
2020-09-23T08:54:48
null
0
0
null
null
null
null
UTF-8
Java
false
false
724
java
package Basic3; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Component; @Component("Consumer") public class Consumer implements Person { private String name; private int age; @Autowired @Qualifier("Morning") private Car car; @Override public void setName(String name) { this.name = name; } @Override public String getName() { return name; } @Override public void setAge(int age) { this.age = age; } @Override public int getAge() { return age; } @Override public String personDrive() { return car.drive(); } }
[ "admin@DESKTOP-1RPKURU" ]
admin@DESKTOP-1RPKURU
e6e5ab7b950ef14bfe3e76de9ef6b04afb7febdb
7033d33d0ce820499b58da1d1f86f47e311fd0e1
/org/lwjgl/opengl/LinuxPeerInfo.java
ae80084ddf1ee666019379c19005bc299620a133
[ "MIT" ]
permissive
gabrielvicenteYT/melon-client-src
1d3f1f65c5a3bf1b6bc3e1cb32a05bf1dd56ee62
e0bf34546ada3afa32443dab838b8ce12ce6aaf8
refs/heads/master
2023-04-04T05:47:35.053136
2021-04-19T18:34:36
2021-04-19T18:34:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
545
java
package org.lwjgl.opengl; import java.nio.*; abstract class LinuxPeerInfo extends PeerInfo { LinuxPeerInfo() { super(createHandle()); } private static native ByteBuffer createHandle(); public final long getDisplay() { return nGetDisplay(this.getHandle()); } private static native long nGetDisplay(final ByteBuffer p0); public final long getDrawable() { return nGetDrawable(this.getHandle()); } private static native long nGetDrawable(final ByteBuffer p0); }
[ "haroldthesenpai@gmail.com" ]
haroldthesenpai@gmail.com
881f2c321d90d9ce459274e07b8beb2f913f4b99
0c359fb0a0e69de4f5652ce860ed80d5df0d465d
/Semester 4/Lab6_B00107064/Lab6Part4/src/MobilePhone.java
b7101bbefd0f2859aee1202da344cfa6c1333f5a
[]
no_license
LeonardoMaurins/Java-Programming-Labs
72d3fcb4393ba74ad775b63d4fe058156c472504
3e64ea7be7ed9c17c501255fa2f48069574407c6
refs/heads/main
2023-06-03T12:50:08.278552
2021-06-21T12:20:43
2021-06-21T12:20:43
378,901,054
0
0
null
null
null
null
UTF-8
Java
false
false
437
java
public class MobilePhone extends HandHeldDevice{ protected String networkName; public MobilePhone(String manufacturer, double weight, String networkName) { super(manufacturer, weight); this.networkName = networkName; } public String getNetowrkName() { return networkName; } @Override public String toString() { return "MobilePhone [networkName=" + networkName + ", Subclass of " + super.toString() + "]"; } }
[ "Leo@PC" ]
Leo@PC
8708c274c87812cb43b7136478360d88ac22a896
806f76edfe3b16b437be3eb81639d1a7b1ced0de
/src/cn/com/fmsh/tsm/business/card/core/StpcManager.java
004e8f4a2348dac93c995d8c92a80fbf7573d189
[]
no_license
magic-coder/huawei-wear-re
1bbcabc807e21b2fe8fe9aa9d6402431dfe3fb01
935ad32f5348c3d8c8d294ed55a5a2830987da73
refs/heads/master
2021-04-15T18:30:54.036851
2018-03-22T07:16:50
2018-03-22T07:16:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
30,624
java
package cn.com.fmsh.tsm.business.card.core; import cn.com.fmsh.FM_Exception; import cn.com.fmsh.script.ApduHandler; import cn.com.fmsh.script.constants.ScriptToolsConst.TagName; import cn.com.fmsh.tsm.business.bean.CardAppRecord; import cn.com.fmsh.tsm.business.card.CardTools; import cn.com.fmsh.tsm.business.card.base.CardManager; import cn.com.fmsh.tsm.business.constants.Constants; import cn.com.fmsh.tsm.business.enums.EnumCardAppStatus; import cn.com.fmsh.tsm.business.enums.EnumTradeType; import cn.com.fmsh.tsm.business.exception.BusinessException; import cn.com.fmsh.tsm.business.exception.BusinessException.ErrorMessage; import cn.com.fmsh.util.BCCUtil; import cn.com.fmsh.util.CRCUtil; import cn.com.fmsh.util.FM_Bytes; import cn.com.fmsh.util.FM_CN; import cn.com.fmsh.util.FM_Int; import cn.com.fmsh.util.FM_Long; import cn.com.fmsh.util.FM_Utils; import cn.com.fmsh.util.Util4Java; import cn.com.fmsh.util.log.FMLog; import cn.com.fmsh.util.log.LogFactory; import com.huawei.datatype.SportType; import com.huawei.nfc.carrera.logic.appletcardinfo.result.AppletCardResult; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Random; import org.apache.log4j.net.SyslogAppender; public class StpcManager implements CardManager { /* synthetic */ FMLog f9707a = LogFactory.getInstance().getLog(); private final /* synthetic */ String f9708b = StpcManager.class.getName(); private final /* synthetic */ byte[] f9709c; private final /* synthetic */ byte[] f9710d; private final /* synthetic */ int f9711e; private final /* synthetic */ int f9712f; private final /* synthetic */ byte f9713g; private /* synthetic */ ApduHandler f9714h; public StpcManager() { r0 = new byte[9]; this.f9709c = r0; r0 = new byte[2]; r0[0] = (byte) 32; this.f9710d = r0; this.f9711e = 10; this.f9712f = 23; this.f9713g = (byte) 0; } private final /* bridge */ /* synthetic */ EnumTradeType m13028a(byte b, byte b2) { EnumTradeType enumTradeType = null; switch (b) { case (byte) -125: enumTradeType = EnumTradeType.recharge; break; case (byte) 1: enumTradeType = EnumTradeType.subwayConsumption; break; case (byte) 5: enumTradeType = EnumTradeType.subwayConsumption; break; case (byte) 9: enumTradeType = EnumTradeType.bus; break; case (byte) 17: enumTradeType = EnumTradeType.subwayConsumption; break; case (byte) 20: enumTradeType = EnumTradeType.subwayUpdate; break; case (byte) 32: enumTradeType = EnumTradeType.maglev; break; case (byte) 34: enumTradeType = EnumTradeType.recharge; break; case (byte) 49: enumTradeType = EnumTradeType.ferry; break; case (byte) 65: enumTradeType = EnumTradeType.taxi; break; case (byte) 81: enumTradeType = EnumTradeType.expressway; break; case (byte) 82: enumTradeType = EnumTradeType.park; break; case (byte) 99: enumTradeType = EnumTradeType.gasStation; break; } if (enumTradeType != null) { return enumTradeType; } switch (b2) { case (byte) 2: return EnumTradeType.recharge; default: return EnumTradeType.elseTrade; } } private final /* synthetic */ byte[] m13029a(byte[] bArr) throws BusinessException { try { byte[] transceive = this.f9714h.transceive(bArr); if (transceive != null && transceive.length >= 2) { return transceive; } if (this.f9707a != null) { this.f9707a.warn(this.f9708b, BCCUtil.getChars("\u0012,a{挐令扮衞终柘乷稬", 3, 9)); } if (this.f9714h != null) { this.f9714h.close(); } throw new BusinessException(FM_CN.equals("\u00102wq夑琀嘿奌瑟纙枇旬敕", 94), ErrorMessage.local_business_execute_fail); } catch (Exception e) { if (this.f9707a != null) { this.f9707a.warn(this.f9708b, new StringBuilder(FM_Long.copyValueOf("Jxaw捘亸戾蠚冩珠彏干", 3)).append(Util4Java.getExceptionInfo(e)).toString()); } if (this.f9714h != null) { this.f9714h.close(); } throw new BusinessException(FM_Long.copyValueOf("\u0001->\"捓亵戩蠇冲珵彀帧", 344), ErrorMessage.local_business_execute_fail); } } private final /* synthetic */ byte[] m13030b(byte[] bArr) { if (bArr == null || bArr.length < 1) { return null; } String bytesToHexString = FM_Bytes.bytesToHexString(bArr); int indexOf = bytesToHexString.indexOf(FM_Exception.insert(3, 103, ">\be_2O")); if (indexOf >= 0) { byte[] hexStringToBytes = FM_Bytes.hexStringToBytes(bytesToHexString.substring(indexOf)); return new byte[]{hexStringToBytes[13], hexStringToBytes[14]}; } else if (this.f9707a == null) { return null; } else { this.f9707a.error(this.f9708b, FM_Int.replace(134, "h\u001815绔枖莺叆埝帔缏砝央货)哅废绝枍丙匒吱$\u0006s\u0005")); return null; } } public byte[] getAid() { return this.f9709c; } public byte[] getAppNo() throws BusinessException { Object obj = new byte[8]; if (this.f9707a != null) { this.f9707a.info(this.f9708b, Util4Java.endsWith("Q[@^&NH\u0011j\u001d\u0013e`y.", 5, 9)); } if (this.f9714h == null) { if (this.f9707a != null) { this.f9707a.warn(this.f9708b, FM_Utils.regionMatches(5, 33, "也浡亳遂匸皞序畴廒刉叨l@r'1夁琀嘯乲穳")); } throw new BusinessException(FM_Int.replace(158, "丙浡亽逆卾皆庑甠庄则另8Vjy5奇瑀嘡乶稵"), ErrorMessage.local_business_apdu_handler_null); } byte[] bArr = new byte[7]; bArr[1] = TagName.CommandMultiple; bArr[4] = (byte) 2; bArr[5] = Constants.TagName.CARD_APP_ACTIVATION_STATUS; bArr[6] = (byte) 1; Object a = m13029a(bArr); byte[] b = m13030b(a); if (b == null || !Arrays.equals(b, this.f9710d)) { throw new BusinessException(FM_CN.equals("菡厑乒派其亯卽皉匿厸斶}忇夗琂皑卧乚晧乓洽亿逖卼", 3), ErrorMessage.local_get_app_info_no_sptcc); } else if (!FM_Bytes.isEnd9000(a)) { if (this.f9707a != null) { this.f9707a.warn(this.f9708b, new StringBuilder(FM_CN.equals("菠厞乓洽具亨卼皊匾厧斷~遊拽DRA房蠅彘平&", 4)).append(FM_Bytes.bytesToHexString(a)).toString()); } throw new BusinessException(FM_Long.copyValueOf("莻叟丌浴公仹医盓匵厦斸g遁抬\u0003\u001b\u001a戾蠚彑幨", 4), ErrorMessage.local_message_apdu_execute_exception); } else if (a.length >= 42) { System.arraycopy(a, 34, obj, 0, obj.length); return obj; } else { bArr = new byte[5]; bArr[1] = (byte) -80; bArr[2] = Constants.TagName.PREDEPOSIT_TYPE; a = m13029a(bArr); if (!FM_Bytes.isEnd9000(a)) { if (this.f9707a != null) { this.f9707a.warn(this.f9708b, new StringBuilder(FM_Utils.regionMatches(4, 74, "菣又丂津兰仢危盞匥叹斮.遅拿1斓亨哅廆弞帾j")).append(FM_Bytes.bytesToHexString(a)).toString()); } throw new BusinessException(FM_Bytes.concat("菮參丛洺儥亡占皙匸厢旧!遀抬0(斞亣咜庙弋幽", 2, 28), ErrorMessage.local_message_apdu_execute_exception); } else if (a.length < 20) { return null; } else { System.arraycopy(a, 12, obj, 0, obj.length); return obj; } } } public CardAppRecord getAppRecord4bytes(byte[] bArr, Map<String, EnumTradeType> map) { CardAppRecord cardAppRecord = new CardAppRecord(); cardAppRecord.setTradeNo(FM_Bytes.bytesToInt(new byte[]{bArr[0], bArr[1]})); byte[] bArr2 = new byte[]{bArr[16], bArr[17], bArr[18], bArr[19]}; cardAppRecord.setTradeDate(FM_Bytes.bytesToHexString(bArr2)); byte[] bArr3 = new byte[]{bArr[20], bArr[21], bArr[22]}; cardAppRecord.setTradeTime(FM_Bytes.bytesToHexString(bArr3)); cardAppRecord.setAmount(Integer.parseInt(FM_Bytes.bytesToHexString(new byte[]{bArr[5], bArr[6], bArr[7], bArr[8]}), 16)); cardAppRecord.setBalance(FM_Bytes.bytesToInt(new byte[]{bArr[2], bArr[3], bArr[4]})); cardAppRecord.setOriTradeType(bArr[12]); cardAppRecord.setOriTradeType(bArr[9]); EnumTradeType enumTradeType = (EnumTradeType) map.get(FM_Bytes.bytesToHexString(bArr2) + FM_Bytes.bytesToHexString(bArr3)); EnumTradeType a = m13028a(bArr[12], bArr[9]); if (a != null) { cardAppRecord.setTradeType(a); } else { cardAppRecord.setTradeType(enumTradeType); } cardAppRecord.setTradeDevice(FM_Bytes.bytesToHexString(new byte[]{bArr[10], bArr[11], bArr[12], bArr[13], bArr[14], bArr[15]})); return cardAppRecord; } public String getDateTime4File07(byte[] bArr) { StringBuffer stringBuffer = new StringBuffer(); stringBuffer.append(String.valueOf(FM_Bytes.bytesToInt(new byte[]{bArr[0], bArr[1]}) >> 4)); String valueOf = String.valueOf(bArr[1] & 15); if (valueOf.length() == 1) { valueOf = "0" + valueOf; } stringBuffer.append(valueOf); valueOf = String.valueOf((bArr[2] & 248) >> 3); if (valueOf.length() == 1) { valueOf = "0" + valueOf; } stringBuffer.append(valueOf); valueOf = String.valueOf(FM_Bytes.bytesToInt(new byte[]{(byte) (bArr[2] & 7), (byte) (bArr[3] & 192)}) >> 6); if (valueOf.length() == 1) { valueOf = "0" + valueOf; } stringBuffer.append(valueOf); valueOf = String.valueOf((byte) (bArr[3] & 63)); if (valueOf.length() == 1) { valueOf = "0" + valueOf; } stringBuffer.append(valueOf); valueOf = String.valueOf((bArr[4] & 252) >> 2); if (valueOf.length() == 1) { valueOf = "0" + valueOf; } stringBuffer.append(valueOf); return stringBuffer.toString(); } public String getFaceID() throws BusinessException { if (this.f9707a == null) { this.f9707a = LogFactory.getInstance().getLog(); } if (this.f9707a != null) { this.f9707a.info(this.f9708b, Util4Java.endsWith("R\u000fIXy1tp4ocdii+-", 4, 94)); } if (this.f9714h != null) { return CardTools.getFaceID4UID(Arrays.copyOfRange(getAppNo(), 4, 8)); } if (this.f9707a != null) { this.f9707a.warn(this.f9708b, FM_Int.replace(3, "華厍匿靣右旱&L`wc夝琚噷丸穿")); } throw new BusinessException(FM_Bytes.concat("菭反卽霿厩早l\u0000rg1奁琀噯乲稳", 3, 33), ErrorMessage.local_business_apdu_handler_null); } public String getMOC() throws BusinessException { byte[] bArr = new byte[5]; bArr[0] = Byte.MIN_VALUE; bArr[1] = (byte) -54; bArr[4] = (byte) 9; bArr = m13029a(bArr); if (FM_Bytes.isEnd9000(bArr)) { return FM_Bytes.bytesToHexString(Arrays.copyOf(bArr, bArr.length - 2)); } if (this.f9707a != null) { this.f9707a.warn(this.f9708b, new StringBuilder(FM_Long.copyValueOf("菹厝伇庿邪读讝硘斠⦅\u0011\u001d\u000e\u0012捃亥迊囅绋枉夣贪＀{csosir.", 230)).append(FM_Bytes.bytesToHexString(bArr)).toString()); } throw new BusinessException(FM_Exception.insert(6, 97, "莽厝坄孕劑育镑宋犤恒斢9W\u0007\u001cL挝亿奘琛夯赺"), ErrorMessage.local_business_execute_fail); } public EnumCardAppStatus getStatus() throws BusinessException { EnumCardAppStatus enumCardAppStatus = EnumCardAppStatus.STATUS_INSTALL; if (this.f9707a != null) { this.f9707a.info(this.f9708b, BCCUtil.getChars("菤厝弐刖厂蠇狵怚=%-", 3, 120)); } if (this.f9714h == null) { if (this.f9707a != null) { this.f9707a.warn(this.f9708b, Util4Java.endsWith("菨厕匦丁庛畻弄剖犩怂斱gNc3.夛琅噯乱稵", 2, 100)); } throw new BusinessException(FM_Long.copyValueOf("莼叞卤丈廋畴弊创狥恑斻f\u00064%+奟瑞嘽乨稵", 3), ErrorMessage.local_business_apdu_handler_null); } byte[] bArr = new byte[5]; bArr[1] = (byte) -80; bArr[2] = Constants.TagName.PREDEPOSIT_TYPE; try { byte[] transceive = this.f9714h.transceive(bArr); if (!FM_Bytes.isEnd9000(transceive)) { return enumCardAppStatus; } bArr = new byte[32]; bArr[30] = Constants.TagName.SYSTEM_VERSION; if (Arrays.equals(bArr, transceive)) { return enumCardAppStatus; } enumCardAppStatus = EnumCardAppStatus.STATUS_PERSONALIZED; byte[] bArr2 = new byte[8]; new Random().nextBytes(bArr2); bArr = new byte[5]; bArr[1] = (byte) 10; bArr[2] = Constants.TagName.ACTIVITY_CODE; bArr[3] = (byte) 4; bArr[4] = (byte) 8; bArr2 = FM_Bytes.join(bArr, bArr2); Object obj = null; try { transceive = this.f9714h.transceive(bArr2); } catch (Exception e) { if (this.f9707a != null) { this.f9707a.error(this.f9708b, new StringBuilder(FM_CN.equals("剼旤晵呭圔孕锟宕时}彀幫~", 5)).append(Util4Java.getExceptionInfo(e)).toString()); } obj = 1; } if (obj != null) { obj = 1; } else if (!FM_Bytes.isEnd9000(transceive)) { obj = 1; } else if (transceive.length < 5) { obj = 1; } else { String bytesToHexString = FM_Bytes.bytesToHexString(Arrays.copyOfRange(transceive, 1, 5)); long currentTimeMillis = System.currentTimeMillis(); Date date = null; try { date = new SimpleDateFormat(FM_CN.equals("/>!0WFxi", 3)).parse(bytesToHexString); } catch (ParseException e2) { if (this.f9707a != null) { this.f9707a.warn(this.f9708b, new StringBuilder(BCCUtil.getChars("菤叜淉贡勐胻锜寎犽恃旯|莰又监早杜栦彞弊帧l", 3, 55)).append(bytesToHexString).toString()); } } if (date == null) { obj = 1; } else if (transceive[0] != (byte) 0 && date.getTime() >= currentTimeMillis) { return EnumCardAppStatus.STATUS_ACTIVATE; } else { obj = null; } } if (obj == null) { return enumCardAppStatus; } bArr = new byte[16]; bArr[0] = Byte.MIN_VALUE; bArr[1] = Constants.TagName.ORDER_BRIEF_INFO_LIST; bArr[3] = (byte) 2; bArr[4] = Constants.TagName.IDENTIFYING_TYPE; bArr[5] = (byte) 1; bArr[8] = (byte) 7; bArr[9] = (byte) -48; try { if (!FM_Bytes.isEnd9000(this.f9714h.transceive(bArr))) { return enumCardAppStatus; } try { bArr = this.f9714h.transceive(FM_Bytes.hexStringToBytes(FM_Bytes.concat(";{f)3;cksI!kr#,1sb.2>`oz9Ub{zQ)", 140, 104))); return FM_Bytes.isEnd(bArr, new byte[]{Constants.TagName.PLATFORM_NOTICES, (byte) 2}) ? EnumCardAppStatus.STATUS_ACTIVATE : FM_Bytes.isEnd9000(bArr) ? EnumCardAppStatus.STATUS_ACTIVATE : enumCardAppStatus; } catch (Exception e3) { if (this.f9707a == null) { return enumCardAppStatus; } this.f9707a.error(this.f9708b, new StringBuilder(BCCUtil.getChars("剷旯匰景吩弞逗斪g坒嬑刅姌匀头赱y", 3, 111)).append(Util4Java.getExceptionInfo(e3)).toString()); return enumCardAppStatus; } } catch (Exception e32) { if (this.f9707a == null) { return enumCardAppStatus; } this.f9707a.error(this.f9708b, new StringBuilder(FM_Int.replace(2, "剳旷匼是吥弆逓旺#圚孍刅姐匈夰贡=")).append(Util4Java.getExceptionInfo(e32)).toString()); return enumCardAppStatus; } } catch (Exception e322) { if (this.f9707a == null) { return enumCardAppStatus; } this.f9707a.error(this.f9708b, new StringBuilder(Util4Java.endsWith("莦叐卺乚廑畲彜剉犯恏斵t诶叔'|pc斌件夤赯e", 276, 21)).append(Util4Java.getExceptionInfo(e322)).toString()); return enumCardAppStatus; } } public String getTime4Validity() throws BusinessException { byte[] bArr = new byte[7]; bArr[1] = TagName.CommandMultiple; bArr[4] = (byte) 2; bArr[5] = Constants.TagName.CARD_APP_ACTIVATION_STATUS; bArr[6] = (byte) 1; bArr = m13029a(bArr); if (FM_Bytes.isEnd9000(bArr)) { bArr = m13030b(bArr); if (bArr == null || !Arrays.equals(bArr, this.f9710d)) { throw new BusinessException(FM_Utils.regionMatches(192, 2, "莧叄亰逌卹佃颁旨l忇奀瑀盌匫乁晡乚津仰遌匹"), ErrorMessage.local_get_app_info_no_sptcc); } bArr = new byte[5]; bArr[1] = (byte) -80; bArr[2] = Constants.TagName.PREDEPOSIT_TYPE; bArr = m13029a(bArr); if (!FM_Bytes.isEnd9000(bArr)) { if (this.f9707a != null) { this.f9707a.error(this.f9708b, new StringBuilder(Util4Java.endsWith("莶叏匰七廕由杘敁杞斯=讲受h$旎价夨赴3", 4, 56)).append(FM_Bytes.bytesToHexString(bArr)).toString()); } throw new BusinessException(BCCUtil.getChars("菢叞卺丄廕畼李攒朒时?讽厏}j斕仳天赮", 5, 19), ErrorMessage.local_business_execute_fail); } else if (bArr.length < 29) { if (this.f9707a != null) { this.f9707a.error(this.f9708b, new StringBuilder(FM_Long.copyValueOf("莼叞卤丈廋畴材攞杌斦a讱厑ut旙亭奩走h", 3)).append(FM_Bytes.bytesToHexString(bArr)).toString()); } throw new BusinessException(BCCUtil.getChars("菥厒卷乂庎甤杗敘朝斢*讣厜-{旇令奵贳", 2, 82), ErrorMessage.local_business_execute_fail); } else { return FM_Bytes.bytesToHexString(new byte[]{bArr[24], bArr[25], bArr[26], bArr[27]}); } } if (this.f9707a != null) { this.f9707a.error(this.f9708b, new StringBuilder(FM_Exception.insert(4, 41, "莿叇医三庘畽杗敏杏斯.遂抽庉畮皡彍奰赯)")).append(FM_Bytes.bytesToHexString(bArr)).toString()); } throw new BusinessException(CRCUtil.substring(2, "莸双卤业序畮杘攔杘斤q送拺床甡盺彊捍亱奄瑍奧贤"), ErrorMessage.local_business_execute_fail); } public boolean isLock4Consume() throws BusinessException { if (this.f9707a == null) { this.f9707a = LogFactory.getInstance().getLog(); } if (this.f9714h == null) { if (this.f9707a != null) { this.f9707a.warn(this.f9708b, FM_Utils.regionMatches(4, 9, "菣压圎字劇胼锋安犪恄斸{\u000196.夀琋噾严穲")); } throw new BusinessException(FM_Int.replace(3, "華厍仺逛卥佞颗旻<Rf}i夛琄噭串穱"), ErrorMessage.local_business_apdu_handler_null); } byte[] bArr = new byte[8]; new Random().nextBytes(bArr); byte[] bArr2 = new byte[5]; bArr2[1] = (byte) 10; bArr2[2] = Constants.TagName.TERMINAL_BACK_INFO_TYPE; bArr2[3] = (byte) 4; bArr2[4] = (byte) 8; bArr2 = m13029a(FM_Bytes.join(bArr2, bArr)); if (!FM_Bytes.isEnd9000(bArr2)) { if (this.f9707a != null) { this.f9707a.warn(this.f9708b, FM_Long.copyValueOf("菹厝淀赼勝胢锝它犠怒旦!KW@T挙仿迌囋绁枓夽贬", 198)); } throw new BusinessException(FM_Utils.regionMatches(5, 50, "菢发坑孓劂育销寉犳怖斿7\f\u000fU\u0016挒亣奝琍奬贪"), ErrorMessage.local_business_execute_fail); } else if (bArr2.length < 5) { if (this.f9707a != null) { this.f9707a.warn(this.f9708b, BCCUtil.getChars("莳叄淈起勃肷镙宜犢怃旦2\r\n\f\u0003挃件处琈夭赯", 180, 14)); } throw new BusinessException(FM_Int.replace(SportType.SPORT_TYPE_CLIMB_HILL, "菮厊块孚劚胵锊宔犧怕旡6\\PGS挎仨夋琔夤贽"), ErrorMessage.local_business_execute_fail); } else { String bytesToHexString = FM_Bytes.bytesToHexString(Arrays.copyOfRange(bArr2, 1, 5)); try { return bArr2[0] == (byte) 0 || new SimpleDateFormat(CRCUtil.substring(232, ",yroLAs&")).parse(bytesToHexString).getTime() < System.currentTimeMillis(); } catch (ParseException e) { if (this.f9707a != null) { this.f9707a.warn(this.f9708b, new StringBuilder(Util4Java.endsWith("莪又涗费办胿锂实犳怇旱$莾叜皏早朒栲开弒帩(", 288, 1)).append(bytesToHexString).toString()); } throw new BusinessException(FM_Exception.insert(4, 23, "莿叉圞嬕勛肦锓宓狶恖斸)]C\u000e\u0014损仫夂琛奥赮"), ErrorMessage.local_business_execute_fail); } } } public boolean isLock4Load() throws BusinessException { if (this.f9707a == null) { this.f9707a = LogFactory.getInstance().getLog(); } if (this.f9714h == null) { if (this.f9707a != null) { this.f9707a.warn(this.f9708b, FM_Long.copyValueOf("莵叉圔孁劉胮锑宗犼怆旲-\u001f+< 奖瑉嘤乳稼", 282)); } throw new BusinessException(FM_Long.copyValueOf("莺叜亣逞占伇飆斮y\u0013?(<奂瑅嘨乧稠", 5), ErrorMessage.local_business_apdu_handler_null); } byte[] bArr = new byte[8]; new Random().nextBytes(bArr); byte[] bArr2 = new byte[5]; bArr2[1] = (byte) 10; bArr2[2] = Constants.TagName.ACTIVITY_CODE; bArr2[3] = (byte) 4; bArr2[4] = (byte) 8; bArr2 = m13029a(FM_Bytes.join(bArr2, bArr)); if (!FM_Bytes.isEnd9000(bArr2)) { if (this.f9707a != null) { this.f9707a.warn(this.f9708b, FM_Bytes.concat("華取址嬈劇肽镉宊犮恁旾<\u0019PL\u0005损令辜嚎绋柜她贵", 1, 40)); } throw new BusinessException(FM_Int.replace(94, "菤厀坑嬄勀肿镄寒狽恏斧x\u0016\n\u0019U挄仢复琊夾贷"), ErrorMessage.local_business_execute_fail); } else if (bArr2.length < 5) { if (this.f9707a != null) { this.f9707a.warn(this.f9708b, FM_Bytes.concat("莸參坓嬙勘胰锒寃狩恄旽=\u0016\r\u0007\\挈亱奟瑇夶质", SyslogAppender.LOG_LOCAL7, 102)); } throw new BusinessException(FM_CN.equals("莢叐土子勆肷镚寖犫怏早<@\u0002\u0007\u0001捂仲夃琞夸赿", 194), ErrorMessage.local_business_execute_fail); } else { String bytesToHexString = FM_Bytes.bytesToHexString(Arrays.copyOfRange(bArr2, 1, 5)); try { return bArr2[0] == (byte) 0 || new SimpleDateFormat(FM_Bytes.concat("\":2jVN/7", 4, 104)).parse(bytesToHexString).getTime() < System.currentTimeMillis(); } catch (ParseException e) { if (this.f9707a != null) { this.f9707a.warn(this.f9708b, new StringBuilder(FM_Utils.regionMatches(4, 72, "菣及涌赵劋股锅寖犢恝斲＀菣及盀早杋栠弋彎帬f")).append(bytesToHexString).toString()); } throw new BusinessException(FM_Long.copyValueOf("莾叐國存勂肧镖寎狧恏施d\u0004\u0012\u001b\t捞亲套瑖奼赯", 1), ErrorMessage.local_business_execute_fail); } } } public int queryBalance() throws BusinessException { if (this.f9707a == null) { this.f9707a = LogFactory.getInstance().getLog(); } if (this.f9707a != null) { this.f9707a.info(this.f9708b, FM_Int.replace(48, "VX_M1v{{s#&fgba")); } if (this.f9714h == null) { if (this.f9707a != null) { this.f9707a.warn(this.f9708b, BCCUtil.getChars("菢叅亵違匬佒颔斱iBq{(奟琟噿乯稩", 5, 30)); } throw new BusinessException(FM_Exception.insert(316, 114, "菷叄亠逌卩伃飑斨|\u0003dbm夎瑚嘦乺稨"), ErrorMessage.local_business_apdu_handler_null); } byte[] bArr = new byte[7]; bArr[1] = TagName.CommandMultiple; bArr[4] = (byte) 2; bArr[5] = Constants.TagName.CARD_APP_ACTIVATION_STATUS; bArr[6] = (byte) 1; bArr = m13030b(m13029a(bArr)); if (bArr == null || !Arrays.equals(bArr, this.f9710d)) { throw new BusinessException(FM_Exception.insert(3, 125, "莰叒亥遄区企飈斤c忉奍瑀盇匡乐晵九洣仵達匪"), ErrorMessage.local_get_app_info_no_sptcc); } bArr = new byte[17]; bArr[0] = Byte.MIN_VALUE; bArr[1] = Constants.TagName.ORDER_BRIEF_INFO_LIST; bArr[2] = (byte) 3; bArr[3] = (byte) 2; bArr[4] = Constants.TagName.IDENTIFYING_TYPE; bArr[5] = (byte) 1; bArr[16] = (byte) 15; bArr = m13029a(bArr); if (bArr.length < 9) { if (this.f9707a != null) { this.f9707a.warn(this.f9708b, FM_CN.equals("莸取亵逘匲伝飈新;IIN\u000e咁廉益敯捾旡敚", 188)); } throw new BusinessException(Util4Java.endsWith("菸厊仭逌卢佉飀於{咉庅敮捥斸攍", 242, 109), ErrorMessage.local_get_app_info_fail); } return FM_Bytes.bytesToInt(Arrays.copyOf(bArr, 4)) - FM_Bytes.bytesToInt(new byte[]{bArr[6], bArr[7], bArr[8]}); } public List<CardAppRecord> readAppRecords() throws BusinessException { List arrayList = new ArrayList(); if (this.f9707a != null) { this.f9707a.info(this.f9708b, BCCUtil.getChars("\u0013I\u0006\b$<&(3p#7z$p',u", AppletCardResult.RESULT_FAILED_TRAFFIC_CARD_INFO_PIN_LOCKED, 89)); } if (this.f9714h == null) { if (this.f9707a != null) { this.f9707a.warn(this.f9708b, FM_Exception.insert(3, 105, "莰历份晑讻彁斫j\u000ehe套瑚嘭临穭")); } throw new BusinessException(BCCUtil.getChars("菦厘亯昛诵弗早p\u0018fw%奉琌噯乾稻", 1, 93), ErrorMessage.local_business_apdu_handler_null); } byte[] bArr = new byte[7]; bArr[1] = TagName.CommandMultiple; bArr[4] = (byte) 2; bArr[5] = Constants.TagName.CARD_APP_ACTIVATION_STATUS; bArr[6] = (byte) 1; bArr = m13030b(m13029a(bArr)); if (bArr == null || !Arrays.equals(bArr, this.f9710d)) { throw new BusinessException(FM_Long.copyValueOf("莼叞丏浵儳仸匸盒价晃诽弟斱h忄奚瑝盜匴也晠乆派仢遙匡", 3), ErrorMessage.local_get_app_info_no_sptcc); } int i; Map hashMap = new HashMap(); bArr = new byte[7]; bArr[1] = TagName.CommandMultiple; bArr[4] = (byte) 2; bArr[6] = (byte) 7; m13029a(bArr); bArr = new byte[5]; for (i = 1; i <= 10; i++) { byte[] bArr2 = new byte[5]; bArr2[1] = Constants.TagName.APP_TYPE; bArr2[2] = (byte) i; bArr2[3] = (byte) 4; bArr2 = m13029a(bArr2); if (Arrays.equals(new byte[]{Constants.TagName.PAY_ORDER_ID, Constants.TagName.ACTIVITY_CODE}, Arrays.copyOfRange(bArr2, bArr2.length - 2, bArr2.length))) { break; } if (bArr2.length >= 16) { String dateTime4File07 = getDateTime4File07(Arrays.copyOfRange(bArr2, 10, 15)); EnumTradeType a = m13027a(bArr2[0]); if (!(dateTime4File07 == null || a == null)) { hashMap.put(dateTime4File07, a); } } } bArr = new byte[7]; bArr[1] = TagName.CommandMultiple; bArr[4] = (byte) 2; bArr[6] = Constants.TagName.ORDER_INVOICE_STATUS; m13029a(bArr); for (i = 1; i <= 10; i++) { bArr2 = new byte[5]; bArr2[1] = Constants.TagName.APP_TYPE; bArr2[2] = (byte) i; bArr2[3] = (byte) 4; bArr2 = m13029a(bArr2); if (Arrays.equals(new byte[]{Constants.TagName.PAY_ORDER_ID, Constants.TagName.ACTIVITY_CODE}, Arrays.copyOfRange(bArr2, bArr2.length - 2, bArr2.length))) { break; } if (bArr2.length >= 23) { arrayList.add(getAppRecord4bytes(bArr2, hashMap)); } } return arrayList; } public void setApduHandler(ApduHandler apduHandler) { this.f9714h = apduHandler; } }
[ "lebedev1537@gmail.com" ]
lebedev1537@gmail.com
e1230b2097e27dd2fbb6f0b8d9168056eaadf29c
5f9548fdc7516f565be75326a21400ee645d9027
/app/src/main/java/com/example/pellesam/outerspacemanager/MainActivity/ReportDetailActivity.java
29f070d1bafa31adee94c28f655665142227dacd
[]
no_license
SamuelPelletier/OuterSpaceManager
a66c9ea74c7e51caf3f04f8c73860b06a079f1bb
1a28d920006080a6fb6ef1ee3895e8e04597aa38
refs/heads/master
2021-01-17T14:32:47.141286
2017-03-28T10:29:47
2017-03-28T10:29:47
84,090,259
0
0
null
null
null
null
UTF-8
Java
false
false
1,951
java
package com.example.pellesam.outerspacemanager.MainActivity; import android.app.Activity; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.widget.ListView; import android.widget.TextView; import com.example.pellesam.outerspacemanager.CustomActivity.CustomAdaptaterViewUsers; import com.example.pellesam.outerspacemanager.Entity.User; import com.example.pellesam.outerspacemanager.Entity.Users; import com.example.pellesam.outerspacemanager.Fragment.FragmentReportDetails; import com.example.pellesam.outerspacemanager.R; import com.example.pellesam.outerspacemanager.Service.OuterSpaceManager; import java.util.ArrayList; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; import retrofit2.Retrofit; import retrofit2.converter.gson.GsonConverterFactory; /** * Created by mac14 on 27/03/2017. */ public class ReportDetailActivity extends AppCompatActivity{ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_report_details); String from = (String) getIntent().getExtras().get("from"); String to = (String) getIntent().getExtras().get("to"); String gas = (String) getIntent().getExtras().get("gas"); String mineral = (String) getIntent().getExtras().get("mineral"); String date = (String) getIntent().getExtras().get("date"); String attackerFleet = (String) getIntent().getExtras().get("attackerFleet"); String defenderFleet = (String) getIntent().getExtras().get("defenderFleet"); FragmentReportDetails fragmentReportDetails = (FragmentReportDetails)getSupportFragmentManager().findFragmentById(R.id.fragmentReportDetails); fragmentReportDetails.setText(from,to,gas, mineral, date, attackerFleet, defenderFleet); } }
[ "pellesam.info@gmail.com" ]
pellesam.info@gmail.com
8aa4de7d52eb4266ecd8aa93496af4a75b1b3f82
48de06bcf26e1ef32f00df1d46f8b883f59df67e
/restful-web-services/src/main/java/com/myspace/rest/webservices/restfulwebservices/user/UserNotFoundException.java
60d5b1bb7646358624e32a9dbf42e4c7e4658fcf
[]
no_license
ynaprashanth8/restful_web_service
ebb9bf9d090c7f05797e6e0d60facd9eb6236a64
1750c9470b50004051a86cbdeeb2c83775ad035f
refs/heads/master
2020-04-22T02:44:32.119242
2019-03-18T10:14:46
2019-03-18T10:14:46
170,061,341
0
0
null
null
null
null
UTF-8
Java
false
false
398
java
package com.myspace.rest.webservices.restfulwebservices.user; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; @ResponseStatus(HttpStatus.NOT_FOUND) public class UserNotFoundException extends RuntimeException { public UserNotFoundException(String message) { super(message); // TODO Auto-generated constructor stub } }
[ "35754809+ynaprashanth8@users.noreply.github.com" ]
35754809+ynaprashanth8@users.noreply.github.com
79af75e00e2769ae4b058ac6fffda41d22219e6e
b664f2bc242eebb957f6710ef129bbfaec81f98c
/homework6/list/DListNode.java
8ad25d0de21bb4bb2f65dd101b11d8dc29b47078
[]
no_license
JessieLiu00/ucb_cs61b
d08162127d1fafdd7f11108eeeda1d7f7b2a5f7c
8ca411babee5165e4a8f5b4241c7fd90a5ddccb9
refs/heads/master
2020-04-11T04:03:58.196613
2019-01-09T13:38:58
2019-01-09T13:38:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,983
java
package list; /** * A DListNode is a mutable node in a DList (doubly-linked list). **/ public class DListNode extends ListNode { /** * (inherited) item references the item stored in the current node. * (inherited) myList references the List that contains this node. * prev references the previous node in the DList. * next references the next node in the DList. * * DO NOT CHANGE THE FOLLOWING FIELD DECLARATIONS. **/ protected DListNode prev; protected DListNode next; /** * DListNode() constructor. * @param i the item to store in the node. * @param l the list this node is in. * @param p the node previous to this node. * @param n the node following this node. */ DListNode(Object i, DList l, DListNode p, DListNode n) { item = i; myList = l; prev = p; next = n; } /** * isValidNode returns true if this node is valid; false otherwise. * An invalid node is represented by a `myList' field with the value null. * Sentinel nodes are invalid, and nodes that don't belong to a list are * also invalid. * * @return true if this node is valid; false otherwise. * * Performance: runs in O(1) time. */ public boolean isValidNode() { return myList != null; } /** * next() returns the node following this node. If this node is invalid, * throws an exception. * * @return the node following this node. * @exception InvalidNodeException if this node is not valid. * * Performance: runs in O(1) time. */ public ListNode next() throws InvalidNodeException { if (!isValidNode()) { throw new InvalidNodeException("next() called on invalid node"); } return next; } /** * prev() returns the node preceding this node. If this node is invalid, * throws an exception. * * @return the node preceding this node. * @exception InvalidNodeException if this node is not valid. * * Performance: runs in O(1) time. */ public ListNode prev() throws InvalidNodeException { if (!isValidNode()) { throw new InvalidNodeException("prev() called on invalid node"); } return prev; } /** * insertAfter() inserts an item immediately following this node. If this * node is invalid, throws an exception. * * @param item the item to be inserted. * @exception InvalidNodeException if this node is not valid. * * Performance: runs in O(1) time. */ public void insertAfter(Object item) throws InvalidNodeException { if (!isValidNode()) { throw new InvalidNodeException("insertAfter() called on invalid node"); } // Your solution here. Will look something like your Homework 4 solution, // but changes are necessary. For instance, there is no need to check if // "this" is null. Remember that this node's "myList" field tells you // what DList it's in. You should use myList.newNode() to create the // new node. DList l = (DList)this.myList; DListNode node = l.newNode(item,l,this,this.next); this.next = node; this.next.prev = node; } /** * insertBefore() inserts an item immediately preceding this node. If this * node is invalid, throws an exception. * * @param item the item to be inserted. * @exception InvalidNodeException if this node is not valid. * * Performance: runs in O(1) time. */ public void insertBefore(Object item) throws InvalidNodeException { if (!isValidNode()) { throw new InvalidNodeException("insertBefore() called on invalid node"); } // Your solution here. Will look something like your Homework 4 solution, // but changes are necessary. For instance, there is no need to check if // "this" is null. Remember that this node's "myList" field tells you // what DList it's in. You should use myList.newNode() to create the // new node. DList l =(DList)this.myList; DListNode node = l.newNode(item, l, this.prev , this); prev.next = node; prev = node; } /** * remove() removes this node from its DList. If this node is invalid, * throws an exception. * * @exception InvalidNodeException if this node is not valid. * * Performance: runs in O(1) time. */ public void remove() throws InvalidNodeException { if (!isValidNode()) { throw new InvalidNodeException("remove() called on invalid node"); } // Your solution here. Will look something like your Homework 4 solution, // but changes are necessary. For instance, there is no need to check if // "this" is null. Remember that this node's "myList" field tells you // what DList it's in. next.prev = prev; prev.next = next; // Make this node an invalid node, so it cannot be used to corrupt myList. myList = null; // Set other references to null to improve garbage collection. next = null; prev = null; } }
[ "44805397+JamieJLiu@users.noreply.github.com" ]
44805397+JamieJLiu@users.noreply.github.com
8117cdf4477b410662fc822a822d3959aa07d128
0ffd55c90e12d102303b712a6e101dbe84970d71
/satisfy-commons/src/main/java/net/thucydides/core/steps/SatisfyStepArgumentWriter.java
352cc4bbdc48f055b57001b9ceb33fa8e7a9bf3b
[ "MIT" ]
permissive
tapack/satisfy
c7bc9db1f5f2521cbe5e7b1d0ded0b9fa4254663
e2cc99d6fd86fc8cd7ee9ee95fe28cd9517cad38
refs/heads/master
2022-12-25T07:19:56.693948
2020-01-31T18:22:33
2020-01-31T18:22:33
109,585,534
2
0
MIT
2020-10-13T03:50:15
2017-11-05T14:15:29
Java
UTF-8
Java
false
false
551
java
package net.thucydides.core.steps; import org.apache.commons.lang3.ArrayUtils; import org.jbehave.core.model.ExamplesTable; public class SatisfyStepArgumentWriter { public static String readableFormOf(Object arg) { if (arg == null) { return "<null>"; } else if (arg.getClass().isArray()) { return ArrayUtils.toString(arg); } else if (arg instanceof ExamplesTable) { return "\n" + ((ExamplesTable) arg).asString(); } else { return arg.toString(); } } }
[ "dmo.builder@gmail.com" ]
dmo.builder@gmail.com
d6bd2f41191ab3349a170d3792ed83ad9e27b4c9
adb316498382da60830b65bec615ebed86b5e52c
/app/src/main/java/com/rotor/chappy/adapters/ChatAdapter.java
b28eba546fb4522d90e8c83df6912bd37367fec5
[ "Apache-2.0" ]
permissive
rotorlab/chappy-android-sample
c98751cdae4c5f4bd0cd64c7bd2c87764aa214e2
19d083505a5ff497ceb1e4e16bb8761395cce89e
refs/heads/master
2018-09-04T02:07:32.828518
2018-06-04T00:37:07
2018-06-04T00:37:07
93,250,805
1
0
Apache-2.0
2018-06-04T00:37:08
2017-06-03T13:46:11
Kotlin
UTF-8
Java
false
false
1,773
java
package com.rotor.chappy.adapters; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.RelativeLayout; import android.widget.TextView; import com.rotor.chappy.model.Chat; import java.util.ArrayList; import java.util.List; /** * Created by efraespada on 17/06/2017. */ public abstract class ChatAdapter extends RecyclerView.Adapter<ChatAdapter.ViewHolder> { public static final List<Chat> chats = new ArrayList<>(); public ChatAdapter() { // nothing to do here } public abstract void onChatClicked(Chat chat); @Override public ChatAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View itemView = LayoutInflater.from(parent.getContext()).inflate(com.rotor.chappy.R.layout.item_chat, parent, false); return new ViewHolder(itemView); } @Override public void onBindViewHolder(ChatAdapter.ViewHolder holder, int position) { final Chat chat = chats.get(position); holder.content.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { onChatClicked(chat); } }); holder.name.setText(chat.getName()); } @Override public int getItemCount() { return chats.size(); } static class ViewHolder extends RecyclerView.ViewHolder { RelativeLayout content; TextView name; public ViewHolder(View itemView) { super(itemView); content = itemView.findViewById(com.rotor.chappy.R.id.chat_content); name = itemView.findViewById(com.rotor.chappy.R.id.group_name); } } }
[ "efraespada@gmail.com" ]
efraespada@gmail.com
b73aa60a546436cce589f3265a24bab52fd0ecc1
250852b7a10684337c4b61a62d4b7d58b7c841cf
/src/main/java/com/israeldago/appUsersWS/service/exceptions/CredentialsCheckException.java
f3c9051522d7d96aa57942f274b8b8bfa3b14091
[]
no_license
israeldago/appUsersWS
60729280d20cf294011f547b0525f13692e9bb47
28149d575d30d0289991cef1995a5becab4bc74a
refs/heads/master
2020-03-26T11:21:48.116058
2018-08-15T15:25:43
2018-08-15T15:25:43
144,839,132
0
0
null
null
null
null
UTF-8
Java
false
false
579
java
package com.israeldago.appUsersWS.service.exceptions; public class CredentialsCheckException extends RuntimeException { public CredentialsCheckException() { } public CredentialsCheckException(String s) { super(s); } public CredentialsCheckException(String s, Throwable throwable) { super(s, throwable); } public CredentialsCheckException(Throwable throwable) { super(throwable); } public CredentialsCheckException(String s, Throwable throwable, boolean b, boolean b1) { super(s, throwable, b, b1); } }
[ "dagoisrael@gmail.com" ]
dagoisrael@gmail.com